/*
 * Gemeinsame UI-Bausteine fuer alle drei Seiten (index.php,
 * schluchtenkampf.php, thementage.php): Kopfzeile mit Menue-Button,
 * Sprachwahl, Login/Admin-Icon, Sortier-Dropdown und Watchlist-Listen.
 * Erwartet dieselben CSS-Variablen wie in den jeweiligen Seiten definiert
 * (--bg, --card, --card-nested, --border, --text, --muted, --muted-faint,
 * --accent, --font-mono, --ok, --no).
 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px; margin-bottom: 8px;
}
.menu-btn {
  display: flex; align-items: center; gap: 8px; background: none; border: none; color: var(--text);
  font-family: inherit; font-weight: 700; font-size: 13px; padding: 4px 2px; cursor: pointer;
}
.menu-btn .bars { display: flex; flex-direction: column; gap: 3px; }
.menu-btn .bars span { width: 16px; height: 2px; background: var(--muted); border-radius: 1px; transition: background .15s ease; }
.menu-btn:hover .bars span { background: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 999px; background: var(--card-nested); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--muted-faint); cursor: pointer;
  font-size: 13px; padding: 0; transition: border-color .15s ease, color .15s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.admin-on { color: var(--accent); border-color: var(--accent); }
.nav-menu {
  display: none; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; margin-bottom: 12px;
}
.nav-menu.open { display: flex; }
.nav-menu a {
  display: flex; align-items: center; gap: 8px; padding: 9px 8px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; transition: background .15s ease;
}
.nav-menu a:hover { background: var(--card-nested); color: var(--accent); }
.lang-switch { display: flex; gap: 1px; background: var(--card-nested); border: 1px solid var(--border); border-radius: 999px; padding: 2px; flex: 0 0 auto; }
.lang-switch a {
  color: var(--muted-faint); background: none; border: none; font-family: var(--font-mono); font-weight: 700;
  padding: 4px 9px; border-radius: 999px; text-decoration: none; font-size: 10.5px; transition: color .15s ease, background .15s ease;
}
.lang-switch a:hover:not(.active) { color: var(--muted); }
.lang-switch a.active { color: var(--accent); background: var(--card); }

.dd-select {
  color: var(--text); background: var(--card-nested); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 9px; text-decoration: none; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: border-color .15s ease;
}
.dd-select:hover, .dd-select:focus { border-color: var(--accent); outline: none; }
.icon-btn-sq {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; background: var(--card-nested); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 14px; transition: border-color .15s ease, color .15s ease;
}
.icon-btn-sq:hover { border-color: var(--accent); color: var(--accent); }

.watchlist ul {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.watchlist ul li {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  font-size: 12.5px; font-weight: 600; padding: 7px 10px; color: var(--text);
  border-top: 1px solid var(--border);
}
.watchlist ul li:nth-child(-n+2) { border-top: none; }
.watchlist ul li:nth-child(odd) { border-right: 1px solid var(--border); }
/* Ungerade Anzahl: letzter Eintrag ueber die volle Breite, damit die Trennlinie durchgehend bleibt */
.watchlist ul li:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: none; }
.watchlist ul li .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.watchlist ul li .name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watchlist:last-child ul li .dot { background: var(--no); }

/* Heatmap-Tabellen (class="heat"): am Desktop normale Tabelle, auf dem Handy
   zwei Zeilen pro Spieler (Name/Rang/Bilanz oben, farbige Quadrate darunter). */
.heat .lb-short { display: none; }
.heat td.mdetail { display: none; }
@media (max-width: 640px) {
  .heat .lb-full { display: none; }
  .heat .lb-short { display: inline; }
  table.heat, table.heat tbody { display: block; }
  table.heat tr {
    display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px;
    padding: 10px 14px 11px; border-bottom: 1px solid var(--border);
  }
  table.heat tr:first-child { padding: 10px 14px 6px; background: var(--card-nested); }
  table.heat th, table.heat td { display: block; padding: 0; border: 0; }
  table.heat th:not(.wk-h) { display: none; }
  table.heat th.wk-h {
    width: 26px; text-align: center; font-family: var(--font-mono);
    font-size: 10px; letter-spacing: .04em; background: none;
  }
  table.heat td:nth-child(1) { order: 1; flex: 0 1 auto; min-width: 0; font-size: 14px; font-weight: 700; }
  table.heat td:nth-child(2) { order: 2; font-family: var(--font-mono); font-size: 11px; color: var(--muted-faint); }
  table.heat td.quote { order: 3; margin-left: auto; font-size: 12px; }
  table.heat tr[data-rank]::before { content: ""; order: 4; flex: 0 0 100%; height: 0; }
  table.heat td.wk { order: 5; width: 26px; margin-top: 8px; text-align: center; }
  table.heat td.streak { order: 6; margin-left: auto; margin-top: 8px; font-family: var(--font-mono); font-size: 12px; }
  table.heat td.mark { display: none; }
  table.heat td.mdetail {
    display: none; order: 9; flex: 0 0 100%; margin-top: 9px; padding-top: 8px;
    border-top: 1px dashed var(--border); font-family: var(--font-mono); font-size: 11px;
    line-height: 1.7; font-weight: 400; color: var(--muted);
  }
  table.heat tr.row-highlight td.mdetail { display: block; color: var(--muted); }
}
