/* ═══════════════════════════════════════════════════════════════
   Pétanque Liga CMS – Standard-Theme
   Basiert auf Bootstrap 5 (via CDN).
   Passe diese Datei an oder erstelle ein neues Theme.
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS-Variablen ─────────────────────────────────────────────
   Überschreibe diese in deinem eigenen Theme oder weiter unten. */
:root {
  --green:                        #1b3a10;
  --lgn:                          #2d5a1a;
  --gold:                         #c8a217;
  --text:                         #212529;
  --bg:                           #f8f9fa;
  --border-light:                 #d8e4cd;
  --rank-first-bg:                #fffbf0;
  --accent:                       #1b3a10;
  --pos:                          #2e7d32;
  --neg:                          #c62828;
  --neutral:                      #888;
}

/* ── Darkmode (folgt Systemeinstellung, überschreibbar per Umschalter) ──
   data-bs-theme wird per JS in header.php gesetzt: gespeicherte Wahl
   (localStorage) oder, falls keine Wahl getroffen wurde, prefers-color-scheme. */
[data-bs-theme="dark"] .team-avatar {
  filter: brightness(1.3) saturate(0.85);
  color: #1b2e10;
}

[data-bs-theme="dark"] {
  --text:                         #e6e6e6;
  --bg:                           #15191c;
  --border-light:                 #2c352c;
  --rank-first-bg:                rgba(200, 162, 23, .12);
  --accent:                       #8fd66f;
  --pos:                          #5cc46a;
  --neg:                          #f06a6a;
  --neutral:                      #999;
}

/* ── Navbar ────────────────────────────────────────────────────*/
.navbar {
  --bs-navbar-toggler-padding-x:  .25rem;
  background: var(--green) !important;
}
.navbar-brand {
  font-weight: 700;
  letter-spacing: .05em;
  color: #c8e6b0 !important;
}
.navbar-nav .nav-link {
  color: #a8d090 !important;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: #fff !important;
}
.navbar-toggler-icon {
  filter: invert(1);
}

/* ── Ligatabelle ───────────────────────────────────────────────*/
.table-liga thead {
  background: var(--green);
  color: #f5f0e8;
}
.table-liga tbody tr:first-child td {
  background: var(--rank-first-bg);
}
.rank-first {
  background: var(--rank-first-bg);
}

/* Farb-Hilfsklassen für Tabellenzellen (überschreiben Bootstrap table-hover) */
.col-pos     { color: var(--pos)     !important; }
.col-neg     { color: var(--neg)     !important; }
.col-neutral { color: var(--neutral) !important; }
.col-accent  { color: var(--accent)  !important; }

/* ── Tabellenrechner-Button ────────────────────────────────────*/
.calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: var(--green);
  color: #c8e6b0;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  padding: .6rem .9rem;
  margin-block-start: .5rem;
}
.calc-btn:hover {
  background: var(--lgn);
  color: #fff;
}
.calc-btn-sm {
  padding: .12rem .5rem;
  font-size: .8rem;
}

/* ── Aktuelles ─────────────────────────────────────────────────*/
.text-muted + h6 {
  margin-block-start: .5rem;
}
figcaption {
  font-size: .85rem;
  margin-block-start: .25rem;
  margin-inline-start: .25rem;
}

/* ── Footer ────────────────────────────────────────────────────*/
footer {
  background: var(--green);
  color: #a8d090;
  font-size: .85rem;
  margin-top: 3rem;
  padding: .75rem 0;
}
footer a {
  color: #c8e6b0;
}

footer > .container > p {
  margin-bottom: .5rem;
}

footer > .container > p:last-of-type {
  margin-bottom: 0;
}

/* ── Allgemein ─────────────────────────────────────────────────*/
body {
  background: var(--bg);
  color: var(--text);
}
/* Ersatz für Bootstraps .text-dark, das im Darkmode fix dunkel bleibt */
.text-theme {
  color: var(--text) !important;
}

/* ── Begegnungs-Info-Modal ─────────────────────────────────────*/
#miOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .45);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.mi-card {
  background: var(--bg);
  color: var(--text);
  border-radius: .5rem;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .5);
  overflow: hidden;
}
.mi-header {
  background: var(--green);
  color: #c8e6b0;
  padding: .6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#miTitle {
  font-size: .9rem;
  font-weight: 600;
}
.mi-close {
  background: none;
  border: none;
  color: #c8e6b0;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 0 .5rem;
}
#miBody {
  padding: 1rem;
  font-size: .9rem;
}
.dd-pseudo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  max-width: 100%;
  overflow: hidden;
  cursor: pointer;
  font-weight: 600;
}
.dd-pseudo svg {
  flex-shrink: 0;
}
.dd-pseudo:hover {
  color: var(--accent);
}
.dd-pseudo select {
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  font-size: 16px; /* verhindert iOS-Zoom beim Öffnen */
}

/* ── Spieltag-Navigationsleiste (Pfeile + Pseudo-Dropdown) ────────*/
.md-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: .5rem;
  margin-bottom: 1rem;
}
.md-nav-center {
  flex-grow: 1;
  min-width: 0;
  justify-content: center;
  color: var(--text);
  padding: .5rem 0;
}
.md-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  color: var(--accent);
  text-decoration: none;
  border-radius: .5rem;
}
.md-nav-arrow:hover {
  background: var(--bg);
}
.md-nav-arrow--disabled {
  color: var(--accent);
  opacity: .25;
  cursor: not-allowed;
}

