/* ═══════════════════════════════════════════
   theuzka Dashboard — Dark Purple Theme
   Industrial / Control Panel Aesthetic
   ═══════════════════════════════════════════ */

:root {
  /* Base */
  --bg-base: #06040c;
  --bg-card: #0c0914;
  --bg-card-hover: #110d1e;
  --bg-surface: #16102a;
  --bg-inset: #0a0710;

  /* Purple Spectrum */
  --purple-deep: #1a0e30;
  --purple-dim: #2d1f4e;
  --purple-mid: #7c3aed;
  --purple-bright: #a78bfa;
  --purple-glow: #c4b5fd;
  --purple-accent: #8b5cf6;

  /* Semantic */
  --green: #22d3a7;
  --green-dim: rgba(34, 211, 167, 0.1);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.1);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.1);
  --blue: #3b82f6;

  /* Text */
  --text-primary: #e4e0ed;
  --text-secondary: #8a7fa3;
  --text-muted: #4a4260;
  --text-bright: #f5f3ff;

  /* Border */
  --border: rgba(124, 58, 237, 0.12);
  --border-hover: rgba(124, 58, 237, 0.25);
  --border-strong: rgba(124, 58, 237, 0.4);

  /* Typography */
  --font-mono: 'DM Mono', 'Cascadia Code', monospace;
  --font-heading: 'Syne', 'Arial Black', sans-serif;

  /* Spacing */
  --radius: 10px;
  --radius-sm: 6px;
  --gap: 16px;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Body ── */
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Grain Overlay ── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Scanline Effect ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ═══════════════════════════════════════════
   Header
   ═══════════════════════════════════════════ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(26, 14, 48, 0.4) 0%, transparent 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-bracket {
  color: var(--purple-mid);
}

.logo-text {
  background: linear-gradient(135deg, var(--purple-glow), var(--purple-mid));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
}

.header-sub {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.header-clock {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════
   Status Dots
   ═══════════════════════════════════════════ */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green), 0 0 20px rgba(34, 211, 167, 0.3);
  animation: pulse-green 2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--text-muted);
}

.status-dot.degraded {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: pulse-amber 2s ease-in-out infinite;
}

.status-dot.down {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes pulse-amber {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══════════════════════════════════════════
   Dashboard Layout
   ═══════════════════════════════════════════ */
.dashboard {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 28px 40px;
}

/* ── Section ── */
.section {
  margin-bottom: 28px;
}

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

.section-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.section-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 3px 10px;
  border-radius: 4px;
}

/* ── Node Grid ── */
.node-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

/* ── Bottom Grid ── */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gap);
}

/* ═══════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.25s ease, background 0.25s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--purple-mid), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  flex: 1;
}

.card-location {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Node Cards ── */
.node-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.node-indicator.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.node-indicator.offline {
  background: var(--text-muted);
}

.node-tag {
  font-size: 10px;
  color: var(--purple-bright);
  background: var(--purple-dim);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.card-specs {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.card-role {
  font-size: 11px;
  color: var(--purple-bright);
  margin-bottom: 16px;
}

/* ── Metrics ── */
.metric-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  display: grid;
  grid-template-columns: 40px 1fr 48px;
  align-items: center;
  gap: 10px;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-bar {
  height: 6px;
  background: var(--bg-inset);
  border-radius: 3px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--purple-mid);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.metric-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.4));
  border-radius: 0 3px 3px 0;
}

/* Color thresholds */
.metric-fill.warn {
  background: var(--amber);
}
.metric-fill.warn::after {
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.4));
}

.metric-fill.crit {
  background: var(--red);
}
.metric-fill.crit::after {
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.4));
}

.metric-value {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Card Footer ── */
.card-footer {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   Weather Card
   ═══════════════════════════════════════════ */
.weather-current {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 0;
}

.weather-temp {
  font-family: var(--font-heading);
  font-size: 42px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
}

.weather-icon {
  font-size: 32px;
  line-height: 1;
}

.weather-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--text-secondary);
}

.weather-details strong {
  color: var(--text-primary);
}

.weather-forecast {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}

.forecast-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.forecast-icon {
  font-size: 20px;
}

.forecast-range {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   Transit Card
   ═══════════════════════════════════════════ */
.transit-stops {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.transit-stop {
  padding-top: 8px;
}

.stop-name {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--purple-bright);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stop-name::before {
  content: '●';
  font-size: 8px;
  color: var(--purple-mid);
}

.departures {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.departure-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg-inset);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.departure-line {
  font-weight: 500;
  color: var(--text-bright);
  background: var(--purple-dim);
  text-align: center;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

.departure-dest {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.departure-time {
  color: var(--green);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.departure-placeholder {
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 0;
}

/* ═══════════════════════════════════════════
   Uptime Card
   ═══════════════════════════════════════════ */
.uptime-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.uptime-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-inset);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.uptime-item:hover {
  background: var(--bg-surface);
}

.uptime-name {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.uptime-ping {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════ */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .node-grid {
    grid-template-columns: 1fr 1fr;
  }
  .bottom-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .dashboard {
    padding: 16px;
  }
  .node-grid {
    grid-template-columns: 1fr;
  }
  .bottom-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════ */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fade-in 0.4s ease both;
}

.node-grid .card:nth-child(1) { animation-delay: 0.05s; }
.node-grid .card:nth-child(2) { animation-delay: 0.1s; }
.node-grid .card:nth-child(3) { animation-delay: 0.15s; }
.bottom-grid .card:nth-child(1) { animation-delay: 0.2s; }
.bottom-grid .card:nth-child(2) { animation-delay: 0.25s; }
.bottom-grid .card:nth-child(3) { animation-delay: 0.3s; }
