/* ═══════════════════════════════════════════
   STUDYPEAK — auth.css
   Login, Register, OTP, Reset, Change Password
   Covers: login.html, register.html,
   verify_otp.html, reset_request.html,
   reset_verify_otp.html, reset_confirm.html,
   change_password.html
═══════════════════════════════════════════ */


/* ─────────────────────────────────────────
   AUTH WRAPPER & BACKGROUND
───────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(79, 142, 247, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(52, 211, 153, 0.05) 0%, transparent 55%),
        radial-gradient(ellipse at 60% 10%, rgba(251, 191, 36, 0.03) 0%, transparent 40%),
        var(--bg);
}


/* ─────────────────────────────────────────
   AUTH CARD
───────────────────────────────────────── */
.auth-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0.5;
}

.auth-card-wide {
    max-width: 520px;
}


/* ─────────────────────────────────────────
   AUTH LOGO
───────────────────────────────────────── */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text);
    letter-spacing: -0.02em;
    text-decoration: none;
    transition: opacity var(--transition);
}

.auth-logo:hover { opacity: 0.85; }

.auth-logo-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.auth-logo-text {
    background: linear-gradient(135deg, var(--text), var(--text-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .auth-logo-text {
    -webkit-text-fill-color: var(--text);
    background: none;
}


/* ─────────────────────────────────────────
   AUTH HEADER
───────────────────────────────────────── */
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.55;
}

.auth-subtitle strong {
    color: var(--accent);
    font-weight: 600;
}


/* ─────────────────────────────────────────
   VERIFY ICON (OTP / Reset pages)
───────────────────────────────────────── */
.auth-verify-icon {
    width: 66px; height: 66px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    border: 1px solid rgba(79, 142, 247, 0.2);
    transition: transform var(--transition);
}

.auth-verify-icon:hover { transform: scale(1.04); }

.auth-icon-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: rgba(251, 191, 36, 0.2);
}

.auth-icon-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.2);
}

.auth-icon-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.2);
}


/* ─────────────────────────────────────────
   AUTH FORM
───────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-group:last-of-type {
    margin-bottom: 0;
}

.auth-form .btn {
    margin-top: 8px;
}

.mb-8 { margin-bottom: 8px; }

/* Label inline flex (for "Password" + "Forgot?" row) */
.flex-between.mb-8 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}


/* ─────────────────────────────────────────
   INPUT WITH ICON — extended styles
───────────────────────────────────────── */
.input-icon-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 0.85rem;
    pointer-events: none;
    transition: color var(--transition);
    z-index: 1;
}

.form-input.input-with-icon:focus ~ .input-icon,
.input-icon-wrap:focus-within .input-icon {
    color: var(--accent);
}

.form-input.input-with-icon {
    padding-left: 40px;
}

.form-input.input-with-icon-right {
    padding-right: 44px;
}

.input-icon-right {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.input-icon-right:hover {
    color: var(--text-2);
    background: var(--bg-4);
}


/* ─────────────────────────────────────────
   AUTH DIVIDER
───────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font-size: 0.8rem;
    color: var(--text-3);
    white-space: nowrap;
}

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


/* ─────────────────────────────────────────
   AUTH LINK & FOOTER
───────────────────────────────────────── */
.auth-link {
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
    transition: opacity var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.auth-link:hover { opacity: 0.75; }

.auth-link i { font-size: 0.8em; }

.auth-footer {
    text-align: center;
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}


/* ─────────────────────────────────────────
   AUTH HINT (validation feedback)
───────────────────────────────────────── */
.auth-hint {
    font-size: 0.8rem;
    margin-top: 6px;
    min-height: 18px;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.auth-hint-success { color: var(--success); }
.auth-hint-error   { color: var(--danger);  }
.auth-hint-info    { color: var(--text-3);  }


/* ─────────────────────────────────────────
   ROLE SELECTOR (register.html)
───────────────────────────────────────── */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 2px;
}

.role-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    position: relative;
    background: var(--bg-3);
}

.role-option:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.role-option.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.role-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    background: var(--bg-4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-2);
    flex-shrink: 0;
    transition: all var(--transition);
}

.role-option.active .role-icon {
    background: var(--accent);
    color: #fff;
}

.role-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}

.role-sublabel {
    font-size: 0.75rem;
    color: var(--text-3);
    margin-top: 3px;
}

.role-check {
    margin-left: auto;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: transparent;
    transition: all var(--transition);
    flex-shrink: 0;
}

.role-option.active .role-check {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}


/* ─────────────────────────────────────────
   PASSWORD STRENGTH METER (reset_confirm.html)
───────────────────────────────────────── */
.password-strength {
    margin-top: 8px;
}

