/**
 * Authentication Page Styles - Optimized for Integration
 * Compatible with main style.css
 * @version 2.0
 */

/* ============================================================================
   AUTH-SPECIFIC CONTAINER (uses variables from style.css)
   ============================================================================ */

.auth-container {
    max-width: 480px;
    margin: 60px auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: auth-slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes auth-slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   AUTH TABS
   ============================================================================ */

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--gray-100);
}

.auth-tab {
    padding: 18px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
}

.auth-tab:hover {
    color: var(--text-dark);
    background: rgba(255, 255, 255, 0.5);
}

.auth-tab:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.auth-tab.active {
    background: var(--white);
    color: var(--primary-color);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    animation: auth-slideInWidth 0.3s ease;
}

@keyframes auth-slideInWidth {
    from { width: 0; }
    to { width: 100%; }
}

/* ============================================================================
   AUTH FORM
   ============================================================================ */

.auth-form {
    padding: 40px;
    animation: auth-fadeIn 0.4s ease-out;
}

@keyframes auth-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-header {
    text-align: center;
    margin-bottom: 35px;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.auth-header p {
    color: var(--text-light);
    font-size: 15px;
    line-height: 1.5;
}

/* ============================================================================
   FORM ELEMENTS (extends from style.css)
   ============================================================================ */

.auth-form .form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.auth-form .form-group {
    margin-bottom: 20px;
    position: relative;
}

.auth-form .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.auth-form .form-group label svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.auth-form .form-group input,
.auth-form .form-group select,
.auth-form .form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 15px;
    transition: var(--transition-base);
    background: var(--white);
    font-family: inherit;
}

.auth-form .form-group input:hover {
    border-color: var(--gray-300);
}

.auth-form .form-group input:focus,
.auth-form .form-group select:focus,
.auth-form .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(230, 90, 75, 0.1);
}

.auth-form .form-group input::placeholder {
    color: var(--gray-400);
}

.auth-form .form-group input:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Input Validation States */
.auth-form .form-group input.invalid {
    border-color: var(--danger-color);
    background-color: #FEE2E2;
}

.auth-form .form-group input.valid {
    border-color: var(--success-color);
    background-color: var(--white);
}

/* ============================================================================
   PASSWORD INPUT
   ============================================================================ */

.auth-form .password-input {
    position: relative;
}

.auth-form .password-input input {
    padding-right: 50px;
}

.auth-form .btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition-base);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-form .btn-toggle-password:hover {
    color: var(--primary-color);
    background: var(--gray-100);
}

.auth-form .btn-toggle-password:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================================================
   PASSWORD STRENGTH INDICATOR
   ============================================================================ */

.auth-form .password-strength {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    display: none;
    transition: var(--transition-base);
}

.auth-form .password-strength:not(:empty) {
    display: block;
    animation: auth-slideDown 0.3s ease;
}

@keyframes auth-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
}

.auth-form .password-strength .strength-indicator {
    display: block;
    height: 4px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.auth-form .password-strength .strength-indicator::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--gray-300);
    transition: width 0.3s ease, background-color 0.3s ease;
}

.auth-form .password-strength.weak .strength-indicator::after {
    width: 33%;
    background: var(--danger-color);
}

.auth-form .password-strength.medium .strength-indicator::after {
    width: 66%;
    background: var(--warning-color);
}

.auth-form .password-strength.good .strength-indicator::after {
    width: 85%;
    background: var(--info-color);
}

.auth-form .password-strength.strong .strength-indicator::after {
    width: 100%;
    background: var(--success-color);
}

.auth-form .password-strength .strength-text {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-form .password-strength.weak .strength-text {
    color: var(--danger-color);
}

.auth-form .password-strength.medium .strength-text {
    color: var(--warning-color);
}

.auth-form .password-strength.good .strength-text {
    color: var(--info-color);
}

.auth-form .password-strength.strong .strength-text {
    color: var(--success-color);
}

/* ============================================================================
   FORM OPTIONS
   ============================================================================ */

.auth-form .form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 12px;
}

