/* ═══════════════════════════════════════════════════════════════
   Auth Pages — Premium Split-Panel Layout
   Tokens from theme.css — references --brand-red, --sidebar-bg, etc.
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Root ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'DM Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--sidebar-bg);
    overflow: hidden;
}

/* ── Accent strip at top ───────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-red) 0%, #ef4444 40%, var(--brand-red) 100%);
    z-index: 100;
}

/* ── Shell ──────────────────────────────────────────────────── */
.login-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ── LEFT: Brand Panel ──────────────────────────────────────── */
.brand-panel {
    position: relative;
    width: 50%;
    min-width: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 72px;
    overflow: hidden;
}

/* Mesh gradient background */
.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(220, 38, 38, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 80% 20%, rgba(239, 68, 68, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse 50% 50% at 50% 50%, rgba(30, 41, 59, 0.5) 0%, transparent 80%);
    pointer-events: none;
}

/* Subtle grid pattern */
.brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 70% at 30% 70%, black 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 70% 70% at 30% 70%, black 0%, transparent 70%);
    pointer-events: none;
}

/* ── Brand Content ──────────────────────────────────────────── */
.brand-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
}

/* Logo */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 56px;
    opacity: 0;
    animation: fadeUp 600ms ease-out 200ms forwards;
}

.brand-logo img {
    height: 64px;
    width: auto;
}

.logo-text {
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.logo-text span {
    color: #94a3b8;
    font-weight: 400;
}

/* Headline */
.brand-headline {
    font-size: 40px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    opacity: 0;
    animation: fadeUp 600ms ease-out 350ms forwards;
}

.brand-headline em {
    font-style: normal;
    background: linear-gradient(135deg, #f87171 0%, var(--brand-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-sub {
    font-size: 15px;
    color: #94a3b8;
    line-height: 1.65;
    margin-bottom: 48px;
    max-width: 400px;
    opacity: 0;
    animation: fadeUp 600ms ease-out 450ms forwards;
}

/* Feature list */
.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
    opacity: 0;
    animation: fadeUp 600ms ease-out 550ms forwards;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 13.5px;
    color: #cbd5e1;
    line-height: 1.5;
}

.feature-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.feature-icon svg {
    width: 16px;
    height: 16px;
    color: #f87171;
}

.feature-label {
    font-weight: 600;
    color: #e2e8f0;
}

/* Stats footer */
.brand-footer {
    position: absolute;
    bottom: 48px;
    left: 72px;
    right: 72px;
    z-index: 1;
    display: flex;
    gap: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--sidebar-border);
    opacity: 0;
    animation: fadeUp 600ms ease-out 700ms forwards;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
}

/* ── RIGHT: Form Panel ──────────────────────────────────────── */
.form-panel {
    width: 50%;
    min-width: 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 48px;
    position: relative;
    overflow-y: auto;
}

.form-wrapper {
    width: 100%;
    max-width: 380px;
}

.form-header {
    margin-bottom: 36px;
    opacity: 0;
    animation: fadeUp 500ms ease-out 300ms forwards;
}

.form-eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.form-title {
    font-size: 30px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.3px;
    margin-bottom: 8px;
}

.form-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.55;
}

/* Form body animation wrapper */
.form-body {
    opacity: 0;
    animation: fadeUp 500ms ease-out 450ms forwards;
}

/* ── Form Elements ──────────────────────────────────────────── */

/* Field groups */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 22px;
}

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

.field-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Inputs — shared class .auth-input */
.auth-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-family: inherit;
    font-size: 16px;
    color: #0f172a;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-input:hover {
    border-color: #cbd5e1;
}

.auth-input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px var(--brand-red-glow);
}

/* Textarea variant */
textarea.auth-input {
    height: auto;
    padding: 10px 14px;
    resize: vertical;
}

/* ── Primary Button ─────────────────────────────────────────── */
.auth-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #ef4444 0%, var(--brand-red) 50%, var(--brand-red-dark) 100%);
    color: white;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 200ms ease, transform 100ms ease, filter 200ms ease;
    position: relative;
    overflow: hidden;
}

.auth-btn-primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.auth-btn-primary:active {
    transform: scale(0.985);
}

.auth-btn-primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

.auth-btn-primary:disabled {
    cursor: not-allowed;
    transform: none;
    opacity: 0.85;
    filter: none;
    box-shadow: none;
}

