/* ==========================================================================
   CSS SYSTEM - WARUNG PINTAR (POS, STOK, LAPORAN)
   Mobile-First, Compact & Modern (Light/Dark Glassmorphism)
   ========================================================================== */

/* --- Import Google Font --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Common variables */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 15px rgba(6, 182, 212, 0.3);

  /* Primary Theme Gradients (Solid Green/Teal) */
  --grad-primary: #0d9488;
  --grad-success: #10b981;
  --grad-warning: #f59e0b;
  --grad-danger: #ef4444;
  
  /* LIGHT MODE (Default) */
  --bg-app: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-sidebar: #ffffff;
  --bg-input: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --border-glass: rgba(226, 232, 240, 0.8);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  --border-color: #e2e8f0;
  --accent-cyan: #0d9488;
  --accent-hover: #0f766e;
}

/* DARK MODE */
[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-sidebar: #0f172a;
  --bg-input: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.75);
  --border-glass: rgba(51, 65, 85, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #090d16;
  --border-color: #334155;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

input, select, textarea, button {
  font-family: var(--font-sans);
  font-size: 14px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   LAYOUT STRUCTURE (MOBILE-FIRST)
   ========================================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 70px; /* Space for Bottom Nav */
}

/* --- Sidebar (Hidden on Mobile) --- */
.sidebar {
  display: none;
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  flex-direction: column;
  padding: 20px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: background-color var(--transition-normal), border var(--transition-normal);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  padding: 12px;
  width: 100%;
}

/* --- Header --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 90;
  margin: -12px -12px 12px -12px; /* Pull header flush to edges */
}

.shop-branding {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-logo-container {
  width: 32px;
  height: 32px;
}

.shop-logo-container img {
  width: 100%;
  height: 100%;
}

.shop-name {
  font-size: 16px;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Bottom Navigation (Mobile Only) --- */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--bg-card);
  backdrop-filter: blur(15px);
  border-top: 1px solid var(--border-glass);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  width: 20%;
  height: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color var(--transition-fast);
  gap: 4px;
}

.nav-item i {
  font-size: 20px;
}

.nav-item.active {
  color: var(--accent-cyan);
}

.nav-item.active i {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 4px rgba(6, 182, 212, 0.4));
}

/* ==========================================================================
   DESKTOP SCREEN LAYOUT OVERRIDES (iPad/Desktop)
   ========================================================================== */
@media (min-width: 768px) {
  .app-container {
    flex-direction: row;
    padding-bottom: 0;
  }
  
  .sidebar {
    display: flex;
  }
  
  .bottom-nav {
    display: none;
  }
  
  .main-content {
    margin-left: 260px;
    padding: 24px;
  }

  .app-header {
    margin: -24px -24px 24px -24px;
    padding: 16px 24px;
  }

  .shop-name {
    font-size: 20px;
  }
}

/* ==========================================================================
   SIDEBAR NAVIGATION (DESKTOP)
   ========================================================================== */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo img {
  width: 40px;
  height: 40px;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-nav-btn:hover {
  background-color: var(--bg-input);
  color: var(--text-main);
}

.sidebar-nav-btn.active {
  background: var(--grad-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-glow);
}

.sidebar-footer {
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   UI COMPONENTS & UTILITIES
   ========================================================================== */

/* --- Headings --- */
h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}
@media (min-width: 768px) {
  h1 { font-size: 26px; }
}

/* --- Section Switcher --- */
.app-section {
  display: none;
  animation: fadeIn var(--transition-normal);
}
.app-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Grid & Flex utils --- */
.row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 992px) {
  .row { flex-direction: row; }
  .col-2-3 { flex: 2; }
  .col-1-3 { flex: 1; }
}

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.btn-wrap { white-space: normal !important; text-align: left; }

/* --- Cards (Glassmorphism) --- */
.card {
  background-color: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--grad-primary);
  color: var(--text-inverse);
}
.btn-primary:hover {
  box-shadow: var(--shadow-glow);
}

.btn-success {
  background: var(--grad-success);
  color: var(--text-inverse);
}

.btn-warning {
  background: var(--grad-warning);
  color: var(--text-inverse);
}

.btn-danger {
  background: var(--grad-danger);
  color: var(--text-inverse);
}

