/**
 * CardMan - Authentication Styles
 */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    --bg-dark: #050a15;
    --bg-card: rgba(10, 20, 42, 0.92);
    --accent: #38b6ff;
    --accent-secondary: #0ea5e9;
    --accent-glow: rgba(56, 182, 255, 0.4);
    --accent-green: #06d6a0;
    --text-primary: #e8f4ff;
    --text-secondary: #8ab4d8;
    --text-muted: #5a7a9a;
    --border-color: rgba(56, 182, 255, 0.15);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --success-accent: #4ade80;
    --success-accent-glow: rgba(74, 222, 128, 0.3);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ============================
   ANIMATED BACKGROUND
   ============================ */

/* Multi-layer starfield */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Distant small stars */
.stars::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 300%;
    background:
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 25% 45%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.5px 1.5px at 40% 15%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 55% 65%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1.5px 1.5px at 70% 30%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 85% 55%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 15% 70%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1.5px 1.5px at 60% 80%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 90% 10%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 35% 90%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1.5px 1.5px at 5% 50%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 75% 75%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 48% 35%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1.5px 1.5px at 20% 85%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 95% 40%, rgba(255,255,255,0.4), transparent);
    background-size: 100% 33.33%;
    animation: starsFloat 80s linear infinite;
}

/* Brighter closer stars */
.stars::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 300%;
    background:
        radial-gradient(2px 2px at 12% 35%, rgba(56, 182, 255, 0.6), transparent),
        radial-gradient(2.5px 2.5px at 42% 60%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 68% 20%, rgba(6, 214, 160, 0.5), transparent),
        radial-gradient(2.5px 2.5px at 88% 70%, rgba(56, 182, 255, 0.5), transparent),
        radial-gradient(2px 2px at 30% 10%, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 78% 85%, rgba(167, 139, 250, 0.5), transparent),
        radial-gradient(2.5px 2.5px at 52% 48%, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 8% 80%, rgba(56, 182, 255, 0.4), transparent);
    background-size: 100% 33.33%;
    animation: starsFloat 120s linear infinite;
}

@keyframes starsFloat {
    from { transform: translateY(0); }
    to { transform: translateY(-33.33%); }
}

/* Orbital rings behind card */
body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 700px;
    height: 700px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(56, 182, 255, 0.06);
    box-shadow:
        0 0 80px rgba(56, 182, 255, 0.03),
        inset 0 0 80px rgba(56, 182, 255, 0.02);
    animation: orbitPulse 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 500px;
    height: 500px;
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 50%;
    border: 1px solid rgba(6, 214, 160, 0.05);
    box-shadow:
        0 0 60px rgba(6, 214, 160, 0.02);
    animation: orbitPulse 12s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: 0;
}

@keyframes orbitPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
}

/* Nebula glow effect */
.auth-container::before {
    content: '';
    position: fixed;
    top: 30%;
    left: 25%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(56, 182, 255, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    animation: nebulaShift 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.auth-container::after {
    content: '';
    position: fixed;
    bottom: 20%;
    right: 20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(6, 214, 160, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    animation: nebulaShift 20s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: 0;
}

@keyframes nebulaShift {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -20px); }
    66% { transform: translate(-20px, 15px); }
}

/* ============================
   AUTH CONTAINER & CARD
   ============================ */

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    z-index: 1;
    position: relative;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(56, 182, 255, 0.05),
        0 0 60px rgba(56, 182, 255, 0.05);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: cardEntry 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Gradient top border */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent,
        var(--accent) 20%,
        var(--accent-green) 50%,
        var(--accent-secondary) 80%,
        transparent);
    opacity: 0.8;
}

/* Subtle inner glow */
.auth-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(56, 182, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

/* ============================
   AUTH HEADER
   ============================ */

.auth-header {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.auth-header .logo {
    margin-bottom: 12px;
    display: inline-block;
    animation: logoFloat 4s ease-in-out infinite;
    filter: drop-shadow(0 0 16px rgba(56, 182, 255, 0.4));
    line-height: 1;
}

.auth-header .logo img {
    display: block;
    border-radius: 16px;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.auth-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 3px;
    margin-bottom: 4px;
    text-shadow: 0 0 30px rgba(56, 182, 255, 0.2);
}

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

.auth-header .app-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.auth-header .app-tagline {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.auth-description {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

/* ============================
   ALERTS
   ============================ */

.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    animation: alertSlide 0.3s ease-out;
}

@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* ============================
   LOGIN ANIMATIONS
   ============================ */

/* Card shake on error */
.auth-shake {
    animation: authShake 0.5s ease-out;
}
@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(7px); }
    45% { transform: translateX(-5px); }
    60% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
    90% { transform: translateX(1px); }
}

/* Success overlay */
.auth-success-card {
    animation: authSuccessPulse 1.5s ease-out;
}
@keyframes authSuccessPulse {
    0% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 0 40px var(--success-accent-glow), 0 8px 32px rgba(0, 0, 0, 0.3); }
    100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
}

