/* Css Datei für beide Kunden Vorbestellungsseiten (im Prozess. nicht Anleitung) */

/* === Globales Box-Sizing gegen "seitlich scrollen" === */
*, *::before, *::after {
  box-sizing: border-box;
}

/* === Grundlayout === */
html, body {
  height: 100%;
  overflow-x: hidden; /* niemals seitlich scrollen */
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #0f172a;
  color: #222;

  /* App auf Displayhöhe begrenzen */
  height: 100dvh;
  min-height: 100dvh;

  display: flex;
  flex-direction: column;

  overflow: hidden; /* verhindert, dass Inhalte den Body verlängern */
  overscroll-behavior: none;
}

/* Fallback für Browser ohne dvh */
@supports not (height: 100dvh) {
  body {
    height: 100vh;
    min-height: 100vh;
  }
}

/* === Header === */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(6px);

  flex: 0 0 auto; /* Header bleibt fix in der Höhe */
}

/* === Header Button Gruppe === */
.header-buttons {
  display: flex;
  gap: 10px;
}

.back-btn {
  background: #ffffff;
  color: #000;
  text-decoration: none;
  font-weight: bold;
  border-radius: 12px;
  padding: 8px 16px;
  transition: all 0.25s ease;
}

.back-btn:hover {
  background: #ddd;
}

.clock {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
}

/* Neuer Event-Button */
.event-btn {
  background: #e0f0ff;
  color: #003366;
  text-decoration: none;
  font-weight: bold;
  border-radius: 12px;
  padding: 8px 16px;
  transition: all 0.25s ease;
}

.event-btn:hover {
  background: #c2e0ff;
}

/* === Hauptbereich === */
main {
  flex: 1;

  /* WICHTIG: main muss Flex-Container sein, damit .kasse-container wirklich "Resthöhe" bekommt */
  display: flex;
  flex-direction: column;

  padding: 20px;
  min-height: 0;     /* erlaubt inneres Scrollen */
  overflow: hidden;  /* Scrollen passiert in den Spalten, nicht im main */

  /* iOS/iPad Safe-Area */
  padding-bottom: calc(20px + env(safe-area-inset-bottom));

  overflow-x: hidden;
}

h1 {
  text-align: center;
  color: white;
  margin-bottom: 25px;

  flex: 0 0 auto; /* Überschrift nimmt nur ihren Platz ein */
}

/* === Kassenbereich === */
.kasse-container {
  display: flex;
  flex-direction: row;
  gap: 20px;

  /* WICHTIG: nimmt die restliche Höhe unterhalb von h1 ein */
  flex: 1 1 auto;
  min-height: 0;

  align-items: stretch;

  /* kein seitliches Wrap -> sonst gibt’s oft komische Höhen */
  flex-wrap: nowrap;

  /* damit nicht der Container selbst "rauswächst" */
  overflow: hidden;
  overflow-x: hidden;
  width: 100%;
}

/* === Artikelliste links === */
.article-list {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;

  /* WICHTIG: links wird scrollbar wenn Inhalte zu hoch werden */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;

  padding-right: 6px; /* Platz für Scrollbar */
}

/* Scrollbar-Styling links */
.article-list::-webkit-scrollbar {
  width: 8px;
}
.article-list::-webkit-scrollbar-thumb {
  background-color: rgba(204, 204, 204, 0.9);
  border-radius: 8px;
}
.article-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(170, 170, 170, 0.95);
}

.category {
  color: white;
  font-size: 1.4rem;
  font-weight: bold;
  margin-top: 10px;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

.article {
  background: white;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;

  /* verhindert, dass lange Texte horizontal rausdrücken */
  min-width: 0;
}

.article:hover {
  background: #f7f7f7;
  transform: scale(1.02);
}

/* === Warenkorb rechts === */
.cart {
  flex: 1;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);

  display: flex;
  flex-direction: column;

  /* WICHTIG: cart bleibt in der verfügbaren Höhe */
  min-height: 0;
  overflow: hidden;
  overflow-x: hidden;
}

.cart h2 {
  margin-top: 0;
  text-align: center;

  flex: 0 0 auto;
}

/* Artikelliste scrollbar machen */
.cart ul {
  list-style: none;
  padding: 0;
  margin: 0;

  overflow-y: auto;
  overflow-x: hidden;

  flex: 1 1 auto;
  min-height: 0;

  padding-right: 5px;
}

