/* ==========================================================================
   Tasuke Skincare & Beauty POS - Modern Online Operations Styling
   ========================================================================== */

:root {
  --primary: #0A7789;
  --primary-hover: #08616f;
  --primary-light: #e0f2f5;
  --primary-dark: #064752;
  --secondary: #f59e0b;
  --accent: #10b981;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --khr-color: #dc2626;
  --usd-color: #059669;
  --radius: 14px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  overscroll-behavior-y: none;
}

body {
  font-family: 'Kantumruy Pro', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.pos-app {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
}

button, a, input, select, textarea, .nav-tab, .category-pill, .product-card, .pipeline-card, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.overflow-y-auto, .overflow-x-auto, #productsGrid, #salesCartSection, .tab-content, #cartItemsContainer, .category-carousel-wrapper, .pipeline-column-scroll {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

input, textarea, select, option {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.5);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Custom Visible Scrollbar for Pipeline Columns */
.pipeline-column-scroll {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 rgba(226, 232, 240, 0.6);
  scroll-behavior: smooth;
}
.pipeline-column-scroll::-webkit-scrollbar {
  width: 7px;
}
.pipeline-column-scroll::-webkit-scrollbar-track {
  background: rgba(203, 213, 225, 0.4);
  border-radius: 9999px;
}
.pipeline-column-scroll::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 9999px;
}
.pipeline-column-scroll::-webkit-scrollbar-thumb:hover {
  background: #0A7789;
}

/* Pipeline Card Compact & Transition Effects */
.pipeline-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pipeline-card:hover {
  border-color: #0A7789;
  box-shadow: 0 4px 12px rgba(10, 119, 137, 0.12);
}

.pipeline-view-btn.active {
  background-color: #0A7789 !important;
  color: #ffffff !important;
  border-color: #0A7789 !important;
  box-shadow: 0 2px 6px rgba(10, 119, 137, 0.25);
}

/* Nav Tab States */
.nav-tab {
  color: rgba(255, 255, 255, 0.75);
}
.nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.nav-tab.active {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Category Tab Pill */
.category-pill {
  transition: var(--transition);
}
.category-pill.active {
  background: #0A7789 !important;
  color: #ffffff !important;
  border-color: #0A7789 !important;
  box-shadow: 0 4px 10px rgba(10, 119, 137, 0.25);
}

/* Report Subtabs Active State */
.report-subtab {
  transition: all 0.15s ease;
}
.report-subtab.active {
  background-color: #0A7789 !important;
  color: #ffffff !important;
  border-color: #0A7789 !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(10, 119, 137, 0.25);
}

/* Product Card */
.product-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.08);
}
.product-card:active {
  transform: scale(0.97);
}

/* Payment Method Button */
.pay-method-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}
.pay-method-btn.active {
  background: #e0f2f5;
  border-color: #0A7789;
  color: #0A7789;
  box-shadow: 0 2px 6px rgba(10, 119, 137, 0.15);
}

/* Modal Overlay & Animations */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out forwards;
}
.modal-overlay.hidden {
  display: none !important;
}
#salesInvoiceHistoryModal {
  z-index: 100000 !important;
}
#orderDetailsModal {
  z-index: 100010 !important;
}
#editOrderModal {
  z-index: 100020 !important;
}
#customerModal {
  z-index: 100020 !important;
}
.modal-content {
  max-height: 92vh;
  overflow-y: auto;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mobile Specific Drawer & Navigation Styling */
@media (max-width: 767px) {
  .mobile-cart-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 99999 !important;
    background-color: #ffffff !important;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-cart-drawer.open {
    transform: translateY(0) !important;
  }
  
  .product-card {
    border-radius: 12px;
  }
}

.mobile-nav-item.active {
  color: #2dd4bf !important;
}

/* Report Subtab Active */
.report-subtab {
  transition: all 0.15s ease;
  border: 1px solid #e2e8f0;
}
.report-subtab:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.report-subtab.active {
  background: #0A7789 !important;
  color: #ffffff !important;
  border-color: #0A7789 !important;
  box-shadow: 0 2px 6px rgba(10, 119, 137, 0.25);
}

.chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Print Rules - Standard POS Thermal & A4 Printing */
@media print {
  @page {
    size: auto;
    margin: 0mm;
  }
  html, body {
    background: #fff !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
  }
  body > *:not(#printContainer) {
    display: none !important;
  }
  #printContainer {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 80mm !important;
    margin: 0 auto !important;
    padding: 4mm !important;
    background: #fff !important;
    color: #000 !important;
    z-index: 999999 !important;
  }
  #printContainer * {
    visibility: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Status Badges with Rich Color Contrast */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* 1. Pending (Amber / Yellow) */
.status-pill-pending {
  background-color: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #fcd34d !important;
}
.status-pill-pending .dot {
  background-color: #d97706 !important;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.25);
}

/* 2. Printed (Vibrant Blue) */
.status-pill-printed {
  background-color: #dbeafe !important;
  color: #1e40af !important;
  border: 1px solid #93c5fd !important;
}
.status-pill-printed .dot {
  background-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* 3. Packed (Rich Purple) */
.status-pill-packed {
  background-color: #f3e8ff !important;
  color: #6b21a8 !important;
  border: 1px solid #d8b4fe !important;
}
.status-pill-packed .dot {
  background-color: #9333ea !important;
  box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.25);
}

/* 4. Shipped (Cyan / Sky) */
.status-pill-shipped {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #7dd3fc !important;
}
.status-pill-shipped .dot {
  background-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

/* 5. Settled (Emerald Green) */
.status-pill-settled {
  background-color: #d1fae5 !important;
  color: #065f46 !important;
  border: 1px solid #6ee7b7 !important;
}
.status-pill-settled .dot {
  background-color: #059669 !important;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.25);
}



/* =========================================================================
   REPORT FULLSCREEN VIEW MODE (ពង្រីកពេញអេក្រង់ ១០០%)
   ========================================================================= */
.report-fullscreen-mode {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 999999 !important;
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: #f8fafc !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: none !important;
}

.report-fullscreen-mode #reportSubTableContainer {
  flex: 1 1 0% !important;
  height: calc(100vh - 56px) !important;
  max-height: calc(100vh - 56px) !important;
  overflow-y: auto !important;
  padding-bottom: 2.5rem !important;
}

.report-fullscreen-mode #reportSubTableContainer {
  height: calc(100vh - 60px) !important;
  max-height: calc(100vh - 60px) !important;
  padding-bottom: 2rem !important;
}
