/* ===========================================
   AUTH-ONBOARDING.CSS
   Auth, Registration & Onboarding Styles
   =========================================== */

/* ─────────────────────────────────────────
   1. LAYOUT
   ───────────────────────────────────────── */

.auth-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

/* ─────────────────────────────────────────
   2. HEADER & LOGO
   ───────────────────────────────────────── */

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.logo svg {
    width: 40px;
    height: 40px;
    color: var(--primary);
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ─────────────────────────────────────────
   3. FORM STRUCTURE
   ───────────────────────────────────────── */

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

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

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

.optional-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 7px;
}

/* ─────────────────────────────────────────
   4. INPUTS
   ───────────────────────────────────────── */

.form-control {
    width: 100%;
    padding: 14px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--bg-elevated);
    outline: none;
}

.form-help {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-help.with-icon {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.form-help.with-icon svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--text-secondary);
}

/* ─────────────────────────────────────────
   5. PASSWORD FIELD WITH TOGGLE
   ───────────────────────────────────────── */

.form-control-merged {
    position: relative;
    display: flex;
    align-items: center;
}

.merged-input {
    width: 100%;
    padding: 14px 48px 14px 14px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    transition: var(--transition);
}

.merged-input:focus {
    border-color: var(--primary);
    background: var(--bg-elevated);
    outline: none;
}

.toggle-password-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

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

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

/* Initial icon state – JS overrides via style.display */
.toggle-password-btn .eye-open   { display: block; }
.toggle-password-btn .eye-closed { display: none;  }

/* ─────────────────────────────────────────
   6. PASSWORD STRENGTH BAR
   ───────────────────────────────────────── */

.password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar .__fill {
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease, background 0.3s ease;
}

.strength-text {
    font-size: 11px;
    font-weight: 700;
    min-width: 44px;
    text-align: right;
}

.password-strength.strength-weak   .strength-bar .__fill { background: var(--danger);  }
.password-strength.strength-medium .strength-bar .__fill { background: var(--warning); }
.password-strength.strength-strong .strength-bar .__fill { background: var(--success); }

.password-strength.strength-weak   .strength-text { color: var(--danger);  }
.password-strength.strength-medium .strength-text { color: var(--warning); }
.password-strength.strength-strong .strength-text { color: var(--success); }

/* ─────────────────────────────────────────
   7. PASSWORD MATCH HINT
   ───────────────────────────────────────── */

.password-match-hint {
    font-size: 12px;
    font-weight: 600;
    display: none;
    margin-top: 2px;
}

.password-match-hint.success { color: var(--success); }
.password-match-hint.error   { color: var(--danger);  }

/* ─────────────────────────────────────────
   8. CONSENT TOGGLE SWITCHES
   ───────────────────────────────────────── */

.consent-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    min-height: 52px;
}

.form-checkbox:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.form-checkbox.highlight-consent {
    border-color: rgba(249, 180, 28, 0.3);
    background: var(--primary-subtle);
}

/* Invalid state – set by JS validation */
.form-checkbox.consent-invalid {
    border-color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.04) !important;
    animation: shake 0.35s ease;
}

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

/* Hide native checkbox – replaced by toggle-switch */
.form-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Toggle track */
.toggle-switch {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 44px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    border: 1.5px solid transparent;
    transition: background 0.25s ease, border-color 0.25s ease;
    margin-top: 1px;
}

/* Toggle knob */
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checked state */
.form-checkbox input[type="checkbox"]:checked ~ .toggle-switch {
    background: var(--primary);
    border-color: var(--primary-dark);
}

.form-checkbox input[type="checkbox"]:checked ~ .toggle-switch::after {
    transform: translateX(18px);
}

/* Keyboard focus ring */
.form-checkbox input[type="checkbox"]:focus-visible ~ .toggle-switch {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Label text */
.consent-label {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

.consent-label .label-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.consent-label .label-desc {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.5;
}

.consent-label .label-text {
    font-size: 14px;
    font-weight: 500;
}

.legal-link {
    color: var(--primary-dark);
    text-decoration: underline;
    font-weight: 700;
}

.legal-link:hover {
    color: var(--primary);
}

/* ─────────────────────────────────────────
   9. ALERTS
   ───────────────────────────────────────── */

.alert {
    padding: 14px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--text-primary);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--text-primary);
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.alert-success h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
    margin: 0;
}

.alert-success p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.alert-success .btn {
    margin-top: 8px;
}

.error-icon,
.success-icon {
    flex-shrink: 0;
}

.error-icon svg {
    width: 20px;
    height: 20px;
    color: var(--danger);
}

.success-icon svg {
    width: 48px;
    height: 48px;
    color: var(--success);
}

.alert-error p,
.alert-error strong {
    margin: 0;
    line-height: 1.5;
}

.alert-error a {
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: underline;
}

/* ─────────────────────────────────────────
   10. FORM ROW (remember me + forgot link)
   ───────────────────────────────────────── */

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.link-secondary {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.link-secondary:hover {
    text-decoration: underline;
}

/* ─────────────────────────────────────────
   11. BUTTONS
   ───────────────────────────────────────── */

.btn-block {
    width: 100%;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

/* ─────────────────────────────────────────
   12. DIVIDER
   ───────────────────────────────────────── */

.divider {
    display: flex;
    align-items: center;
    text-align: center;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

/* ─────────────────────────────────────────
   13. AUTH FOOTER
   ───────────────────────────────────────── */

.auth-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

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

.auth-footer a:hover {
    text-decoration: underline;
}

/* ─────────────────────────────────────────
   14. HONEYPOT
   ───────────────────────────────────────── */

.visually-hidden-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ─────────────────────────────────────────
   15. ONBOARDING STEPS
   ───────────────────────────────────────── */

.onboarding-screen {
    text-align: center;
    padding: 40px 20px;
}

.progress-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 24px 0;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    transition: var(--transition);
}

.dot.active {
    width: 24px;
    background: var(--primary);
}

/* ─────────────────────────────────────────
   16. DARK MODE ADJUSTMENTS
   ───────────────────────────────────────── */

[data-theme="dark"] .toggle-switch {
    background: var(--border);
}

[data-theme="dark"] .toggle-switch::after {
    background: #e2e8f0;
}

[data-theme="dark"] .form-checkbox input[type="checkbox"]:checked ~ .toggle-switch {
    background: var(--primary);
}


/* --- DELETE ACCOUNT PAGE --- */
.alert-delete-warning {
    margin-bottom: 24px;
}

.delete-warning-list {
    margin-top: 10px;
    padding-left: 18px;
    font-size: 14px;
    line-height: 2;
}

.delete-warning-note {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.link-muted {
    color: var(--primary-dark);
}

.form-control-static {
    cursor: default;
    color: var(--text-secondary);
}

.input-delete-confirm {
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-delete-submit {
    margin-bottom: 12px;
}