.login-success-overlay {
    text-align: center;
    padding: 40px 20px;
    animation: loginSuccessFadeIn 0.6s ease-out;
}
.login-success-overlay .success-icon {
    color: var(--success-accent);
}
.login-success-overlay h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    color: var(--success-accent);
    margin: 16px 0 8px;
}
.login-success-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
@keyframes loginSuccessFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================
   FORMS
   ============================ */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.form-group label .required {
    color: var(--error);
}

.form-group label .optional {
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(56, 182, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input[type="text"]:hover,
.form-group input[type="email"]:hover,
.form-group input[type="password"]:hover {
    border-color: rgba(56, 182, 255, 0.25);
    background: rgba(0, 0, 0, 0.4);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.45);
    box-shadow:
        0 0 0 3px rgba(56, 182, 255, 0.1),
        0 0 20px rgba(56, 182, 255, 0.08);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================
   CUSTOM CHECKBOX
   ============================ */

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    user-select: none;
    transition: color 0.2s;
}

.checkbox-label:hover {
    color: var(--text-primary);
}

/* Hide native checkbox */
.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Custom checkbox visual */
.checkbox-label span {
    position: relative;
    padding-left: 30px;
}

.checkbox-label span::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(56, 182, 255, 0.3);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-label span::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-60%) rotate(45deg) scale(0);
    width: 6px;
    height: 10px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-label:hover span::before {
    border-color: rgba(56, 182, 255, 0.5);
    background: rgba(56, 182, 255, 0.05);
}

.checkbox-label input[type="checkbox"]:checked + span::before {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(56, 182, 255, 0.3);
}

.checkbox-label input[type="checkbox"]:checked + span::after {
    transform: translateY(-60%) rotate(45deg) scale(1);
}

.checkbox-label input[type="checkbox"]:focus-visible + span::before {
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.2);
}

.link,
.link:visited {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s;
}

.link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
    text-shadow: 0 0 10px rgba(56, 182, 255, 0.2);
}

/* ============================
   BUTTONS
   ============================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary,
.btn-primary:visited {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(56, 182, 255, 0.25);
    letter-spacing: 0.5px;
}

/* Shimmer effect on primary button */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s ease;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(56, 182, 255, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(56, 182, 255, 0.3);
}

.btn-secondary,
.btn-secondary:visited {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(56, 182, 255, 0.08);
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    padding: 8px 0;
    font-size: 0.9rem;
}

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

/* ============================
   FOOTER & BRANDING
   ============================ */

.auth-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer a,
.auth-footer a:visited {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.auth-footer a:hover {
    text-decoration: underline;
    text-shadow: 0 0 10px rgba(56, 182, 255, 0.2);
}

.auth-branding {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}

/* ============================
   SUCCESS / ERROR MESSAGES
   ============================ */

.success-message,
.error-message {
    text-align: center;
    padding: 20px 0;
    position: relative;
    z-index: 1;
}

.success-icon,
.error-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

/* ---- Animated SVG status icons ---- */

/* Shared outer ring pulse */
.icon-ring {
    opacity: 0.15;
    animation: iconRingPulse 3s ease-in-out 1.5s infinite;
}
@keyframes iconRingPulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.35; }
}

/* Background circle fade-in */
.icon-bg {
    opacity: 0;
    animation: iconFadeIn 0.5s ease-out 0.2s forwards;
}
@keyframes iconFadeIn { to { opacity: 1; } }

/* Shared draw-in keyframe */
@keyframes iconDraw { to { stroke-dashoffset: 0; } }

/* Circle stroke draw */
.icon-circle-draw {
    stroke-dasharray: 189;
    stroke-dashoffset: 189;
    animation: iconDraw 0.8s ease-out 0.2s forwards;
}

/* Success checkmark draw */
.icon-check-draw {
    stroke-dasharray: 44;
    stroke-dashoffset: 44;
    animation: iconDraw 0.5s ease-out 0.9s forwards;
}

/* Success sparkles */
.icon-sparkle {
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: iconSparkle 2.5s ease-out var(--delay, 1s) infinite;
}
@keyframes iconSparkle {
    0%   { opacity: 0; transform: scale(0); }
    15%  { opacity: 1; transform: scale(1.3); }
    30%  { opacity: 0.7; transform: scale(1); }
    100% { opacity: 0; transform: scale(0); }
}

