/**
 * Global CSS custom properties (design tokens) used across all components.
 * Referenced via var(--name) in component styles throughout the app.
 */
:root {
  --color-bg: #0f202f;
  --color-surface: #ffffff;
  --color-overlay-bg: #e9e9e9;
  --color-accent-green: #2e720e;
  --color-separator: #525252;
  --color-text: #333333;

  --font-primary: 'Helvetica Neue', Helvetica, Arial, sans-serif;

  /* WaveBackground gradient stops (top → bottom of the animated wave) */
  --wave-stop-1: rgba(130, 158, 249, 0.06);
  --wave-stop-2: rgba(34, 91, 124, 0.6);
  --wave-stop-3: rgba(72, 152, 209, 0.2);
}

/* ===== Kiosk Lockdown ===== */

/**
 * Universal kiosk lockdown applied to all elements.
 * Prevents text selection, element dragging, long-press callout,
 * tap highlight flash, and disables focus outlines (no keyboard on kiosk).
 */
* {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

/**
 * Login fields of the hosted display: Safari refuses input into fields with
 * user-select: none.
 */
.display-login input {
  user-select: text;
  -webkit-user-select: text;
}

/**
 * Prevents scrolling, overscroll bounce, pull-to-refresh, double-tap zoom,
 * and pinch zoom on the root element. Reinforces viewport meta restrictions.
 */
html {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/**
 * Removes default margins/padding, hides overflow and scrollbars on the body.
 * touch-action: none prevents all gesture-based navigation (swipe, pinch, pull-to-refresh).
 */
body {
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/**
 * Hides the scrollbar in WebKit-based browsers (Chrome, Edge).
 * Complements the body overflow lockdown above.
 */
body::-webkit-scrollbar {
  display: none;
}

/**
 * Disables pointer events on all images to prevent dragging the logo
 * or any other image on the kiosk touchscreen.
 */
img {
  pointer-events: none;
}

/**
 * Prevents links from being draggable or showing callout menus.
 * Ensures anchor elements cannot be long-pressed to open context menus.
 */
a {
  -webkit-touch-callout: none;
  pointer-events: none;
}

/* ===== SVG Wave Background ===== */

/**
 * Full-screen fixed SVG backdrop with a blue gradient overlay.
 * Applied to the <svg> element rendered by WaveBackground.js.
 * Sits behind all content at z-index 0.
 */
svg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background-color: var(--color-bg);
  background-image: linear-gradient(
    to bottom,
    var(--color-bg) 50%,
    rgba(14, 65, 102, 0.86)
  );
  z-index: 0;
}

/* ===== Logo ===== */

/**
 * Fixed-position wrapper for the company logo, top-left corner.
 * Used by AppLogo.js as the outer <div> around the <img> element.
 * Responsive width adjusted in portrait/small media queries below.
 */
.logo-container {
  position: fixed;
  left: 3vw;
  top: 3vh;
  z-index: 100;
  width: 20vw;
  max-width: 250px;
}

/**
 * Makes the logo image fill its container width.
 * Applied to the <img> element inside .logo-container in AppLogo.js.
 */
.logo {
  width: 100%;
}

/* ===== QR Code ===== */

/**
 * Fixed-position badge in the top-right corner displaying a QR code.
 * Used by QrCodeBadge.js as the outer container wrapping the
 * QR canvas and label text. Shown when a cart ID is active.
 */
.qrcode-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 8px;
  z-index: 100;
  padding: 10px 20px 6px;
  border: 4px solid #0f202f;
  border-radius: 10px;
  background-color: var(--color-surface);
  font-family: var(--font-primary);
  font-size: medium;
  font-weight: 600;
  line-height: 25px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/**
 * Label text displayed below the QR code image (e.g. "Bon scannen").
 * Used by QrCodeBadge.js inside .qrcode-container.
 */
.qrcode-label {
  display: block;
  margin-top: 4px;
  white-space: nowrap;
  font-size: small;
}

/* ===== Kundenhandy (PhoneStatus.js im Slot von QrCodeBadge) ===== */

/**
 * Tonfarben der Statuszeilen und Hinweisfelder — als Variablen, damit ein
 * Marken-Theme (style-<format>.css) sie überschreiben kann.
 */
:root {
  --phone-ok: #2e720e;
  --phone-info: #1d5c8c;
  --phone-success: #2e720e;
  --phone-warning: #b35900;
  --phone-error: #b3261e;
}

/** Spalte unter dem QR-Label; leer (nichts zu melden) nimmt sie keinen Platz. */
.phone-status {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 6px;
  max-width: 340px;
}

.phone-status:empty {
  display: none;
}

/** Kurze Zustandszeile („Handy verbunden", „Kein Papierbeleg"). */
.phone-status-line {
  font-size: small;
  line-height: 20px;
  white-space: nowrap;
}

.phone-status-ok {
  color: var(--phone-ok);
}

/**
 * Hinweisfeld (Handyzahlung, abgewiesenes Handy): Icon + Titel + Text im Stil
 * der Kassen-Hinweise (frontend_sumware src/styles/snackbar.css): weiße Fläche,
 * schlichter Rahmen rundum, die Farbe trägt nur das Icon. Bewusst KEIN farbiger
 * Seitenstreifen — am Kundendisplay nie.
 */
.phone-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background-color: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  color: var(--color-text);
  text-align: left;
  line-height: 1.3;
  white-space: normal;
  animation: phone-notice-in 0.25s ease-out;
}

.phone-notice-info .phone-notice-icon {
  color: var(--phone-info);
}

.phone-notice-success .phone-notice-icon {
  color: var(--phone-success);
}

.phone-notice-warning .phone-notice-icon {
  color: var(--phone-warning);
}

/* Fehler: Rahmen in der Fehlerfarbe, wie die Kassen-Meldung „phoneRejected" */
.phone-notice-error {
  border-color: var(--phone-error);
}

.phone-notice-error .phone-notice-icon {
  color: var(--phone-error);
}

.phone-notice-icon {
  flex-shrink: 0;
  font-size: 24px;
  line-height: 24px;
}

.phone-notice-title {
  font-size: medium;
  font-weight: 600;
}

.phone-notice-text {
  font-size: small;
  opacity: 0.85;
}

@keyframes phone-notice-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ===== Video Player ===== */

/**
 * Fixed-position container for the promotional video, right side of the screen.
 * Used by VideoPlayer.js. Takes full viewport height on landscape kiosk displays.
 * Overridden in portrait/small media queries to stack above the cart.
 */
.video-container {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 1;
}

/**
 * The <video> element itself, sized to fill its container height.
 * Used by VideoPlayer.js inside .video-container.
 */
.video {
  height: 100%;
  width: auto;
  display: block;
}

/* ===== Items / Cart Container ===== */

/**
 * Fixed-position receipt panel anchored to the bottom-left of the screen.
 * Used by CartItems.js as the outer v-sheet wrapping all line items,
 * vouchers, totals, and payments. Width is calculated to fill the space
 * left of the video (assuming 16:9 aspect ratio). Scrollable when content
 * exceeds max-height. Hidden via v-show when the cart is empty.
 */
.items-container {
  position: fixed !important;
  left: 12px;
  bottom: 0;
  min-height: 20vh;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  justify-content: flex-end;
  flex-direction: column;
  width: calc(100vw - (100vh / 1.42));
  padding: clamp(8px, 1.5vw, 16px) !important;
  z-index: 10;
  font-family: var(--font-primary);
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 600;
}

/**
 * Vertical padding for each row inside the cart (items, totals, payments).
 * Applied to every v-row in CartItems.js template.
 */
.cart-row {
  padding: 2px 0;
}

/**
 * Pulls the discount row closer to its preceding item row so they
 * appear visually grouped. Applied when a .cart-row is immediately
 * followed by an .item-discount row in CartItems.js.
 */
.cart-row + .item-discount {
  margin-top: -10px;
  padding-bottom: 4px;
}

/**
 * Bold weight for the "Summe" (total), "Restgeld" (change), and
 * "Offener Betrag" (outstanding) rows in CartItems.js.
 */
.cart-total {
  font-weight: 800;
}

/**
 * Left-aligns the item name column in each cart line item row.
 * Used by CartItems.js on the first v-col of each item v-row.
 */
.item-name {
  text-align: left;
}

/**
 * Right-aligns and prevents wrapping for all price values in the cart.
 * Used by CartItems.js on the v-col cols="auto" holding prices,
 * discounts, voucher amounts, totals, and payments.
 */
.item-price {
  text-align: right;
  white-space: nowrap;
  padding-left: 16px;
}

/**
 * Styles the discount row (e.g. "Nachlass") with smaller, muted text.
 * Used by CartItems.js on the v-row that shows item.discount
 * and optional item.discountReason.
 */
.item-discount {
  font-size: 0.85em;
  color: #a94b4b;
}

/**
 * Styles the voucher rows ("Gutschein") with smaller, muted text
 * matching the discount style. Used by CartItems.js on each
 * voucher v-row when voucher.used is truthy.
 */
.item-voucher {
  font-size: 0.85em;
  color: #a94b4b;
}

/* ===== Customer Overlay ===== */

/**
 * Background color for the customer data / signature overlay card.
 * Used by CustomerOverlay.js on the v-card wrapping customer data
 * preview and signature pad views.
 */
.overlay-card {
  background: var(--color-overlay-bg) !important;
}

/**
 * Responsive title for the customer data overlay.
 * Scales with viewport height so it stays proportional to the data rows.
 * Used by CustomerOverlay.js on the v-card-title element.
 */
.ctm-title {
  font-size: clamp(18px, 3vh, 36px);
  line-height: 1.2;
  margin-bottom: clamp(4px, 1vh, 12px);
}

/* ===== Customer Data Grid ===== */

/**
 * Each label/value row in the customer data preview table.
 * Used by CustomerOverlay.js for v-row elements displaying
 * fields like name, address, email, and phone number.
 * Font size and padding scale with viewport height to fill
 * available space without scrolling.
 */
.ctm-data-row {
  font-family: var(--font-primary);
  font-size: clamp(14px, 2.8vh, 32px);
  line-height: 1.3;
  padding: clamp(2px, 0.6vh, 8px) 0;
  border-bottom: 1px solid #ddd;
}

/**
 * Removes the bottom border from the last customer data row.
 * Used by CustomerOverlay.js to avoid a trailing separator line.
 */
.ctm-data-row:last-child {
  border-bottom: none;
}

/**
 * Muted color for the label column (e.g. "Vorname", "Straße")
 * in the customer data grid. Used by CustomerOverlay.js on the
 * first v-col of each .ctm-data-row.
 */
.ctm-label {
  color: #555;
}

/**
 * Allows long customer data values (e.g. addresses, email) to
 * wrap within their column. Used by CustomerOverlay.js on the
 * second v-col of each .ctm-data-row.
 */
.ctm-value {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ===== Signature Pad ===== */

/**
 * Touch-enabled canvas for capturing the customer's signature.
 * Used by SignaturePad.js via a template ref. Full width up to 1000px,
 * with touch-action:none to prevent browser gestures during drawing.
 * Canvas internal resolution is scaled by devicePixelRatio in JS.
 */
.signature-pad {
  display: block;
  width: 100%;
  height: 250px;
  border: 2px solid black;
  border-radius: 5px;
  background: var(--color-surface);
  touch-action: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}

/**
 * Optional legal/explanatory line above the pad in the return-signature
 * overlay. Used by SignatureOverlay.js when the POS sends
 * signatureRequest.text; absent for the plain signature request.
 */
.signature-hint {
  font-family: var(--font-primary);
  font-size: clamp(14px, 2vh, 22px);
  line-height: 1.35;
  margin-bottom: clamp(6px, 1.5vh, 14px);
}

/**
 * Position list above the pad in the return-signature overlay — what the
 * customer confirms with the signature. Used by SignatureOverlay.js when the
 * POS sends signatureRequest.items. Scrolls instead of pushing the pad off the
 * card when a return has many positions.
 */
.signature-items {
  font-family: var(--font-primary);
  font-size: clamp(13px, 1.9vh, 21px);
  line-height: 1.3;
  max-height: 34vh;
  overflow-y: auto;
  margin-bottom: clamp(6px, 1.5vh, 14px);
  border-top: 1px solid #ddd;
}

/** One position: quantity, name (+ size/colour), line total. */
.signature-item-row {
  display: flex;
  align-items: baseline;
  gap: clamp(6px, 1.2vh, 14px);
  padding: clamp(2px, 0.6vh, 8px) 0;
  border-bottom: 1px solid #ddd;
}

/** Quantity column — fixed width so the names line up. */
.signature-item-qty {
  flex: 0 0 3.5ch;
  text-align: right;
  color: #555;
}

/** Article name; takes the remaining width and wraps. */
.signature-item-name {
  flex: 1 1 auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/** Size/colour suffix behind the article name. */
.signature-item-size {
  color: #555;
}

/** Line total, right-aligned. */
.signature-item-price {
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/** "… und N weitere" when the POS truncated the list. */
.signature-item-more {
  color: #555;
  font-style: italic;
}

/** Sum row below the positions. */
.signature-items-total {
  font-weight: 700;
  border-bottom: none;
}

/**
 * Customer data block above the pad in the return-signature overlay — the last
 * name and postcode the customer checks before signing (SignatureOverlay.js,
 * signatureRequest.ident). Bigger than the position list: these are the values
 * the customer is asked to verify, so they must be readable from arm's length.
 */
.signature-ident {
  font-family: var(--font-primary);
  font-size: clamp(15px, 2.2vh, 24px);
  line-height: 1.3;
  margin-bottom: clamp(4px, 1vh, 10px);
  padding: clamp(6px, 1.2vh, 12px) clamp(8px, 1.5vh, 16px);
  border: 2px solid #ddd;
  border-radius: 8px;
}

/** One line of the data block: label left, value right. */
.signature-ident-row {
  display: flex;
  align-items: baseline;
  gap: clamp(8px, 1.5vh, 18px);
}

.signature-ident-label {
  flex: 0 0 9ch;
  color: #555;
}

.signature-ident-value {
  flex: 1 1 auto;
  font-weight: 700;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/**
 * Why the data is stored (signatureRequest.note). Information under the data
 * block — deliberately no checkbox and no gate on the sign button: the legal
 * basis is documenting the return, not consent.
 */
.signature-note {
  font-family: var(--font-primary);
  font-size: clamp(12px, 1.6vh, 18px);
  line-height: 1.3;
  color: #555;
  margin-bottom: clamp(6px, 1.5vh, 14px);
}

/**
 * Thank-you state shown by SignatureOverlay.js after the customer signed,
 * until the cashier's next cart update removes the overlay.
 */
.signature-thanks {
  font-size: clamp(28px, 6vh, 64px);
  padding: clamp(24px, 6vh, 64px) 0;
}

/* ===== Consent Checkboxes ===== */

/**
 * Vertically aligns the checkbox to the top of its label text.
 * Used by SignaturePad.js on each v-checkbox in the consent section.
 * Default Vuetify centers the checkbox icon vertically; this overrides
 * that to top-align when labels wrap to multiple lines.
 */
.consent-checkbox .v-selection-control {
  align-items: flex-start;
  padding-left: 0;
}

/**
 * Removes Vuetify's default left padding on the checkbox wrapper
 * so the checkbox icon aligns flush with the signature canvas left edge.
 */
.consent-checkbox.v-input {
  padding-inline-start: 14px !important;
}

/**
 * Scales the checkbox icon to 2x default size (48px) and colors it
 * green when checked. Applied via the consent-checkbox wrapper class
 * in SignaturePad.js on each v-checkbox.
 */
.consent-checkbox .v-selection-control__input > .v-icon {
  font-size: 48px;
}

/**
 * Adds right margin after the checkbox icon so the label text
 * does not sit too close to the oversized checkbox.
 */
.consent-checkbox .v-selection-control__input {
  margin-right: 24px;
}

/**
 * Green color for checked consent checkboxes.
 * Targets the Vuetify "checked" state icon.
 */
.consent-checkbox .v-selection-control--dirty .v-icon {
  color: var(--color-accent-green);
}

/* ===== Consent Text ===== */

/**
 * Text style for the three consent/agreement checkbox labels
 * on the signature view. Used by SignaturePad.js inside the
 * v-checkbox #label slots. Responsive font size via clamp().
 */
.consent-text {
  font-size: clamp(12px, 1.4vw, 16px);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  line-height: 1.4;
  white-space: normal;
}

/* ===== Responsive: Portrait / Tablet ===== */

/**
 * Media query for portrait tablets and narrow screens (< 1024px).
 * Switches the layout from side-by-side (video right, cart left)
 * to stacked (video top, cart bottom). Adjusts logo and QR code sizing.
 * Affects: VideoPlayer.js, CartItems.js, AppLogo.js, QrCodeBadge.js.
 */
@media (max-width: 1023px) {
  /** Expands the video container to full width, top 35% of viewport. */
  .video-container {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 35vh;
    width: 100%;
  }

  /** Fills the container with cover-fit to avoid letterboxing. */
  .video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /** Cart takes full width at the bottom, limited to 60% of viewport height. */
  .items-container {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-height: 60vh;
  }

  /** Slightly larger logo on portrait screens. */
  .logo-container {
    width: 25vw;
  }

  /** Tighter positioning for the QR badge on smaller screens. */
  .qrcode-container {
    right: 10px;
    top: 10px;
  }
}

/* ===== Responsive: Small / Debug ===== */

/**
 * Media query for small screens and debug windows (< 600px).
 * Reduces video height, increases cart area, shrinks signature pad.
 * Affects: VideoPlayer.js, CartItems.js, SignaturePad.js, AppLogo.js.
 */
@media (max-width: 599px) {
  /** Reduces video to 25% of viewport height. */
  .video-container {
    height: 25vh;
  }

  /** Expands cart area and uses smaller base font size. */
  .items-container {
    max-height: 70vh;
    font-size: 14px;
  }

  /** Shorter signature canvas for small screens. */
  .signature-pad {
    height: 180px;
  }

  /** Larger relative logo width to stay legible on small screens. */
  .logo-container {
    width: 30vw;
  }
}
