/* Advanced Tech Light Mode POS & Inventory CSS System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Tech Light Palette */
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --accent-tech: #4f46e5;
  --accent-tech-hover: #4338ca;
  --accent-cyan: #0891b2;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  
  --border-light: #e2e8f0;
  --border-active: #818cf8;
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 4px 14px rgba(79, 70, 229, 0.2);
}

/* Tech Dark Palette Override */
[data-theme="dark"] {
  --bg-app: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-surface: #334155;
  --bg-hover: #475569;
  
  --accent-tech: #6366f1;
  --accent-tech-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #64748b;
  
  --border-light: #334155;
  --border-active: #818cf8;
  
  --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .glass-panel {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .mobile-header-bar {
  background: #1e293b;
  border-bottom-color: #334155;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Style */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-tech);
}

.glass-panel {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-light);
}

/* App Wrapper */
.app-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Mobile Header Bar (Visible <= 1024px) */
.mobile-header-bar {
  display: none;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  z-index: 60;
  box-sizing: border-box;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin-bottom: 0.75rem;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent-tech);
}

.sidebar-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 0.85rem;
  background: var(--bg-sidebar);
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.brand-logo i {
  color: var(--accent-tech);
  font-size: 1.5rem;
}

.tech-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent-tech);
  border: 1px solid rgba(79, 70, 229, 0.25);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.25rem;
  list-style: none;
}

.nav-item > a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.nav-item > a span {
  white-space: nowrap;
}

.nav-item > a:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.active > a {
  background: var(--accent-tech);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

/* Parent Dropdown Accordion Styling */
.nav-item.has-dropdown > a {
  background: transparent;
  color: var(--text-secondary);
}

.nav-item.has-dropdown > a:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.has-dropdown.active > a {
  background: rgba(79, 70, 229, 0.05) !important;
  color: var(--accent-tech) !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  border-left: 3.5px solid var(--accent-tech);
}

/* Sub-menu Dropdown Styling */
.nav-submenu {
  list-style: none;
  padding: 0.35rem 0 0.45rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-left: 1.5px dashed rgba(79, 70, 229, 0.25);
  margin-left: 1.25rem;
  margin-top: 0.2rem;
}

.nav-submenu-item a {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.83rem !important;
  font-weight: 500 !important;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap !important;
}

.nav-submenu-item a:hover {
  background: rgba(79, 70, 229, 0.08) !important;
  color: var(--accent-tech) !important;
  transform: translateX(2px);
}

.nav-submenu-item.active a {
  background: var(--accent-tech) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35) !important;
  transform: translateX(4px);
}

.nav-submenu-item.active a i {
  color: #ffffff !important;
}

/* Sidebar Mobile Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 55;
}

/* POS Container */
.pos-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 420px;
  height: 100vh;
  overflow: hidden;
}

.pos-products-area {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  gap: 1.25rem;
  overflow: hidden;
  background: var(--bg-app);
}

.pos-header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.search-input-group {
  position: relative;
  flex: 1;
}

.search-input-group input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.15s ease;
}

.search-input-group input:focus {
  border-color: var(--accent-tech);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.product-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.95rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: var(--shadow-card);
}

.product-card:hover {
  border-color: var(--accent-tech);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.12);
}

.product-card:active {
  transform: scale(0.98);
}

.product-sku {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-tech);
  margin-bottom: 0.35rem;
}

.product-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  border-top: 1px dashed var(--border-light);
  padding-top: 0.5rem;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.product-stock {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* POS Cart Sidebar */
.pos-cart-area {
  background: #ffffff;
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-shadow: -4px 0 15px rgba(0,0,0,0.02);
}

.cart-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.cart-items-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg-app);
}

.cart-item-row {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.cart-item-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cart-item-info span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}

.qty-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.1s;
}

.qty-btn:hover {
  background: var(--accent-tech);
  color: #ffffff;
}

.cart-summary {
  padding: 1.25rem;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.summary-row.grand-total {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  border-top: 1px dashed var(--border-light);
  padding-top: 0.65rem;
  margin-top: 0.25rem;
}

.checkout-btn {
  width: 100%;
  padding: 1rem;
  background: var(--accent-emerald);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
}

.checkout-btn:hover {
  background: #047857;
  transform: translateY(-1px);
}

/* Floating Cart Toggle Button for Mobile Screens */
.mobile-cart-toggle-btn {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--accent-tech);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: 30px;
  font-weight: 700;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
  z-index: 45;
  border: none;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE MEDIA QUERIES
   ========================================================================== */

@media (max-width: 1024px) {
  .app-wrapper {
    flex-direction: column;
  }

  .mobile-header-bar {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 5px 0 25px rgba(0,0,0,0.15);
  }

  .app-sidebar.active {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .pos-container {
    grid-template-columns: 1fr;
    height: calc(100vh - 56px);
  }

  .pos-cart-area {
    position: fixed;
    inset: 0;
    top: 56px;
    z-index: 45;
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }

  .pos-cart-area.active {
    transform: translateY(0);
  }

  .mobile-cart-toggle-btn {
    display: flex;
  }
}

@media (max-width: 640px) {
  .pos-products-area {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .pos-header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
  }

  .product-card {
    padding: 0.75rem;
  }

  .product-title {
    font-size: 0.85rem;
  }
}

/* Media Print Styling for Reports and Documents */
@media print {
  .no-print, button, nav, header, .app-sidebar, .mobile-header-bar, .action-buttons-wrap, .sidebar-overlay {
    display: none !important;
  }
  
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: system-ui, -apple-system, sans-serif !important;
  }

  .glass-panel {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  body.printing-thermal * {
    visibility: hidden !important;
  }
  body.printing-thermal #thermal-receipt-modal,
  body.printing-thermal #thermal-receipt-modal * {
    visibility: visible !important;
  }
  body.printing-thermal #thermal-receipt-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    margin: 0;
    padding: 0.5rem;
    background: #fff;
    color: #000;
  }
}
