@charset "UTF-8";

:root {
  /* City Color Palette (override per deployment) */
  --color-blue: #0f2864;
  --color-cyan: #0ab4ff;
  --color-yellow: #ffcc01;
  --color-orange: #f49100;
  --color-red: #e61937;
  --color-pink: #e5006d;
  --color-burgundy: #800032;
  --color-violet: #94559c;
  --color-gray: #aec0ca;
  --color-teal: #00847e;
  --color-turquoise: #17af8d;
  --color-green: #76b729;

  /* Theme: Dark Mode (Default) */
  --bg: #07090e;
  --bg-elevated: rgba(13, 20, 36, 0.65);
  --panel: rgba(18, 26, 47, 0.65);
  --panel-strong: #17223b;
  --text: #e2e8f0;
  --muted: #8b9ca8;
  --border: rgba(10, 180, 255, 0.15);
  --border-focus: rgba(10, 180, 255, 0.4);
  
  --accent: var(--color-cyan);
  --accent-glow: rgba(10, 180, 255, 0.35);
  
  --shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
  
  /* Status Colors */
  --good: var(--color-gruen);
  --degraded: var(--color-orange);
  --silent: var(--color-rot);
  --pending: #c99500;
  --unknown: var(--color-grau);
  --archived: #8a9ba8;
  
  /* Heatmap */
  --heat-0: rgba(230, 25, 55, 0.2); /* Red for no data */
  --heat-1: rgba(10, 180, 255, 0.25);
  --heat-2: rgba(10, 180, 255, 0.50);
  --heat-3: rgba(10, 180, 255, 0.75);
  --heat-4: var(--color-cyan);
  --heat-border: rgba(255, 255, 255, 0.05);

  --radius: 16px;
  --font-ui: "Outfit", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Abstracted Effects */
  --bg-gradient: 
    radial-gradient(circle at 15% 0%, rgba(10, 180, 255, 0.08), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(15, 40, 100, 0.15), transparent 40%);
  --grid-color: rgba(10, 180, 255, 0.03);

  /* Component defaults (Dark Mode) */
  --datastream-bg: rgba(0, 0, 0, 0.2);
  --stat-bg: var(--bg-elevated);
  --project-body-bg: var(--bg-elevated);
  --thing-body-bg: rgba(0, 0, 0, 0.3);
}

/* Light mode overrides if needed, but we focus on deep dark mode */
body[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #f8fafc; /* Cleaner slate 50 */
  --panel: #ffffff;
  --panel-strong: #ffffff; /* Pure white for nested panels */
  --text: #0f2864;
  --muted: #64748b;
  --border: rgba(15, 40, 100, 0.08); /* Softer borders */
  --shadow: 0 12px 32px rgba(15, 40, 100, 0.06); /* Softer shadow */
  --heat-0: rgba(230, 25, 55, 0.12);
  --heat-3: rgba(10, 180, 255, 0.75);
  --heat-4: var(--color-cyan);

  /* Component specific light mode cleanups */
  --datastream-bg: #ffffff;
  --stat-bg: #f1f5f9;
  --project-body-bg: #fcfdfe;
  --thing-body-bg: rgba(15, 40, 100, 0.03);

  /* Light Theme Specific Effects */
  --bg-gradient: 
    radial-gradient(circle at 15% 0%, rgba(10, 180, 255, 0.05), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(10, 180, 255, 0.03), transparent 40%);
  --grid-color: rgba(10, 180, 255, 0.02);
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Technical grid background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 80%);
  z-index: -1;
}

.shell {
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

/* HERO SECTION */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  background: linear-gradient(135deg, var(--panel), var(--bg-elevated));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  margin-bottom: 32px;
}

.hero::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; width: 300px;
  background: radial-gradient(circle at right, var(--accent-glow), transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.hero__row {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 800;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-ui);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 65ch;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 16px;
  font-size: 1.05rem;
}

.highlight-muted {
  color: var(--muted);
  text-decoration: underline decoration-thickness 1px;
  text-underline-offset: 4px;
}