.auth-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    user-select: none;
    transition: var(--transition-fast);
}

.auth-form .checkbox-label:hover {
    color: var(--text-dark);
}

.auth-form .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
    border-radius: var(--radius-sm);
}

.auth-form .checkbox-label input[type="checkbox"]:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.auth-form .link-forgot {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-base);
    position: relative;
}

.auth-form .link-forgot::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.auth-form .link-forgot:hover::after {
    width: 100%;
}

.auth-form .link-forgot:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
    border-radius: 2px;
}

/* ============================================================================
   FORM AGREEMENTS
   ============================================================================ */

.auth-form .form-agreements {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.auth-form .form-agreements .checkbox-label {
    font-size: 13px;
    line-height: 1.6;
}

.auth-form .form-agreements a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
    transition: var(--transition-fast);
}

.auth-form .form-agreements a:hover {
    color: var(--primary-dark);
}

.auth-form .form-agreements a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================================================
   SUBMIT BUTTON (unique class name)
   ============================================================================ */

.auth-form .btn-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.auth-form .btn-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.auth-form .btn-submit:hover::before {
    width: 300px;
    height: 300px;
}

.auth-form .btn-submit:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.auth-form .btn-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.auth-form .btn-submit:focus {
    outline: 3px solid rgba(230, 90, 75, 0.3);
    outline-offset: 3px;
}

.auth-form .btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-form .btn-submit.loading {
    pointer-events: none;
    padding-left: 50px;
}

.auth-form .btn-submit.loading svg.spinner {
    position: absolute;
    left: 16px;
}

/* ============================================================================
   SOCIAL DIVIDER
   ============================================================================ */

.auth-form .social-divider {
    position: relative;
    text-align: center;
    margin: 30px 0;
}

.auth-form .social-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-form .social-divider span {
    position: relative;
    display: inline-block;
    padding: 0 15px;
    background: var(--white);
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================================
   SOCIAL LOGIN
   ============================================================================ */

.auth-form .social-login {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form .btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.auth-form .btn-social::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transition: left 0.5s;
}

.auth-form .btn-social:hover::before {
    left: 100%;
}

.auth-form .btn-social:hover {
    border-color: var(--gray-400);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.auth-form .btn-social:active {
    transform: translateY(0);
}

.auth-form .btn-social:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.auth-form .btn-google {
    color: #333;
}

.auth-form .btn-google:hover {
    background: #f8f9fa;
    border-color: #dadce0;
}

.auth-form .btn-facebook {
    color: #1877f2;
}

.auth-form .btn-facebook:hover {
    background: #e7f3ff;
    border-color: #1877f2;
}

/* ============================================================================
   AUTH FEATURES
   ============================================================================ */

.auth-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-features .feature-item {
    text-align: center;
    padding: 20px;
    border-radius: var(--radius-lg);
    transition: var(--transition-base);
}

.auth-features .feature-item:hover {
    background: var(--gray-50);
    transform: translateY(-5px);
}

.auth-features .feature-item svg {
    color: var(--primary-color);
    margin-bottom: 15px;
    transition: var(--transition-base);
}

.auth-features .feature-item:hover svg {
    transform: scale(1.1);
}

.auth-features .feature-item h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.auth-features .feature-item p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================================================
   MODAL (prefixed for auth)
   ============================================================================ */

#forgotPasswordModal.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: auth-fadeIn 0.3s ease;
}

#forgotPasswordModal.modal.show {
    display: flex;
}

#forgotPasswordModal .modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: auth-scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes auth-scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#forgotPasswordModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
}

#forgotPasswordModal .modal-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
}

#forgotPasswordModal .btn-close {
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

#forgotPasswordModal .btn-close:hover {
    background: var(--gray-200);
    color: var(--text-dark);
    transform: rotate(90deg);
}

