/* Glas-Design der KlH-Website (Schaltflächen via Glisse, Aktivierung per assets/js/glass-buttons.js).
   Hier stellst du Farben, Größen und Animationen ein. Ohne das Skript behalten die Seiten ihr altes Aussehen. */

/* ============================================================
   1) Kein Aufblitzen: Buttons und Navigation bleiben unsichtbar,
      bis das Skript sie umgestellt hat (html.glass-ready), und blenden dann weich ein.
      Fällt das Skript aus, erscheint nach 1,8 s trotzdem alles im alten Stil.
   ============================================================ */
html:not(.glass-ready) :is(.btn, .btn-table, .btn-remove-row, .filter-btn, .copy-btn, .navbar-nav, .navbar-seg) {
  opacity: 0;
  animation: klh-failsafe 0.2s ease 1.8s forwards;
}
@keyframes klh-failsafe { to { opacity: 1; } }
.navbar-nav, .navbar-seg { transition: opacity 0.35s ease; }

/* ============================================================
   2) Farben und Form der Glas-Buttons
      Standard = dunkles Rauchglas mit hellem Rand (weißer Text)
   ============================================================ */
:root {
  --lg-blur: 10px;
  --klh-glass-dark: rgb(16 40 78 / 0.84);
  --klh-glass-dark-hover: rgb(30 66 118 / 0.92);
  --klh-glass-light: rgb(255 255 255 / 0.62);
  --klh-glass-light-hover: rgb(234 242 251 / 0.95);
  --klh-green: rgb(14 88 52 / 0.86);
  --klh-red: rgb(150 36 30 / 0.86);
  --klh-blurple: rgb(88 101 242 / 0.92);
}

.lg-glass.lg-button {
  height: 38px;
  padding: 0 20px;
  border-radius: 19px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.005em;
  --lg-glass: var(--klh-glass-dark);
  --lg-glass-active: var(--klh-glass-dark-hover);
  --lg-foreground: #ffffff;
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.34),
    inset 0 0 0 0.5px rgb(255 255 255 / 0.3),
    0 8px 18px -10px rgb(8 24 52 / 0.6),
    0 1px 2px rgb(8 24 52 / 0.25);
  transition: background-color 0.28s ease, box-shadow 0.28s ease, color 0.2s ease, opacity 0.35s ease;
}
.lg-glass.lg-button[data-rim] {
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    0 8px 18px -10px rgb(8 24 52 / 0.6),
    0 1px 2px rgb(8 24 52 / 0.25);
}
.lg-glass.lg-button:disabled { opacity: 0.45; cursor: not-allowed; }

/* Helle Glas-Variante für ruhigere Buttons (Abbrechen, Tabelle, Filter, Kopieren) */
.lg-glass.btn-outline,
.lg-glass.btn-table,
.lg-glass.filter-btn,
.lg-glass.copy-btn {
  --lg-glass: var(--klh-glass-light);
  --lg-glass-active: var(--klh-glass-light-hover);
  --lg-foreground: var(--text-primary, #0b1621);
  color: var(--text-primary, #0b1621);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.95),
    inset 0 0 0 0.5px rgb(11 22 33 / 0.24),
    0 6px 14px -8px rgb(11 22 33 / 0.35);
}
.lg-glass.btn-outline[data-rim],
.lg-glass.btn-table[data-rim],
.lg-glass.filter-btn[data-rim],
.lg-glass.copy-btn[data-rim] {
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.95), 0 6px 14px -8px rgb(11 22 33 / 0.35);
}
/* Aktiver Filter = dunkles Glas */
.lg-glass.filter-btn.active {
  --lg-glass: var(--klh-glass-dark);
  --lg-glass-active: var(--klh-glass-dark-hover);
  --lg-foreground: #ffffff;
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.34),
    inset 0 0 0 0.5px rgb(255 255 255 / 0.3),
    0 6px 14px -8px rgb(8 24 52 / 0.6);
}

