/* ===================================================================
   TV AIR QUALITY DASHBOARD - LIGHT NEUMORPHIC THEME
   Accurately matches reference mockup in folder
   =================================================================== */

:root {
  /* Core Background & Card Colors */
  --bg-canvas: #f7f5ee;
  --bg-card: #ffffff;
  --border-card: #e5e0d5;
  --shadow-card: 0 16px 36px -6px rgba(130, 120, 100, 0.09), 0 6px 14px -3px rgba(130, 120, 100, 0.05);

  /* Typography Colors */
  --text-primary: #111827;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* PCD Air Quality Status Colors */
  --color-good: #34d399;
  --color-good-dark: #15803d;
  --bg-good-pill: #bbf7d0;

  --color-moderate: #fbbf24;
  --color-moderate-dark: #9a3412;
  --bg-moderate-pill: #fed7aa;

  --color-alert: #f87171;
  --color-alert-dark: #991b1b;
  --bg-alert-pill: #fca5a5;

  /* Fonts */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-th: 'Prompt', 'Inter', sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* TV Canvas Container (16:9 optimized, responsive for TV and monitors) */
.tv-canvas {
  width: 100%;
  min-height: 100vh;
  padding: 2.25rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: 1920px;
  margin: 0 auto;
}

/* ===================================================================
   TOP HEADER: CLOCK, DATE & LIVE BADGE
   =================================================================== */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0rem;
  padding-bottom: 0em;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.digital-time {
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1;
}

.calendar-date {
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Authentic • LIVE • Pill Badge */
.live-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background-color: #bbf7d0;
  border: 1.5px solid #86efac;
  border-radius: 9999px;
  padding: 0.45rem 1.15rem;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.18);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #16a34a;
}

.pulse {
  animation: pulse-dot 1.8s infinite ease-in-out;
}

@keyframes pulse-dot {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.3);
    opacity: 0.45;
  }
}

.live-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: #15803d;
  letter-spacing: 0.08em;
}

.live-pill,
.live-pill.status-connected {
  background-color: #dcfce7;
  border-color: #86efac;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.18);
}

.live-pill.status-connected .live-dot {
  background-color: #16a34a;
}

.live-pill.status-connected .live-text {
  color: #15803d;
}

.live-pill.status-connecting {
  background-color: #fef3c7;
  border-color: #fde68a;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.18);
}

.live-pill.status-connecting .live-dot {
  background-color: #d97706;
}

.live-pill.status-connecting .live-text {
  color: #92400e;
}

.live-pill.status-disconnected {
  background-color: #fee2e2;
  border-color: #fca5a5;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.18);
}

.live-pill.status-disconnected .live-dot {
  background-color: #dc2626;
}

.live-pill.status-disconnected .live-text {
  color: #991b1b;
}

/* Discreet utility buttons */
.control-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.control-actions:hover {
  opacity: 1;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-icon.active {
  background: #1e293b;
  color: #ffffff;
  border-color: #0f172a;
}


/* ===================================================================
   MAIN CARDS GRID (TSP, PM10, PM2.5)
   =================================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.25rem;
  margin: 1.5rem 0;
}

.metric-card {
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-radius: 34px;
  padding: 2.75rem 2rem 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  text-align: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 44px -8px rgba(130, 120, 100, 0.14), 0 8px 18px -4px rgba(130, 120, 100, 0.07);
}

/* Card Header */
.card-header {
  margin-bottom: 0.5rem;
}

.pollutant-title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1;
}

.pollutant-title sub,
.pollutant-title .sub-num {
  font-size: 0.58em;
  line-height: 0;
  vertical-align: -0.2em;
  font-weight: 900;
  letter-spacing: normal;
}

.pollutant-desc {
  font-size: 1.4rem;
  font-weight: 500;
  color: #475569;
  margin-top: 0.65rem;
  line-height: 1.35;
  max-width: 95%;
  margin-left: auto;
  margin-right: auto;
  min-height: 2.9em;
  display: block;
  text-align: center;
  transition: opacity 0.25s ease;
}

