/* ==========================================================================
   BHARATAQI - MINIMAL END-USER AIR QUALITY PORTAL STYLESHEET
   Clean, elegant, distraction-free design with hideable sidebar navigation.
   ========================================================================== */

:root {
  --bg-main: #0f172a;        /* Deep Slate Navy */
  --bg-surface: #1e293b;     /* Card Surface */
  --bg-sidebar: #090d16;     /* Darker Sidebar */
  --bg-subtle: rgba(255, 255, 255, 0.03);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);

  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-white: #ffffff;

  /* CPCB India AQI Standard Colors */
  --cpcb-good: #22c55e;
  --cpcb-satisfactory: #84cc16;
  --cpcb-moderate: #f59e0b;
  --cpcb-poor: #f97316;
  --cpcb-verypoor: #ef4444;
  --cpcb-severe: #880e4f;

  --accent-cyan: #38bdf8;
  --accent-blue: #0284c7;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-orange: #fb923c;
  --accent-green: #22c55e;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- OVERALL LAYOUT ---------------- */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ---------------- HIDEABLE SIDEBAR ---------------- */
.app-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  user-select: none;
  z-index: 50;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: margin-left, transform;
}

/* Collapsed State: Left Panel Hides Completely */
.app-layout.sidebar-collapsed .app-sidebar {
  margin-left: -260px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.brand-tricolor {
  display: flex;
  flex-direction: column;
  width: 7px;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
}

.brand-tricolor .saffron { background: #ff9933; flex: 1; }
.brand-tricolor .white   { background: #ffffff; flex: 1; }
.brand-tricolor .green   { background: #138808; flex: 1; }

.brand-name {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-white);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.brand-name span {
  color: var(--accent-cyan);
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
}

.sidebar-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-close-btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.05);
}

/* Sidebar Nav Items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 14px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-white);
}

.nav-item.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

.live-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cpcb-good);
  box-shadow: 0 0 10px var(--cpcb-good);
  animation: pulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.lsc-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-white);
  display: block;
}

.lsc-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: block;
}

/* ---------------- MAIN APP CONTENT ---------------- */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------- TOP NAVBAR (MINIMAL) ---------------- */
.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-white);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.page-title-wrap {
  display: flex;
  flex-direction: column;
}

.page-eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-white);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.standard-switch {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  padding: 3px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.std-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.std-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-white);
}

.live-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.15);
  color: var(--cpcb-good);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cpcb-good);
}

/* ---------------- SCROLLABLE APP CONTENT ---------------- */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 40px 28px;
}

.screen-view {
  display: none;
  animation: fadeIn 0.2s ease;
}

.screen-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- HERO CARD (CLEAN & MINIMAL) ---------------- */
.hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hero-left {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-wrap {
  position: relative;
  width: 220px;
  height: 220px;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 16;
}

.gauge-fill {
  fill: none;
  stroke: var(--cpcb-good);
  stroke-width: 16;
  stroke-linecap: round;
  stroke-dasharray: 596.9;
  stroke-dashoffset: 596.9;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
}

.gauge-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gauge-sub {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.gauge-num {
  font-size: 4.2rem;
  font-weight: 900;
  color: var(--text-white);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 8px 0;
}

.gauge-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 14px;
  text-transform: uppercase;
  background: rgba(34, 197, 94, 0.2);
  color: var(--cpcb-good);
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.hero-right {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 16px;
}

.health-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--cpcb-good);
  padding: 14px 18px;
  border-radius: var(--radius-xs);
  transition: all 0.3s ease;
}

.health-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 4px;
}

.health-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cigarette-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.2);
  padding: 10px 16px;
  border-radius: var(--radius-xs);
}

