/* =========================
   Buttons
   ========================= */
.btn-primary {
  background-color: var(--clr-green);
  color: #fff;
  font-weight: 700;
  height: var(--size-btn-height);
}

.btn-primary:hover {
  background-color: var(--clr-green-700);
}

/* generisch größerer Button für Checkout */
.btn-large {
  min-width: 220px;
  height: var(--size-btn-large-h);
  font-size: 18px;
  font-weight: 600;
}

/* kompakter Edit-Button & Utility */
.btn-edit {
  padding: 6px 10px;
  line-height: 1;
}

.btn-quick {
  width: 75px;
}

/* =========================
   Badges
   ========================= */
.badge--member {
  background: var(--clr-green-700);
  color: #fff;
  border: none;
}

.badge--guest {
  background: var(--clr-amber);
  color: var(--clr-amber-text);
  border: none;
}

.badge--houseround {
  background: var(--clr-blue);
  color: #fff;
  border: none;
}

/* =========================
   Produkt-/Kunden-Kacheln
   ========================= */
.product-tile,
.customer-tile {
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s ease, transform .12s ease, outline-color .15s ease;
}

/* Produkt-Selection */
.product-tile.selected {
  outline: 3px solid var(--clr-green);
  box-shadow: var(--shadow-raise);
  transform: scale(1.05);
  z-index: 1;
}

/* Kunden-Kacheln Grid & Variante */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 5px;
  padding: 10px;
  /* etwas Luft unten */
}

.customer-tile {
  position: relative;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  max-width: 85%;
  max-height: 160px;
  /* konsolidiert */
}

.customer-tile img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  display: block;
  margin: 8px auto;
  border-radius: var(--radius-md);
}

.customer-tile.selected {
  outline: 3px solid #ff9800;
  box-shadow: var(--shadow-selected);
  background-color: var(--clr-elev-1);
  transform: scale(1.05);
  z-index: 1;
}

.customer-tile.is-disabled {
  opacity: .6;
  cursor: not-allowed;
  filter: grayscale(.3);
}

.customer-tile.is-disabled input[type="radio"] {
  pointer-events: none;
}

/* Foto-/No-Foto-Varianten */
.customer-tile--photo .tile-media img {
  width: 96px;
  height: 96px;
  border-radius: 10px;
}

.customer-tile--photo .tile-name {
  font-size: 13px;
  line-height: 1.2;
  width: 100%;
}

.customer-tile--nophoto .tile-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  width: 100%;
}

/* Name/Statusfläche */
.tile-name {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  max-width: 100%;
}

.tile-name__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-name__meta {
  font-weight: 500;
  opacity: .8;
}

.status--guest {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffe69c;
}

.status--member {
  background: #d1e7dd;
  color: #0f5132;
  border: 1px solid #badbcc;
}

.status--house {
  background: #e7f1ff;
  color: #084298;
  border: 1px solid #b6d4fe;
}

.status--other {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
}

/* Kachel mit (Hintergrund)bild */
.bg-tile {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  background: #0e1422 center/cover no-repeat;
  border-radius: 12px;
}

.bg-tile .tile__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .35) 0%, rgba(0, 0, 0, .15) 45%, rgba(0, 0, 0, .55) 100%);
  pointer-events: none;
}

.bg-tile .tile__header,
.bg-tile .tile__footer {
  position: absolute;
  left: 12px;
  right: 12px;
  z-index: 2;
}

.bg-tile .tile__header {
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bg-tile .tile__footer {
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-name,
.product-name {
  color: #e9eef6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  font-weight: 700;
}

/* Hover/Selected Visuals (additiv) */
.customer-tile:hover:not(.is-disabled) {
  box-shadow: 0 0 10px rgba(34, 197, 94, .15);
}

.customer-tile.selected,
.product-tile.selected {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, .45) inset;
}

/* Produkt-Kachel Höhe */
.product-tile {
  min-height: 150px;
}

/* =========================
   Produktzähler / Inputs
   ========================= */
.qty-input {
  width: 60px;
  /* konsolidiert (früher 54/60) */
  text-align: center;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  background: var(--clr-bg-dark-2);
  color: var(--clr-text);
  padding: 6px 8px;
  /* konsolidiert */
}

.kasse-input input {
  width: 220px;
  font-size: 18px;
  padding: 6px 8px;
  margin-top: 4px;
}

/* Screenreader Utility */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================
   POS Layout (2 echte Scroll-Spalten)
   ========================= */

.pos-left-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: calc(100vh - var(--pos-grid-top, 0px) - 12px);
}

.pos-customers,
.pos-products {
  height: calc(100vh - var(--pos-grid-top, 0px) - 12px);
  /* einheitliche Höhenlogik */
  overflow: auto;
  overscroll-behavior: contain;
  /* verhindert „Mit-Scrollen“ der Seite */
  contain: layout paint size;
  /* bessere Sticky-Performance */
  scrollbar-width: auto;
  scrollbar-color: #555 #1b1b1b;
  /* thumb + track */
}