.pollutant-desc sub,
.pollutant-desc .sub-num {
  font-size: 0.72em;
  vertical-align: -0.18em;
  line-height: 0;
  font-weight: 600;
}

.nobr {
  white-space: nowrap;
}

body.hide-desc .pollutant-desc {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  pointer-events: none;
}


/* Numerical Value Display */
.value-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  margin: 1rem 0 1.5rem 0;
}

.val-num {
  font-size: 5.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #0f172a;
  line-height: 0.95;
}

.val-unit {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1e293b;
}

/* 3D Sphere Emoji Wrapper */
.emoji-wrapper {
  position: relative;
  width: 175px;
  height: 175px;
  margin: 0.8rem 0 2.2rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sphere-emoji {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: float-soft 4s ease-in-out infinite;
}

@keyframes float-soft {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

.emoji-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 14px 20px rgba(80, 60, 40, 0.16));
}

/* Bottom Card Limit Pill */
.card-footer-pill {
  width: 92%;
  max-width: 460px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.65rem 0.85rem 0.65rem 1.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  margin: 0 auto;
  transition: all 0.25s ease;
}

.pill-limit-text {
  font-size: 1.25rem;
  color: #1e293b;
  font-weight: 600;
  white-space: nowrap;
}

.pill-limit-text strong {
  font-weight: 800;
  font-size: 1.3rem;
  white-space: nowrap;
}

.badge-status {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.45rem 1.3rem;
  border-radius: 9999px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.status-good {
  background-color: var(--bg-good-pill);
  color: var(--color-good-dark);
}

.status-moderate {
  background-color: var(--bg-moderate-pill);
  color: var(--color-moderate-dark);
}

.status-unhealthy {
  background-color: var(--bg-alert-pill);
  color: var(--color-alert-dark);
}

/* ===================================================================
   BOTTOM LEGEND BAR
   =================================================================== */
.legend-bar {
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-radius: 20px;
  padding: 0.9rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3.5rem;
  box-shadow: var(--shadow-card);
  width: 100%;
  margin: 0 auto;
}

.legend-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 2.25rem;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.legend-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.dot-good {
  background-color: #6ee7b7;
}

.dot-moderate {
  background-color: #fcd34d;
}

.dot-alert {
  background-color: #f87171;
}

.chip-label {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1e293b;
}

/* ===================================================================
   INTERACTIVE SIMULATION MODAL
   =================================================================== */
.sim-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sim-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #ffffff;
  border-radius: 20px;
  width: 90%;
  max-width: 520px;
  padding: 1.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  border: 1px solid #e2e8f0;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.modal-head h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #64748b;
}

.preset-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.p-btn {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  padding: 0.6rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.p-btn:hover {
  background: #f1f5f9;
}

.p-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.slider-row {
  margin-bottom: 1rem;
}

.slider-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: #0f172a;
}

.switch-row {
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid #f1f5f9;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: #475569;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===================================================================
   RESPONSIVE SCALING FOR 4K TV / LARGE SCREENS & TABLETS
   =================================================================== */
@media (min-width: 2560px) {
  .tv-canvas {
    padding: 3.5rem 5rem;
  }

  .digital-time {
    font-size: 4.8rem;
  }

  .calendar-date {
    font-size: 2.8rem;
  }

  .pollutant-title {
    font-size: 3.8rem;
  }

  .pollutant-desc {
    font-size: 1.6rem;
  }

  .val-num {
    font-size: 7.2rem;
  }

  .val-unit {
    font-size: 2.2rem;
  }

  .emoji-wrapper {
    width: 230px;
    height: 230px;
  }

  .legend-title {
    font-size: 1.8rem;
  }

  .chip-label {
    font-size: 1.6rem;
  }
}

@media (max-width: 1200px) {
  .tv-canvas {
    padding: 1.5rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .digital-time {
    font-size: 2.5rem;
  }

  .calendar-date {
    font-size: 1.5rem;
  }

  .legend-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}