#forgotPasswordModal .btn-close:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

#forgotPasswordModal .modal-body {
    padding: 30px;
}

#forgotPasswordModal .modal-body p {
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.6;
}

#forgotPasswordModal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

#forgotPasswordModal .btn-secondary {
    padding: 12px 24px;
    background: var(--gray-100);
    color: var(--text-color);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}

#forgotPasswordModal .btn-secondary:hover {
    background: var(--gray-200);
}

#forgotPasswordModal .btn-secondary:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

#forgotPasswordModal .btn-primary {
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
}

#forgotPasswordModal .btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

#forgotPasswordModal .btn-primary:active {
    transform: scale(0.98);
}

#forgotPasswordModal .btn-primary:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================================================
   FORM MESSAGES (scoped to auth)
   ============================================================================ */

.auth-form .form-message {
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: auth-slideDown 0.3s ease;
    line-height: 1.5;
}

.auth-form .form-message-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.auth-form .form-message svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.auth-form .form-message.error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid var(--danger-color);
}

.auth-form .form-message.success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid var(--success-color);
}

.auth-form .form-message.info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid var(--info-color);
}

.auth-form .form-message.warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid var(--warning-color);
}

/* ============================================================================
   FIELD ERRORS
   ============================================================================ */

.auth-form .field-error {
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: auth-shake 0.4s ease;
}

@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.auth-form .field-error svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* ============================================================================
   TOAST NOTIFICATIONS (unique prefix)
   ============================================================================ */

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    padding: 16px;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.toast-content svg {
    flex-shrink: 0;
}

.toast-notification.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-notification.toast-success .toast-content svg {
    color: var(--success-color);
}

.toast-notification.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-notification.toast-error .toast-content svg {
    color: var(--danger-color);
}

.toast-notification.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-notification.toast-info .toast-content svg {
    color: var(--info-color);
}

.toast-notification.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-notification.toast-warning .toast-content svg {
    color: var(--warning-color);
}

.toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--text-dark);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .auth-container {
        margin: 30px 20px;
    }
    
    .auth-form {
        padding: 30px 25px;
    }
    
    .auth-header h1 {
        font-size: 24px;
    }
    
    .auth-features {
        grid-template-columns: 1fr;
        gap: 40px;
        margin: 40px 0;
    }
    
    .toast-notification {
        left: 20px;
        right: 20px;
        min-width: auto;
    }
    
    .auth-form .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .auth-container {
        margin: 20px 15px;
        border-radius: var(--radius-lg);
    }
    
    .auth-form {
        padding: 25px 20px;
    }
    
    .auth-header h1 {
        font-size: 22px;
    }
    
    .auth-form .form-group input,
    .auth-form .form-group select {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .auth-form .btn-submit {
        padding: 14px;
        font-size: 15px;
    }
    
    .auth-form .social-login {
        gap: 10px;
    }
    
    .auth-form .btn-social {
        padding: 12px;
        font-size: 14px;
    }
    
    #forgotPasswordModal .modal-content {
        border-radius: var(--radius-lg);
    }
    
    #forgotPasswordModal .modal-header,
    #forgotPasswordModal .modal-body {
        padding: 20px;
    }
    
    .toast-notification {
        top: 10px;
        left: 10px;
        right: 10px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .auth-container,
    .auth-form,
    .auth-tab.active::after,
    .auth-form .btn-submit::before,
    .auth-form .password-strength,
    .auth-form .form-message,
    #forgotPasswordModal .modal-content,
    .toast-notification {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auth-form .btn-submit,
    #forgotPasswordModal .btn-primary,
    .auth-form .btn-social {
        border: 2px solid currentColor;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .auth-tabs,
    .auth-form .social-login,
    .auth-features,
    .auth-form .btn-submit,
    .auth-form .btn-social,
    .toast-notification,
    #forgotPasswordModal {
        display: none !important;
    }
    
    .auth-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}