.btn-secondary {
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

/* --- Forms & Inputs --- */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* Input Group with Button (e.g. Scan Barcode Button next to Barcode SKU field) */
.input-group {
  display: flex;
  gap: 8px;
}
.input-group .form-control {
  flex: 1;
}

/* Badges */
.badge {
  display: inline-flex;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50px;
  text-transform: uppercase;
}

.badge-success { background-color: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-warning { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-danger { background-color: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-info { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; }

/* ==========================================================================
   DASHBOARD TAB STYLES
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

.stat-card {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-size: 18px;
}
.stat-icon.blue { background: var(--grad-primary); }
.stat-icon.green { background: var(--grad-success); }
.stat-icon.orange { background: var(--grad-warning); }
.stat-icon.red { background: var(--grad-danger); }

.stat-info {
  display: flex;
  flex-direction: column;
}
.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}
@media (min-width: 768px) {
  .stat-value { font-size: 18px; }
}

/* Low stock notification list */
.critical-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.critical-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background-color: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.1);
  font-size: 12px;
}
.critical-name {
  font-weight: 600;
  color: var(--text-main);
}
.critical-qty {
  font-weight: 700;
  color: #ef4444;
}

/* ==========================================================================
   POINT OF SALE (POS) TAB - MOBILE FIRST COMPACT
   ========================================================================== */
.pos-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 992px) {
  .pos-layout {
    flex-direction: row;
    height: calc(100vh - 100px);
  }
  .pos-catalog-side {
    flex: 3;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .pos-cart-side {
    flex: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 420px;
  }
}

/* Search bar & filter POS sticky top */
.pos-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  padding: 2px;
}
.search-wrapper {
  position: relative;
  display: flex;
  gap: 8px;
  width: 100%;
}
.search-wrapper .form-control {
  padding-left: 36px;
}
.search-icon-inside {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.category-tags {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
}
.category-tags::-webkit-scrollbar {
  display: none; /* Chrome */
}
.tag-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.tag-btn:hover {
  background-color: var(--bg-input);
}
.tag-btn.active {
  background: var(--grad-primary);
  color: var(--text-inverse);
  border-color: transparent;
}

/* POS Catalog grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  overflow-y: auto;
}
@media (min-width: 576px) {
  .catalog-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 992px) {
  .catalog-grid {
    grid-template-columns: repeat(3, 1fr);
    flex: 1;
  }
}
@media (min-width: 1200px) {
  .catalog-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Product Card POS (Super Compact) */
.product-card {
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  cursor: pointer;
}
.product-card.out-of-stock {
  opacity: 0.5;
  cursor: not-allowed;
}
.product-info-top {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.product-sku {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.product-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 31px;
}
.product-info-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 6px;
}
.product-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cyan);
}
.product-stock-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
}
.product-stock-tag.low {
  color: #ef4444;
  font-weight: 600;
}

/* Floating Cart Trigger Button for Mobile */
.floating-cart-trigger {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--grad-success);
  color: var(--text-inverse);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 80;
  transition: all var(--transition-fast);
}
.floating-cart-trigger i {
  font-size: 24px;
}
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #ef4444;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 2px solid var(--bg-app);
}

@media (min-width: 992px) {
  .floating-cart-trigger {
    display: none;
  }
}

/* Cart Panel (POS right side) */
.cart-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.cart-header {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (max-width: 991px) {
  .pos-cart-side {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    z-index: 100;
    transition: bottom 0.3s ease-in-out;
    background-color: var(--bg-surface);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding-bottom: 16px;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.15);
    height: 80vh; /* Adjust height to not cover entire screen */
  }

  .pos-cart-side.active-drawer {
    bottom: 0;
  }

  /* Cart list in drawer mode might need specific styling */
  .cart-items-list {
    max-height: calc(80vh - 120px);
  }
}