/* Scrollbar-Styling */
.cart ul::-webkit-scrollbar {
  width: 8px;
}

.cart ul::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 8px;
}

.cart ul::-webkit-scrollbar-thumb:hover {
  background-color: #aaa;
}

/* Artikel-Elemente im Warenkorb */
.cart li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
  border-bottom: 1px solid #ccc;
  padding-bottom: 4px;

  min-width: 0;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.quantity-controls button {
  background: #eee;
  font-size: 0.9rem;
  padding: 2px 8px;
  border-radius: 6px;
  border: none;
  transition: background 0.25s;
}

.quantity-controls button:hover {
  background: #ddd;
}

/* === Sticky-Footer im Warenkorb === */
.cart-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 2px solid #eee;
  background: white;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  flex: 0 0 auto;
}

#totalPrice {
  text-align: left;
  font-weight: bold;
  color: #222;
}

/* 🆕 Ghost-Button */
.ghost-btn {
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
  text-align: center;
}

.ghost-btn.ghost-off {
  background: #ffe0e0;
  color: #a10000;
}

.ghost-btn.ghost-on {
  background: #d4ffd4;
  color: #064e00;
}

.ghost-btn:active {
  transform: scale(0.97);
}

/* === Warenkorb Buttons === */
.cart-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;

  flex: 0 0 auto;
}

#clearCart,
#sendCart {
  flex: 1;
  margin: 0 5px;
  border-radius: 10px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;

  padding: 18px 0;
  font-size: 18px;
  min-height: 55px;
}

#clearCart {
  background: #ffe0e0;
  color: #a10000;
}

#clearCart:hover {
  background: #ffb3b3;
}

#sendCart {
  background: #d4ffd4;
  color: #064e00;
}

#sendCart:hover {
  background: #a9f3a9;
}

/* === Overlay === */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;

  overflow: hidden;
  overflow-x: hidden;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: #f5f5f5;
  border-radius: 16px;
  padding: 25px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);

  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-x: hidden;
}

@supports not (max-height: 85dvh) {
  .overlay-content {
    max-height: 85vh;
  }
}

.overlay-content h2 {
  margin-top: 0;
  text-align: center;
  color: #333;

  flex: 0 0 auto;
}

/* Komponentenliste scrollt, wenn zu groß */
#componentList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 10px 0 10px;

  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  padding-right: 6px;

  position: relative;
  scrollbar-gutter: stable; /* Desktop: reserviert Platz für Scrollbar */
}

/* Scrollbar-Styling im Overlay */
#componentList::-webkit-scrollbar {
  width: 8px;
}
#componentList::-webkit-scrollbar-thumb {
  background-color: rgba(180, 180, 180, 0.9);
  border-radius: 8px;
}
#componentList::-webkit-scrollbar-thumb:hover {
  background-color: rgba(150, 150, 150, 0.95);
}

/* Standard: unsichtbar */
#componentList::after {
  content: "▾";
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;

  height: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: center;

  font-size: 18px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.35);

  background: linear-gradient(
    to bottom,
    rgba(245, 245, 245, 0),
    rgba(245, 245, 245, 1)
  );

  pointer-events: none;

  opacity: 0;                 /* <-- aus */
  transition: opacity 0.2s ease;
}

/* Nur wenn JS sagt: "hier ist es scrollbar" */
#componentList.scroll-hint::after {
  opacity: 1;                 /* <-- an */
}

/* Optional: wenn man ganz unten ist, Pfeil wieder aus */
#componentList.at-bottom::after {
  opacity: 0;
}

/* === Komponenten Buttons === */
.component-button {
  display: block;
  width: 100%;
  margin: 0 auto;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  background: #e0e0e0;
  color: #333;
  font-weight: bold;
  border: 2px solid transparent;
  transition: all 0.25s ease;
}

.component-button:hover {
  background: #d5d5d5;
}

.component-button.active {
  background: #007bff;
  color: white;
  border-color: #0056b3;
}

/* === Overlay Buttons === */
.overlay-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;

  flex: 0 0 auto;
}

.overlay-buttons button {
  flex: 1;
  margin: 0 5px;
  border-radius: 10px;
  padding: 10px;
  border: none;
  font-weight: bold;
  transition: all 0.25s ease;
  cursor: pointer;
}

