/* =====================================================================
   PubliBike Mobility Analytics Portal – Stylesheet
   =====================================================================

   Aufbau in zwei Ebenen:

   1. MARKENFARBEN (--brand-*)  : die rohen CI-Werte, einmal definiert
   2. SEMANTISCHE TOKENS        : --surface, --text-primary usw.

   Komponenten benutzen AUSSCHLIESSLICH die semantischen Tokens.
   Dadurch braucht der Dunkelmodus nur einen neuen Token-Block und
   keine einzige doppelte Komponentenregel.

   TODO: Die Markenfarben unten stammen aus dem bisherigen Code
   (--pb-pink: #744d67). Bitte gegen das offizielle PubliBike-CI
   prüfen und hier – nur hier – korrigieren.
   ===================================================================== */

:root {
  /* --- 1. Markenfarben ---------------------------------------------- */
  --brand-primary:        #744d67;
  --brand-primary-hell:   #9a6d8b;
  --brand-primary-dunkel: #5a3b50;
  --brand-primary-rgb:    116, 77, 103;   /* für rgba()-Schatten */

  /* --- 2. Semantische Tokens: HELL ---------------------------------- */
  --bg:               #FAFAFB;
  --surface:          #FFFFFF;
  --surface-hover:    #FFFFFF;
  --border:           #EDEDF2;
  --border-stark:     #DCDCE4;
  --text-primary:     #2B2B38;
  --text-secondary:   #4C4C60;
  --text-muted:       #8A8A9C;
  --akzent:           var(--brand-primary);
  --akzent-kontrast:  #FFFFFF;
  --schatten:         0 4px 14px rgba(var(--brand-primary-rgb), 0.12);
  --schatten-weich:   0 1px 3px rgba(0, 0, 0, 0.05);

  --radius:      10px;
  --radius-klein: 6px;
  --inhalt-max:  980px;
}

/* --- Dunkelmodus: nur Tokens neu belegen ---------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-primary:      #b98aa8;
    --brand-primary-rgb:  185, 138, 168;

    --bg:              #16161C;
    --surface:         #1E1E26;
    --surface-hover:   #262630;
    --border:          #2E2E3A;
    --border-stark:    #3C3C4A;
    --text-primary:    #F2F2F5;
    --text-secondary:  #C9C9D4;
    --text-muted:      #8A8A9C;
    --akzent-kontrast: #16161C;
    --schatten:        0 4px 16px rgba(0, 0, 0, 0.45);
    --schatten-weich:  0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

/* Manuelle Umschaltung überschreibt die Systemeinstellung */
:root[data-theme="dark"] {
  --brand-primary:      #b98aa8;
  --brand-primary-rgb:  185, 138, 168;

  --bg:              #16161C;
  --surface:         #1E1E26;
  --surface-hover:   #262630;
  --border:          #2E2E3A;
  --border-stark:    #3C3C4A;
  --text-primary:    #F2F2F5;
  --text-secondary:  #C9C9D4;
  --text-muted:      #8A8A9C;
  --akzent-kontrast: #16161C;
  --schatten:        0 4px 16px rgba(0, 0, 0, 0.45);
  --schatten-weich:  0 1px 3px rgba(0, 0, 0, 0.3);
}

/* =====================================================================
   Grundlagen
   ===================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Sichtbarer Fokusring für Tastaturbedienung (Barrierefreiheit) */
:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
  border-radius: var(--radius-klein);
}

/* =====================================================================
   Kopfzeile
   ===================================================================== */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.topbar .logo-img {
  height: 52px;
  width: auto;
  display: block;
  border-radius: 8px;
}

.topbar .title {
  display: block;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.2;
}

.topbar .subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Sprachwahl: Globus mit Klappmenü -------------------------------
   Statt einer Leiste mit allen Kürzeln. Die Leiste wurde bei fünf
   Sprachen zu breit und wäre mit jeder weiteren gewachsen.
   Umgesetzt mit <details>: kein JavaScript zum Öffnen nötig.
   -------------------------------------------------------------------- */

.sprachwahl { position: relative; }

/* Das Standard-Dreieck von <summary> entfernen – je nach Browser
   braucht es beide Schreibweisen. */
.sprachwahl > summary { list-style: none; cursor: pointer; }
.sprachwahl > summary::-webkit-details-marker { display: none; }
.sprachwahl > summary::marker { content: ''; }

