/*=====================================
       AUTH PAGES (Login & Register)
======================================*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f0f4ff;
    min-height: 100vh;
}

/* ── Layout ── */
.auth-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ── Left panel (hero) ── */
.auth-hero {
    position: relative;
    background: linear-gradient(145deg, #1a1a4e 0%, #0f3460 50%, #16213e 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 50px;
    overflow: hidden;
    color: #fff;
    text-align: center;
}

.auth-hero::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(37, 99, 235, .35) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    border-radius: 50%;
}

.auth-hero::after {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(37, 99, 235, .25) 0%, transparent 70%);
    bottom: -80px;
    right: -80px;
    border-radius: 50%;
}

/* Register hero uses slightly different gradient orbs */
.auth-hero.register-hero::before {
    background: radial-gradient(circle, rgba(99, 102, 241, .35) 0%, transparent 70%);
}

.auth-hero.register-hero::after {
    background: radial-gradient(circle, rgba(236, 72, 153, .25) 0%, transparent 70%);
}

.hero-logo {
    width: 72px;
    margin-bottom: 28px;
    filter: drop-shadow(0 4px 12px rgba(37, 99, 235, .6));
    position: relative;
    z-index: 1;
}

.auth-hero.register-hero .hero-logo {
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, .6));
}

.hero-title {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 16px;
    color: #fff;
    position: relative;
    z-index: 1;
}

.hero-title span {
    color: #fff;
}

.hero-sub {
    font-size: 1rem;
    color: rgba(255, 255, 255, .65);
    max-width: 340px;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

/* Hero stats (login) */
.hero-stats {
    display: flex;
    gap: 36px;
    margin-top: 48px;
    position: relative;
    z-index: 1;
}

.stat-item {
    text-align: center;
}

.stat-num {
    font-size: 1.65rem;
    font-weight: 700;
    color: #fff;
}

.stat-lbl {
    font-size: .75rem;
    color: rgba(255, 255, 255, .5);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-top: 2px;
}

/* Hero features (register) */
.hero-features {
    margin-top: 48px;
    position: relative;
    z-index: 1;
    text-align: left;
    width: 100%;
    max-width: 280px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.feature-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, .12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    color: #3b82f6;
    flex-shrink: 0;
}

.feature-text {
    font-size: .85rem;
    color: rgba(255, 255, 255, .75);
    line-height: 1.4;
}

.feature-text strong {
    display: block;
    color: #fff;
    font-size: .9rem;
    margin-bottom: 2px;
}

/* Hero badge */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: .78rem;
    color: rgba(255, 255, 255, .8);
    margin-bottom: 28px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.hero-badge span,
.hero-badge .dot {
    width: 7px;
    height: 7px;
    background: #22d3ee;
    border-radius: 50%;
    display: inline-block;
}

/* ── Right panel (form) ── */
.auth-form-panel {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 56px;
    overflow-y: auto;
}

.auth-form-inner {
    width: 100%;
    max-width: 420px;
}

/* ── Tabs ── */
.auth-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 36px;
}

.auth-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    border-radius: 9px;
    font-size: .9rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: all .25s;
    text-decoration: none;
    text-align: center;
    display: block;
}

.auth-tab.active,
.auth-tab:hover {
    background: #fff;
    color: #1d6cf5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

/* ── Form heading ── */
.form-heading {
    margin-bottom: 28px;
}

.form-heading h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
}

.form-heading p {
    font-size: .88rem;
    color: #64748b;
    margin-top: 5px;
}

/* ── Field ── */
.field-group {
    margin-bottom: 18px;
}

.field-group label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: .03em;
}

.field-wrap {
    position: relative;
}

.field-wrap .field-icon,
.field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .95rem;
    pointer-events: none;
}

.field-wrap input,
.field-group input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .9rem;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
    outline: none;
    font-family: inherit;
}

.field-wrap input:focus,
.field-group input:focus {
    border-color: #1d6cf5;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(29, 108, 245, .1);
}

/* Icon color follows focus */
.field-wrap input:focus~.field-icon,
.field-wrap:focus-within .field-icon {
    color: #1d6cf5;
    transition: color .25s ease;
}

