/* ═══════════════════════════════════════════════════════
   Junket.gg — Night Pressroom Design System
   Fonts: Syne (headings) · Outfit (body) · JetBrains Mono (code)
   ═══════════════════════════════════════════════════════ */

/* ── Design tokens ─────────────────────────────────────── */
:root {
    --bg-deep:      #06080E;
    --bg-base:      #0B0E18;
    --bg-card:      #111520;
    --bg-header:    #161B2B;
    --border:       #1B2338;
    --border-mid:   #22304D;
    --border-hi:    #2D3F65;
    --text-1:       #E8EDFB;
    --text-2:       #8695BE;
    --text-3:       #47567A;
    --accent:       #7B6CFF;
    --accent-lt:    #9D91FF;
    --accent-glow:  rgba(123, 108, 255, 0.18);
    --accent-glow2: rgba(123, 108, 255, 0.08);
    --success:      #3DD68C;
    --warning:      #F4BC4A;
    --danger:       #FF6B6B;
    --radius:       10px;
    --radius-sm:    6px;
    --radius-xs:    4px;
}

/* ── Base reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    background-color: var(--bg-base);
    color: var(--text-1);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.65;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.025em;
    color: var(--text-1);
}

/* ── Top accent line ────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 640px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 40%, var(--accent-lt) 60%, transparent 100%);
    z-index: 200;
    opacity: 0.7;
}

/* ── Grain noise overlay ────────────────────────────────── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: var(--bg-deep); }
::-webkit-scrollbar-thumb      { background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Transitions ────────────────────────────────────────── */
a, button, input, select, textarea {
    transition: color 0.15s ease, background 0.15s ease,
                border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

/* ══════════════════════════════════════════════════════════
   TAILWIND DARK OVERRIDES
   ══════════════════════════════════════════════════════════ */

/* ── Surface colors ─────────────────────────────────────── */
.bg-white    { background-color: var(--bg-card)   !important; }
.bg-gray-50  { background-color: var(--bg-header) !important; }
.bg-gray-100 { background-color: var(--border)    !important; }
.bg-gray-200 { background-color: var(--border-mid) !important; }

/* ── Text hierarchy ─────────────────────────────────────── */
.text-gray-900 { color: var(--text-1) !important; }
.text-gray-800 { color: #C8D1EC      !important; }
.text-gray-700 { color: var(--text-2) !important; }
.text-gray-600 { color: var(--text-2) !important; }
.text-gray-500 { color: var(--text-3) !important; }
.text-gray-400 { color: #32405C      !important; }
.text-gray-300 { color: #253248      !important; }

/* ── Borders ─────────────────────────────────────────────── */
.border-gray-100 { border-color: var(--border)     !important; }
.border-gray-200 { border-color: var(--border-mid)  !important; }
.border-gray-300 { border-color: var(--border-hi)   !important; }

/* ── Dividers ────────────────────────────────────────────── */
.divide-y > * + *          { border-color: var(--border) !important; }
.divide-gray-100 > * + *   { border-color: var(--border) !important; }

/* ── Hover surfaces ──────────────────────────────────────── */
.hover\:bg-gray-50:hover   { background-color: rgba(255,255,255,0.022) !important; }
.hover\:bg-gray-100:hover  { background-color: rgba(255,255,255,0.038) !important; }
.hover\:bg-gray-200:hover  { background-color: rgba(255,255,255,0.055) !important; }
.hover\:text-gray-700:hover { color: var(--text-2) !important; }
.hover\:text-gray-600:hover { color: var(--text-2) !important; }

/* ── Shadows ─────────────────────────────────────────────── */
.shadow    { box-shadow: 0 0 0 1px var(--border), 0 2px 10px rgba(0,0,0,0.45)  !important; }
.shadow-sm { box-shadow: 0 0 0 1px var(--border), 0 1px 4px rgba(0,0,0,0.35)   !important; }
.shadow-lg { box-shadow: 0 0 0 1px var(--border), 0 8px 28px rgba(0,0,0,0.60)  !important; }

/* ── Border radius ───────────────────────────────────────── */
.rounded-lg   { border-radius: var(--radius)    !important; }
.rounded      { border-radius: var(--radius-sm) !important; }
.rounded-md   { border-radius: var(--radius-sm) !important; }
.rounded-sm   { border-radius: var(--radius-xs) !important; }
.rounded-full { border-radius: 9999px           !important; }

/* ── Status badges ───────────────────────────────────────── */
.bg-green-50   { background-color: rgba(61,214,140,0.10) !important; }
.bg-green-100  { background-color: rgba(61,214,140,0.13) !important; }
.bg-green-200  { background-color: rgba(61,214,140,0.20) !important; }
.text-green-600 { color: var(--success) !important; }
.text-green-700 { color: var(--success) !important; }
.border-green-200 { border-color: rgba(61,214,140,0.25) !important; }

.bg-red-50     { background-color: rgba(255,107,107,0.10) !important; }
.bg-red-100    { background-color: rgba(255,107,107,0.13) !important; }
.text-red-500  { color: var(--danger) !important; }
.text-red-700  { color: var(--danger) !important; }
.border-red-200 { border-color: rgba(255,107,107,0.25) !important; }

.bg-yellow-50   { background-color: rgba(244,188,74,0.10) !important; }
.bg-yellow-100  { background-color: rgba(244,188,74,0.13) !important; }
.text-yellow-600 { color: var(--warning) !important; }
.text-yellow-700 { color: var(--warning) !important; }
.bg-amber-100   { background-color: rgba(244,188,74,0.13) !important; }
.text-amber-700 { color: var(--warning) !important; }

.bg-blue-50    { background-color: rgba(123,108,255,0.10) !important; }
.bg-blue-100   { background-color: rgba(123,108,255,0.13) !important; }
.text-blue-600 { color: var(--accent-lt) !important; }
.text-blue-700 { color: var(--accent-lt) !important; }

/* ── Semantic custom classes ─────────────────────────────── */
.text-primary { color: var(--accent-lt) !important; }
.text-danger  { color: var(--danger)    !important; }
.text-success { color: var(--success)   !important; }

/* ── Primary button ──────────────────────────────────────── */
.bg-primary {
    background: linear-gradient(135deg, #7B6CFF 0%, #5A4ED6 100%) !important;
    box-shadow: 0 2px 14px rgba(123,108,255,0.32) !important;
}
.bg-primary:hover,
.hover\:bg-blue-700:hover,
.hover\:opacity-90:hover {
    background: linear-gradient(135deg, #9D91FF 0%, #7B6CFF 100%) !important;
    box-shadow: 0 4px 22px rgba(123,108,255,0.44) !important;
    opacity: 1 !important;
}
.bg-success   { background-color: var(--success)  !important; }
.bg-danger    { background-color: var(--danger)   !important; }
.bg-yellow-400 { background-color: var(--warning) !important; }
.bg-gray-300   { background-color: var(--text-3)  !important; }

/* Approve / deny action buttons in tables */
.bg-green-100.text-green-700 {
    background-color: rgba(61,214,140,0.13) !important;
    color: var(--success) !important;
}
.bg-green-100.text-green-700:hover,
.hover\:bg-green-200:hover {
    background-color: rgba(61,214,140,0.22) !important;
}
.bg-red-100.text-red-700 {
    background-color: rgba(255,107,107,0.13) !important;
    color: var(--danger) !important;
}
.bg-red-100.text-red-700:hover,
.hover\:bg-red-200:hover {
    background-color: rgba(255,107,107,0.22) !important;
}

/* ── Gradient covers (placeholder backgrounds) ───────────── */
.from-gray-100 { --tw-gradient-from: var(--bg-header) !important; }
.to-gray-200   { --tw-gradient-to: var(--border-mid)  !important; }

/* ── Form inputs ─────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
    background-color: var(--bg-deep) !important;
    border-color: var(--border-mid)  !important;
    color: var(--text-1)             !important;
}
input::placeholder,
textarea::placeholder {
    color: var(--text-3) !important;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent)     !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    outline: none;
}
select option {
    background-color: var(--bg-card);
    color: var(--text-1);
}
/* Focus ring utility overrides */
.focus\:ring-primary:focus,
.focus\:ring-2:focus {
    --tw-ring-color: var(--accent-glow) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

/* ── Table headers ───────────────────────────────────────── */
thead th,
thead.bg-gray-50 th {
    font-size: 0.64rem    !important;
    letter-spacing: 0.09em !important;
    font-weight: 600       !important;
    color: var(--text-3)   !important;
}

/* ── Progress bar tracks ─────────────────────────────────── */
.bg-gray-100.rounded-full { background-color: var(--border-mid) !important; }

/* ══════════════════════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════════════════════ */
nav {
    background: rgba(11, 14, 24, 0.82) !important;
    backdrop-filter: blur(18px)         !important;
    -webkit-backdrop-filter: blur(18px) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: none !important;
    position: sticky !important;
    top: 0           !important;
    z-index: 100     !important;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}
.nav-logo-mark {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-3);
    letter-spacing: -0.05em;
    line-height: 1;
    padding-bottom: 1px;
}
.nav-logo-text {
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.03em;
}
.nav-logo-text em {
    font-style: normal;
    color: var(--accent-lt);
}

.nav-link {
    color: var(--text-3);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.nav-link:hover {
    color: var(--text-1);
    background: rgba(255,255,255,0.05);
}

.nav-user-email {
    font-size: 0.72rem;
    color: var(--text-3);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-logout {
    font-size: 0.73rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    color: var(--text-3);
    background: transparent;
    border: 1px solid var(--border-mid);
    padding: 0.22rem 0.7rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    letter-spacing: 0.01em;
}
.nav-logout:hover {
    color: var(--text-1);
    border-color: var(--text-3);
    background: rgba(255,255,255,0.04);
}
.nav-divider {
    width: 1px;
    height: 1.2rem;
    background: var(--border-mid);
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   AUTH PAGE
   ══════════════════════════════════════════════════════════ */
.auth-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2.5rem;
    padding-bottom: 3rem;
}
.auth-box {
    width: 100%;
    max-width: 440px;
}
.auth-brand {
    text-align: center;
    margin-bottom: 2.5rem;
}
.auth-brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.6rem;
}
.auth-brand-mark {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: var(--text-3);
    letter-spacing: -0.05em;
}
.auth-brand-name {
    font-family: 'Syne', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.035em;
}
.auth-brand-name em {
    font-style: normal;
    color: var(--accent-lt);
}
.auth-brand-tagline {
    color: var(--text-3);
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-mid);
}
.auth-divider span {
    font-size: 0.72rem;
    color: var(--text-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn-google:hover {
    border-color: var(--border-hi);
    color: var(--text-1);
    background: rgba(255,255,255,0.03);
}

/* ══════════════════════════════════════════════════════════
   PAGE ENTER ANIMATION
   ══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
main > * {
    animation: fadeUp 0.28s ease both;
}

/* ══════════════════════════════════════════════════════════
   LAYOUT ADJUSTMENTS
   ══════════════════════════════════════════════════════════ */
/* Slightly wider max-width */
.max-w-4xl { max-width: 72rem !important; }

/* Back links */
a.text-gray-400 { color: var(--text-3) !important; }
a.text-gray-400:hover { color: var(--text-2) !important; }

/* Monospace for key codes (if ever applied directly) */
.font-mono,
code {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 0.85em;
    letter-spacing: -0.02em;
}

/* Inline code / key reveal */
.key-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--accent-lt);
    letter-spacing: 0.05em;
    background: var(--accent-glow2);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(123,108,255,0.2);
}

/* ══════════════════════════════════════════════════════════
   DARK CONSOLE — Publisher Dashboard
   Scoped to .dark-console so it never leaks to other pages.
   ══════════════════════════════════════════════════════════ */
.dark-console {
    --c-bg:      #0A0B0F;
    --c-bg2:     #0F1117;
    --c-panel:   #13151D;
    --c-panel2:  #191C25;
    --c-line:    #242835;
    --c-line2:   #2E3342;
    --c-ink:     #E9EAEE;
    --c-ink2:    #B6B9C4;
    --c-muted:   #71768A;
    --c-muted2:  #4C5265;
    --c-accent:  #C3FF4A;
    --c-accent2: #8AE3FF;
    --c-warn:    #FF8A3B;
    --c-crit:    #FF4C6A;
    --c-good:    #5CE39B;
    background-color: var(--c-bg);
    color: var(--c-ink);
    font-family: 'Sora', ui-sans-serif, system-ui, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.45;
    min-height: 100vh;
}

/* Neutralize global body chrome (top accent line, grain) on console pages */
body.dark-console::before,
body.dark-console::after {
    content: none !important;
}

/* Ambient radial glows painted behind everything */
.dark-console .ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(1200px 600px at 80% -10%, rgba(195,255,74,0.06), transparent 60%),
        radial-gradient(900px 500px at -10% 100%, rgba(138,227,255,0.05), transparent 60%);
}

.dark-console .mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Track fill gradients for inventory progress bars */
.dark-console .fill-crit {
    background: linear-gradient(90deg, #FF4C6A, #FF8A3B);
    box-shadow: 0 0 12px rgba(255,76,106,0.4);
}
.dark-console .fill-warn {
    background: linear-gradient(90deg, #FF8A3B, #FFD36B);
}
.dark-console .fill-ok {
    background: linear-gradient(90deg, #C3FF4A, #8AE3FF);
}

/* ROI hero compound background */
.dark-console .roi-bg {
    background:
        radial-gradient(500px 200px at 100% 0%, rgba(138,227,255,0.12), transparent 55%),
        linear-gradient(180deg, #121722 0%, #0E1018 100%);
}

/* Hero KPI gradient (Primary) */
.dark-console .kpi-hero-bg {
    background: linear-gradient(180deg, #1F2A10 0%, #141810 80%);
}

/* Inventory row icon gradients */
.dark-console .inv-icon-default {
    background: linear-gradient(135deg, #2A2F3E, #151821);
}
.dark-console .inv-icon-crit {
    background: linear-gradient(135deg, #3E1A24, #1A0E12);
}

/* Topbar blur */
.dark-console .topbar {
    background: rgba(10,11,15,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Critical banner gradient */
.dark-console .banner-crit {
    background: linear-gradient(90deg, rgba(255,76,106,0.14), rgba(255,138,59,0.08));
    border: 1px solid rgba(255,76,106,0.35);
}

/* Active nav lime rail */
.dark-console .nav-link-active {
    position: relative;
    background: var(--c-panel2);
    color: var(--c-ink);
}
.dark-console .nav-link-active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--c-accent);
}

/* Live pulse dot */
.dark-console .live-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--c-good);
    box-shadow: 0 0 10px var(--c-good);
    animation: console-pulse 2s infinite;
    vertical-align: middle;
}
@keyframes console-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
    .dark-console .live-dot { animation: none; }
}

/* Brand glyph clip */
.dark-console .brand-glyph {
    clip-path: polygon(0 0, 100% 0, 100% 75%, 75% 100%, 0 100%);
}

/* Primary button glow */
.dark-console .btn-primary-glow {
    box-shadow: 0 0 24px rgba(195,255,74,0.25);
}
.dark-console .btn-primary-glow:hover {
    box-shadow: 0 0 28px rgba(195,255,74,0.4);
}

/* Scrollbar: darker on console */
.dark-console ::-webkit-scrollbar-track { background: var(--c-bg); }
.dark-console ::-webkit-scrollbar-thumb { background: var(--c-line2); }

/* ── Form inputs (override the global !important rules above) ───────────── */
.dark-console input[type="text"],
.dark-console input[type="email"],
.dark-console input[type="password"],
.dark-console input[type="number"],
.dark-console input[type="url"],
.dark-console select,
.dark-console textarea {
    background-color: var(--c-bg2) !important;
    border-color: var(--c-line2)   !important;
    color: var(--c-ink)            !important;
}
.dark-console input::placeholder,
.dark-console textarea::placeholder {
    color: var(--c-muted2) !important;
}
.dark-console input:focus,
.dark-console select:focus,
.dark-console textarea:focus {
    border-color: var(--c-accent2) !important;
    box-shadow: none               !important;
    outline: none                  !important;
}

/* Browser autofill — kill Chrome's canary yellow */
.dark-console input:-webkit-autofill,
.dark-console input:-webkit-autofill:hover,
.dark-console input:-webkit-autofill:focus,
.dark-console textarea:-webkit-autofill,
.dark-console select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--c-bg2) inset !important;
    -webkit-text-fill-color: var(--c-ink) !important;
    caret-color: var(--c-ink);
    border-color: var(--c-line2) !important;
}

/* Native select chevron replacement */
.dark-console select.console-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23B6B9C4' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.dark-console select.console-select option {
    background: var(--c-panel);
    color: var(--c-ink);
}

/* Checkbox + radio — use accent-color for native theming */
.dark-console input[type="checkbox"].console-check,
.dark-console input[type="radio"].console-check {
    accent-color: var(--c-accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* HTMX request indicator */
.dark-console .htmx-indicator { opacity: 0; transition: opacity 200ms; }
.dark-console .htmx-request .htmx-indicator,
.dark-console .htmx-request.htmx-indicator { opacity: 1; }

/* Disabled input styling (e.g. team-member email) */
.dark-console input:disabled,
.dark-console select:disabled,
.dark-console textarea:disabled {
    background-color: var(--c-panel2) !important;
    border-color: var(--c-line)       !important;
    color: var(--c-muted2)            !important;
    cursor: not-allowed;
}