#cancelComponent {
  background: #ffcccc;
  color: #800000;
}

#cancelComponent:hover {
  background: #ff9999;
}

#addToCart {
  background: #c8f7c5;
  color: #064e00;
}

#addToCart:hover {
  background: #a3f0a0;
}

/* === Notiz Overlay === */
#noteOverlay textarea {
  width: 100%;
  margin: 10px auto;
  display: block;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
  resize: none;
}

#noteOverlay .overlay-content {
  max-width: 400px;
  max-height: 85dvh;
  overflow: hidden;

  display: flex;
  flex-direction: column;
}

#noteOverlay .overlay-buttons button {
  flex: 1;
  margin: 0 5px;
  border-radius: 10px;
  padding: 10px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.25s ease;
}

#noteOverlay #cancelNote {
  background: #ffcccc;
  color: #800000;
}

#noteOverlay #cancelNote:hover {
  background: #ff9999;
}

#noteOverlay #saveNote {
  background: #c8f7c5;
  color: #064e00;
}

#noteOverlay #saveNote:hover {
  background: #a3f0a0;
}

/* ✅ NEU: Confirm Overlay Styling */
.overlay-content--confirm {
  max-width: 520px;      /* etwas breiter für lesbare Liste */
  max-height: 90dvh;     /* mehr Platz, trotzdem nie größer als Bildschirm */
}

@supports not (max-height: 90dvh) {
  .overlay-content--confirm {
    max-height: 90vh;
  }
}

.confirm-meta {
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: grid;
  gap: 8px;
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.confirm-label {
  font-weight: 700;
  color: #333;
}

.confirm-value {
  font-weight: 700;
  color: #111;
}

.confirm-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;

  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-list::-webkit-scrollbar {
  width: 8px;
}
.confirm-list::-webkit-scrollbar-thumb {
  background-color: rgba(180, 180, 180, 0.9);
  border-radius: 8px;
}
.confirm-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(150, 150, 150, 0.95);
}

.confirm-item {
  background: #ffffff;
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.confirm-item__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.confirm-item__title {
  font-weight: 800;
  color: #222;
  min-width: 0;
}

.confirm-item__qty {
  font-weight: 800;
  color: #111;
  flex: 0 0 auto;
}

.confirm-item__comps {
  margin-top: 6px;
  color: #444;
  font-size: 0.95rem;
}

.confirm-item__note {
  margin-top: 8px;
  background: #f3f7ff;
  border: 1px solid #dbe7ff;
  color: #1f3b7a;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.confirm-item__bottom {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #333;
  font-weight: 700;
}

.confirm-item__unit {
  color: #555;
  font-weight: 700;
}

.confirm-item__sum {
  color: #111;
  font-weight: 900;
}

.confirm-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 0.85rem;
  border-radius: 999px;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  color: #7a5a00;
  font-weight: 800;
}

#confirmBack {
  background: #ffcccc;
  color: #800000;
}

#confirmBack:hover {
  background: #ff9999;
}

#confirmSend {
  background: #c8f7c5;
  color: #064e00;
}

#confirmSend:hover {
  background: #a3f0a0;
}

.confirm-hint {
  margin-top: 10px;
  font-size: 0.92rem;
  color: #555;
  text-align: center;
}