/* Farbcodierung wie bisher: grün = bestätigen, rot = ablehnen */
.lg-glass.btn-confirm { --lg-glass: var(--klh-green); --lg-glass-active: rgb(20 110 66 / 0.92); }
.lg-glass.btn-reject  { --lg-glass: var(--klh-red);   --lg-glass-active: rgb(176 48 40 / 0.92); }
.lg-glass.lg-button.btn-discord-top { --lg-glass: var(--klh-blurple); --lg-glass-active: rgb(104 116 247 / 0.95); }

/* Größen */
.lg-glass.lg-button.btn-sm { height: 32px; padding: 0 15px; border-radius: 16px; font-size: 12px; }
.lg-glass.lg-button.btn-table { height: 28px; padding: 0 13px; border-radius: 14px; font-size: 12px; font-weight: 500; }
.lg-glass.lg-button.filter-btn { height: 30px; padding: 0 14px; border-radius: 15px; font-size: 12px; font-weight: 500; }
.lg-glass.lg-button.filter-btn.active { font-weight: 600; }
.lg-glass.lg-button.copy-btn { height: 24px; padding: 0 10px; border-radius: 12px; font-size: 11px; font-weight: 500; gap: 4px; }
.lg-glass.lg-button.btn-remove-row {
  height: 28px; width: 28px; padding: 0; border-radius: 14px; flex: 0 0 auto; font-size: 14px;
  --lg-glass: transparent; --lg-glass-active: rgb(163 39 30 / 0.12);
  --lg-foreground: var(--text-secondary, #2a3a4b);
  color: var(--text-secondary, #2a3a4b);
  box-shadow: none;
}
.lg-glass.lg-button.btn-remove-row:hover { color: var(--status-einspruch, #a3271e); }

/* Beim Drücken darf der Button leicht über seine Nachbarn ragen */
.lg-glass.lg-button:active,
.lg-glass.lg-button[data-pressed] { z-index: 2; }

/* Einzelner Navigations-Button (wenn es keinen Slider gibt) im selben Rauchglas-Stil */
.navbar-link.active {
  background-color: var(--klh-glass-dark);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.34),
    inset 0 0 0 0.5px rgb(255 255 255 / 0.3),
    0 8px 18px -10px rgb(8 24 52 / 0.6);
}
.navbar-link { transition: color 0.25s ease, background-color 0.25s ease; }

/* ============================================================
   3) Navigation als Slider (Segmented-Control mit gleitendem Glas)
   ============================================================ */
.navbar-nav.is-replaced { display: none; }
.navbar-seg { flex: 1; display: flex; align-items: center; min-width: 0; }
.navbar-seg:empty { display: none; }
.navbar-seg .lg-segmented {
  --lg-tab-width: 142px;   /* Breite pro Tab (längster Name: "Mitarbeiter-Portal") */
  --lg-tab-height: 36px;
  flex: none;
}
.navbar-seg .lg-tab-text { white-space: nowrap; }
.navbar-seg .lg-segmented :is(.lg-tab, .lg-tab-copy) { font-size: 13px; font-family: inherit; }

/* Schmale Bildschirme: Slider in eigener Zeile unter Logo und Abmelden */
@media (max-width: 1060px) {
  .navbar-inner:has(.navbar-seg:not(:empty)) { flex-wrap: wrap; row-gap: 12px; column-gap: 12px; }
  .navbar-inner:has(.navbar-seg:not(:empty)) .navbar-actions { order: 1; margin-left: auto; }
  .navbar-inner:has(.navbar-seg:not(:empty)) .navbar-seg { order: 2; flex: 1 1 100%; }
}
@media (max-width: 560px) {
  .navbar-inner { padding-left: 16px; padding-right: 16px; }
  .navbar-brand-text { font-size: 12px; }
  /* Bei vielen Tabs seitlich wischbar, der aktive Tab wird in die Mitte geholt */
  .navbar-seg { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .navbar-seg::-webkit-scrollbar { display: none; }
  .navbar-seg .lg-segmented { --lg-tab-width: max(118px, calc((100vw - 34px) / var(--seg-count, 2))); --lg-tab-height: 36px; }
  .navbar-seg .lg-segmented :is(.lg-tab, .lg-tab-copy) { font-size: 12.5px; }
}
