/* NIFTY zones page. Tokens copied from the terminal's src/index.css (light :root and .dark blocks, plus the
   bridge block for --control-track / --info) so this page reads as part of the same site. Keep them in step. */
:root {
  --background: 225 28.6% 97.3%;
  --foreground: 220.9 39.3% 11%;
  --card: 0 0% 100%;
  --muted: 217.5 30.8% 94.9%;
  --muted-foreground: 220 8.9% 46.1%;
  --border: 214 32% 91%;
  --primary: 210.1 100% 44.5%;
  --primary-foreground: 0 0% 100%;
  --bullish: 146 67% 37%;
  --bearish: 4 61% 53%;
  --surface-2: 226.7 52.9% 96.7%;
  --control-track: 217.5 30.8% 94.9%;
  --control: 0 0% 100%;
  --pill-active: var(--control);
  --pill-active-ink: var(--foreground);
  --info: 210.13216 100% 44.5098%;
  --reference: 210.1 100% 44.5%;
  --grid: 214 32% 93%;
  --shadow-card: 0 1px 2px rgb(30 37 56 / 0.04), 0 6px 20px -8px rgb(30 37 56 / 0.12);
  --topbar: linear-gradient(90deg, #cee3fd, #cee3fd 50%, #f1e4fe);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Hanken Grotesk", "Segoe UI", sans-serif;
  --font-display: Inter, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
  --chart-2: 210.13216 100% 44.5098%;
  --chart-3: 217.09924 58.22222% 55.88235%;
  --chart-4: 255 45% 55%;
  --chart-5: 215.04 68.30601% 64.11765%;
  --chart-6: 330 45% 45%;
  --chart-call: 4 61% 53%;
  --chart-put: 146 67% 37%;
  --warning: 35 84% 36%;
  color-scheme: light;
}
.dark {
  --background: 0 0% 4%;
  --foreground: 0 0% 93%;
  --card: 0 0% 7.5%;
  --muted: 0 0% 11%;
  --muted-foreground: 0 0% 62%;
  --border: 0 0% 15%;
  --primary: 0 0% 92%;
  --primary-foreground: 0 0% 8%;
  --bullish: 145 55% 55%;
  --bearish: 4 75% 68%;
  --surface-2: 0 0% 10%;
  --control-track: 0 0% 93% / 0.06;
  --control: 0 0% 16%;
  --pill-active: var(--primary);
  --pill-active-ink: var(--primary-foreground);
  --info: 217 91% 60%;
  --reference: 211 78% 68%;
  --grid: 0 0% 100% / 0.04;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 18px -6px rgb(0 0 0 / 0.4);
  --topbar: hsl(0 0% 4% / 0.9);
  --chart-2: 211 78% 68%;
  --chart-3: 40 56.5% 71.2%;
  --chart-4: 255 68% 80%;
  --chart-5: 178 55% 70%;
  --chart-6: 330 55% 74%;
  --chart-call: 4 75% 68%;
  --chart-put: 145 55% 55%;
  --warning: 40 56.5% 71.2%;
  color-scheme: dark;
}

/* Theme switch: the terminal's circular reveal (View Transitions), driven from app.js. */
::view-transition-new(root), ::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
html.vt-shrink::view-transition-old(root) { z-index: 2; }
html.vt-shrink::view-transition-new(root) { z-index: 1; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: 14px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}
button { font: inherit; color: inherit; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 12px; line-height: 16px; }
p { margin: 0; }

/* Top bar, like the terminal's shell header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  background: var(--topbar);
  border-bottom: 1px solid hsl(var(--border) / 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; }
/* Same logo and wordmark as the terminal's header (DashboardLayout BrandMark + "OrderFlow<Talks>"). */
.brand-mark { flex: none; width: 32px; height: 32px; border-radius: 999px; }
.brand-name { font-size: 16px; line-height: 1; font-weight: 600; }
.brand-accent { color: hsl(var(--primary)); }
.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: hsl(var(--card) / 0.7);
  box-shadow: 0 0 0 1px hsl(var(--border));
  cursor: pointer;
  transition: background-color .15s ease, transform .15s var(--ease);
}
.icon-button:hover { background: hsl(var(--muted)); }
.icon-button:active { transform: scale(0.94); }
.icon-button:focus-visible, .pill-track button:focus-visible { outline: none; box-shadow: 0 0 0 3px hsl(var(--primary) / 0.3); }
.icon-sun { display: none; }
.dark .icon-sun { display: block; }
.dark .icon-moon { display: none; }