/* === Touch / Selection Verhalten === */
button,
input,
selectable,
.component-button {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* === Responsive (Handy) === */
@media (max-width: 800px) {
  /* Platz sparen */
  main {
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  h1 {
    font-size: 1.4rem;
    margin-bottom: 12px;
  }

  /* Header kompakter */
  header {
    padding: 8px 10px;
  }

  .header-buttons {
    gap: 6px;
  }

  .back-btn,
  .event-btn {
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
  }

  .clock {
    font-size: 1.0rem;
  }

  /* Untereinander, aber Warenkorb bekommt mehr Höhe als Artikel */
  .kasse-container {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;

    min-height: 0;
    overflow: hidden;
  }

  /* Weniger Platz für Artikel, mehr für Warenkorb */
  .article-list {
    flex: 0.9;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .cart {
    max-height: 35dvh;              /* wichtiger Punkt: Warenkorb deutlich größer */
    min-height: 0;
    overflow: hidden;
    padding: 12px;
  }

  /* Damit man IMMER mindestens 1–2 Zeilen im Warenkorb sieht */
  .cart ul {
    min-height: 80px;
  }

  .cart h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  /* Footer/Buttons kompakter */
  .cart-footer {
    gap: 8px;
    padding-top: 8px;
  }

  .ghost-btn {
    min-width: 95px;
    padding: 6px 8px;
    font-size: 0.9rem;
  }

  .cart-buttons {
    margin-top: 8px;
  }

  /* Leeren/Senden kleiner */
  #clearCart,
  #sendCart {
    padding: 10px 0;
    font-size: 14px;
    min-height: 42px;
  }

  /* Confirm Overlay etwas kompakter */
  .overlay-content--confirm {
    padding: 18px;
    width: 92%;
  }
}

/* Extra-klein (sehr schmale Handys) */
@media (max-width: 480px) {
  .back-btn,
  .event-btn {
    padding: 5px 8px;
    font-size: 0.85rem;
  }

  .clock {
    font-size: 0.95rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  .ghost-btn {
    min-width: 88px;
    font-size: 0.85rem;
  }

  #clearCart,
  #sendCart {
    padding: 9px 0;
    font-size: 13px;
    min-height: 40px;
  }
}

/* ================================
   ✅ Success Page (Vorbestellnummer)
   ================================ */

.success-container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.success-card {
  width: 100%;
  max-width: 560px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.success-title {
  text-align: center;
  font-weight: 900;
  color: #111;
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.success-number {
  text-align: center;
  font-weight: 1000;
  font-size: clamp(64px, 9vw, 120px);
  line-height: 1;
  letter-spacing: 2px;
  color: #064e00;
  margin: 8px 0 10px 0;
  font-family: "Segoe UI", Arial, sans-serif;
}

.success-sub {
  text-align: center;
  color: #333;
  font-weight: 700;
  margin-top: 6px;
  margin-bottom: 14px;
}

.success-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.success-pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f7ff;
  border: 1px solid #dbe7ff;
  color: #1f3b7a;
  font-weight: 800;
  font-size: 0.92rem;
}

.success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.success-btn {
  text-decoration: none;
  font-weight: 900;
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.25s ease;
  display: inline-block;
  min-width: 180px;
  text-align: center;
}

.success-btn--primary {
  background: #d4ffd4;
  color: #064e00;
}

.success-btn--primary:hover {
  background: #a9f3a9;
}

.success-btn--secondary {
  background: #e0f0ff;
  color: #003366;
}

.success-btn--secondary:hover {
  background: #c2e0ff;
}

/* ✅ Fullscreen Lock Overlay (wenn Vorbestellungen geschlossen sind) */
.system-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.system-lock-overlay.hidden {
  display: none;
}

.system-lock-card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 22px 18px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
  border: 1px solid rgba(0,0,0,0.10);

  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.system-lock-title {
  font-weight: 900;
  font-size: 1.35rem;
  color: #111;
}

.system-lock-text {
  font-weight: 700;
  color: #333;
  line-height: 1.35;
}

.system-lock-btn {
  display: inline-block;
  margin-top: 6px;
  background: #ffffff;
  color: #000;
  text-decoration: none;
  font-weight: 900;
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.25s ease;
  border: 1px solid rgba(0,0,0,0.15);
}

.system-lock-btn:hover {
  background: #ddd;
}

/* Lead-Satz: auffällig, auch wenn Safari keinen echten Bold-Font hat */
.success-sub .success-sub-lead {
  display: inline-block;
  margin-bottom: 6px;

  /* “fett” versuchen */
  font-weight: 900 !important;

  /* Safari/Fonts: Fake-Bold erlauben */
  font-synthesis: weight;

  /* Wenn dein Custom-Font keinen Bold hat: nimm für den Lead system fonts, die sicher bold können */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  /* Optisch auffällig, unabhängig von Bold */
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid currentColor;

  /* “Marker”-Look */
  background: rgba(255, 215, 0, 0.28);

  /* Dickere Optik auch ohne Bold */
  text-shadow:
    0.6px 0 currentColor,
    -0.6px 0 currentColor,
    0 0.6px currentColor,
    0 -0.6px currentColor;
}

/* Safari kann Textstroke -> macht es nochmal “dicker” */
@supports (-webkit-text-stroke: 0.6px currentColor) {
  .success-sub .success-sub-lead {
    -webkit-text-stroke: 0.6px currentColor;
    text-shadow: none;
  }
}
