/* Auth Modal Styles */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3,6,12,0.95);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1),
                visibility 280ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    padding: 2rem;
}

.auth-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.auth-modal {
    width: min(500px, 95%);
    background: #1e2938;
    border-radius: 0;
    color: #ffffff;
    position: relative;
    transform: translateY(24px) scale(0.98);
    transition: transform 320ms cubic-bezier(.2,.9,.2,1);
    padding: 60px 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.auth-modal-overlay.open .auth-modal {
    transform: translateY(0) scale(1);
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin: -20px 0 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 1rem;
}

.auth-tab {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 16px;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    letter-spacing: 1px;
}

.auth-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1rem;
    height: 2px;
    background: #ff7a3d;
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-tab.active {
    color: #ffffff;
}

.auth-tab.active::after {
    transform: scaleX(1);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 24px;
}

.auth-form.active {
    display: flex;
}

/* Logo */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.auth-logo-icon {
    width: 50px;
    height: 50px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.auth-logo-text {
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    background: rgba(71, 85, 105, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px 20px;
    color: #ffffff;
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus {
    background: rgba(71, 85, 105, 0.7);
    border-color: rgba(255, 122, 61, 0.5);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff7a3d;
}

.form-checkbox label {
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
}

.auth-submit {
    background: #ff7a3d;
    color: white;
    padding: 16px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-submit:hover {
    background: #ff8c52;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 122, 61, 0.3);
}

.auth-submit:active {
    transform: translateY(0);
}

.form-footer {
    text-align: center;
    margin-top: 1rem;
}

.forgot-password {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 200ms ease;
}

.forgot-password:hover {
    color: var(--text-primary);
}

@media screen and (max-width: 480px) {
    .auth-modal-overlay {
        padding: 1rem;
        align-items: flex-start;
        overflow-y: auto;
    }

    .auth-modal {
        width: min(95%, 440px);
        max-width: 100%;
        margin: 1rem auto;
        padding: 1.25rem 1rem;
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
        border-radius: 16px;
        transform: translateY(0) scale(1);
    }

    .auth-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        margin: 0 0 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid rgba(255,255,255,0.12);
    }

    .auth-tab {
        flex: 1 1 0;
        text-align: center;
        padding: 0.85rem 0.75rem;
        font-size: 0.95rem;
        border-radius: 12px;
        background: rgba(255,255,255,0.04);
        min-width: 0;
    }

    .auth-tab.active {
        color: #ffffff;
    }

    .auth-form {
        gap: 18px;
    }

    .auth-logo {
        gap: 0.75rem;
        margin-bottom: 28px;
    }

    .auth-logo-text {
        font-size: 20px;
    }

    .form-group {
        gap: 6px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input {
        min-height: 50px;
        padding: 14px 16px;
        font-size: 16px;
    }

    .form-group input::placeholder {
        font-size: 16px;
    }

    .auth-submit {
        min-height: 50px;
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
    }

    .forgot-password,
    .forgot-link,
    .back-link,
    .form-footer {
        font-size: 14px;
    }

    .modal-close {
        position: absolute;
        top: 0.85rem;
        right: 0.85rem;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        background: rgba(255,255,255,0.08);
        color: #ffffff;
    }

    .modal-close:hover {
        background: rgba(255,255,255,0.14);
    }

    .reset-code-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .reset-code-row input[type="text"] {
        width: 100%;
        letter-spacing: 4px;
    }
}

/* Improved styles for Forgot / Reset forms */
.auth-form .form-note {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    margin-bottom: 6px;
}

#forgotForm, #resetForm {
    padding: 8px 0 0 0;
}

.forgot-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.reset-code-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.reset-code-row input[type="text"] {
    width: 140px;
    padding: 12px 14px;
    font-size: 16px;
    letter-spacing: 3px;
    text-align: center;
}

.small-link {
    color: rgba(255,255,255,0.8);
    text-decoration: underline;
    font-size: 13px;
}

/* Stylish forgot-password link/button */
.forgot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,122,61,0.08);
    color: #ffd9c4;
    border: 1px solid rgba(255,122,61,0.12);
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 180ms ease;
}

.forgot-link::before {
    content: '🔒';
    display: inline-block;
    transform: translateY(1px);
}

.forgot-link:hover {
    background: rgba(255,122,61,0.14);
    box-shadow: 0 6px 18px rgba(255,122,61,0.08);
    transform: translateY(-2px);
    color: #fff;
}

.forgot-link:active {
    transform: translateY(0);
}

/* Back-to-login link/button style */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.85);
    background: transparent;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: all 180ms ease;
}

.back-link::before {
    content: '←';
    opacity: 0.9;
}

.back-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.06);
    transform: translateY(-2px);
}

.back-link:active { transform: translateY(0); }

/* center small back link under buttons */
.auth-form .back-row { text-align: center; margin-top: 10px; }

.auth-submit.small {
    padding: 10px 14px;
    font-size: 15px;
    border-radius: 6px;
}

/* compact layout for mobile */
@media (max-width: 420px) {
    .reset-code-row { flex-direction: column; align-items: stretch; }
    .reset-code-row input[type="text"] { width: 100%; letter-spacing: 4px; }
}

/* Focused loading style for single button (forgot password) */
.auth-submit.loading,
.auth-submit.loading:disabled {
    opacity: 0.95;
}
.auth-submit.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    vertical-align: middle;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #ffffff;
    animation: amspin 820ms linear infinite;
}

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

/* Password toggle styles */
.pw-wrapper {
    position: relative;
}
.pw-wrapper input[type="password"],
.pw-wrapper input[type="text"] {
    padding-right: 44px;
}
.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.pw-toggle:focus {
    outline: 2px solid rgba(255,122,61,0.22);
}
.pw-toggle i { pointer-events: none; }