/* ==========================================================================
 * ROOT VARIABLEN & BASISLAYOUT
 * ========================================================================== */
:root {
  /* Layout */
  --container-narrow: 980px;
  --navbar-height: 56px;

  /* Toolbar-spezifisch (optional) */
  --ctrl-h-toolbar: 36px;
  --ctrl-px-toolbar: .6rem;

  /* Globale Controls (Buttons/Inputs) */
  --ctrl-h-global: 38px;      /* EIN Wert für ALLE Buttons/Inputs */
  --ctrl-px-global: .7rem;    /* horizontales Padding */
}

html,
body {
  height: 100%;
}

body {
  background: #f5f7fb;
}

/* Containerbreite */
.container-narrow {
  max-width: 100%;
}

@media (min-width: 768px) {
  .container-narrow {
    max-width: var(--container-narrow);
  }
}

/* Inhaltspadding */
.content-wrap {
  padding-top: .9rem;
  padding-bottom: 1.25rem;
}

/* ==========================================================================
 * KARTEN / BUTTONS / UTILITIES
 * ========================================================================== */

/* Karten kompakt */
.card-compact {
  border-radius: .8rem;
}

.card-compact .card-body {
  padding: .75rem .9rem;
}

/* Buttons / Icons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.btn-icon .bi {
  font-size: 1.05rem;
}

/* Extra-kleine Buttons */
.btn-xs {
  --bs-btn-padding-y: .15rem;
  --bs-btn-padding-x: .45rem;
  --bs-btn-font-size: .8rem;
  border-radius: .4rem;
}

/* Pointer-Utility */
.pointer {
  cursor: pointer;
}

