/* ═══════════════════════════════════════════════════
   ihprohub.ai — Heat Stress Monitor
   Extracted & extended from uploaded index.html
   ═══════════════════════════════════════════════════ */

:root {
  --bg-primary:    #0a0f1a;
  --bg-card:       #0f1829;
  --bg-card2:      #141f33;
  --accent-teal:   #00c896;
  --accent-teal-dim: #00c89622;
  --orange:        #E8621A;
  --text-primary:  #e8edf5;
  --text-secondary:#7a8ba8;
  --text-muted:    #4a5a72;
  --border:        #1e2d47;
  --border-glow:   #00c89633;
}

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

body {
  font-family: 'DM Mono', monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ═══ HEADER ═════════════════════════════════════════ */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  position: sticky; top: 0; z-index: 100;
}

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

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #FDF0E8, #E8621A);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace;
  font-weight: 700; font-size: 14px; color: #fff;
}

.logo-text {
  font-family: 'Syne', 'DM Mono', monospace;
  font-size: 20px; font-weight: 600;
  color: var(--text-primary);
}
.logo-text span { color: var(--orange); }

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

.live-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--accent-teal);
  background: var(--accent-teal-dim);
  border: 1px solid var(--border-glow);
  padding: 4px 10px; border-radius: 20px;
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--accent-teal); border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.5; transform:scale(0.8); }
}

.last-update { font-size: 12px; color: var(--text-muted); }

.units-toggle { display: flex; gap: 4px; }
.units-toggle button {
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px; border-radius: 6px;
  font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.units-toggle button.active {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  color: #000; font-weight: 600;
}

.refresh-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px; border-radius: 6px;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.2s;
}
.refresh-btn:hover { border-color: var(--accent-teal); color: var(--accent-teal); }
.refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ═══ ALERT BANNER ═══════════════════════════════════ */
.alert-banner {
  background: rgba(244,67,54,0.12);
  border-bottom: 1px solid rgba(244,67,54,0.28);
  color: #fca5a5; font-size: 13px; font-weight: 500;
  padding: 8px 2rem;
  display: flex; align-items: center; gap: 8px;
}

/* ═══ PAGE BODY ══════════════════════════════════════ */
.page-body { padding: 1.5rem 2rem 3rem; }

.page-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px; font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 1.25rem;
}

/* ═══ GRID — strict 3 columns ════════════════════════ */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* ═══ STATION CARD ═══════════════════════════════════ */
.station-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.3s;
}
.station-card:hover { border-color: #2a3d5a; }

/* ── Header ── */
.station-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.station-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px; font-weight: 600;
  color: var(--text-primary);
}
.station-id { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.station-status { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; }

.status-online  { color: var(--accent-teal); }
.status-online  .status-dot { background: var(--accent-teal); box-shadow: 0 0 5px var(--accent-teal); }
.status-offline { color: #F44336; }
.status-offline .status-dot { background: #F44336; }
.status-loading { color: #FFC107; }
.status-loading .status-dot { background: #FFC107; animation: pulse 1s infinite; }

/* ── Instrument body (2×2 grid around central dial) ── */
.instrument-body {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

/* Metric boxes — 4 corners */
.metric-box {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.metric-label {
  font-size: 10px; font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.8px; text-transform: uppercase;
  display: flex; align-items: center; gap: 4px;
}
.metric-label svg { width: 12px; height: 12px; opacity: 0.6; flex-shrink: 0; }
.metric-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px; font-weight: 700;
  line-height: 1; color: var(--text-primary);
}
.metric-unit { font-size: 12px; font-weight: 400; color: var(--text-secondary); margin-left: 2px; }

/* ── HI Dial (centre column, spans 2 rows) ── */
.hi-dial-wrap {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 140px; gap: 8px;
}
.hi-dial {
  width: 140px; height: 140px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border: 4px solid transparent;
  transition: background 0.6s, border-color 0.6s, box-shadow 0.6s;
}
.hi-label-top {
  font-size: 10px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  opacity: 0.85; margin-bottom: 2px;
}
.hi-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 48px; font-weight: 700; line-height: 1;
}
.hi-unit { font-size: 14px; opacity: 0.7; margin-top: 2px; }

.hi-category {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 4px;
  text-align: center;
}

/* ── Controls Panel ── */
.controls-panel {
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
}
.controls-title {
  font-size: 10px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 7px;
  display: flex; align-items: center; gap: 5px;
}
.controls-list { display: flex; flex-direction: column; gap: 4px; }
.control-item {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 11px; color: var(--text-secondary); line-height: 1.4;
}
.control-bullet {
  width: 6px; height: 6px; border-radius: 50%;
  margin-top: 3px; flex-shrink: 0;
}

/* ═══ LEGEND ═════════════════════════════════════════ */
.legend {
  margin-top: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}
.legend-title {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 10px;
}
.legend-items { display: flex; flex-wrap: wrap; gap: 8px; }
.legend-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
}
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ═══ SKELETON ═══════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card2) 0%, #1a2840 50%, var(--bg-card2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══ ERROR ══════════════════════════════════════════ */
.error-card {
  border: 1px solid #F4433633; border-radius: 8px;
  padding: 1.5rem; text-align: center;
  color: #F44336; font-size: 13px; margin: 12px;
}

/* ═══ RESPONSIVE ═════════════════════════════════════ */
@media (max-width: 1100px) {
  .stations-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .stations-grid { grid-template-columns: 1fr; }
  header         { padding: 0 1rem; }
  .page-body     { padding: 1rem; }
  .last-update   { display: none; }
  .hi-dial, .hi-dial-wrap { width: 120px; height: 120px; }
  .hi-value      { font-size: 38px; }
}
