/* =======================================================
   Design Tokens
   – zentrale Variablen für konsistente Farben/Abstände
======================================================= */
:root{
  /* Spacing & Radii */
  --pad: clamp(8px, 2vw, 24px);
  --gap: clamp(8px, 1.6vw, 16px);
  --radius: 12px;
  --shadow: 0 6px 18px rgba(0,0,0,.12);

  /* Typo & Farben */
  --text: #111827;
  --muted: #6b7280;

  /* Brand (dein „Fast Schwarz“) */
  --brand: #1F332D;
  --brand-600: #324c43;     /* Hover/Fokus etwas heller */
  --brand-focus: color-mix(in srgb, var(--brand) 28%, transparent);

  /* Oberflächen */
  --surface: #ffffff;
  --surface-soft: rgba(255,255,255,.9);
  --glass: rgba(255,255,255,.75);

  /* Kachel-Farben Startseite */
  --tile-bg: #2c7be5;
  --tile-fg: #ffffff;
  --tile-guest: #f59e0b;

  /* Buttons (UI in Artikelliste etc.) */
  --btn: #3498db;
  --btn-hover: #2980b9;

  /* Rahmen/Separatoren */
  --line: #e5e7eb;

  /* Hintergrundbild-Overlay */
  --bg-overlay: linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.3));
}

/* =======================================================
   Reset & Grundlayout
======================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html, body{
  height: 100%;
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    var(--bg-overlay),
    url('/static/background.jpg') center/cover fixed no-repeat;
}

/* Globale Links – auf Brand umgestellt */
a{
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}
a:hover{ color: var(--brand-600); text-decoration: underline; }

/* Utilities */
.inline-delete-form{ all: unset; display:inline; }

/* Typo-Scaling mobil */
@media (max-width: 600px){
  html{ font-size: 18px; }
  button, input, select{ font-size: 1rem; }
}



/* =======================================================
   NAVBAR (User) – mit Suche & Uhr  [FIXED]
   - Grid-Mittelspalte mit minmax(0, 1fr)
   - Safe-Area-Padding (iOS Landscape)
   - overflow:hidden als Rahmen-Schutz
   - Schrumpfbare Kinder (min-width: 0)
======================================================= */
.navbar{
  position: sticky;
  top: env(safe-area-inset-top, 0);
  z-index: 100;

  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto; /* <— WICHTIG */
  align-items: center;
  gap: 10px;

  /* Rahmen / Glas-Effekt wie gehabt */
  padding: 8px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  backdrop-filter: saturate(140%) blur(6px);
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
  border-radius: var(--radius);

  /* Verhindert jegliches „Herausquellen“ */
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;

  /* Safe-Area links/rechts (v.a. iOS im Querformat) */
  padding-inline-start: max(12px, env(safe-area-inset-left, 0px));
  padding-inline-end:   max(12px, env(safe-area-inset-right, 0px));
}

/* Linke/rechte Gruppe bleiben flexibel */
.navbar-left,
.navbar-right{
  display:flex;
  align-items:center;
  gap:10px;

  /* <— erlaubt Schrumpfen in Grid/Flex-Layouts */
  min-width: 0;
}

/* Nav-Links (dein Design beibehalten) */
.navbar a{
  position: relative;
  display:inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  color: var(--brand);
  background: transparent;
  transition: color .2s ease;
  white-space: nowrap;            /* nicht umbrechen */
  text-overflow: ellipsis;        /* … falls zu lang */
  overflow: hidden;
}
.navbar a:hover{
  background: rgba(0,0,0,.06);
  color: var(--brand-600);
}
.navbar a::after{
  content:"";
  position:absolute;
  left:10px; right:10px; bottom:5px;
  height:2px; background: currentColor;
  border-radius: 2px;
  transform: scaleX(.35);
  opacity: 0;
  transform-origin: center;
  transition: transform .18s ease, opacity .18s ease;
}
.navbar a:hover::after{ opacity:1; transform: scaleX(1); }
.navbar a.active{ color: var(--brand); }
.navbar a.active::after{ opacity:1; transform: scaleX(1); }
.navbar a:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-focus);
}