.cig-emoji { font-size: 1.6rem; }
.cig-label { font-size: 0.72rem; font-weight: 700; color: #fb923c; text-transform: uppercase; }
.cig-text { font-size: 0.95rem; color: var(--text-white); font-weight: 600; }
.cig-text b { color: #f87171; font-weight: 800; }

.quick-env-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.env-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
}

.env-lbl { font-size: 0.7rem; color: var(--text-dim); font-weight: 600; display: block; }
.env-val { font-size: 0.95rem; font-weight: 700; color: var(--text-white); margin-top: 2px; }

/* Scale Bar */
.scale-bar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scale-bar {
  position: relative;
  display: flex;
  height: 14px;
  border-radius: var(--radius-xs);
  overflow: visible;
}

.scale-tier {
  flex: 1;
  font-size: 0.62rem;
  font-weight: 800;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.t-good     { background: var(--cpcb-good); border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.t-sat      { background: var(--cpcb-satisfactory); }
.t-mod      { background: var(--cpcb-moderate); }
.t-poor     { background: var(--cpcb-poor); }
.t-verypoor { background: var(--cpcb-verypoor); color: #fff; }
.t-severe   { background: var(--cpcb-severe); color: #fff; border-top-right-radius: 4px; border-bottom-right-radius: 4px; }

.scale-pointer {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 22px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 10px #ffffff;
  transform: translateX(-50%);
  transition: left 0.8s ease;
}

.scale-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0 2px;
}

/* ---------------- PRECAUTIONS ROW ---------------- */
.precautions-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.prec-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
}

.prec-icon {
  font-size: 1.8rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.prec-meta { display: flex; flex-direction: column; }
.prec-name { font-size: 0.85rem; font-weight: 700; color: var(--text-white); }
.prec-val  { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ---------------- POLLUTANTS GRID ---------------- */
.section-divider {
  margin: 28px 0 16px 0;
}

.section-divider-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.pollutants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.pollutant-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.pollutant-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.card-accent-blue   { border-top: 3px solid var(--accent-cyan); }
.card-accent-amber  { border-top: 3px solid var(--accent-amber); }
.card-accent-cyan   { border-top: 3px solid var(--accent-blue); }
.card-accent-green  { border-top: 3px solid var(--accent-green); }
.card-accent-purple { border-top: 3px solid var(--accent-purple); }
.card-accent-orange { border-top: 3px solid var(--accent-orange); }

.pcard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pcard-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-white);
}

.pcard-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-blue   { background: rgba(56, 189, 248, 0.15); color: var(--accent-cyan); }
.badge-amber  { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-cyan   { background: rgba(2, 132, 199, 0.15); color: var(--accent-blue); }
.badge-green  { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.badge-orange { background: rgba(251, 146, 60, 0.15); color: var(--accent-orange); }

.pcard-val-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}

.pcard-number {
  font-size: 2.3rem;
  font-weight: 900;
  color: var(--text-white);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pcard-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
}

.pcard-progress {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.pcard-fill { height: 100%; border-radius: 3px; }
.bg-blue   { background: var(--accent-cyan); }
.bg-amber  { background: var(--accent-amber); }
.bg-cyan   { background: var(--accent-blue); }
.bg-purple { background: var(--accent-purple); }
.bg-orange { background: var(--accent-orange); }

.pcard-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

/* Weather Split Card */
.split-weather-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin: 6px 0 16px 0;
}

.split-weather-row > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sw-val { font-size: 1.8rem; font-weight: 900; color: var(--text-white); line-height: 1.1; }
.sw-unit { font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
.sw-lbl { font-size: 0.7rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; margin-top: 2px; }
.sw-sep { width: 1px; height: 38px; background: var(--border-subtle); }

/* ---------------- CHART CONTAINER CARD ---------------- */
.chart-container-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.chart-eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.chart-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-white);
  margin-top: 2px;
}

.chart-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

.chart-legend {
  display: flex;
  gap: 12px;
}

.leg-pill {
  font-size: 0.75rem;
  font-weight: 700;
}
.pill-cyan  { color: var(--accent-cyan); }
.pill-amber { color: var(--accent-amber); }

.canvas-wrap {
  width: 100%;
  height: 260px;
  position: relative;
}

.canvas-wrap-large {
  width: 100%;
  height: 380px;
  position: relative;
}

.canvas-wrap canvas,
.canvas-wrap-large canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--radius-sm);
}

.canvas-wrap-small {
  width: 100%;
  height: 220px;
  position: relative;
}

/* ---------------- SCREEN 2 & 3: MAP & ANALYTICS ---------------- */
.screen-banner {
  margin-bottom: 20px;
}

.sb-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-white);
}

.sb-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.map-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: calc(100vh - 220px);
}

.map-element {
  width: 100%;
  height: 100%;
  background: #0b1120;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ---------------- SCREEN 4: REPORTS ---------------- */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.report-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.rep-icon { font-size: 2.4rem; margin-bottom: 12px; }
.rep-title { font-size: 1.1rem; font-weight: 800; color: var(--text-white); margin-bottom: 6px; }
.rep-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 20px; flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #0f172a;
}

.btn-primary:hover {
  background: #7dd3fc;
}

.standby-notice-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.snb-icon {
  font-size: 1.8rem;
}

.snb-text h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-white);
}

.snb-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------------- FOOTER ---------------- */
.app-footer {
  margin-top: 36px;
  padding: 20px 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.app-footer p { font-size: 0.85rem; color: var(--text-white); font-weight: 600; }
.footer-sub { font-size: 0.75rem; color: var(--text-dim) !important; font-weight: 500 !important; margin-top: 3px; }

/* ---------------- RESPONSIVENESS ---------------- */
@media (max-width: 1100px) {
  .hero-card { grid-template-columns: 1fr; }
  .pollutants-grid { grid-template-columns: repeat(2, 1fr); }
  .precautions-row { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    margin-left: -260px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }
  .app-layout.sidebar-open .app-sidebar {
    margin-left: 0;
  }
  .pollutants-grid { grid-template-columns: 1fr; }
  .precautions-row { grid-template-columns: 1fr; }
  .quick-env-row { grid-template-columns: repeat(2, 1fr); }
}
