/* ═══════════════════════════════════════════════════════════════════
   SURYA BMS — Cinema Intelligence System
   Aesthetic: Industrial War Room × Film Terminal
   Fonts: Bebas Neue (display) · JetBrains Mono (data) · DM Sans (body)
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg:          #080808;
  --surface:     #101010;
  --surface-2:   #161616;
  --border:      rgba(255, 255, 255, 0.07);
  --border-hi:   rgba(255, 255, 255, 0.13);

  --amber:       #f59e0b;
  --amber-soft:  rgba(245, 158, 11, 0.14);
  --amber-glow:  rgba(245, 158, 11, 0.05);

  --crimson:     #ef4444;
  --crimson-soft:rgba(239,  68,  68, 0.13);

  --orange:      #f97316;
  --yellow:      #eab308;
  --green:       #22c55e;

  --white:       #f0f0f0;
  --muted:       #444;
  --muted-2:     #777;

  --display: 'Bebas Neue', sans-serif;
  --mono:    'JetBrains Mono', monospace;
  --body:    'DM Sans', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; color-scheme: dark; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Film grain ────────────────────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* Scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 3px,
    rgba(0, 0, 0, 0.035) 3px,
    rgba(0, 0, 0, 0.035) 4px
  );
  pointer-events: none;
  z-index: 8999;
}

/* ── Ticker ────────────────────────────────────────────────────── */
.ticker-bar {
  background: var(--amber);
  height: 30px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: flex;
  white-space: nowrap;
  animation: ticker 50s linear infinite;
}

.ticker-inner {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #000;
  padding-right: 20px;
}

.ticker-inner .sep { color: rgba(0,0,0,0.3); }

@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 52px;
  height: 62px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 8, 0.96);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 500;
}

.logo { display: flex; align-items: center; gap: 10px; }

.logo-mark {
  font-size: 18px;
  color: var(--amber);
  line-height: 1;
}

.logo-text {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: 0.05em;
  color: var(--white);
}

.logo-text em {
  font-style: normal;
  color: var(--amber);
  margin-left: 1px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted-2);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 6px var(--crimson);
  animation: pulse-dot 1.6s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--crimson); }
  50%       { opacity: 0.3; box-shadow: none; }
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 72px 52px 56px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  min-height: 340px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 80% 30%, rgba(245,158,11,0.07) 0%, transparent 65%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(239,68,68,0.04) 0%, transparent 60%);
  pointer-events: none;
}

/* Diagonal rule across hero */
.hero::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber) 30%, transparent 70%, transparent);
  opacity: 0.25;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--amber);
  margin-bottom: 18px;
}

.hero-title {
  font-family: var(--display);
  font-size: clamp(68px, 9vw, 116px);
  line-height: 0.88;
  letter-spacing: 0.015em;
  color: var(--white);
  position: relative;
}

.hero-sub {
  margin-top: 28px;
  font-size: 13.5px;
  color: var(--muted-2);
  max-width: 380px;
  line-height: 1.7;
}

/* Film strip ─ decorative */
.film-strip {
  display: flex;
  flex-direction: column;
  opacity: 0.12;
  flex-shrink: 0;
  margin-left: 48px;
  align-self: center;
}

.strip-perfs {
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.06);
}

.strip-perfs span {
  display: block;
  width: 22px;
  height: 14px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 3px;
}

.strip-frames {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.strip-frame {
  width: 118px;
  height: 82px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-top: none;
  background: rgba(255,255,255,0.02);
}

/* ── Search ────────────────────────────────────────────────────── */
.search-section {
  padding: 40px 52px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.search-inner { max-width: 1200px; margin: 0 auto; }

.panel-eyebrow {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.search-grid {
  display: grid;
  grid-template-columns: 1.6fr 1.4fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 9px; }

.field-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-hint {
  font-size: 9px;
  color: var(--muted);
  font-weight: 400;
}

.field-custom { grid-column: 1 / -1; }

.select-wrap { position: relative; }

.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--amber);
  pointer-events: none;
  font-size: 12px;
  font-family: var(--mono);
}

select,
input[type="date"],
input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-hi);
  color: var(--white);
  padding: 12px 40px 12px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

input[type="text"] { padding-right: 14px; }

select:focus,
input:focus {
  border-color: var(--amber);
  background: var(--surface-2);
  outline: none;
}

select option, select optgroup {
  background: #141414;
  color: var(--white);
  font-size: 12px;
}

.field-btn { justify-content: flex-end; }

.run-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 26px;
  background: var(--amber);
  color: #000;
  border: none;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  cursor: pointer;
  border-radius: 2px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 0 0 0 rgba(245,158,11,0);
}

.run-btn:hover {
  background: #fbbf24;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(245,158,11,0.4);
}

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

.run-icon { font-size: 15px; }