.pos-customers::-webkit-scrollbar,
.pos-products::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.pos-customers::-webkit-scrollbar-track,
.pos-products::-webkit-scrollbar-track {
  background: #1b1b1b;
  border-radius: 8px;
}

.pos-customers::-webkit-scrollbar-thumb,
.pos-products::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 8px;
  border: 3px solid #1b1b1b;
}

.pos-customers::-webkit-scrollbar-thumb:hover,
.pos-products::-webkit-scrollbar-thumb:hover {
  background: #888;
}

/* Rechte Spalte: Card füllt die Spaltenhöhe, Inhalt flexibler */
.pos-products .card {
  display: flex;
  flex-direction: column;
}

.pos-right-wrapper main {
  margin-top: 2px;
}

/* =========================
   Kasse: Header & Totals
   ========================= */
.kasse-header {
  display: grid;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.kasse-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.kasse-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quickguest-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--clr-bg-dark);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.quickguest-form input {
  min-width: 180px;
  padding: 4px 6px;
  font-size: 14px;
  border: 1px solid var(--clr-elev-2);
  border-radius: var(--radius-sm);
  background: var(--clr-elev-1);
  color: var(--clr-text);
}

.quickguest-form input::placeholder {
  color: #9ca3af;
}


/* =========================
   Sticky Checkout-Bar in Produkten
   ========================= */
.pos-products {
  position: relative;
}

.pos-checkout-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .92) 0%, rgba(15, 23, 42, .98) 60%, rgba(15, 23, 42, 1) 100%);
  border-top: 1px solid var(--clr-elev-2);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: var(--shadow-sticky);
}

.pos-checkout-left {
  min-height: 36px;
  display: flex;
  align-items: center;
}

.pos-checkout-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* --- Kundenauswahl: Kollaps / Chip-Card ---------------------------------- */
.pos-customers.collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  overflow: hidden;
  transition: max-height .28s ease, opacity .22s ease, transform .22s ease;
}

/* --- Kundenauswahl einklappen --- */
.selected-customer-bar.active {
  display: flex;
}

.selected-customer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.selected-customer-chip img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.dim {
  opacity: .7;
}

/* Eingeklappt: nur die ausgewählte Kachel sichtbar lassen */
.pos-customers.collapsed .customer-grid {
  display: none;
}

/* --- Produkte sperren, bis Kunde gewählt --- */
.products-disabled {
  filter: grayscale(.2);
}

.products-disabled * {
  pointer-events: none !important;
}

.products-disabled .pos-checkout-bar {
  opacity: .6;
}

/* Grid-Layout dynamisch je nach Zustand */
.pos-grid {
  display: grid;
  grid-template-columns: 520px 1fr;
  /* Standard: 2 Spalten */
  gap: 12px;
  align-items: start;
  transition: grid-template-columns .25s ease;
  /* sanfter Wechsel */
}

/* Wenn Kundenspalte kollabiert → Produkte volle Breite */
.pos-grid.customer-collapsed {
  grid-template-columns: 1fr;
}

/* Kundenspalte einklappen mit kleinem „woosh“ */
.pos-customers.collapsing,
.pos-customers.collapsed {
  overflow: hidden;
}

.pos-customers.collapsing {
  max-height: 40px;
  opacity: .0;
  transform: translateY(-4px);
  transition: max-height .25s ease, opacity .2s ease, transform .25s ease;
}

/* Kompakte Bar mit gewähltem Kunden bleibt oben sichtbar */
.selected-customer-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 12px;
  margin: 6px 0 10px;
  background: linear-gradient(180deg, rgba(30, 41, 59, .95) 0%, rgba(15, 23, 42, .98) 100%);
  border: 1px solid var(--clr-elev-2);
  border-radius: var(--radius-md);
  align-items: center;
  gap: 10px;
}

.selected-customer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.selected-customer-chip img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

/* =========================
   Produktkacheln
   ========================= */
/* (Optional) Produktkacheln ruhig etwas breiter lassen */
.product-grid {
  flex: 1 1 auto;
  /* wächst im Flex-Container .card */
  overflow: visible;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  /* statt 180px */
  gap: 12px;
  padding-bottom: 96px;
}

.product-grid .btn {
  font-size: 25px;
  padding: 5px 8px;
  border-radius: 5px;
}

.product-grid .badge {
  font-size: 22px;
}

.product-tile {
  min-height: 170px;
}

/* =========================
Offene Rechnungen
==========================*/

.open-invoices td{
  border-bottom: 2px solid var(--border);
  padding: 5px;
  text-align: center;
}

/* =========================
   Utility / Edit-Mode
   ========================= */
.hidden {
  display: none !important;
}

.toggle-form {
  display: none;
}

.edit-mode .toggle-form {
  display: inline-block !important;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1400px) {
  .pos-grid {
    grid-template-columns: 520px 1fr;
  }

  .customer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .pos-grid {
    grid-template-columns: 1fr;
  }

  .kasseneingabe-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kasse-header {
    align-items: flex-start;
  }

  .quickguest-form {
    width: 100%;
  }
}