/* Suche mittig – vollständig schrumpfbar */
.navbar-search {
  justify-self: center;
  max-width: min(520px, 60vw);
  display: flex;
  align-items: center;

  /* Layout-neutral (deine Overrides beibehalten) */
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;

  min-width: 0; /* <— erlaubt Schrumpfen */
}

.navbar-search input[type="search"] {
  width: 100%;
  min-width: 0;                 /* <— statt fixer Mindestbreite */
  padding: 10px 16px;
  font-size: 1rem;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, .6);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
  color: inherit;
}
.navbar-search input[type="search"]::placeholder { color: #7a7a7a; }
.navbar-search input[type="search"]:focus {
  background: #fff;
  box-shadow: 0 0 0 2px var(--brand-focus);
}

/* Uhr rechts */
.navbar-clock{
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,.04);
  color: var(--brand);
  opacity: .95;
}

/* Mobile: Navbar einkolumnig, Suche volle Breite (wie gehabt) */
@media (max-width: 560px){
  .navbar{ grid-template-columns: 1fr; gap:6px; }
  .navbar-search{ justify-self: stretch; max-width: 100%; }
}

/* Querformat-Optimierungen */
@media (orientation: landscape){
  /* Weniger Platz für die Suche im Landscape */
  .navbar-search{ max-width: min(480px, 55vw); }
  .navbar-search input[type="search"]{
    /* darf kleiner werden, statt den Rahmen zu sprengen */
    min-width: 140px;
  }

  /* Logos/Bilder in der Navbar skalieren vernünftig mit */
  .navbar-left img,
  .navbar-left svg {
    max-height: clamp(22px, 5vh, 34px);
    height: auto;
    max-width: 34vw;
    object-fit: contain;
  }
}

/* Weniger Platz – Uhr mittig (deine Regel bleibt, nur gelassen) */
@media (max-width: 480px){
  .navbar-right{
    margin-left: 0;
    width: 100%;
    justify-content: center;
    margin-top: 5px;
  }
}