.strength-track {
    height: 4px;
    background: var(--bg-4);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 20px;
    transition: width 0.35s ease, background 0.35s ease;
}

.strength-label {
    font-size: 0.75rem;
    font-weight: 600;
    display: block;
}


/* ─────────────────────────────────────────
   OTP INPUTS (verify_otp.html, reset_verify_otp.html)
───────────────────────────────────────── */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.otp-input {
    width: 52px; height: 58px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    font-family: var(--font-display);
    background: var(--bg-3);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    transition: all var(--transition);
    caret-color: var(--accent);
    letter-spacing: 0.04em;
}

.otp-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--bg-2);
    transform: translateY(-1px);
}

.otp-input-filled {
    border-color: var(--accent);
    color: var(--accent);
}

.otp-input.otp-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
    animation: shake 0.35s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-4px); }
    40%       { transform: translateX(4px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(2px); }
}


/* ─────────────────────────────────────────
   OTP TIMER
───────────────────────────────────────── */
.otp-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-2);
    margin: 18px 0;
}

.otp-timer i { font-size: 0.8rem; }

.otp-timer-count {
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--accent);
    min-width: 48px;
    display: inline-block;
    transition: color 0.3s ease;
}

.otp-timer-count.expiring { color: var(--warning); }
.otp-timer-count.expired  { color: var(--danger); }


/* ─────────────────────────────────────────
   CHANGE PASSWORD — section divider
───────────────────────────────────────── */
.change-password-section {
    padding: 16px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.change-password-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}


/* ─────────────────────────────────────────
   INFO / WARNING BOX (generic auth notices)
───────────────────────────────────────── */
.auth-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.auth-notice-info {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(79, 142, 247, 0.2);
}

.auth-notice-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.auth-notice-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.auth-notice i { font-size: 0.9rem; margin-top: 1px; flex-shrink: 0; }


/* ─────────────────────────────────────────
   AUTH SUCCESS STATE (after verification)
───────────────────────────────────────── */
.auth-success-banner {
    text-align: center;
    padding: 24px;
    background: var(--success-soft);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.auth-success-icon {
    font-size: 2rem;
    color: var(--success);
    margin-bottom: 8px;
}

.auth-success-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 4px;
}

.auth-success-text {
    font-size: 0.85rem;
    color: var(--text-2);
}


/* ─────────────────────────────────────────
   FORM HINT — inline link variant
───────────────────────────────────────── */
.form-hint-link {
    color: var(--accent);
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    transition: opacity var(--transition);
    text-decoration: none;
}

.form-hint-link:hover { opacity: 0.75; }


/* ─────────────────────────────────────────
   TERMS & POLICY TEXT
───────────────────────────────────────── */
.auth-terms {
    font-size: 0.78rem;
    color: var(--text-3);
    text-align: center;
    line-height: 1.5;
    margin-top: 14px;
}

.auth-terms a {
    color: var(--text-2);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--transition);
}

.auth-terms a:hover { color: var(--accent); }


/* ─────────────────────────────────────────
   RESEND BUTTON (verify pages)
───────────────────────────────────────── */
.resend-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: all var(--transition);
    font-family: var(--font-body);
}

.resend-btn:hover {
    background: var(--accent-soft);
}

.resend-btn:disabled {
    color: var(--text-3);
    cursor: not-allowed;
    background: none;
}


/* ─────────────────────────────────────────
   SUBMIT BUTTON LOADING STATE
───────────────────────────────────────── */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 16px; height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

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


/* ─────────────────────────────────────────
   BACK BUTTON (compact variant for auth)
───────────────────────────────────────── */
.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-2);
    transition: all var(--transition);
    padding: 6px 10px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    text-decoration: none;
}

.auth-back-link:hover {
    color: var(--text);
    background: var(--bg-3);
}

.auth-back-link i { font-size: 0.8rem; }


/* ─────────────────────────────────────────
   EMAIL DISPLAY (OTP pages)
───────────────────────────────────────── */
.auth-email-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 4px;
}

.auth-email-display i {
    font-size: 0.75rem;
    color: var(--text-3);
}


/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-card {
        padding: 28px 18px;
        border-radius: var(--radius-lg);
    }

    .auth-title { font-size: 1.3rem; }

    .role-selector { grid-template-columns: 1fr; gap: 10px; }

    .otp-inputs { gap: 6px; }
    .otp-input {
        width: 42px; height: 50px;
        font-size: 1.1rem;
    }

    .auth-verify-icon {
        width: 56px; height: 56px;
        font-size: 1.4rem;
    }
}

@media (max-width: 360px) {
    .otp-input {
        width: 36px; height: 44px;
        font-size: 1rem;
    }

    .auth-card { padding: 22px 14px; }
}