/* ── Stats bar ─────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.stat {
  flex: 1;
  min-width: 150px;
  padding: 28px 28px 26px;
  border-right: 1px solid var(--border);
  transition: background 0.2s;
  cursor: default;
}

.stat:last-child { border-right: none; }

.stat:hover { background: var(--amber-glow); }

.stat.featured {
  background: var(--amber-soft);
  border-color: rgba(245,158,11,0.25);
}

.stat-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.17em;
  color: var(--muted-2);
  margin-bottom: 12px;
}

.stat-val {
  font-family: var(--display);
  font-size: 42px;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--white);
  transition: color 0.2s;
}

.stat.occ   .stat-val { color: var(--crimson); }
.stat.gross .stat-val { color: var(--amber); }

/* ── Loading / Error / Empty states ───────────────────────────── */
.state-wrap {
  padding: 80px 52px;
  display: flex;
  justify-content: center;
}

/* Loader */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.loader-reel {
  width: 46px;
  height: 46px;
  border: 3px solid var(--border-hi);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-text {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted-2);
}

.ellipsis {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  width: 0;
  animation: grow-dots 1s steps(4, end) infinite;
}

@keyframes grow-dots {
  0%   { width: 0; }
  100% { width: 24px; }
}

/* Error */
.error-box {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 28px;
  border: 1px solid var(--crimson);
  background: var(--crimson-soft);
  border-radius: 2px;
  max-width: 600px;
  width: 100%;
}

.error-icon { font-size: 26px; color: var(--crimson); flex-shrink: 0; }

.error-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--crimson);
}

.error-body {
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted-2);
  line-height: 1.5;
}

.error-body code {
  font-family: var(--mono);
  color: var(--amber);
  background: rgba(245,158,11,0.1);
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 12px;
}

/* Empty */
.empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 460px;
  text-align: center;
}

.empty-icon { font-size: 36px; color: var(--muted); }

.empty-title {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.05em;
  color: var(--muted-2);
}

.empty-body { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── Tables ────────────────────────────────────────────────────── */
.tables-section {
  display: flex;
  flex-direction: column;
  gap: 52px;
  padding: 48px 52px 64px;
  max-width: 100%;
  overflow-x: hidden;
}

/* Each table block */
.t-block {}

.t-head { margin-bottom: 6px; display: flex; align-items: baseline; gap: 12px; }

.t-title {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.04em;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 12px;
}

.t-title::before {
  content: "";
  display: block;
  width: 4px;
  height: 30px;
  background: var(--amber);
  border-radius: 2px;
  flex-shrink: 0;
}

.t-count {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.t-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 18px;
  margin-left: 16px;
}

/* Table */
.bms-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
}

.bms-table thead th {
  background: var(--surface);
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border-hi);
  white-space: nowrap;
  font-weight: 700;
}

.bms-table thead th:first-child {
  text-align: left;
  border-left: 4px solid var(--amber);
  padding-left: 18px;
}

.bms-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.bms-table tbody tr:hover { background: var(--amber-glow); }

.bms-table tbody tr:hover td:first-child {
  border-left-color: var(--amber);
}

.bms-table tbody td {
  padding: 11px 14px;
  text-align: right;
  color: var(--muted-2);
  vertical-align: middle;
}

.bms-table tbody td:first-child {
  text-align: left;
  color: var(--white);
  font-weight: 700;
  padding-left: 18px;
  border-left: 4px solid transparent;
  transition: border-color 0.12s;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Value styles */
.v-gross { color: var(--amber) !important; font-weight: 700; }

.occ-fire { color: var(--crimson)  !important; font-weight: 700; }
.occ-hot  { color: var(--orange)   !important; font-weight: 700; }
.occ-warm { color: var(--yellow)   !important; }
.occ-low  { color: var(--muted-2); }

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.badge-ff { background: var(--crimson-soft); color: var(--crimson); }
.badge-hf { background: rgba(249,115,22,0.13); color: var(--orange); }
.badge-0  { color: var(--muted); }

/* No data */
.no-data td {
  text-align: center !important;
  padding: 36px 16px !important;
  color: var(--muted) !important;
  font-size: 11px;
  letter-spacing: 0.1em;
  border-left: none !important;
}

/* ── Footer ────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.footer-brand { color: var(--amber); font-weight: 700; letter-spacing: 0.08em; }
.footer-div   { color: var(--muted); }
.footer code  {
  font-family: var(--mono);
  color: var(--amber);
  background: rgba(245,158,11,0.1);
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .navbar    { padding: 0 24px; }
  .hero      { padding: 52px 24px 44px; min-height: auto; }
  .film-strip { display: none; }
  .search-section { padding: 32px 24px; }
  .search-grid { grid-template-columns: 1fr 1fr; }
  .field-btn { grid-column: 1 / -1; }
  .run-btn   { width: 100%; }
  .stats-bar { flex-wrap: wrap; }
  .stat      { flex: 1 1 45%; border-right: 1px solid var(--border); }
  .tables-section { padding: 32px 24px 48px; }
  .footer    { padding: 20px 24px; }
}

@media (max-width: 600px) {
  .hero-title { font-size: 60px; }
  .search-grid { grid-template-columns: 1fr; }
  .stat { flex: 1 1 100%; border-right: none; }
  .t-title { font-size: 24px; }
  .bms-table { font-size: 11px; }
  .bms-table tbody td:first-child { max-width: 120px; }
}