/* BUTTONS & ACTIONS */
.actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  font-family: var(--font-ui);
}

.button {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.button--primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.button--primary:hover {
  background: color-mix(in srgb, var(--accent) 80%, white);
}

/* METRICS */
.months-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    margin-top: 8px;
    width: 100%;
}

.month-block {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 4px;
}

.hero-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.hero-metric {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hero-metric i {
  color: var(--accent);
  font-size: 1.1rem;
}

.hero-metric__value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.hero-metric__label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: border-color 0.3s ease;
}

/* PROJECTS & ENTITIES */
.section {
  margin-top: 40px;
}

.section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section__title h2 {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.entity-belt {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 0;
  margin-top: 2px;
}

.entity-metric {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s;
}

.entity-metric i {
  color: var(--accent);
  font-size: 0.8rem;
}

.entity-metric--highlight {
  border-color: var(--color-cyan);
  background: rgba(10, 180, 255, 0.08);
  color: var(--text);
}

.entity-metric--highlight i {
  color: var(--color-cyan);
}

.entity-metric:hover {
  border-color: var(--accent);
  background: var(--panel-strong);
  transform: translateY(-1px);
}

.badge-sta {
  background: var(--panel-strong);
  color: var(--color-cyan);
  border: 1px solid rgba(10, 180, 255, 0.3);
  font-family: var(--font-mono);
}

.badge--date {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.badge--healthy { background: rgba(118, 183, 41, 0.15); color: var(--color-gruen); border: 1px solid rgba(118, 183, 41, 0.3); }
.badge--degraded { background: rgba(244, 145, 0, 0.15); color: var(--color-orange); border: 1px solid rgba(244, 145, 0, 0.3); }
.badge--silent { background: rgba(230, 25, 55, 0.1); color: var(--color-rot); border: 1px solid rgba(230, 25, 55, 0.2); }
.badge--unknown { background: rgba(174, 192, 202, 0.15); color: var(--color-grau); border: 1px solid rgba(174, 192, 202, 0.3); }
.badge--pending { background: rgba(244, 180, 0, 0.15); color: #b8860b; border: 1px solid rgba(244, 180, 0, 0.3); }
.badge--archived { background: rgba(138, 155, 168, 0.15); color: #8a9ba8; border: 1px solid rgba(138, 155, 168, 0.3); }

/* Warning for missing data */
.warning-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--muted);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  animation: pulse-border 2s infinite alternate;
}
@keyframes pulse-border {
  from { border-color: rgba(255, 255, 255, 0.1); }
  to { border-color: rgba(255, 255, 255, 0.3); }
}

/* DETAILS COMBINED STYLES */
details > summary {
  list-style: none;
  cursor: pointer;
}
details > summary::-webkit-details-marker {
  display: none;
}

.datastream[open] .fa-chevron-right {
  transform: rotate(90deg);
}

/* PROJECT */
.project {
  margin-top: 48px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 100%;
}

.project > summary {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(135deg, var(--panel-strong), var(--bg-elevated));
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.project > summary:hover {
  background: linear-gradient(135deg, var(--panel-strong), var(--panel));
  border-bottom-color: var(--accent);
}

.entity-header-row {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.entity-header-row--thing {
  flex-wrap: nowrap;
}

.project-header-top.entity-header-row--project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.entity-title-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.project-title-inline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  min-width: 0;
  flex-wrap: wrap;
}

.project-title-inline .badge {
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}

.project-title-inline .badge-sta {
  margin-right: 7px;
}

.entity-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.entity-status-row--inline {
  margin-left: 0;
}

.entity-belt-slot {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.stat--date {
  background: rgba(255, 255, 255, 0.05);
}

.project-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.project-header-top.entity-header-row--project > .project-title-group {
  grid-column: 1;
}

.project-header-top.entity-header-row--project > .entity-status-row {
  grid-column: 2;
  justify-self: center;
}

.project-header-top.entity-header-row--project > .entity-belt-slot {
  grid-column: 3;
}

.project-header-top .project-title-group h3 {
  margin-bottom: 0;
  line-height: 1;
}

.project-header-top .entity-belt {
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.project-entities-summary {
  display: flex;
  align-items: flex-start;
}

.project-title-group h3 {
  font-size: 1.4rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-body {
  padding: 24px 24px 32px 32px; /* Indented left for hierarchy */
  background: var(--project-body-bg);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* THING (Sensor) */
.thing {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.thing > summary {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid transparent;
}
.thing[open] > summary {
  border-bottom-color: var(--border);
}

.thing-title {
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.thing__body {
  padding: 16px 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-left: 1px solid var(--border);
  margin-left: 20px;
}

/* DATASTREAM */
.datastream {
  background: var(--datastream-bg);
  border: 1px solid var(--border);
  border-left: 5px solid var(--color-cyan);
  border-radius: 8px;
  padding: 24px;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.datastream:hover {
  transform: translateX(4px);
  box-shadow: -8px 0 20px rgba(10, 180, 255, 0.15);
}

.datastream__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.datastream__title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-cyan);
  letter-spacing: -0.01em;
}

.summary-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.datastream__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.datastream__stats--mini {
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.datastream__stats--mini .stat {
  padding: 4px 8px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.05);
}

.datastream__stats--mini .stat__label {
  font-size: 0.55rem;
  margin-bottom: 2px;
  opacity: 0.7;
}

.datastream__stats--mini .stat__value {
  font-size: 0.85rem;
}

.stat {
  padding: 12px;
  background: var(--stat-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.stat--alert {
  border-bottom: 2px solid var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.stat__label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  display: block;
}

.stat__value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: block;
}

/* HEATMAP TIMELINE */
.heatmap-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.heatmap-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.heatmap-timeline-blocks {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  min-width: 0;
}

/* Custom Scrollbar for Heatmap */
.heatmap-timeline-blocks::-webkit-scrollbar {
  height: 8px;
}
.heatmap-timeline-blocks::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}
.heatmap-timeline-blocks::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}
.heatmap-timeline-blocks::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 80%, white);
}

.month-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  min-width: 0;
}

.month-label-static {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  min-height: 40px;
  height: auto !important;
}

.heatmap__cell {
  border-radius: 2px;
  background: var(--heat-0);
  border: 1px solid var(--heat-border);
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0.85;
  overflow: hidden;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -0.03em;
}

.heatmap__cell:hover {
  transform: scale(1.3);
  z-index: 10;
  border-color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Levels */
.heatmap__cell[data-level="1"] { background: var(--heat-1); }
.heatmap__cell[data-level="2"] { background: var(--heat-2); }
.heatmap__cell[data-level="3"] { background: var(--heat-3); }
.heatmap__cell[data-level="4"] { background: var(--heat-4); border-color: rgba(10, 180, 255, 0.2); }

.heatmap__cell[data-gap="true"] {
  background: var(--heat-0);
  border: 1px solid rgba(230, 25, 55, 0.4);
  opacity: 1;
}

.heatmap__cell--empty {
  background: rgba(174, 192, 202, 0.08);
  border: 1px solid var(--heat-border);
  color: transparent;
}

/* THEME SWITCH */
.theme-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.theme-switch button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.theme-switch button[data-active="true"] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* DOTS */
.status-line {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  margin-top: 16px;
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

.dot--healthy { color: var(--good); background: var(--good); }
.dot--degraded { color: var(--degraded); background: var(--degraded); }
.dot--silent { color: var(--silent); background: var(--silent); }
.dot--pending { color: var(--pending); background: var(--pending); }
.dot--unknown { color: var(--unknown); background: var(--unknown); }
.dot--archived { color: var(--archived); background: var(--archived); }

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}



.metadata-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.metadata-item {
  display: flex;
  gap: 4px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 2px 4px;
}

.metadata-key {
  color: var(--muted);
  font-weight: 600;
}

.metadata-value {
  color: var(--text);
}

@media (max-width: 720px) {
  .metric {
    padding: 16px;
  }
}
