/* ═══════════════════════════════════════════════════════
   ALION DARK THEME — zentrale CSS
   Gilt für alle Seiten via base.html
   ═══════════════════════════════════════════════════════ */

/* ─── CSS-Variablen ─────────────────────────────────── */
:root {
  --bg:         #0e0e1a;
  --bg2:        #1a1a2e;
  --card:       rgba(28, 28, 44, 0.92);
  --border:     rgba(120, 160, 255, 0.15);
  --accent:     #c0e0ff;
  --dim:        #8899bb;
  --text:       #dde3ee;
  --gruen:      #4ade80;
  --gelb:       #facc15;
  --rot:        #f87171;
  --gruen-bg:   rgba(74, 222, 128, 0.10);
  --gelb-bg:    rgba(250, 204, 21, 0.10);
  --rot-bg:     rgba(248, 113, 113, 0.12);
  --nav-bg:     rgba(14, 14, 30, 0.97);
  --nav-hover:  rgba(120, 160, 255, 0.15);
  --shadow:     0 4px 24px rgba(0, 0, 0, 0.5);
}

/* ─── Reset / Base ──────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse at top, var(--bg2) 0%, var(--bg) 100%);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Header & Navigation ───────────────────────────── */
header {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
}

nav {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Desktop-Menü */
.menu {
  list-style: none;
  display: flex;
  gap: 0.2rem;
  padding: 0;
  margin: 0;
  align-items: center;
  flex-wrap: wrap;
}

.menu li a {
  color: var(--accent);
  text-decoration: none;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  font-size: 0.88rem;
  display: block;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.menu li a:hover {
  background: var(--nav-hover);
  color: #fff;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-content {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  /* Beim Schließen: sofort unsichtbar nach 400ms Wartezeit */
  transition: opacity 0.15s ease 0s, visibility 0s linear 0.4s;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 200px;
  z-index: 999;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dropdown-content a {
  color: var(--text);
  padding: 0.6rem 1rem;
  text-decoration: none;
  display: block;
  font-size: 0.87rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s ease;
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background: var(--nav-hover);
  color: var(--accent);
}

.dropdown:hover .dropdown-content {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  /* Beim Öffnen: sofort sichtbar, kein Delay */
  transition: opacity 0.15s ease 0s, visibility 0s linear 0s;
}

/* ─── Hamburger-Menü (Mobile) ───────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 6px 8px;
  transition: background 0.2s;
}

.hamburger:hover {
  background: var(--nav-hover);
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Menü-Overlay */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0 1rem;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  color: var(--text);
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.93rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s ease;
}

.mobile-menu a:hover {
  background: var(--nav-hover);
  color: var(--accent);
}

.mobile-menu .section-label {
  color: var(--dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1rem 1.5rem 0.3rem;
  font-weight: 600;
}

/* ─── Main Content ──────────────────────────────────── */
main {
  max-width: 100%;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

/* Seitentitel */
h1.page-title,
.page-title {
  text-align: center;
  color: var(--accent);
  font-size: 1.6rem;
  margin: 1.4rem 0 0.2rem;
  font-family: 'Segoe UI', sans-serif;
  font-weight: 600;
}

.page-subtitle, .ts {
  text-align: center;
  color: var(--dim);
  font-size: 0.82rem;
  margin-bottom: 1.4rem;
}

/* ─── Dashboard Grid ─────────────────────────────────  */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem 1.2rem;
}

.dashboard.wide {
  grid-template-columns: 1fr;
}

.dashboard.two {
  grid-template-columns: 2fr 1fr;
}

/* ─── Cards ──────────────────────────────────────────  */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
}

.card-title {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.card-title span {
  margin-right: 0.4em;
}

/* ─── KPI-Reihen ─────────────────────────────────────  */
.kpi-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.kpi {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  flex: 1;
  min-width: 80px;
}

.kpi-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.kpi-lbl {
  font-size: 0.72rem;
  color: var(--dim);
  margin-top: 0.1rem;
}

/* ─── Info-Reihen ────────────────────────────────────  */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.32rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  gap: 0.8rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-key {
  color: var(--dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.info-val {
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

/* ─── Text-Boxen ─────────────────────────────────────  */
.highlight-box, .text-block {
  background: rgba(120, 160, 255, 0.07);
  border: 1px solid rgba(120, 160, 255, 0.18);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #aac4ee;
  line-height: 1.6;
}

.amber-box, .amber-block {
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.2);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: #ffe066;
  line-height: 1.6;
  font-style: italic;
}

.gruen-block {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: #86efac;
  line-height: 1.65;
}

.rot-block {
  background: var(--rot-bg);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: #fca5a5;
  line-height: 1.65;
}

/* ─── Status-Punkte & Badges ─────────────────────────  */
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  flex-shrink: 0;
}

.dot.gruen { background: var(--gruen); box-shadow: 0 0 6px var(--gruen); }
.dot.gelb  { background: var(--gelb);  box-shadow: 0 0 6px var(--gelb); }
.dot.rot   { background: var(--rot);   box-shadow: 0 0 6px var(--rot); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.15rem 0.55rem;
  border-radius: 5px;
  font-size: 0.77rem;
  font-weight: 500;
}

.badge.gruen { background: var(--gruen-bg); color: var(--gruen); }
.badge.gelb  { background: var(--gelb-bg);  color: var(--gelb); }
.badge.rot   { background: var(--rot-bg);   color: var(--rot); }

/* ─── Tags ───────────────────────────────────────────  */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tag {
  background: rgba(100, 140, 255, 0.12);
  border: 1px solid rgba(100, 140, 255, 0.2);
  border-radius: 5px;
  padding: 0.15rem 0.55rem;
  font-size: 0.77rem;
  color: #9bbee0;
}

/* ─── Farbpunkt ──────────────────────────────────────  */
.farbpunkt {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  vertical-align: middle;
  margin-left: 0.4em;
}

/* ─── Fortschrittsbalken ─────────────────────────────  */
.bar-wrap {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin: 0.4rem 0;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
}

.bar-fill.gruen { background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar-fill.gelb  { background: linear-gradient(90deg, #ca8a04, #facc15); }
.bar-fill.rot   { background: linear-gradient(90deg, #dc2626, #f87171); }

/* ─── SSL-Warnung ────────────────────────────────────  */
.ssl-warn {
  background: var(--rot-bg);
  border: 1px solid var(--rot);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  color: var(--rot);
  font-size: 0.88rem;
}

/* ─── Tabellen ───────────────────────────────────────  */
.dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.dtable th {
  color: var(--dim);
  font-weight: 500;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dtable td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
}

.dtable tr:last-child td {
  border-bottom: none;
}

.dtable .mtime  { color: var(--dim); font-size: 0.78rem; white-space: nowrap; }
.dtable .logtext { color: #aab; word-break: break-word; max-width: 480px; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Monatsübersicht Tabelle */
.month-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.month-table th {
  background: rgba(28, 28, 60, 0.9);
  color: var(--accent);
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.month-table td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.month-table tr:hover td {
  background: rgba(120, 160, 255, 0.05);
}

.month-table a {
  color: var(--gruen);
  text-decoration: none;
}

/* Detail-Tabelle */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  margin-top: 0.5rem;
}

.detail-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-table td:first-child {
  color: var(--gruen);
  font-weight: 600;
  width: 140px;
  white-space: nowrap;
}

/* ─── Buttons ────────────────────────────────────────  */
button, .btn {
  background: rgba(120, 160, 255, 0.15);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.5rem 1.1rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s ease;
  font-family: inherit;
}

button:hover, .btn:hover {
  background: rgba(120, 160, 255, 0.28);
  color: #fff;
}

/* Aspekt-Buttons */
.aspekt-btn {
  flex: 1 1 calc(25% - 1rem);
  min-width: 130px;
  background: rgba(0, 50, 140, 0.4);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.aspekt-btn:hover {
  background: rgba(0, 80, 200, 0.5);
  color: #fff;
}

.aspekt-btn.active {
  background: rgba(100, 160, 255, 0.25);
  box-shadow: 0 0 8px 2px rgba(100, 160, 255, 0.4);
  font-weight: 700;
  color: var(--accent);
}

/* ─── Formular-Elemente ──────────────────────────────  */
input[type="date"],
input[type="text"],
input[type="search"],
select {
  background: rgba(28, 28, 44, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

input[type="date"]:focus,
input[type="text"]:focus,
select:focus {
  border-color: rgba(120, 160, 255, 0.5);
}

label {
  color: var(--dim);
  font-size: 0.88rem;
}

.form-box {
  background: rgba(28, 28, 44, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0.8rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Navigation Buttons ─────────────────────────────  */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin: 1.5rem 0;
  gap: 1rem;
}

/* ─── Fehlermeldung ──────────────────────────────────  */
.fehlermeldung, .alert {
  background: var(--rot-bg);
  border: 1px solid var(--rot);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--rot);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

/* ─── Bild-Container ─────────────────────────────────  */
.img-center {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 12px;
}

.moon-img {
  width: 100%;
  max-width: 180px;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(154, 230, 180, 0.3);
  margin: 0 auto 1rem;
  display: block;
  animation: pulseMoon 3s infinite ease-in-out;
}

@keyframes pulseMoon {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(154, 230, 180, 0.3); }
  50%       { transform: scale(1.04); box-shadow: 0 0 30px rgba(154, 230, 180, 0.5); }
}

/* ─── Blockquote ─────────────────────────────────────  */
blockquote {
  border-left: 3px solid rgba(120, 160, 255, 0.5);
  margin: 0.5rem 0;
  padding: 0.4rem 0 0.4rem 1rem;
  color: var(--dim);
  font-style: italic;
  line-height: 1.65;
}

/* ─── Footer ─────────────────────────────────────────  */
footer {
  text-align: center;
  padding: 1.2rem;
  margin-top: 2rem;
  color: var(--dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  background: rgba(14, 14, 26, 0.8);
}

/* ─── Überschriften (Reset für Dark Mode) ────────────  */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Segoe UI', sans-serif;
  color: var(--accent);
  margin-top: 0;
  border-bottom: none;
}

/* ─── Debug-Box ──────────────────────────────────────  */
.debug-box {
  background: rgba(250, 204, 21, 0.05);
  border: 1px solid rgba(250, 204, 21, 0.2);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-size: 0.75rem;
  color: var(--dim);
  margin-top: 1rem;
}

/* ─── Scroll-Overflow für Tabellen ──────────────────  */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE / MOBILE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .dashboard.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Nav: Desktop-Menü verstecken, Hamburger zeigen */
  .menu {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  /* Dashboard wird einspaltiger */
  .dashboard {
    grid-template-columns: 1fr;
    padding: 0 0.75rem 1rem;
  }

  .dashboard.two,
  .dashboard.wide {
    grid-template-columns: 1fr;
  }

  /* Card span 2 zurücksetzen */
  .card[style*="grid-column: span 2"],
  [style*="grid-column: span 2"] {
    grid-column: span 1 !important;
  }

  /* KPI-Reihen: kleinere Basis */
  .kpi {
    min-width: 60px;
    padding: 0.4rem 0.6rem;
  }

  .kpi-val {
    font-size: 1rem;
  }

  /* Inhaltsabstand */
  h1.page-title, .page-title,
  h1 {
    font-size: 1.3rem;
    margin: 1rem 0 0.2rem;
  }

  /* Tabellen */
  .dtable th, .dtable td {
    padding: 0.35rem 0.4rem;
    font-size: 0.78rem;
  }

  .dtable .logtext {
    max-width: 200px;
  }

  .month-table th,
  .month-table td {
    padding: 0.35rem 0.4rem;
    font-size: 0.78rem;
  }

  /* Flexbox Layouts */
  .flexbox-wrapper {
    flex-direction: column !important;
  }

  /* Formulare */
  .form-box {
    flex-direction: column;
    align-items: flex-start;
  }

  input[type="date"],
  input[type="text"] {
    width: 100%;
  }

  /* Nav-Buttons */
  .nav-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Aspekt-Buttons */
  .aspekt-btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 120px;
    font-size: 0.78rem;
    padding: 0.55rem 0.6rem;
  }

  /* Twospaltige Grids in Cards */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Moon img */
  .moon-img {
    max-width: 140px;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 0 0.75rem;
  }

  .card {
    padding: 0.9rem 1rem;
  }

  .kpi-row {
    gap: 0.4rem;
  }

  .aspekt-btn {
    flex: 1 1 100%;
  }

  .info-row {
    font-size: 0.82rem;
  }
}