/* Page */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px 20px 14px;
  min-height: 0;
}
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.context { font-size: 12px; line-height: 16px; font-weight: 500; color: hsl(var(--muted-foreground)); margin-bottom: 2px; }
/* Headline: the NIFTY 50 badge, then "Zones" in heavy ink */
.headline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 2px 0 0;
  line-height: 1;
}
/* NIFTY 50 logo on a white card in both themes (the logo is drawn for white) */
.nifty-badge {
  display: inline-flex;
  align-self: center;
  align-items: center;
  height: 40px;
  padding: 4px 8px;
  margin-right: 4px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 0 1px hsl(var(--border)), var(--shadow-card);
}
.nifty-badge img { display: block; height: 32px; width: auto; }
.hl-zones {
  font: 800 32px/1 var(--font-display);
  letter-spacing: -0.045em;
}
@media (max-width: 600px) {
  .nifty-badge { height: 34px; padding: 3px 7px; }
  .nifty-badge img { height: 28px; }
  .hl-zones { font-size: 28px; }
}
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }

/* Segmented pill, as on the terminal's Fut / Spot switch */
.pill-track {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: hsl(var(--control-track));
}
.pill-track button {
  min-width: 64px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.pill-track button:hover { color: hsl(var(--foreground)); }
.pill-track button[aria-pressed="true"] {
  background: hsl(var(--pill-active));
  color: hsl(var(--pill-active-ink));
  font-weight: 600;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.dark .pill-track button[aria-pressed="true"] { box-shadow: 0 4px 10px -3px rgb(0 0 0 / 0.3); }

.switch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 4px; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500; color: hsl(var(--muted-foreground));
}
.switch:hover, .switch[aria-checked="true"] { color: hsl(var(--foreground)); }
.switch:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 2px; border-radius: 8px; }
.switch-track {
  position: relative; width: 32px; height: 18px; border-radius: 999px;
  background: hsl(var(--border)); transition: background-color .2s var(--ease);
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform .2s var(--ease);
}
.switch[aria-checked="true"] .switch-track { background: hsl(var(--primary)); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(14px); }
.dark .switch[aria-checked="true"] .switch-thumb { background: hsl(var(--primary-foreground)); }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-thumb { transition: none; } }

.legend { display: flex; gap: 14px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 10px; border-radius: 3px; border: 1px solid currentColor; }
.swatch.demand { color: hsl(var(--bullish)); background: hsl(var(--bullish) / 0.18); }
.swatch.supply { color: hsl(var(--bearish)); background: hsl(var(--bearish) / 0.18); }

.notice {
  padding: 9px 14px;
  border-radius: 12px;
  background: hsl(var(--surface-2));
  box-shadow: inset 0 0 0 1px hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}

/* Cards */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}
.chart-card {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  padding: 12px 14px 14px;
  border-radius: 20px;
}
.chart-caption { font-size: 12px; color: hsl(var(--muted-foreground)); margin: 0 2px 8px; }
.chart-caption #instrument { color: hsl(var(--foreground)); font-weight: 600; }
.contract { font-family: var(--font-mono); font-size: 11px; margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: hsl(var(--muted)); }
.contract:empty { display: none; }
.open-ref { float: right; font-family: var(--font-mono); font-size: 12px; color: hsl(var(--reference)); }
.open-ref:empty { display: none; }
.plot { position: relative; flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: hsl(var(--card)); }
.dark .plot { background: hsl(var(--surface-2) / 0.55); }
#chart { position: absolute; inset: 0; }
#chart-tooltip { position: absolute; z-index: 2; pointer-events: none; max-width: min(300px, 100%); padding: 8px 10px; border: 1px solid hsl(var(--border)); border-radius: 10px; background: hsl(var(--card) / 0.95); box-shadow: var(--shadow-card); font-size: 11px; overflow-wrap: anywhere; }
#chart-tooltip b { display: block; }
.chart-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}
.chart-message[hidden] { display: none; }
.levels-key { margin: 10px 2px 0; font-size: 12px; line-height: 17px; color: hsl(var(--muted-foreground)); }
.levels-key b { font-weight: 600; color: hsl(var(--foreground)); }