/* =======================================================
   NAVBAR (Admin) – ohne Suche  [FIXED]
   - Safe-Area, overflow, Schrumpfen
======================================================= */
.admin-navbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  backdrop-filter: saturate(140%) blur(6px);
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
  border-radius: var(--radius);

  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;

  padding-inline-start: max(12px, env(safe-area-inset-left, 0px));
  padding-inline-end:   max(12px, env(safe-area-inset-right, 0px));
}
.admin-navbar a,
.admin-navbar button.btn-link{
  display:inline-block;
  padding:8px 12px;
  border-radius:10px;
  font-weight:700;
  color:var(--brand);
  background:transparent;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.admin-navbar a:hover,
.admin-navbar button.btn-link:hover{ background: rgba(0,0,0,.06); }
.admin-navbar .navbar-admin-right{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap: 10px;

  min-width: 0; /* <— darf schrumpfen */
}






/* Standard-Container: nur auf verifizierten Seiten Grid */
.container {
  display: grid;
  grid-template-columns: 1fr 3fr; /* oder wie bei dir definiert */
  gap: 20px;
}

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.login-card {
  max-width: 400px;
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  text-align: center;
}


















/* =======================================================
   FORMULARE (global)
======================================================= */
form{
  max-width: 700px;
  margin: 0 auto 2rem;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,.08);
}
label{ display:block; margin:.8rem 0 .4rem; font-weight:600; color:#555; }
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select{
  width:100%;
  padding:.6rem .8rem;
  font-size:1rem;
  border:1px solid #ccc;
  border-radius:10px;
  outline: none;
}
input[type="password"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus{
  border-color: var(--btn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn) 18%, transparent);
}

button, form button{
  width:100%;
  padding:.8rem;
  background:var(--btn);
  color:#fff;
  border:none;
  border-radius:10px;
  font-weight:700;
  font-size:1.05rem;
  cursor:pointer;
  transition: background-color .2s ease, transform .05s ease;
}
button:hover, form button:hover{ background:var(--btn-hover); }
button:active, form button:active{ transform: translateY(1px); }

/* =======================================================
   CONTAINER / SEITEN
======================================================= */
main.container{
  max-width: 1400px;
  margin: 40px auto 0; /* Abstand unter Navbar */
  background: var(--surface-soft);
  padding: 25px;
  border-radius: var(--radius);
  box-shadow: 0 0 15px rgba(0,0,0,.1);
}
main.container h2{ text-align:center; margin-bottom:20px; }

main.login-container{
  max-width:420px;
  margin:min(6vh,60px) auto;
  background: var(--surface-soft);
  padding:24px;
  border-radius: var(--radius);
  box-shadow: 0 0 15px rgba(0,0,0,.1);
  display:flex; flex-direction:column; align-items:center; text-align:center;
}
.login-logo{
  display:block; width:min(60vw,220px); max-width:220px; height:auto; margin:0 auto 16px;
}
.login-form{ width:100%; }
.login-form input[type="password"]{
  width:100%; padding:12px 14px; font-size:1rem; border:1px solid #cfcfcf; border-radius:10px;
  outline:none; transition: box-shadow .15s ease, border-color .15s ease;
}
.login-form input[type="password"]:focus{
  border-color: var(--tile-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tile-bg) 15%, transparent);
}
.login-form button{
  width:100%; padding:12px 14px; font-size:1.05rem; font-weight:700; border-radius:10px;
  background: #2980b9; color:#fff; border:none; cursor:pointer; margin-top:10px;
}
.login-form button:hover{ background:#1c5980; }

@media (max-width: 480px){
  main.login-container{ margin: min(4vh,32px) var(--pad); padding:18px; }
  .login-logo{ width:min(70vw,200px); margin-bottom:12px; }
}

/* =======================================================
   FLASH-MESSAGES
======================================================= */
.flash-container{ margin:1em auto; max-width:800px; padding:0 1em; }
.flash-message{
  padding:.75em 1em; border-radius:8px; margin-bottom:.5em; color:#fff; box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.flash-message.success{ background:#4CAF50; }
.flash-message.warning{ background:#ff9800; }
.flash-message.danger{  background:#f44336; }
.flash-message.info{    background:#2196F3; }

/* =======================================================
   STARTSEITE / KACHELGRID
======================================================= */
.ks-body{ height:100dvh; overflow:hidden; display:flex; flex-direction:column; padding:0 !important; }
.ks-main{ flex:1; padding:var(--pad); overflow:hidden; }

.ks-panel{
  height:100%; width:100%;
  padding:var(--pad);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(2px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.ks-tiles{
  height:100%;
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 24vw, 160px), 1fr));
  gap: var(--gap);
  align-content:start;
  overflow:hidden;
}

.ks-tile{ margin:0; padding:0; border:0; background:transparent; }
.ks-tile-btn{
  display:grid; grid-template-rows: 1fr auto;
  width:100%; min-height: clamp(96px, 18vh, 120px);
  padding: clamp(10px, 2.2vh, 16px);
  border-radius: 16px;
  background: var(--tile-bg); color: var(--tile-fg);
  box-shadow: 0 4px 18px rgba(0,0,0,.08);
  text-align:left; cursor:pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, box-shadow .1s ease;
}
.ks-tile-btn:active{ transform: scale(.98); }
@media (hover:hover){ .ks-tile-btn:hover{ transform: translateY(-2px); } }

.ks-tile-btn.gast{ background: var(--tile-guest); color:#fff; }
.ks-tile-name{ font-size: clamp(1rem, 2.4vw, 1.25rem); font-weight:400; line-height:1.2; }
.ks-tile-saldo{ font-size: clamp(.95rem, 2vw, 1.05rem); opacity:.96; }
.ks-empty{ color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.1rem); }
.ks-chip{
  display:inline-block; margin-left:.5rem; padding:.1rem .45rem;
  font-size:.75rem; font-weight:700; line-height:1; border-radius:999px;
  background: rgba(255,255,255,.22); color:#fff;
}

/* =======================================================
   ARTIKELLISTE & WARENKORB (Bestellansicht)
======================================================= */
main.container.app{
  /* alternative App-Seite mit zwei Spalten */
  display:flex; gap:2rem; max-width:1200px; height:80vh; overflow:hidden;
  margin:2rem auto; background:var(--surface-soft); padding:1rem;
  border-radius: var(--radius); box-shadow: 0 0 15px rgba(0,0,0,.1);
}

/* linke Spalte: Artikel */
.artikel-liste{
  flex:2; overflow-y:auto; border:1px solid #ccc; padding:1rem;
  background:#f9f9f9; border-radius: var(--radius);
}

/* Grid für Buttons */
.button-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(5cm, 1fr));
  gap: 1rem;
}

/* Artikelbutton */
.artikel-button{
  display:flex; align-items:center; justify-content:space-between;
  padding:1rem; background: var(--btn); color:#fff; font-weight:700;
  border:0; border-radius:8px; cursor:pointer; transition: background-color .2s ease;
}
.artikel-button:hover{ background: var(--btn-hover); }

.artikel-textblock{ display:flex; flex-direction:column; }
.artikel-preis{ font-size:.85em; font-weight:400; margin-top:.2rem; color:#f0f0f0; }
.artikel-icon{ width:30px; height:30px; object-fit:contain; flex-shrink:0; }

/* rechte Spalte: Warenkorb */
.warenkorb-container{
  flex:1; overflow-y:auto; border:1px solid #ccc; padding:1rem;
  background:#fff; border-radius: var(--radius);
}

/* kompakte Tabelle */
.bestaetigungstabelle{ width:100%; border-collapse:collapse; }
.bestaetigungstabelle th{
  background:#f4f4f4; text-align:left; padding:6px 8px; font-weight:700;
}
.bestaetigungstabelle td{
  border-top:1px solid var(--line); padding:4px 8px; line-height:1.1; vertical-align:middle;
  font-size:.95rem;
}
/* schmale Spalten */
.col-menge, .col-summe, .col-aktion{ width:1%; white-space:nowrap; }

/* Formulare im Tisch nicht wie Karten stylen (Overrides) */
.bestaetigungstabelle td form{
  display:inline; margin:0; padding:0; background:transparent; box-shadow:none;
  border-radius:0; max-width:none;
}

/* Minus-Button */
.entfernen-button{
  width:28px; height:28px; padding:0; display:inline-flex; align-items:center; justify-content:center;
  font-size:18px; background:#e74c3c; color:#fff; border:none; border-radius:6px;
  cursor:pointer; transition: background-color .2s ease, transform .05s ease;
}
.entfernen-button:hover{ background:#c0392b; }
.entfernen-button:active{ transform: scale(.96); }

/* Gesamtsumme hervorheben */
.sum-row td{ border-top:2px solid #d1d5db; font-weight:700; padding-top:6px; }
.sum-row .label{ text-align:right; }

/* =======================================================
   Responsive Tweaks
======================================================= */
@media (max-width: 480px){
  /* Uhr mittig, wenn wenig Platz */
  .navbar-right{
    margin-left: 0;
    width: 100%;
    justify-content: center;
    margin-top: 5px;
  }
}

/* Weniger Animation für Nutzer:innen mit reduzierter Bewegung */
@media (prefers-reduced-motion: reduce){
  .navbar a::after{ transition: none; }
  .artikel-button,
  .ks-tile-btn{ transition: none; }
}

/* Fix: Admin-Navbar immer Flex mit Uhr und Logo rechts */
.page-login .admin-navbar {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
}

.page-login .admin-navbar .navbar-admin-right {
  margin-left: auto !important;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Fix: Auf der Login-Seite rechte Spalte ganz nach rechts */
.page-login .navbar {
  grid-template-columns: auto 1fr auto; /* Links – Mitte – Rechts */
}

.page-login .navbar-right {
  justify-self: end; /* sorgt dafür, dass Uhr/Logo rechts kleben */
}


/* bisher: #installBtn { right: 12px; display: none; } */
#installBtn {
  right: 12px;
  bottom: 72px;   /* <- statt 12px, sitzt jetzt über dem Vollbild-Knopf */
  display: none;
}