/* ── Darkmode-Umschalter ───────────────────────────────────────*/
.theme-toggle-btn {
  background: none;
  border: none;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

/* ── Bilder & Picture-Element ──────────────────────────────────*/
picture {
  display: block;
  max-width: 100%;
}
picture img,
.post-content img {
  max-width: 100%;
  height: auto;
}
/* ── Typografie-Utilities ──────────────────────────────────────*/
.fs-xs   { font-size: .72rem; }
.fs-sm   { font-size: .75rem !important; }
.fs-md   { font-size: .78rem; }
.fs-tbl  { font-size: .85rem; } /* Tabellen, Listen */
.fs-item { font-size: .88rem; } /* Listenpositionen */
.fs-std  { font-size: .9rem;  } /* Standard-Tabellengröße */
.ls-score { letter-spacing: .05em; }

/* ── Farb-Utilities ────────────────────────────────────────────*/
.text-accent  { color: var(--accent) !important; }
.text-lgn     { color: #c8e6b0; }
.th-win       { color: #90ee90; } /* Tabellenkopf S */
.th-loss      { color: #ffaaaa; } /* Tabellenkopf N */
.border-event { border-color: var(--lgn, #2e7d32) !important; }

/* ── Flex-Truncate (Teamname in Zeile mit ellipsis) ────────────*/
.flex-truncate {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flex-truncate-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Tabellen-Spaltenbreiten ───────────────────────────────────*/
.col-rank  { width: 36px; }
.col-delta { width: 34px; }

/* ── Rang-Delta (Pfeile in Ligatabelle) ────────────────────────*/
.rank-delta       { white-space: nowrap; font-size: .78rem; }
.rank-delta svg   { vertical-align: -1px; }

/* ── Score-Zelle (Begegnung Heim–Gast) ─────────────────────────*/
.score-cell {
  min-width: 3.5rem;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Icon-Buttons in Spieltagliste (absolut positioniert) ──────*/
.match-report-btn,
.match-info-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--accent);
  line-height: 1;
}
.match-report-btn { right: 1.95rem; }
.match-info-btn   { right: .4rem; }

/* ── Spieltag-Listeneintrag ────────────────────────────────────*/
.match-list-item {
  font-size: .88rem;
  position: relative;
  padding-right: 3.4rem;
}

/* ── Karten-Kopfzeile mit Akzentfarbe ─────────────────────────*/
.card-header-accent { color: var(--accent); }

/* ── Vorschau-Banner ───────────────────────────────────────────*/
.preview-banner { font-size: .85rem; }

/* ── Subnavigation / Saison-Unterzeile im Header ──────────────*/
.subnav-bar {
  background: var(--lgn);
  color: #c8e6b0;
  font-size: .8rem;
  letter-spacing: .1em;
  text-align: center;
  padding: .25rem 0;
}

/* ── Logo im Header ────────────────────────────────────────────*/
.navbar-logo {
  height: 24px;
  margin-right: .5rem;
  vertical-align: middle;
}
@media (min-width: 768px) {
  .navbar-logo { height: 32px; }
}

/* ── Nächste Termine Widget ────────────────────────────────────*/
.next-match-first       { border-left: 3px solid var(--accent) !important; }
.next-match-single        { background: #c8e6b0 !important; color: var(--green); }
.next-match-single .text-muted { color: #2d5a1a !important; }
.next-match-single .next-match-date--first { color: #2d5a1a; font-weight: 400; font-size: calc(var(--bs-body-font-size) * .8); }
.next-match-single .next-match-loc { color: #2d5a1a; }
.next-match-date        {}
.next-match-date--first { color: var(--accent); font-weight: 700; }
.next-match-meta        { font-size: calc(var(--bs-body-font-size) * .75); }
.next-match-center      { min-width: 4rem; line-height: 1.3; font-size: calc(var(--bs-body-font-size) * .85); }
.next-match-loc         {}
.next-match-teams       { font-size: .85rem; }
.next-match-teams--first{ font-size: .95rem; }
.next-match-vs          { font-size: .72rem; }

/* ── Weiterlesen-Link im News-Widget ──────────────────────────*/
.link-accent { color: var(--accent); text-decoration: none; }

/* ── Eingabefelder Tabellenrechner ────────────────────────────*/
.calc-score-input { width: 2.6rem; padding: .2rem; }

/* ── SVG inline ────────────────────────────────────────────────*/
.svg-inline     { vertical-align: -.1em; }
.svg-inline-mid { vertical-align: -0.22em; fill: currentColor; }

/* ── Teamlogos ─────────────────────────────────────────────────*/
.team-logo-xs {
  height: 1rem;
  width: auto;
  object-fit: contain;
  vertical-align: text-bottom;
}
.team-logo-sm {
  height: 1.25rem;
  width: auto;
  object-fit: contain;
  vertical-align: bottom;
}
.team-logo-lg {
  height: 3rem;
  width: auto;
  object-fit: contain;
}

/* ── Initialen-Avatare ─────────────────────────────────────────*/
.team-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  flex-shrink: 0;
}
.team-avatar-xs {
  width: 1.1rem;
  height: 1.1rem;
  font-size: .5rem;
}
.team-avatar-sm {
  width: 1.4rem;
  height: 1.4rem;
  font-size: .6rem;
  vertical-align: top;
}
.team-avatar-lg {
  width: 3rem;
  height: 3rem;
  font-size: 1.1rem;
}
/* ── Tabellenrechner Vs-Zelle ──────────────────────────────────*/
.calc-vs {
  min-width: 1.5rem;
  text-align: center;
}

/* ── Video-Player ──────────────────────────────────────────────*/
.video-wrap {
  margin: 1rem 0;
}
.video-wrap video {
  width: 100%;
  height: auto;
  border-radius: .375rem;
  background: #000;
  display: block;
}