/* Beta sign-up: a quiet two-line note with a small button at the very bottom, for people who scroll that far.
   The Google Form opens inline below it (iframe added on first click by app.js). */
.beta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 20px;
  padding: 4px 0 2px;
}
.beta-copy { max-width: 100ch; font-size: 12px; line-height: 18px; color: hsl(var(--muted-foreground)); }
.beta-line { display: block; }
.beta-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.beta-cta {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px 0 16px; border: 0; border-radius: 999px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform .15s var(--ease), filter .15s ease;
}
.beta-cta:hover { filter: brightness(1.07); }
.beta-cta:active { transform: scale(0.97); }
.beta-cta:focus-visible { outline: none; box-shadow: 0 0 0 3px hsl(var(--primary) / 0.35); }
.beta-cta svg { transition: transform .25s var(--ease); }
.beta-cta[aria-expanded="true"] svg { transform: rotate(180deg); }
.beta-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 500; text-decoration: none;
}
.beta-link:hover { color: hsl(var(--foreground)); text-decoration: underline; text-underline-offset: 3px; }
.beta-link:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 3px; border-radius: 4px; }

/* The Google Form, opened inline */
.beta-form { flex: 1 1 100%; scroll-margin-top: 68px; /* clear the sticky top bar */ }
.beta-form[hidden] { display: none; }
.beta-form-frame {
  max-width: 820px; margin: 0 auto; overflow: hidden; border-radius: 14px; background: #fff;
  box-shadow: 0 0 0 1px hsl(var(--border));
}
.beta-form iframe { display: block; width: 100%; height: 1180px; border: 0; }
.beta-form-note { margin-top: 8px; font-size: 12px; color: hsl(var(--muted-foreground)); text-align: center; }
.beta-form-note a { color: inherit; }

@media (max-width: 600px) {
  .beta { flex-direction: column; text-align: center; }
  .beta-actions { justify-content: center; }
  .beta-form iframe { height: 1320px; }
}
@media (prefers-reduced-motion: reduce) {
  .beta-cta, .beta-cta svg { transition: none; }
}

/* Social links under the chart */
.socials { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; }
.socials-label { font-size: 13px; font-weight: 600; color: hsl(var(--muted-foreground)); margin-right: 4px; }
.social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: hsl(var(--card));
  box-shadow: 0 0 0 1px hsl(var(--border)), var(--shadow-card);
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms ease, transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}
.social:hover { background: hsl(var(--muted)); }
.social:active { transform: scale(0.97); }
/* Each network in its own colours */
.social.instagram, .social.youtube, .social.telegram, .social.whatsapp { color: #fff; box-shadow: none; }
.social.instagram { background: linear-gradient(45deg, #feda75, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5); }
.social.youtube { background: #ff0000; }
.social.telegram { background: linear-gradient(180deg, #2aabee, #229ed9); }
.social.whatsapp { background: linear-gradient(180deg, #2be36f, #1ebe57); }
.social.instagram:hover, .social.youtube:hover, .social.telegram:hover, .social.whatsapp:hover { filter: brightness(1.08) saturate(1.1); transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgb(0 0 0 / 0.45); }
.social:focus-visible { outline: none; box-shadow: 0 0 0 3px hsl(var(--primary) / 0.3); }

/* Status bar, like the terminal's footer */
.statusbar {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.6);
  font: 12px/16px var(--font-mono);
  color: hsl(var(--muted-foreground));
}

/* Desktop: the chart takes the free height; on a short window the page scrolls instead of squeezing the card */
@media (min-width: 1024px) {
  /* Chart still fills most of the window; the links and beta note sit just below it. */
  .layout { min-height: max(470px, calc(100dvh - 250px)); }
}
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  .chart-card { height: 62svh; min-height: 380px; }
}
@media (max-width: 600px) {
  .page { padding: 14px 16px 12px; gap: 12px; }
  .title-row { align-items: stretch; flex-direction: column; }
  .controls { justify-content: space-between; }
  /* Zone pills on the chart already say Demand / Supply; the row keeps the walls switch and Future / Spot. */
  .controls .legend { display: none; }
  .chart-card { padding: 10px 10px 12px; }
  .statusbar { justify-content: center; padding: 8px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pill-track button, .icon-button { transition: none; }
}