/* Layout-Utilities */
.max-w-480 {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.fixed-input-group-160 {
  width: 160px;
}

/* Mobile-first Buttons vollbreit, ab md automatisch */
.btn-mobile-full {
  width: 100%;
}

@media (min-width: 768px) {
  .btn-mobile-full {
    width: auto;
  }

  .tap-target {
    padding-top: .45rem;
    padding-bottom: .45rem;
  }
}

/* Während Sync Links sperren */
.pe-none {
  pointer-events: none;
}

.opacity-50 {
  opacity: .5;
}

/* ==========================================================================
 * NAVBAR & OFFCANVAS
 * ========================================================================== */

.navbar-app {
  background: #fff;
  border-bottom: 1px solid #e9ecef !important;
}

.navbar-app .navbar-brand {
  font-weight: 700;
  letter-spacing: .1px;
  padding: .55rem 0;
}

.brand-ellipsis {
  max-width: 55vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Offcanvas */
.offcanvas .section-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6c757d;
  margin: .25rem 0 .35rem;
}

.offcanvas .list-group-item {
  border: 0;
  padding: .75rem 0;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.offcanvas .list-group-item .bi {
  margin-right: .55rem;
}

.offcanvas .list-group-item.active {
  color: var(--bs-primary);
  background: transparent;
}

.offcanvas .profile-chip {
  background: #f8f9fa;
  border: 1px solid #edf1f5;
  border-radius: .6rem;
  padding: .5rem .65rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ==========================================================================
 * TOPBAR (SEITEN-HEADER)
 * ========================================================================== */

.topbar {
  position: sticky;
  top: 0; /* direkt unter Navbar */
  z-index: 1030;
  background: rgba(245, 247, 251, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #e6e9ee;
}

.topbar-inner {
  padding: .6rem .75rem;
}

.title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #0f1720;
}

.subtitle {
  font-size: .85rem;
  color: #6c757d;
}

.badge-tight {
  --bs-badge-padding-x: .5em;
  --bs-badge-padding-y: .35em;
  font-weight: 600;
}

/* Sticky-Banners knapp unterhalb der Topbar */
.sticky-subtop {
  position: sticky;
  top: .5rem;
  z-index: 1025;
  padding: .45rem .75rem;
}

/* Feinjustierung für ≥768px */
@media (min-width: 768px) {
  .title {
    font-size: 1.05rem;
  }

  .order-name {
    font-size: 1.05rem;
  }
}

/* ==========================================================================
 * LISTEN / LOADER / ALERTS
 * ========================================================================== */

.list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.loader-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Alerts (Seitenweite Info-/Ergebnisboxen) */
.alert-fixed {
  margin: .8rem .75rem 0 .75rem;
}

/* ==========================================================================
 * PRODUKTÜBERSICHT
 * ========================================================================== */

.prod-head {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
}

.prod-name {
  font-size: 1rem;
  line-height: 1.15;
  font-weight: 400;
  color: #0f1720;
}

.prod-meta {
  font-size: .9rem;
  color: #495057;
  display: flex;
  gap: .6rem;
  align-items: center;
}

.chip-sold {
  font-weight: 600;
}

/* ==========================================================================
 * SUCHEINGABE MIT CLEAR-BUTTON
 * ========================================================================== */

.search-wrap {
  position: relative;
}

.search-input {
  padding-right: 2.2rem;
  width: 100%;
}

.btn-clear {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #6c757d;
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.btn-clear:hover {
  background: #e9ecef;
}

#lastSyncAt {
  cursor: default;
  user-select: text;
}

/* ==========================================================================
 * BEMERKUNGEN / NOTIZEN
 * ========================================================================== */

.note-card {
  border-radius: .75rem;
}

.note-text {
  white-space: pre-wrap;
}

.voucher-chip {
  background: rgba(25, 135, 84, .12);
  color: #198754;
}

.msg-box {
  border-left: 4px solid var(--bs-info);
  background: rgba(13, 110, 253, .06);
  border-radius: .5rem;
}

.note-card {
  border-radius: .75rem;
}

.note-text {
  white-space: pre-wrap;
}

.voucher-chip {
  background: rgba(25, 135, 84, .12);
  color: #198754;
}

.msg-box {
  border-left: 4px solid var(--bs-info);
  background: rgba(13, 110, 253, .06);
  border-radius: .5rem;
}

/* NEU: Rahmen + grauer Hintergrund um das obere Textfeld */
.remark-box {
  background-color: #f8f9fa;         /* grau hinter der Textarea */
  border-radius: .5rem;
  border: 1px solid #e9ecef;
  padding: .35rem .4rem .4rem;
}

/* ==========================================================================
 * PRODUKT-BESTELLUNGEN / ORDERS
 * ========================================================================== */

.order-head {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
}

.order-left {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.order-name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.15;
}

.order-meta {
  font-size: calc(1em - 3pt);
  color: #374151;
}

/* Status-Rahmen */
.status-all {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, .18);
  background: linear-gradient(0deg, rgba(34, 197, 94, .06), rgba(34, 197, 94, .06));
}

.status-part {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, .16);
  background: linear-gradient(0deg, rgba(245, 158, 11, .06), rgba(245, 158, 11, .06));
}

/* Varianten / Zähler */
.section-title {
  font-size: .95rem;
  font-weight: 600;
  margin: .75rem 0 .35rem;
}

.variants {
  border-top: 1px dashed #e5e7eb;
  margin-top: .45rem;
  padding-top: .45rem;
}

.variant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .25rem 0;
}

.variant-title {
  font-weight: 600;
  font-size: .95rem;
}

.counter .btn {
  width: 34px;
  height: 30px;
  padding: 0;
}

/* in "Neue Bestellung" etwas größer */
.variants .counter .btn {
  width: 36px;
  height: 32px;
}

.qty-chip {
  min-width: 60px;
  text-align: center;
}

.qty-chip-lg {
  min-width: 64px;
  text-align: center;
}

.door-number {
  font-weight: 700;
  font-size: 1.15rem;
  color: #0f1720;
  padding: 0;
  background: transparent;
  border: none;
  display: inline-block;
  min-width: 28px;
  text-align: center;
}