/* Cart Item card (Compact Row) */
.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-input);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  gap: 8px;
}
.cart-item-name {
  font-size: 12px;
  font-weight: 600;
  flex: 1;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-price-calc {
  font-size: 11px;
  color: var(--text-muted);
}
.cart-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cart-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
}
.cart-qty-btn:hover {
  background-color: var(--border-color);
}
.cart-qty-val {
  font-size: 12px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.cart-item-total {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  min-width: 65px;
  text-align: right;
}
.cart-item-remove {
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

/* Cart Calculation Summary */
.cart-summary {
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}
.summary-row.total {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  border-top: 1px dashed var(--border-color);
  padding-top: 6px;
  margin-top: 4px;
}
.summary-row.total .total-amount {
  color: var(--accent-cyan);
}

/* ==========================================================================
   STOCK & INVENTORY STYLES
   ========================================================================== */
.inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.inventory-toolbar .search-wrapper {
  flex: 1;
  min-width: 150px;
}

/* Compact Table Layout (Responsive) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}
.table-compact {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.table-compact th {
  background-color: var(--bg-input);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}
.table-compact td {
  padding: 8px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}
.table-compact tr:last-child td {
  border-bottom: none;
}
.table-compact tr:hover td {
  background-color: rgba(6, 182, 212, 0.03);
}

/* Compact inventory row layout specifically for mobile views */
.mobile-inventory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (min-width: 768px) {
  .mobile-inventory-list {
    display: none;
  }
}
@media (min-width: 0px) and (max-width: 767px) {
  .table-responsive {
    display: none;
  }
}

.inv-mobile-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
}
.inv-mob-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.inv-mob-name {
  font-size: 13px;
  font-weight: 600;
}
.inv-mob-sub {
  font-size: 10px;
  color: var(--text-muted);
}
.inv-mob-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-mob-stock {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

/* ==========================================================================
   REPORTS & HISTORY STYLES
   ========================================================================== */
.report-date-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.report-date-selector select,
.report-date-selector input {
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
}

.chart-container {
  position: relative;
  height: 220px;
  width: 100%;
  margin-top: 10px;
}

.history-item {
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.history-item:last-child {
  border-bottom: none;
}
.history-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-id {
  font-size: 12px;
  font-weight: 700;
}
.history-date {
  font-size: 10px;
  color: var(--text-muted);
}
.history-right {
  text-align: right;
}
.history-amount {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cyan);
}
.history-pay {
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   MODAL WINDOWS & POPUPS (Glassmorphism)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(9, 13, 22, 0.6);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn var(--transition-fast);
}
.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  animation: modalSlideUp var(--transition-normal);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalSlideUp {
  from { transform: translateY(30px) scale(0.98); }
  to { transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
}
.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   BARCODE SCANNER CONTAINER & SCAN ANIMATION
   ========================================================================== */
#barcode-reader-container {
  width: 100%;
  background-color: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  aspect-ratio: 1; /* Square reader is clean */
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}

/* Camera scan target viewport frame overlay */
.scanner-overlay-frame {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-laser-line {
  position: absolute;
  width: 85%;
  height: 3px;
  background-color: #10b981;
  box-shadow: 0 0 12px #34d399;
  border-radius: 50%;
  animation: laserScan 2.5s infinite ease-in-out;
}

.scanner-target-box {
  width: 70%;
  height: 70%;
  border: 2px dashed rgba(6, 182, 212, 0.6);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4); /* Mask surrounding camera view */
  position: relative;
}

.scanner-target-box::before,
.scanner-target-box::after,
.scanner-target-box span::before,
.scanner-target-box span::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #06b6d4;
  border-style: solid;
  pointer-events: none;
}
/* Corner borders */
.scanner-target-box::before { top: -2px; left: -2px; border-width: 4px 0 0 4px; }
.scanner-target-box::after { top: -2px; right: -2px; border-width: 4px 4px 0 0; }
.scanner-target-box span::before { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; }
.scanner-target-box span::after { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; }

@keyframes laserScan {
  0% { top: 15%; }
  50% { top: 85%; }
  100% { top: 15%; }
}

/* ==========================================================================
   VIRTUAL RECEIPT & PRINT FORMAT
   ========================================================================== */
.receipt-paper {
  background-color: #ffffff;
  color: #000000;
  font-family: 'Courier New', Courier, monospace;
  padding: 20px 15px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
  border: 1px solid #ddd;
  font-size: 12px;
  line-height: 1.4;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border-radius: 2px;
}

.receipt-header {
  text-align: center;
  margin-bottom: 12px;
}
.receipt-shop-name {
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
}
.receipt-line {
  border-top: 1px dashed #000;
  margin: 8px 0;
}
.receipt-item-row {
  display: flex;
  justify-content: space-between;
}
.receipt-item-details {
  margin-left: 10px;
  color: #555;
  font-size: 11px;
}
.receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
}
.receipt-footer-text {
  text-align: center;
  margin-top: 15px;
  font-size: 11px;
}

/* Hide everything except receipt when printing */
@media print {
  body * {
    visibility: hidden;
  }
  .receipt-paper, .receipt-paper * {
    visibility: visible;
  }
  .receipt-paper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    border: none;
    box-shadow: none;
  }
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 350px;
  pointer-events: none;
}
.toast {
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.warning { border-left: 4px solid #f59e0b; }

.toast i {
  font-size: 18px;
}
.toast.success i { color: #10b981; }
.toast.error i { color: #ef4444; }
.toast.warning i { color: #f59e0b; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.fade-out {
  animation: toastFadeOut 0.25s ease forwards;
}
@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(-10px) scale(0.9); }
}

/* ==========================================================================
   SYNC STATUS INDICATOR
   ========================================================================== */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.sync-badge.online {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.2);
}
.sync-badge.syncing {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.2);
}
.sync-badge.offline {
  background-color: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
  border-color: rgba(100, 116, 139, 0.2);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.sync-badge.syncing .sync-dot {
  animation: pulse 1.2s infinite ease-in-out alternate;
}

@keyframes pulse {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.3); }
}

@media (max-width: 480px) {
  .sync-badge .sync-text {
    display: none;
  }
  .sync-badge {
    padding: 4px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    justify-content: center;
  }
}
