/* 
 * Kirana POS - Premium Black & White Design System & Utilities
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #09090b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --black-primary: #18181b;
  --black-hover: #000000;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ==================== PWA Mobile Safe-Area & Bottom Navigation ==================== */
.pwa-safe-bottom-nav {
  height: 4.25rem;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 6px);
  box-sizing: border-box;
}

/* Glassmorphism Navigation Styling */
.glass-bottom-nav {
  background: rgba(255, 255, 255, 0.78) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 0 1px 1px rgba(0, 0, 0, 0.05) !important;
}

.glass-bottom-nav-dark {
  background: rgba(9, 9, 11, 0.82) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5) !important;
}

/* Mobile-only bottom spacing above bottom nav for main app container */
@media (max-width: 767px) {
  .pwa-app-body-container {
    padding-bottom: calc(5.5rem + max(env(safe-area-inset-bottom, 0px), 12px)) !important;
  }
  main.overflow-y-auto {
    padding-bottom: calc(6rem + max(env(safe-area-inset-bottom, 0px), 12px)) !important;
  }
}

@media (min-width: 768px) {
  .pwa-app-body-container {
    padding-bottom: 0 !important;
    min-height: 100vh !important;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal and Drawer Animations */
.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  transition: opacity 0.2s ease-in-out;
}

.drawer-content {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* POS Quick Grid Items */
.pos-product-card {
  transition: all 0.15s ease;
  user-select: none;
}
.pos-product-card:active {
  transform: scale(0.97);
}

/* Hide input spin buttons */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast-msg {
  pointer-events: auto;
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* No Scrollbar Utility */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Smooth Touch Scrolling */
.overflow-x-auto, .overflow-y-auto {
  -webkit-overflow-scrolling: touch;
}

/* Print Stylesheet for Invoices, Reports and Statements */
@media print {
  /* Hide standard web navigation, drawers, and marked elements */
  aside,
  header,
  nav,
  .pwa-safe-bottom-nav,
  .no-print,
  .print\:hidden {
    display: none !important;
  }

  /* Reset container heights for multi-page print */
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .pwa-app-body-container {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
  }

  main {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    width: 100% !important;
  }

  /* Specific isolation ONLY for invoice receipt print page */
  body.invoice-print-page * {
    visibility: hidden;
  }
  body.invoice-print-page #printable-invoice,
  body.invoice-print-page #printable-invoice * {
    visibility: visible;
  }
  body.invoice-print-page #printable-invoice {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  @supports selector(:has(*)) {
    body:has(#printable-invoice) * {
      visibility: hidden;
    }
    body:has(#printable-invoice) #printable-invoice,
    body:has(#printable-invoice) #printable-invoice * {
      visibility: visible;
    }
    body:has(#printable-invoice) #printable-invoice {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      margin: 0;
      padding: 0;
    }
  }

  /* Thermal 80mm / 58mm overrides */
  .thermal-receipt {
    width: 76mm !important;
    max-width: 76mm !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    color: #000 !important;
    background: #fff !important;
  }
}