.sprachwahl[open] > summary {
  border-color: var(--akzent);
  color: var(--akzent);
}

.sprachmenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-stark);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}

.sprachmenu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-klein);
  font-size: 14px;
  text-decoration: none;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sprachmenu a:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.sprachmenu a.aktiv {
  color: var(--akzent);
  font-weight: 600;
}

/* Haken nur beim aktiven Eintrag – der Platz bleibt aber immer
   reserviert, damit die Beschriftungen nicht springen. */
.sprachmenu .haken { line-height: 0; visibility: hidden; }
.sprachmenu a.aktiv .haken { visibility: visible; }

.sprachmenu .haken svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Runde Symbolknöpfe (öffentliche Seite und Verwaltung) ---------- */

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-stark);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color .15s ease, color .15s ease;
}

.icon-btn:hover {
  border-color: var(--akzent);
  color: var(--akzent);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;      /* übernimmt die Textfarbe */
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.icon-btn .icon-sun,
.icon-btn .icon-moon { line-height: 0; }

/* --- Hell/Dunkel-Schalter: nur das passende Symbol zeigen ----------- */

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* =====================================================================
   Inhalt
   ===================================================================== */

main {
  max-width: var(--inhalt-max);
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.greeting {
  font-size: 26px;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.lead {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 15px;
}

/* --- Suchfeld --- */
.suchfeld { margin: 0 0 8px; }

.suchfeld input {
  width: 100%;
  max-width: 360px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-stark);
  border-radius: var(--radius);
}

.suchfeld input::placeholder { color: var(--text-muted); }
.suchfeld input:focus { border-color: var(--akzent); outline: none; }

.keine-treffer {
  color: var(--text-muted);
  font-size: 14px;
  margin: 24px 0;
}

/* --- Überschriften --- */
.network-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--akzent);
  margin: 40px 0 14px;
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Kantonswappen neben der Netzwerküberschrift.
   Nur hier, nicht auf jeder Kachel – siehe Kommentar in gemeinde.php. */
.netzwerk-wappen {
  width: 34px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.sub-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 20px 0 10px;
  font-weight: 700;
}

/* --- Kacheln --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--schatten-weich);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.card:hover {
  background: var(--surface-hover);
  border-color: var(--akzent);
  box-shadow: var(--schatten);
  transform: translateY(-1px);
}

.card[hidden] { display: none; }

.card .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--akzent);
  flex-shrink: 0;
}

/* Auf den Gemeinde-/Stadt-/Campus-Kacheln bewusst kein Wappen: 64 kleine
   Bilder nebeneinander überladen die Seite. Das Wappen steht einmal je
   Netzwerk oben. Partnerfirmen sind die Ausnahme, siehe .partner-logo
   unten – da sind es nur wenige Kacheln und das Markenlogo gehört dazu. */

.stadt-card {
  border-color: var(--akzent);
  font-weight: 700;
  max-width: 280px;
}

/* Punktform als leiser Typhinweis (nur sichtbar, solange kein Logo hochgeladen ist) */
.partner-card .dot { border-radius: 2px; }               /* Quadrat = Partnerfirma */

/* Logo einer Partnerfirma auf ihrer Kachel. Weisses Plättchen dahinter,
   damit Logos mit hellem/undurchsichtigem Hintergrund auch im Dunkelmodus
   sauber aussehen – unabhängig davon, ob die hochgeladene Datei
   transparent ist oder nicht. */
.partner-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  padding: 3px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.campus-card .dot {                                       /* Ring = Campus */
  background: transparent;
  border: 2px solid var(--akzent);
  width: 10px;
  height: 10px;
}

.netzwerk[hidden] { display: none; }

/* --- Schaltfläche --- */
.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--akzent);
  color: var(--akzent-kontrast);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
}

/* =====================================================================
   Fusszeile
   ===================================================================== */

.foot {
  max-width: var(--inhalt-max);
  margin: 0 auto;
  padding: 0 32px 40px;
  color: var(--text-muted);
  font-size: 12px;
}

/* =====================================================================
   Klein / Druck / Bewegungsreduktion
   ===================================================================== */

@media (max-width: 640px) {
  .topbar { padding: 12px 20px; }
  main    { padding: 32px 20px 60px; }
  .foot   { padding: 0 20px 32px; }
  .greeting { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
