/*
 * dashboard.css
 * Single source of truth for all styles across the Louisiana Gaming Revenue site.
 * All HTML pages should link to this file. Do not add inline styles to HTML or
 * Python-generated footer strings -- add classes here instead.
 *
 * Sections:
 *   0. Global Base
 *   1. Site Footer
 *   2. Shared Header
 *   3. 404 Error Page
 *   4. Privacy Policy
 *   5. Dashboard
 *   6. Responsive / Mobile  (must be last -- overrides all base styles above)
 */


/* =============================================================================
   0. GLOBAL BASE
   Used by: all pages
   ============================================================================= */

:root {
  --bg: #f0f2f5;
  --card: #fff;
  --hdr: #1a2744;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --pos: #009E73;
  --neg: #D55E00;
  --gap: 16px;
  --r: 10px;
}

@font-face {
  font-family: 'WindowsCommandPrompt';
  src: url('fonts/windows_command_prompt.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.5;
}

a { color: #0072B2; text-decoration: none; }
a:hover { text-decoration: underline; }


/* =============================================================================
   1. SITE FOOTER
   Used by: index.html, privacy-policy.html, 404.html
   Generated by: refresh_dashboard.py  (stamp_all_footers)
   ============================================================================= */

.site-footer {
  font-size: 16px;
  color: #555;
  padding: 0 0 8px;
  margin-top: 12px;
  line-height: 1.8;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
}

.footer-nav {
  border-top: 1px solid #BBB;
  padding-top: 8px;
}

.footer-nav a {
  color: #0072B2;
  text-decoration: none;
}

.footer-nav a:visited {
  color: #0072B2;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.footer-nav a + a::before {
  content: "\00a0|\00a0";
  color: #BBB;
}

.footer-copyright {
  font-size: 14px;
  color: #777;
  margin-top: 2px;
  font-family: 'WindowsCommandPrompt', monospace;
}

/* Dashboard footer only -- data attribution row */
.footer-attribution {
  font-size: 11px;
  color: #777;
  margin-top: 6px;
}

.footer-attribution a {
  color: #0072B2;
  text-decoration: none;
}

.footer-attribution a:visited {
  color: #0072B2;
}

.footer-attribution a:hover {
  text-decoration: underline;
}



/* =============================================================================
   2. SHARED HEADER
   Used by: index.html, 404.html
   ============================================================================= */

.hdr {
  background: #1a2744;
  color: #fff;
  padding: 18px var(--gap);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  width: calc(100% - 2 * var(--gap));
  max-width: calc(1440px - 2 * var(--gap));
  margin: 0 auto;
}
.hdr h1    { font-size: 18px; font-weight: 700; }
.hdr-logo  { font-size: 22px; line-height: 1; }
.hdr-title { font-size: 18px; font-weight: 700; }
.hdr-sub   { font-size: 12px; opacity: .65; margin-top: 2px; }
.hdr a { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.hdr a:hover .hdr-title { text-decoration: underline; }

/* Header filter controls (index.html) */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fg      { display: flex; flex-direction: column; gap: 2px; }
.fg label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; opacity: .7; }
.fg select {
  background: rgba(255,255,255,.12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,.6)'/%3E%3C/svg%3E") no-repeat right 8px center;
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: 5px;
  padding: 5px 28px 5px 8px;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
}
.fg select option { background: #1a2744; color: #fff; }




/* =============================================================================
   2b. SITE NAVIGATION BAR
   Used by: index.html, about.html, faq.html, contact.html, privacy-policy.html, 404.html
   ============================================================================= */

.site-nav {
  width: calc(100% - 2 * var(--gap));
  max-width: calc(1440px - 2 * var(--gap));
  margin: 0 auto;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  padding: 0 24px;
  display: flex;
  gap: 4px;
  position: sticky;
  /* Default: nav is the first element on the page (about/faq/contact/privacy-policy) --
     stick flush to the top of the viewport. */
  top: 0;
  z-index: 99;
}

/* On index.html and 404.html, the nav directly follows the sticky .hdr bar --
   offset it by .hdr's height so it docks beneath the header instead of overlapping it.
   83px = .hdr desktop height: 36px vertical padding + ~47px content (h1 + hdr-sub) */
.hdr + .site-nav {
  top: 83px;
}

/* On about/faq/contact/privacy-policy, the nav lives inside .container, below the
   .header card -- match the card's width (spans .container's content box, same as
   .header) and let it sit in normal flow rather than pinned to the viewport. */
.container .site-nav {
  width: 100%;
  max-width: none;
  margin: 0 0 20px;
  position: static;
  box-shadow: none;
}

/* Remove .header's bottom margin when the nav directly follows it, so the nav
   sits flush against the banner instead of leaving a gap (the nav supplies its
   own 20px margin-bottom to space itself from .card). Also square off the
   bottom corners -- a rounded edge butting against the flush nav looks odd. */
.header:has(+ .site-nav) {
  margin-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.site-nav a:visited {
  color: var(--text);
}

.site-nav a:hover {
  color: #0072B2;
  text-decoration: none;
  border-bottom-color: #0072B2;
}

.site-nav a.active {
  color: #0072B2;
  border-bottom-color: #0072B2;
}


/* =============================================================================
   3. 404 ERROR PAGE
   Used by: 404.html
   ============================================================================= */

body.page-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* This page is a centered, viewport-filling hero -- it never scrolls in normal
   use, so the sticky .hdr/.site-nav behavior (designed for index.html, where
   content scrolls beneath a pinned bar) serves no purpose here and only
   introduces fragile offset math (see .hdr + .site-nav above). Drop both back
   into normal document flow so the nav docks directly under the header with
   no top-offset value to calculate or maintain. */
body.page-404 .hdr,
body.page-404 .site-nav {
  position: static;
}

/* No longer a floating sticky bar on this page -- a shadow now just smudges
   the seam where it sits flush against .hdr above it (same reasoning as the
   nested-nav treatment on the .container pages). */
body.page-404 .site-nav {
  box-shadow: none;
}

.error-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 20px;
}
.error-dice {
  font-size: 5rem;
  line-height: 1;
  animation: wobble 2.4s ease-in-out infinite;
}
@keyframes wobble {
  0%,100% { transform: rotate(0deg); }
  20%      { transform: rotate(-12deg); }
  40%      { transform: rotate(10deg); }
  60%      { transform: rotate(-8deg); }
  80%      { transform: rotate(6deg); }
}
.error-code {
  font-size: 5.5rem;
  font-weight: 800;
  color: #1a2744;
  line-height: 1;
  letter-spacing: -2px;
}
.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a2e;
}
.error-msg {
  font-size: 1rem;
  color: #6b7280;
  max-width: 440px;
  line-height: 1.7;
}
.error-msg strong {
  color: #1a1a2e;
}
.btn-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 28px;
  background: #1a2744;
  color: #fff;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  margin-top: 4px;
}
.btn-home:hover {
  background: #253563;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
  transform: translateY(-1px);
}
.btn-home:active { transform: translateY(0); }


/* =============================================================================
   4. CONTENT PAGES (About, FAQ, Contact, Privacy Policy)
   Used by: about.html, faq.html, contact.html, privacy-policy.html
   ============================================================================= */

body.privacy-policy,
body.about-page,
body.faq-page,
body.contact-page { line-height: 1.6; }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  background: #1a2744;
  color: white;
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 20px;
}
.header .meta {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}
.header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}
.header .back-link {
  display: inline-block;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 4px 10px;
  transition: background 0.15s;
}
.header .back-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.card {
  background: white;
  border-radius: 10px;
  padding: 32px 36px;
  margin-bottom: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

body.privacy-policy h2,
body.about-page h2,
body.faq-page h2,
body.contact-page h2 {
  font-size: 15px;
  font-weight: 700;
  color: #1a2744;
  margin-top: 28px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #f0f2f5;
}
body.privacy-policy h2:first-child,
body.about-page h2:first-child,
body.faq-page h2:first-child,
body.contact-page h2:first-child { margin-top: 0; }

body.privacy-policy p,
body.about-page p,
body.faq-page p,
body.contact-page p {
  font-size: 14px;
  color: #333;
  margin-bottom: 12px;
}
body.privacy-policy p:last-child,
body.about-page p:last-child,
body.faq-page p:last-child,
body.contact-page p:last-child { margin-bottom: 0; }

body.privacy-policy ul,
body.about-page ul,
body.faq-page ul,
body.contact-page ul {
  font-size: 14px;
  color: #333;
  margin: 8px 0 12px 20px;
}
body.privacy-policy ul li,
body.about-page ul li,
body.faq-page ul li,
body.contact-page ul li { margin-bottom: 6px; }

.effective-date {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 24px;
}


/* =============================================================================
   5. DASHBOARD
   Used by: index.html only
   ============================================================================= */

/* Layout */
.wrap { max-width: 1440px; margin: 0 auto; padding: var(--gap) var(--gap) 0; }
.sec  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 20px 0 10px; }

/* KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi     { background: var(--card); border-radius: var(--r); padding: 18px 20px; box-shadow: 0 1px 4px rgba(0,0,0,.07); border-left: 4px solid #ccc; }
.kpi.tot { border-color: #1a2744; }
.kpi-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.kpi-val { font-size: 26px; font-weight: 800; line-height: 1.1; }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* AI narrative */
.ai-narrative { font-size: 14px; line-height: 1.75; color: var(--text); }
.ai-narrative p { margin-top: 0; margin-bottom: 1.1em; }
.ai-narrative p:last-child { margin-bottom: 0; }
.ai-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0077BB;
  background: #EBF4FB;
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 8px;
  width: fit-content;
}
/* Inline variant for use within body text (about.html, faq.html) */
.ai-label-inline {
  display: inline;
  font-size: 11px;
}
.ai-toggle-btn {
  display: none;
  margin: 10px auto 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.ai-toggle-btn:hover { background: var(--bg); }

/* Badges */
.badge { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 11px; font-weight: 600; margin-right: 4px; }
.pos   { background: #d1fae5; color: #065f46; }
.neg   { background: #fee2e2; color: #991b1b; }

/* Chart grid */
.cgrid { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.g2    { grid-template-columns: 1fr 1fr; }
.g1    { grid-template-columns: 1fr; }
.cc    { background: var(--card); border-radius: var(--r); padding: 20px 22px; box-shadow: 0 1px 4px rgba(0,0,0,.07); min-width: 0; overflow: hidden; }
.cc h3 { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.cc p  { font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.cw    { position: relative; width: 100%; }
.h200  { height: 200px; }
.h220  { height: 220px; }
.h180  { height: 180px; }

/* Donut chart: taller on desktop so the legend fits comfortably below the chart */
.cc:has(#donutChart) .cw { height: 300px; }

/* Insight / summary cards */
.scard    { background: var(--card); border-radius: var(--r); padding: 22px 26px; box-shadow: 0 1px 4px rgba(0,0,0,.07); margin-bottom: var(--gap); }
.scard h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.sgrid    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ins      { padding: 12px 14px; border-radius: 7px; background: #f9fafb; border-left: 3px solid #0072B2; }
.ins.i1   { border-color: #E69F00; }
.ins.i2   { border-color: #009E73; }
.ins.i3   { border-color: #D55E00; }
.ins.i4   { border-color: #56B4E9; }
.ins.i5   { border-color: #CC79A7; }
.ins strong { display: block; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.ins p      { font-size: 12px; color: #374151; line-height: 1.5; }

/* Data table wrapper */
.tw    { background: var(--card); border-radius: var(--r); box-shadow: 0 1px 4px rgba(0,0,0,.07); overflow-x: auto; margin-bottom: var(--gap); }
.th    { padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.th h3 { font-size: 13px; font-weight: 600; }
.tbl   { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.tbl thead th:hover        { color: var(--text); }
.tbl tbody td              { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover        { background: #f9fafb; }

/* Keep the market column (dot + name) on one line so the dot never orphans above the text */
.tbl td:nth-child(2)       { white-space: nowrap; }

/* Color dot (legend and table) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* Casino legend */
.casino-legend      { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.casino-legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text); cursor: pointer; white-space: nowrap; user-select: none; }
.casino-legend-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.casino-legend-item.dim { opacity: .35; }

/* KPI percentage variant — font-size override; color stays inline (runtime value) */
.kpi-val.pct { font-size: 22px; }

/* Table sort hint */
.sort-hint { font-size: 11px; color: var(--muted); }

/* Utility */
.nowrap { white-space: nowrap; }

/* No-JavaScript warning */
.noscript-warning {
  padding: 20px;
  text-align: center;
  background: #fff3cd;
  color: #856404;
  border-radius: 6px;
  margin-bottom: 16px;
}


/* =============================================================================
   6. RESPONSIVE / MOBILE
   Must remain the last section -- media query overrides win via cascade order.

   Breakpoints:
     1024px -- landscape phones (e.g. Pixel 7 at 914px)
      900px -- tablet / wide phone (landscape)
      600px -- phone (portrait, most common)
      480px -- small phone
   ============================================================================= */


/* ---- Tables: min-width forces horizontal scroll on small viewports ---- */
.tbl {
  min-width: 480px;
}

/* ---- Sticky first column: casino name stays visible while table scrolls ---- */
.tbl thead th:first-child,
.tbl tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card, #fff);
}
.tbl tbody tr:hover td:first-child { background: #f9fafb; }


/* =====================================================================
   1024px -- Landscape phones (e.g. Pixel 7 at 914px)
   3 columns gives each KPI card ~280px -- enough for any label
   ===================================================================== */
@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  /* Keep casino legend compact so the donut card alongside it isn't stretched */
  .casino-legend { max-height: 88px; overflow-y: auto; }
  /* AI analysis: show toggle and collapse on all narrow screens incl. landscape */
  .ai-toggle-btn { display: block; }
  .ai-narrative.ai-collapsed {
    max-height: 110px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  }
}


/* =====================================================================
   900px -- Tablet / landscape phone
   ===================================================================== */
@media (max-width: 900px) {
  .g2    { grid-template-columns: 1fr; }
  .sgrid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}


/* =====================================================================
   600px -- Phone portrait
   ===================================================================== */
@media (max-width: 600px) {

  /* -- index.html: sticky header -- */
  .hdr {
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    gap: 6px;
  }
  .hdr h1  { font-size: 14px; }
  .hdr-sub { font-size: 10px; }

  /* -- site nav: full width, not sticky on mobile -- scrolls away to save screen space -- */
  .site-nav {
    position: static;
    top: auto;
    width: 100%;
    margin: 0;
    padding: 0 12px;
    gap: 0;
    box-shadow: none;
  }
  .site-nav a { padding: 6px 10px; font-size: 11px; }

  /* Hide the "MARKET / CASINO / METRIC" labels above each select --
     the placeholder text inside the select is self-explanatory,
     and removing labels shrinks the header significantly */
  .fg label { display: none; }

  /* Force all 3 filters into a single row */
  .filters {
    width: 100%;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .fg { flex: 1; min-width: 0; }

  /* 16px prevents iOS Safari from auto-zooming on select focus */
  .fg select {
    width: 100%;
    font-size: 16px;
    min-height: 36px;
    padding: 6px 24px 6px 6px;
    background-position: right 6px center;
  }

  /* -- index.html: main content area -- */
  .wrap { padding: 12px 12px 0; }

  /* chart cards */
  .cc         { padding: 14px 14px; }
  .cc h3      { font-size: 12px; }

  /* taller charts look better when full-width on a phone */
  .h180 { height: 210px; }
  .h200 { height: 230px; }
  .h220 { height: 250px; }

  /* KPI cards */
  .kpi     { padding: 12px 14px; }
  .kpi-val { font-size: 22px; }

  /* insight / summary cards */
  .scard { padding: 16px 16px; }
  .ins   { padding: 10px 12px; }

  /* AI narrative + label */
  .ai-narrative { font-size: 15px !important; }
  .ai-label { font-size: 12px; }

  /* table header bar */
  .th { padding: 10px 14px; flex-wrap: wrap; gap: 6px; }

  /* table cells */
  .tbl             { font-size: 12px; }
  .tbl thead th,
  .tbl tbody td    { padding: 7px 10px; }

  /* -- table sort header touch targets (44px minimum) -- */
  .tbl thead th { padding-top: 11px; padding-bottom: 11px; }

  /* -- footer: more breathing room, flex layout replaces pipes -- */
  footer { padding-bottom: 24px; }
  .footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; font-size: 14px; }
  .footer-nav a + a::before { content: none; }

  /* -- index.html: casino legend scrollable on mobile -- */
  .casino-legend { max-height: 88px; overflow-y: auto; }

  /* -- about.html, faq.html, contact.html, privacy-policy.html -- */
  .container  { padding: 12px; }
  .header     { padding: 14px 18px; }
  .header h1  { font-size: 22px; }
  .header .meta { font-size: 12px; }
  .header .back-link { font-size: 14px; }
  .card       { padding: 18px 18px; }

  body.about-page p:not(.effective-date),
  body.about-page ul,
  body.privacy-policy p:not(.effective-date),
  body.privacy-policy ul,
  body.faq-page p,
  body.faq-page ul,
  body.contact-page p,
  body.contact-page ul { font-size: 16px; }

  body.about-page h2,
  body.privacy-policy h2,
  body.faq-page h2,
  body.contact-page h2 { font-size: 18px; }

  .effective-date { font-size: 11px; }
}


/* =====================================================================
   480px -- Small phone (iPhone SE, older Androids)
   ===================================================================== */
@media (max-width: 480px) {

  /* index.html: KPI single-column */
  .kpi-row { grid-template-columns: 1fr; }

  /* slightly smaller KPI value to keep it on one line */
  .kpi-val { font-size: 20px; }

  /* section label */
  .sec { font-size: 10px; margin: 14px 0 8px; }

  /* insight block text */
  .ins p,
  .ins strong { font-size: 11px; }

  /* header sub-line: tighten further */
  .hdr-sub { font-size: 9px; }

  /* table cells: tightest comfortable padding */
  .tbl thead th,
  .tbl tbody td { padding: 6px 8px; }
}