/* Email envelope draw */
.icon-envelope-body {
    stroke-dasharray: 108;
    stroke-dashoffset: 108;
    animation: iconDraw 0.6s ease-out 0.2s forwards;
}
.icon-envelope-flap {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: iconDraw 0.4s ease-out 0.5s forwards;
}
.icon-envelope-line {
    opacity: 0;
    animation: iconFadeIn 0.3s ease-out 0.8s forwards;
}

/* Email paper plane fly-in */
.icon-plane {
    opacity: 0;
    animation: iconPlaneFly 0.8s ease-out 0.6s forwards;
}
@keyframes iconPlaneFly {
    0%   { opacity: 0; transform: translate(-10px, 10px) scale(0.3); }
    60%  { opacity: 1; }
    100% { opacity: 1; transform: translate(0, 0) scale(1); }
}

/* Email trail sparkles */
.icon-trail {
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: iconTrail 2s ease-out var(--delay, 0.5s) infinite;
}
@keyframes iconTrail {
    0%   { opacity: 0; transform: scale(0); }
    20%  { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.3); }
}

/* Error X draw */
.icon-x-draw {
    stroke-dasharray: 34;
    stroke-dashoffset: 34;
    animation: iconDraw 0.3s ease-out calc(0.6s + var(--delay, 0s)) forwards;
}

/* Error container shake */
.error-icon svg {
    animation: iconShake 0.5s ease-out 1s;
}
@keyframes iconShake {
    0%, 100% { transform: translateX(0); }
    20%  { transform: translateX(-4px); }
    40%  { transform: translateX(4px); }
    60%  { transform: translateX(-2px); }
    80%  { transform: translateX(2px); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .icon-ring, .icon-sparkle, .icon-trail { animation: none; }
    .icon-sparkle { opacity: 0.4; }
    .icon-ring { opacity: 0.2; }
    .icon-circle-draw, .icon-check-draw, .icon-x-draw,
    .icon-envelope-body, .icon-envelope-flap { animation: none; stroke-dashoffset: 0; }
    .icon-bg, .icon-envelope-line { animation: none; opacity: 1; }
    .icon-plane { animation: none; opacity: 1; transform: none; }
    .error-icon svg { animation: none; }
}

.success-message h2,
.error-message h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.success-message p,
.error-message p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.success-message .muted,
.error-message .muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.success-message .btn,
.error-message .btn {
    margin-top: 24px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.resend-form {
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 480px) {
    .auth-card {
        padding: 30px 24px;
    }

    .auth-header h1 {
        font-size: 1.5rem;
    }

    .form-options {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    body::before,
    body::after {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stars::before,
    .stars::after {
        animation: none;
    }

    body::before,
    body::after {
        animation: none;
    }

    .auth-container::before,
    .auth-container::after {
        animation: none;
    }

    .auth-header .logo {
        animation: none;
    }

    .auth-card {
        animation: none;
    }

    .btn-primary::after {
        display: none;
    }
}

/* ============================================
   LEGAL / POLICY PAGES
   ============================================ */

/* Allow scrolling on legal pages — override body overflow:hidden */
html.legal-html,
html:has(body.legal-body) {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto;
}

body.legal-body {
    overflow-y: auto;
    overflow-x: hidden;
    align-items: flex-start;
    min-height: 100vh;
    height: auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling for legal pages */
body.legal-body::-webkit-scrollbar {
    width: 8px;
}

body.legal-body::-webkit-scrollbar-track {
    background: rgba(5, 10, 21, 0.5);
}

body.legal-body::-webkit-scrollbar-thumb {
    background: rgba(56, 182, 255, 0.25);
    border-radius: 4px;
}

body.legal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 182, 255, 0.4);
}

/* Widen the container for legal content */
.legal-page {
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    flex: 1 0 auto;
}

.legal-card {
    padding: 48px 56px;
}

/* Header — smaller logo, tighter spacing */
.legal-card .auth-header {
    margin-bottom: 12px;
}

.legal-card .auth-header .logo {
    animation: none;
    filter: drop-shadow(0 0 10px rgba(56, 182, 255, 0.3));
}

.legal-card .auth-header .logo img {
    width: 40px;
    height: 40px;
}

.legal-card .auth-header h1 {
    font-size: 1.4rem;
    letter-spacing: 2px;
}

/* ---- Legal content typography ---- */

.legal-content {
    text-align: left;
    line-height: 1.75;
    padding: 0;
    position: relative;
    z-index: 1;
}

/* Page title */
.legal-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--accent);
    letter-spacing: 1px;
}

/* Last updated meta */
.legal-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

/* Section headings */
.legal-content h3 {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 32px 0 12px;
    padding: 10px 16px;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(56, 182, 255, 0.08) 0%, rgba(6, 214, 160, 0.04) 100%);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
}

