/* Fallback tokens for pages that don't load the full design system */
.auth-modal, .auth-modal * {
    --bg-white: var(--bg-white, #ffffff);
    --bg-light: var(--bg-light, #FAFAF9);
    --text-dark: var(--text-dark, #292524);
    --text-gray: var(--text-gray, #78716C);
    --border-light: var(--border-light, #E7E5E4);
    --primary-red: var(--primary-red, #DC3545);
    --primary-navy: var(--primary-navy, #1E3A5F);
    --radius: var(--radius, 8px);
    --space-1: var(--space-1, 4px);
    --space-1-5: var(--space-1-5, 6px);
    --space-2: var(--space-2, 8px);
    --space-2-5: var(--space-2-5, 10px);
    --space-3: var(--space-3, 12px);
    --space-3-5: var(--space-3-5, 14px);
    --space-4: var(--space-4, 16px);
    --space-5: var(--space-5, 20px);
    --space-6: var(--space-6, 24px);
    --color-success-very-light: var(--color-success-very-light, #ECFDF5);
    --mainsite-light: var(--mainsite-light, #FEF2F2);
}

.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.auth-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.auth-modal-content {
    background: var(--bg-white, #ffffff);
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    position: relative;
}

/* Auth Modal Header */
.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: none;
    background: linear-gradient(135deg, var(--primary-red) 0%, #b02a37 100%);
}

.auth-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.auth-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: rotate(90deg);
}

.auth-close-btn:active {
    transform: rotate(90deg) scale(0.9);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
}

.auth-tab {
    flex: 1;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-gray);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

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

.auth-tab.active {
    color: var(--primary-navy);
    border-bottom-color: var(--primary-navy);
}

/* Auth Body */
.auth-body {
    padding: 14px 24px 16px;
}

/* Auth Form */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Form Row for two-column layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.form-row .form-group {
    margin-bottom: var(--space-1);
}

.form-group {
    margin-bottom: var(--space-1);
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 3px;
}

.form-group input {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-family: inherit;
    transition: all 0.15s;
    background: var(--bg-white);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-group input.error {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-error {
    display: none;
    font-size: 0.8rem;
    color: var(--primary-red);
    margin-top: var(--space-1-5);
}

.form-error.visible {
    display: block;
}

/* Password Field with Toggle */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: var(--space-1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.password-toggle:hover {
    color: var(--text-dark);
}

/* Form Options Row */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    font-size: 0.8rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-gray);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-red);
    cursor: pointer;
}

/* Checkbox group for registration form */
.checkbox-group {
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
}

.checkbox-group .checkbox-label {
    font-size: 0.875rem;
    line-height: 1.4;
}

.checkbox-group .checkbox-text {
    color: var(--text-gray);
}

.forgot-password {
    color: var(--primary-red);
    font-weight: 500;
    transition: color 0.15s;
}

.forgot-password:hover {
    color: #b02a37;
    text-decoration: underline;
}

/* Auth Submit Button - Red Theme */
.auth-submit-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    background: linear-gradient(135deg, var(--primary-red) 0%, #b02a37 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.auth-submit-btn:hover {
    background: linear-gradient(135deg, #c82333 0%, #9a1f2b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.auth-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

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

.auth-submit-btn .btn-text {
    color: white;
}

.auth-submit-btn .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Social Login Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 12px 0;
    color: var(--text-gray);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* Social Login Buttons */
.social-login-btns {
    display: flex;
    flex-direction: column;
    gap: var(--space-2-5);
}

.social-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2-5);
}

.social-btn:hover {
    background: var(--bg-light);
    border-color: var(--text-gray);
}

.social-btn svg {
    width: 20px;
    height: 20px;
}

/* Auth Message (Success/Error) */
.auth-message {
    display: none;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: var(--space-3-5);
    align-items: center;
    gap: var(--space-2-5);
}

.auth-message.visible {
    display: flex;
}

.auth-message.success {
    background: var(--color-success-very-light);
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.auth-message.error {
    background: var(--mainsite-light);
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.auth-message svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Terms Text */
.terms-text {
    margin-top: var(--space-2-5);
    font-size: 0.75rem;
    color: var(--text-gray);
    text-align: center;
    line-height: 1.5;
}

.terms-text a {
    color: var(--primary-red);
    font-weight: 500;
}

.terms-text a:hover {
    color: #b02a37;
    text-decoration: underline;
}

/* Auth Switch Text */
.auth-switch-text {
    margin-top: var(--space-2-5);
    font-size: 0.85rem;
    color: var(--text-gray);
    text-align: center;
}

.auth-switch-text a {
    color: var(--primary-red);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch-text a:hover {
    color: #b02a37;
    text-decoration: underline;
}

/* Forgot Password Modal Styles */
.forgot-form-state .form-group {
    margin-bottom: var(--space-4);
}

.forgot-instructions {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

.forgot-form-state .auth-submit-btn {
    margin-top: var(--space-4);
}

.forgot-form-state .auth-switch-text {
    margin-top: var(--space-5);
}

.forgot-success-state {
    text-align: center;
    padding: 20px 0;
}

.forgot-success-state .success-icon-large {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--color-success-very-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.forgot-success-state .success-icon-large svg {
    width: 32px;
    height: 32px;
    color: #065F46;
}

.forgot-success-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px;
}

.forgot-success-state p {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin: 0 0 12px;
    line-height: 1.5;
}

.forgot-success-state p strong {
    color: var(--text-dark);
}

.forgot-note {
    font-size: 0.8rem !important;
    margin-bottom: var(--space-6) !important;
}

.forgot-note a {
    color: var(--primary-red);
    font-weight: 500;
}

.forgot-note a:hover {
    text-decoration: underline;
}
@media (max-width: 768px) {
    .auth-modal-content {
        max-width: 400px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

@media (max-width: 480px) {
    .auth-modal-content {
        width: 95%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px;
        overflow-y: auto;
    }

    .auth-body {
        padding: var(--space-5);
    }

    .form-options {
        flex-direction: column;
        gap: var(--space-3);
        align-items: flex-start;
    }

    .user-name {
        display: none;
    }
}