.field-error {
    font-size: .78rem;
    color: #ef4444;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Show/hide password toggle */
.eye-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: .85rem;
    font-family: inherit;
    font-weight: 500;
    padding: 0;
    line-height: 1;
}

.eye-toggle:hover {
    color: #1d6cf5;
}

/* ── Row ── */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Extras ── */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    font-size: .82rem;
}

.form-options label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #475569;
    cursor: pointer;
}

.form-options input[type=checkbox] {
    accent-color: #1d6cf5;
    width: 15px;
    height: 15px;
}

.form-options a {
    color: #1d6cf5;
    text-decoration: none;
    font-weight: 500;
}

.form-options a:hover {
    text-decoration: underline;
}

/* Terms row (register) */
.terms-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: .82rem;
    color: #475569;
    margin-bottom: 20px;
}

.terms-row input[type=checkbox] {
    accent-color: #1d6cf5;
    margin-top: 2px;
    flex-shrink: 0;
    width: 15px;
    height: 15px;
}

.terms-row a {
    color: #1d6cf5;
    text-decoration: none;
    font-weight: 500;
}

/* ── Submit ── */
.btn-auth {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #1d6cf5 0%, #1253cc 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .15s, box-shadow .2s;
    font-family: inherit;
    letter-spacing: .02em;
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}

.btn-auth:hover {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(29, 108, 245, .35);
}

.btn-auth:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Loading state */
.btn-auth.loading {
    pointer-events: none;
    opacity: .75;
}

.btn-auth.loading .btn-text {
    visibility: hidden;
}

.btn-auth .btn-spinner {
    display: none;
}

.btn-auth.loading .btn-spinner {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ── Switch hint ── */
.switch-hint {
    text-align: center;
    margin-top: 22px;
    font-size: .83rem;
    color: #64748b;
}

.switch-hint a {
    color: #1d6cf5;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: color .15s;
}

.switch-hint a:hover {
    text-decoration: underline;
}

/* ── Messages ── */
.msg-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .84rem;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .84rem;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .84rem;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Referral notice (register) */
.referral-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .83rem;
    color: #1d4ed8;
    margin-bottom: 18px;
}

/* ── Tab content visibility ── */
.tab-content-panel {
    display: none;
}

.tab-content-panel.active {
    display: block;
}

/* Red border on invalid inputs */
.field-wrap.has-error input {
    border-color: #ef4444;
    background: #fff5f5;
}

/* Override Django form widget styles */
.field-wrap input[type="email"],
.field-wrap input[type="password"],
.field-wrap input[type="text"] {
    width: 100% !important;
}

/* ── Password strength ── */
.pwd-strength {
    margin-top: 8px;
}

.pwd-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    overflow: hidden;
    margin-bottom: 4px;
}

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

.pwd-strength-fill[data-score="0"] {
    width: 0;
}

.pwd-strength-fill[data-score="1"] {
    width: 25%;
    background: #ef4444;
}

.pwd-strength-fill[data-score="2"] {
    width: 50%;
    background: #f59e0b;
}

.pwd-strength-fill[data-score="3"] {
    width: 75%;
    background: #3b82f6;
}

.pwd-strength-fill[data-score="4"] {
    width: 100%;
    background: #22c55e;
}

.pwd-strength-label {
    font-size: .72rem;
    font-weight: 500;
    color: #94a3b8;
    transition: color .3s ease;
}

.pwd-strength-label[data-score="1"] {
    color: #ef4444;
}

.pwd-strength-label[data-score="2"] {
    color: #f59e0b;
}

.pwd-strength-label[data-score="3"] {
    color: #3b82f6;
}

.pwd-strength-label[data-score="4"] {
    color: #22c55e;
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .auth-wrapper {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        display: none;
    }

    .auth-form-panel {
        padding: 40px 28px;
    }
}

@media (max-width: 480px) {
    .field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-form-panel {
        padding: 32px 20px;
    }

    .form-heading h2 {
        font-size: 1.35rem;
    }
}