/* First section heading — no extra top margin */
.legal-content h2 + .legal-meta + h3,
.legal-content > h3:first-of-type {
    margin-top: 0;
}

/* Body text */
.legal-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 10px 0;
}

/* Lists */
.legal-content ul {
    padding-left: 0;
    margin: 12px 0;
    list-style: none;
}

.legal-content li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 8px 14px 8px 32px;
    position: relative;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(56, 182, 255, 0.05);
}

.legal-content li::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 15px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(56, 182, 255, 0.4);
}

.legal-content li strong {
    color: var(--text-primary);
}

/* Links */
.legal-content a,
.legal-content a:visited {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(56, 182, 255, 0.25);
    transition: all 0.2s;
}

.legal-content a:hover {
    border-bottom-color: var(--accent);
    text-shadow: 0 0 8px rgba(56, 182, 255, 0.15);
}

/* Inline code */
.legal-content code {
    background: rgba(56, 182, 255, 0.08);
    border: 1px solid rgba(56, 182, 255, 0.12);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.82rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--accent);
}

/* ---- Legal tables ---- */

.legal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    font-size: 0.85rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(56, 182, 255, 0.1);
}

.legal-table th {
    padding: 12px 16px;
    text-align: left;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(56, 182, 255, 0.08);
    border-bottom: 1px solid rgba(56, 182, 255, 0.12);
}

.legal-table td {
    padding: 11px 16px;
    text-align: left;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(56, 182, 255, 0.06);
}

.legal-table tr:last-child td {
    border-bottom: none;
}

.legal-table tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.1);
}

.legal-table tr:hover td {
    background: rgba(56, 182, 255, 0.04);
}

/* ---- Navigation buttons ---- */

.legal-nav {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.legal-nav .btn {
    min-width: 160px;
}

/* ---- Legal page responsive ---- */

@media (max-width: 768px) {
    body.legal-body {
        padding: 16px 12px;
    }

    .legal-page {
        max-width: 100%;
    }

    .legal-card {
        padding: 28px 22px;
        border-radius: 16px;
    }

    .legal-card .auth-header h1 {
        font-size: 1.2rem;
    }

    .legal-content h2 {
        font-size: 1.25rem;
    }

    .legal-content h3 {
        font-size: 0.85rem;
        margin-top: 24px;
        padding: 8px 12px;
    }

    .legal-content p,
    .legal-content li {
        font-size: 0.85rem;
    }

    .legal-content li {
        padding: 7px 12px 7px 28px;
    }

    .legal-content li::before {
        left: 11px;
        top: 14px;
        width: 5px;
        height: 5px;
    }

    .legal-meta {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .legal-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.8rem;
    }

    .legal-table th,
    .legal-table td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    .legal-nav {
        margin-top: 24px;
        padding-top: 20px;
    }

    .legal-nav .btn {
        min-width: 0;
        flex: 1;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    body.legal-body {
        padding: 8px 6px;
    }

    .legal-card {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .legal-card .auth-header .logo img {
        width: 32px;
        height: 32px;
    }

    .legal-card .auth-header h1 {
        font-size: 1.05rem;
        letter-spacing: 1px;
    }

    .legal-content h2 {
        font-size: 1.1rem;
    }

    .legal-content h3 {
        font-size: 0.8rem;
        padding: 7px 10px;
        margin: 20px 0 10px;
    }

    .legal-content p,
    .legal-content li {
        font-size: 0.82rem;
        line-height: 1.65;
    }

    .legal-nav {
        flex-direction: column;
        gap: 8px;
    }

    .legal-nav .btn {
        width: 100%;
    }

    .legal-page .auth-branding {
        padding: 12px 0;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    body.legal-body {
        padding: 12px 20px;
    }

    .legal-card .auth-header {
        margin-bottom: 8px;
    }

    .legal-card .auth-header .logo {
        display: none;
    }
}

/* Consent checkbox styling */
.consent-group {
    margin-top: 4px;
}

.consent-group .checkbox-label span {
    font-size: 0.82rem;
    line-height: 1.5;
}

.consent-group .link {
    color: #38b6ff;
    text-decoration: underline;
    text-decoration-color: rgba(56, 182, 255, 0.3);
}

.consent-group .link:hover {
    text-decoration-color: #38b6ff;
}

/* Auth branding legal links */
.auth-legal-links {
    margin-top: 4px;
    font-size: 0.75rem;
}

.auth-legal-links a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
}

.auth-legal-links a:hover {
    color: rgba(255, 255, 255, 0.7);
}
