/**
 * Thermal Receipt Printing & POS Aesthetics - Expert Gestion 3.0
 */

.receipt-paper {
  width: 100%;
  max-width: 320px;
  background-color: #ffffff !important;
  color: #0f172a !important;
  font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

.receipt-dashed {
  border-top: 1px dashed #64748b;
  margin: 6px 0;
}

.receipt-double {
  border-top: 2px double #0f172a;
  margin: 6px 0;
}

/* @media print: Thermal Roll 80mm Output Isolation */
@media print {
  body * {
    visibility: hidden !important;
  }

  #receipt-print-area,
  #receipt-print-area * {
    visibility: visible !important;
  }

  #receipt-print-area {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 3mm !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    z-index: 9999999 !important;
  }

  .no-print,
  #modal-receipt,
  #receipt-modal-card,
  #mobile-floating-cart-bar,
  #mobile-cart-backdrop,
  header,
  footer,
  aside {
    display: none !important;
  }

  @page {
    size: 80mm auto;
    margin: 0;
  }
}

/* POS Fullscreen Touch Mode */
#pos-app-root:fullscreen,
#pos-app-root:-webkit-full-screen,
.pos-fullscreen-mode {
  background-color: #f1f5f9 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  padding: 0.5rem 0.75rem !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Fullscreen Pro Banner (Visible strictly in Fullscreen) */
.pos-fullscreen-only {
  display: none !important;
}

#pos-app-root:fullscreen .pos-fullscreen-only,
#pos-app-root:-webkit-full-screen .pos-fullscreen-only,
.pos-fullscreen-mode .pos-fullscreen-only {
  display: flex !important;
  flex-shrink: 0 !important;
  margin-bottom: 0.35rem !important;
}

/* Mobile Loyverse Bottom-Sheet Cart Drawer */
@media (max-width: 1023px) {
  #pos-cart-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    max-height: 88vh;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  #pos-cart-panel.mobile-drawer-closed {
    transform: translateY(115%);
    pointer-events: none;
  }

  #pos-cart-panel.mobile-drawer-open {
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* Desktop Normal Mode (Maximized Cart Panel with pinned checkout) */
@media (min-width: 1024px) {
  #pos-cart-panel {
    height: calc(100vh - 5.5rem);
    max-height: calc(100vh - 5.5rem);
    display: flex;
    flex-direction: column;
  }
}

/* Desktop Fullscreen Touch Mode (Cart and Catalog lock inside 100vh, zero bottom overflow) */
@media (min-width: 1024px) {
  #pos-app-root:fullscreen #pos-workbench-grid,
  #pos-app-root:-webkit-full-screen #pos-workbench-grid,
  .pos-fullscreen-mode #pos-workbench-grid {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
    overflow: hidden !important;
    align-items: stretch !important;
  }

  #pos-app-root:fullscreen #pos-workbench-grid > section:first-child,
  #pos-app-root:-webkit-full-screen #pos-workbench-grid > section:first-child,
  .pos-fullscreen-mode #pos-workbench-grid > section:first-child {
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    padding-bottom: 0.5rem !important;
  }

  #pos-app-root:fullscreen #pos-cart-panel,
  #pos-app-root:-webkit-full-screen #pos-cart-panel,
  .pos-fullscreen-mode #pos-cart-panel {
    position: static !important;
    top: auto !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    overflow: hidden !important;
    margin-bottom: 0 !important;
  }

  #pos-app-root:fullscreen #pos-cart-panel .flex-1,
  #pos-app-root:-webkit-full-screen #pos-cart-panel .flex-1,
  .pos-fullscreen-mode #pos-cart-panel .flex-1 {
    min-height: 0 !important;
    flex: 1 1 0% !important;
    overflow-y: auto !important;
  }
}

/* POS Cashier Dark Mode Styling */
#pos-app-root.dark,
#pos-app-root.dark:fullscreen,
.dark #pos-app-root {
  background-color: #0b1120 !important;
  color: #f1f5f9 !important;
}

#pos-app-root.dark .bg-white {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

#pos-app-root.dark .bg-slate-50,
#pos-app-root.dark .bg-slate-100 {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

#pos-app-root.dark .text-slate-900,
#pos-app-root.dark .text-slate-800 {
  color: #f8fafc !important;
}

#pos-app-root.dark .text-slate-700,
#pos-app-root.dark .text-slate-600 {
  color: #94a3b8 !important;
}

#pos-app-root.dark .border-slate-200,
#pos-app-root.dark .border-slate-100 {
  border-color: #334155 !important;
}

#pos-app-root.dark input,
#pos-app-root.dark select,
#pos-app-root.dark textarea {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

#pos-app-root.dark .pos-card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

#pos-app-root.dark .pos-card:hover {
  border-color: #3b82f6 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4) !important;
}