/* Shimmer effect on hover */
.auth-btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: left 500ms ease;
}

.auth-btn-primary:hover::after {
    left: 120%;
}

/* ── Links ──────────────────────────────────────────────────── */
.auth-link {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--brand-red);
    text-decoration: none;
    transition: color 150ms ease;
}

.auth-link:hover {
    color: var(--brand-red-dark);
    text-decoration: underline;
}

/* ── Divider ────────────────────────────────────────────────── */
.form-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.form-divider span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
}

/* ── Register CTA ───────────────────────────────────────────── */
.register-cta {
    margin-top: 6px;
    opacity: 0;
    animation: fadeUp 500ms ease-out 600ms forwards;
}

.btn-register {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}

.btn-register:hover {
    border-color: var(--brand-red);
    background: rgba(220, 38, 38, 0.04);
    color: var(--brand-red);
}

.btn-register svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* ── Form Footer ────────────────────────────────────────────── */
.form-footer {
    position: absolute;
    bottom: 32px;
    left: 48px;
    right: 48px;
    text-align: center;
    font-size: 11.5px;
    color: #94a3b8;
    opacity: 0;
    animation: fadeIn 600ms ease-out 800ms forwards;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.auth-alert-error {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--status-rejected-text);
    background: var(--status-rejected-bg);
    margin-bottom: 1.25rem;
}

.auth-alert-success {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--status-approved-text);
    background: var(--status-approved-bg);
    margin-bottom: 1.25rem;
}

.auth-alert-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--status-pending-text);
    background: var(--status-pending-bg);
    margin-bottom: 1.25rem;
}

/* ── Django form error lists ─────────────────────────────────── */
ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--status-rejected-text);
}

ul.errorlist li {
    padding: 0.25rem 0;
}

/* ── Password help text ──────────────────────────────────────── */
.auth-password-help ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: #64748b;
}

.auth-password-help ul li {
    padding: 0.125rem 0;
    padding-left: 1rem;
    position: relative;
}

.auth-password-help ul li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: #94a3b8;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; r: 2; }
    50%      { opacity: 0.8; r: 3; }
}

@keyframes dash {
    to { stroke-dashoffset: -120; }
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

/* ── Floating Dots Decoration ────────────────────────────────── */
.floating-dots {
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    opacity: 0.35;
    pointer-events: none;
    z-index: 1;
}

.floating-dots circle {
    fill: #475569;
    animation: pulse 4s ease-in-out infinite;
}
.floating-dots circle:nth-child(2) { animation-delay: 0.8s; }
.floating-dots circle:nth-child(3) { animation-delay: 1.6s; }
.floating-dots circle:nth-child(4) { animation-delay: 2.4s; }
.floating-dots circle:nth-child(5) { animation-delay: 3.2s; }

/* ── Connection Line Decoration ──────────────────────────────── */
.connection-line {
    position: absolute;
    bottom: 120px;
    right: 48px;
    width: 160px;
    height: 80px;
    opacity: 0.2;
    pointer-events: none;
    z-index: 1;
}

.connection-line path {
    stroke: #f87171;
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 6 4;
    animation: dash 12s linear infinite;
}

.connection-line circle {
    fill: #f87171;
    animation: nodePulse 3s ease-in-out infinite;
}

.connection-line circle:nth-child(3) { animation-delay: 1s; }
.connection-line circle:nth-child(4) { animation-delay: 2s; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .brand-panel {
        width: 45%;
        padding: 48px 40px;
    }
    .brand-footer {
        left: 40px;
        right: 40px;
    }
    .form-panel {
        width: 55%;
    }
}

@media (max-width: 768px) {
    .login-shell {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    body { overflow-y: auto; }

    .brand-panel {
        width: 100%;
        padding: 24px 28px 20px;
        min-height: auto;
    }

    .brand-headline { font-size: 22px; }
    .brand-sub, .feature-list, .brand-footer,
    .floating-dots, .connection-line { display: none; }

    .form-panel {
        width: 100%;
        flex: 1;
        padding: 32px 28px 32px;
        justify-content: flex-start;
    }

    .form-footer {
        position: static;
        margin-top: 32px;
        opacity: 1;
    }
}

/* ── Reduced Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