/* Remark-Bereich – standardmäßig grauer Rahmen + leichte Schattierung */
.remark-area {
  border: 1px solid #d1d5db; /* hellgrau statt grün */
  border-radius: .6rem;
  padding: .6rem .6rem .6rem .75rem;
  background: #f9fafb; /* leicht graue Schattierung */
}

/* Wenn erledigt: zusätzlich grün hinterlegt wie bisher */
.remark-area.remark-done {
  border-color: #16a34a;
  background: linear-gradient(0deg, rgba(34, 197, 94, .05), rgba(34, 197, 94, .05));
}


/* Wenn erledigt: zusätzlich grün hinterlegt wie bisher */
.remark-area.remark-done {
  border-left-width: 4px;
  border-radius: .6rem;
  padding: .6rem .6rem .6rem .75rem;
  background: linear-gradient(0deg, rgba(34, 197, 94, .05), rgba(34, 197, 94, .05));
}

.remark-msg {
  border-left: 4px solid var(--bs-info);
  background: rgba(13, 110, 253, .06);
  padding: .5rem .65rem;
  border-radius: .5rem;
  white-space: pre-wrap;
  font-size: .875rem;
  line-height: 1.4;
}

.inline-checks {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Lesbarkeit: mehr Innenabstand im Bemerkungs-Textarea */
.remark-area textarea.form-control {
  padding-top: .6rem;
  padding-bottom: .6rem;
  line-height: 1.4;
  min-height: 3.25rem;
  background-color: #ffffff;   /* Textfeld selbst weiß */
}

.remark-area textarea.form-control.form-control-sm {
  padding-top: .55rem;
  padding-bottom: .55rem;
}

.text-muted.muted {
  color: #6c757d !important;
}

/* Abendkasse: +- Eingabegruppe */
.door-input-group {
  width: 120px;
  max-width: 100%;
}

@media (max-width: 380px) {
  .door-input-group {
    width: 110px;
  }
}

/* ==========================================================================
 * COUPONS – MINI-SPREADSHEET
 * ========================================================================== */

.sheet {
  width: 100%;
  border: 2px solid #adb5bd;
  border-radius: .6rem;
  overflow: hidden;
  background: #fff;
}

.sheet table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.sheet thead th {
  background: #f1f3f5;
  border-bottom: 2px solid #adb5bd;
  border-right: 1.5px solid #c1c7cf;
  font-weight: 700;
  padding: .4rem .6rem;
  font-size: .92rem;
}

.sheet thead th:last-child {
  border-right: none;
}

.sheet tbody td {
  border-top: 1.5px solid #cfd4da;
  border-right: 1.5px solid #cfd4da;
  padding: .28rem .5rem;
  vertical-align: middle;
  background: #fff;
}

.sheet tbody td:last-child {
  border-right: none;
}

.cell {
  min-height: 26px;
  line-height: 1.2;
  font-size: .95rem;
  outline: none;
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.cell[contenteditable="true"]:focus,
.cell[contenteditable="true"]:focus-visible {
  outline: 0;
  box-shadow: none;
}

/* visuelles Focus-Highlight */
.sheet tbody td:has(.cell:focus),
.sheet tbody td.td-focused {
  border-color: #4dabf7;
  outline: 2px solid #4dabf7;
  outline-offset: -2px;
}

.row-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.row-actions .btn {
  --bs-btn-padding-y: .1rem;
  --bs-btn-padding-x: .35rem;
  --bs-btn-font-size: .78rem;
}

.sheet-empty-hint {
  padding: .45rem .6rem;
  color: #6c757d;
  font-size: .9rem;
}

.results-table td,
.results-table th {
  vertical-align: middle;
}

/* ==========================================================================
 * COUPONS – ÜBERSICHT / BATCH-EDIT
 * ========================================================================== */

.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl thead th {
  background: #f8f9fa;
  border-bottom: 2px solid #adb5bd;
  padding: .55rem .6rem;
  font-weight: 700;
  white-space: nowrap;
  text-align: left;
}

.tbl tbody td {
  border-top: 1px solid #e5e7eb;
  padding: .45rem .6rem;
  vertical-align: middle;
}

.tbl tbody tr:hover {
  background: #f9fbff;
}

.tbl tbody td,
.tbl thead th {
  vertical-align: middle;
}

.tbl input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  vertical-align: middle;
}

.nowrap {
  white-space: nowrap;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.toolbar .form-control {
  height: var(--ctrl-h-toolbar);
  padding: .25rem .5rem;
}

.toolbar .btn {
  height: var(--ctrl-h-toolbar);
  --bs-btn-padding-y: .25rem;
  --bs-btn-padding-x: .6rem;
}

.badge-lite {
  background: #eef2ff;
  color: #343a40;
  border: 1px solid #dbe1ff;
  font-weight: 500;
}

/* Toolbar responsive */
.toolbar {
  gap: .5rem;
}

.toolbar .btn {
  white-space: nowrap;
}

.toolbar-search {
  width: 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  .toolbar-search {
    max-width: 420px;
    width: auto;
  }
}

/* Tabellen: auf sehr kleinen Displays Kopf fixieren */
@media (max-width: 575.98px) {
  .table thead th {
    position: sticky;
    top: 0;
    background: var(--bs-body-bg);
    z-index: 1;
  }
}

/* table-responsive: abgerundete Kanten + Scrollbar-Overlay sauber */
.table-responsive {
  border-radius: .6rem;
  overflow: hidden;
}

/* ==========================================================================
 * TOOLBAR / CONTROLS – EINHEITLICHE HÖHE GLOBAL
 * ========================================================================== */

/* Grundregeln für Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--ctrl-h-global);
  padding-left: var(--ctrl-px-global);
  padding-right: var(--ctrl-px-global);
  line-height: 1;
  --bs-btn-border-width: 1px;
}

/* Größen-Modifier nicht höher/anders machen */
.btn-sm,
.btn-lg {
  height: var(--ctrl-h-global);
  padding-left: var(--ctrl-px-global);
  padding-right: var(--ctrl-px-global);
  line-height: 1;
}

/* Form Controls: gleiche Höhe wie Buttons */
.form-control,
.form-select,
.input-group-text,
.input-group .btn {
  height: var(--ctrl-h-global);
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.1;
}

/* Input-Group: saubere Radien */
.input-group > :first-child {
  border-top-left-radius: .375rem;
  border-bottom-left-radius: .375rem;
}

.input-group > :last-child {
  border-top-right-radius: .375rem;
  border-bottom-right-radius: .375rem;
}

/* Mobile Vollbreite-Buttons behalten Höhe */
.btn-mobile-full {
  width: 100%;
}

@media (min-width: 768px) {
  .btn-mobile-full {
    width: auto;
  }
}

/* Einheitliche "sm"-Buttons global etwas straffer */
.btn-sm {
  --bs-btn-padding-y: .3rem;
  --bs-btn-padding-x: .55rem;
  --bs-btn-font-size: .875rem;
  line-height: 1.05;
}

/* ==========================================================================
 * COUPONS: SUB-ROW-LAYOUT FÜR SCHMALE VIEWPORTS
 * ========================================================================== */

.row-sub td {
  border-top: 0; /* Sub-Row klebt optisch an Main-Row */
  padding-top: .2rem;
  padding-bottom: .55rem;
}

.row-sub .sub-desc {
  font-size: .925rem;
  color: #495057;
  margin-bottom: .25rem;
  word-break: break-word;
}

.row-sub .sub-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
}

.row-sub .chip {
  display: inline-block;
  border: 1px solid #e5e7eb;
  background: #f8f9fa;
  border-radius: .4rem;
  padding: .15rem .4rem;
  font-size: .78rem;
  color: #495057;
}

/* Desktop bleibt alte Darstellung – Sub-Row per d-md-none im HTML gesteuert */

/* ==========================================================================
 * LOGIN
 * ========================================================================== */
/* nutzt nur Utilities wie .max-w-480 etc. – keine weiteren Styles notwendig */


/* Rahmen der Bemerkung für Abendkasse immer grau halten */
.remark-area .msg-box {
  border-color: #ced4da;      /* Standard-Grau wie Bootstrap */
  box-shadow: none;           /* keine grüne Glow-Umrandung */
}

/* Auch im "Erfolgsfall" / bei Status-Klassen nicht grün einfärben */
.remark-area.remark-done .msg-box,
.remark-area .msg-box.is-valid {
  border-color: #ced4da;      /* Bootstrap-Standard-Grau */
  box-shadow: none;           /* Bootstrap-"is-valid"-Effekt überschreiben */
}

/* linke farbige Leiste, Rahmen trotzdem grau */
.remark-area .msg-box {
  border-left-width: 4px;
  border-left-style: solid;
  border-left-color: #0dcaf0; /* dein Türkis / Info-Farbe */
}


/* =======================================================================
   BEMERKUNGEN – NEUER STIL
   ======================================================================= */

/* Einheitlicher Rahmen */
.remark-area .card {
  border-radius: .75rem;
  border: 1px solid #e9ecef;
}

/* Ticketing-Bereich (gelblich, readonly) */
.remark-ticketing {
  background-color: #fff8e1; /* leicht gelb */
}

.remark-ticketing textarea {
  background-color: #f8f9fa;
  border-color: #dee2e6;
  color: #495057;
  resize: none;
}

/* Abendkasse-Bereich (weiß, editierbar) */
.remark-abendkasse {
  background-color: #ffffff;
}

.remark-abendkasse textarea {
  background-color: #ffffff;
  border-color: #ced4da;
  color: #212529;
}

/* Beschriftung + Hinweistext */
.remark-area .form-label {
  font-size: 0.95rem;
}

.remark-area .form-text {
  font-size: 0.8rem;
  color: #6c757d;
}

/* ====== Bemerkung Ticketing Anpassungen ====== */

/* Fettschrift etwas kleiner */
.bemerkung-ticketing {
  font-weight: bold;
  font-size: 0.9rem !important; /* etwas kleiner als Standard */
  color: #333 !important;
}

/* Standardrahmen grau statt grün */
.bemerkung-box {
  border: 1px solid #ccc !important; /* grauer Rahmen */
  border-radius: 6px;
  padding: 6px 10px;
  background-color: #fafafa;
}

/* Kein Rahmen, wenn leer */
.bemerkung-box:empty {
  border: none !important;
  padding: 0 !important;
  background: none !important;
}

/* Optional: Wenn du bei Aktivität (z. B. beim Bearbeiten) wieder Grün willst */
.bemerkung-box.active {
  border-color: #28a745 !important; /* grüner Rahmen bei Aktivität */
}

/* Remark-Box nur anzeigen, wenn wenigstens ein Bereich sichtbar ist  */
.remark-area:has(> [id^="remarkBox-"]:not(.d-none)),
.remark-area:has(> [id^="msgView-"]:not(.d-none)) {
  display: block; /* Standard */
}

/* Wenn BEIDE inneren Bereiche versteckt sind: ganze graue Box ausblenden */
.remark-area:has(> [id^="remarkBox-"].d-none):has(> [id^="msgView-"].d-none) {
  display: none;
}

/* Topbar & Filter-Badges auf kleinen Screens kompakter */
@media (max-width: 767.98px) {
  .topbar-inner {
    padding: .5rem .6rem .4rem;
  }

  .topbar .form-label {
    font-size: .75rem;
    margin-bottom: .15rem;
  }

  .filter-badges .badge {
    font-size: .7rem;
    padding: .2rem .35rem;
  }
}
