/* ==========================================================================
   JAWAREH POS - Core Design System & Dynamic Theme (Responsive Edition)
   4 Base Colors: primarycolor1, primarycolor2, secondarycolor1, secondarycolor2
   Desktop, Tablet, and Mobile Adaptive
   ========================================================================== */

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

:root {
  /* Dynamic 4 Theme Colors */
  --primary-1: #4F46E5;
  --primary-2: #6366F1;
  --secondary-1: #06B6D4;
  --secondary-2: #F43F5E;

  --primary-1-glow: rgba(79, 70, 229, 0.25);
  --primary-2-glow: rgba(99, 102, 241, 0.2);
  --secondary-1-glow: rgba(6, 182, 212, 0.2);
  --secondary-2-glow: rgba(244, 63, 94, 0.2);

  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-sidebar: #0f172a;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #ffffff;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;

  --border-color: #e2e8f0;
  --border-focus: var(--primary-1);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 20px 30px -6px rgba(15, 23, 42, 0.16);

  --sidebar-width: 250px;
  --sidebar-width-minimized: 72px;
  --header-height: 66px;
  --cart-width: 380px;

  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--bg-app);
  position: relative;
}

/* ================= SIDEBAR ================= */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  color: var(--text-sidebar);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  transition: padding 0.25s ease;
}

.store-logo-img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--primary-1);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-1-glow);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.store-logo-img:hover {
  transform: scale(1.05);
}

.store-brand-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.store-brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-brand-text p {
  font-size: 10px;
  color: var(--secondary-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-mini-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition-smooth);
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar-mini-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  transform: scale(1.08);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: padding 0.25s ease;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  padding: 8px 12px 4px;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #94a3b8;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition-smooth);
  cursor: pointer;
  white-space: nowrap;
}

.nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: var(--primary-1);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px var(--primary-1-glow);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  transition: padding 0.25s ease;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-info {
  min-width: 0;
  transition: opacity 0.2s ease;
}

.user-info h4 {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info span {
  font-size: 11px;
  color: var(--secondary-1);
}

/* ================= MINIMIZED SIDEBAR (DESKTOP & TABLET) ================= */
.app-sidebar.minimized {
  width: var(--sidebar-width-minimized);
}

.app-sidebar.minimized .sidebar-header {
  padding: 14px 10px;
  justify-content: center;
}

.app-sidebar.minimized .store-brand-text,
.app-sidebar.minimized .nav-section-title,
.app-sidebar.minimized .user-info,
.app-sidebar.minimized .sidebar-footer > button {
  display: none !important;
}

.app-sidebar.minimized .sidebar-mini-toggle-btn {
  display: none;
}

.app-sidebar.minimized .store-logo-img {
  width: 42px;
  height: 42px;
}

.app-sidebar.minimized .sidebar-nav {
  padding: 14px 8px;
  align-items: center;
  gap: 8px;
}

.app-sidebar.minimized .nav-item {
  width: 46px;
  height: 46px;
  padding: 0;
  justify-content: center;
  position: relative;
  border-radius: var(--radius-md);
}

.app-sidebar.minimized .nav-item span {
  display: none;
}

.app-sidebar.minimized .nav-item i {
  font-size: 18px;
  width: auto;
  margin: 0;
}

/* Tooltip on hover when minimized */
.app-sidebar.minimized .nav-item:hover::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  z-index: 120;
  pointer-events: none;
  animation: fadeInTooltip 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInTooltip {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

.app-sidebar.minimized .sidebar-footer {
  padding: 14px 8px;
  justify-content: center;
}

.app-sidebar.minimized .user-badge {
  justify-content: center;
}

/* ================= MAIN WRAPPER ================= */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100vw - var(--sidebar-width));
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrapper.sidebar-minimized {
  margin-left: var(--sidebar-width-minimized);
  width: calc(100vw - var(--sidebar-width-minimized));
}

/* Top Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle-btn {
  display: inline-flex;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  font-size: 16px;
  transition: var(--transition-smooth);
}

.menu-toggle-btn:hover {
  background: var(--border-color);
  color: var(--primary-1);
}

.page-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

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

.time-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Content Body */
.content-body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.view-section.active {
  display: block;
}

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

/* ================= POS LAYOUT ================= */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr var(--cart-width);
  gap: 20px;
  height: calc(100vh - var(--header-height) - 40px);
}

.pos-catalog-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow: hidden;
}

.pos-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-box {
  flex: 1;
  position: relative;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

.search-input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition-smooth);
  color: var(--text-main);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-1);
  box-shadow: 0 0 0 4px var(--primary-1-glow);
}

.barcode-scanner-btn {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.barcode-scanner-btn:hover {
  border-color: var(--primary-1);
  color: var(--primary-1);
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-chips::-webkit-scrollbar {
  height: 4px;
}

.category-chip {
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.category-chip.active {
  background: var(--primary-1);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-1-glow);
}

/* Products Grid */
.product-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
  padding-right: 4px;
  padding-bottom: 16px;
}

.product-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  min-height: 250px;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-2);
}

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

.product-img-wrap {
  height: 120px;
  min-height: 120px;
  flex-shrink: 0;
  background: var(--bg-surface-subtle);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.product-card:hover .product-img {
  transform: scale(1.08);
}

.product-badge-cat {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.product-badge-stock {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--success);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

.product-badge-stock.low {
  background: var(--secondary-2);
}

.product-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  justify-content: space-between;
  gap: 4px;
}

.product-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.product-card-barcode {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.product-card-price {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--primary-1);
}

.product-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-1-glow);
  color: var(--primary-1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.product-card:hover .product-add-btn {
  background: var(--primary-1);
  color: #ffffff;
}

/* ================= POS CART PANEL ================= */
.pos-cart-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  height: 100%;
  overflow: hidden;
}

.cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-subtle);
}

.cart-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Modern Multi-Tier Cart Item Card */
.cart-item-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 13px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-item-card:hover {
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Row 1: Header (Title & Subtotal) */
.cart-item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.cart-item-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  word-break: break-word;
  flex: 1;
}

.cart-item-card-total {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--primary-1);
  white-space: nowrap;
}

/* Row 2: Details (Modifiers & Notes) */
.cart-item-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item-modifier-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cart-mod-tag {
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-1);
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.3;
}

.cart-item-kitchen-note {
  font-size: 11px;
  font-weight: 500;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  word-break: break-word;
}

/* Row 3: Footer (Unit Price, Stepper, Delete) */
.cart-item-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.cart-item-unit-price {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.cart-item-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-qty-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px;
}

.cart-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.cart-qty-btn:hover {
  background: var(--primary-1);
  color: #ffffff;
}

.cart-qty-val {
  min-width: 24px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.cart-item-remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-item-remove-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: scale(1.06);
}

/* ==========================================================================
   CART VIEW MODE SWITCHER & COMPACT LIST ITEM
   ========================================================================== */
.cart-view-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.cart-view-btn {
  width: 26px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.cart-view-btn.active {
  background: var(--primary-1);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
}

.cart-view-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

/* Compact List View Item */
.cart-item-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
  gap: 8px;
}

.cart-item-compact:hover {
  border-color: rgba(79, 70, 229, 0.3);
  background: var(--bg-surface-subtle);
}

.cart-item-compact-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.cart-item-compact-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1px;
  flex-shrink: 0;
}

.compact-qty-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.compact-qty-btn:hover {
  background: var(--primary-1);
  color: #ffffff;
}

.compact-qty-val {
  min-width: 18px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
}

.cart-item-compact-info {
  flex: 1;
  min-width: 0;
}

.cart-item-compact-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.cart-item-compact-sub {
  font-size: 10px;
  color: var(--primary-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.cart-item-compact-note {
  font-size: 10px;
  color: #b45309;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.cart-item-compact-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cart-item-compact-total {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-1);
  white-space: nowrap;
}

.compact-del-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.compact-del-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Cart Summary & Action Area */
.cart-summary {
  padding: 12px 18px 8px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.25s ease;
}

.cart-summary-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  opacity: 1;
}

.cart-summary.collapsed .cart-summary-breakdown {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

.summary-row.total {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text-main);
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  margin-top: 2px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.cart-summary.collapsed .summary-row.total {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.btn-summary-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 9.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.btn-summary-toggle:hover {
  background: var(--bg-surface-hover);
  color: var(--primary-1);
  border-color: var(--primary-1);
}

#cart-summary-chevron {
  transition: transform 0.25s ease;
}

.cart-summary.collapsed #cart-summary-chevron {
  transform: rotate(-90deg);
}

.summary-row.total .total-val {
  color: var(--primary-1);
}

.cart-actions {
  padding: 12px 16px 16px;
}

.btn-checkout {
  padding: 13px;
  background: var(--primary-1);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--primary-1-glow);
  transition: var(--transition-smooth);
}

.btn-clear-cart {
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--secondary-2);
  cursor: pointer;
  font-size: 15px;
}

/* Floating Mobile Cart Bar */
.mobile-cart-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 12px 16px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 80;
  align-items: center;
  justify-content: space-between;
}

.mobile-cart-toggle-btn {
  flex: 1;
  background: var(--primary-1);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px var(--primary-1-glow);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (TABLET & MOBILE)
   ========================================================================== */

/* TABLET VIEW (768px - 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
    --cart-width: 320px;
  }

  .content-body {
    padding: 16px;
  }

  .pos-layout {
    gap: 14px;
  }

  .master-grid {
    grid-template-columns: 1fr;
  }

  .color-pickers-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* MOBILE VIEW (< 768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 270px;
  }

  .sidebar-mini-toggle-btn {
    display: none !important;
  }

  .app-sidebar {
    width: var(--sidebar-width) !important;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }

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

  .app-sidebar.minimized .store-brand-text,
  .app-sidebar.minimized .nav-section-title,
  .app-sidebar.minimized .user-info,
  .app-sidebar.minimized .sidebar-footer > button {
    display: block !important;
  }

  .app-sidebar.minimized .sidebar-header {
    padding: 16px 18px !important;
    justify-content: flex-start !important;
  }

  .app-sidebar.minimized .nav-item {
    width: 100% !important;
    height: auto !important;
    padding: 11px 14px !important;
    justify-content: flex-start !important;
  }

  .app-sidebar.minimized .nav-item span {
    display: inline !important;
  }

  .app-sidebar.minimized .sidebar-nav {
    padding: 16px 12px !important;
    align-items: stretch !important;
  }

  .app-sidebar.minimized .nav-item:hover::after {
    display: none !important;
  }

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

  .main-wrapper,
  .main-wrapper.sidebar-minimized {
    margin-left: 0 !important;
    width: 100vw !important;
  }

  .app-header {
    padding: 0 16px;
  }

  .page-title {
    font-size: 16px;
  }

  .time-badge {
    display: none;
  }

  .content-body {
    padding: 14px 12px 70px; /* Extra padding bottom for mobile bar */
  }

  /* POS on Mobile */
  .pos-layout {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .pos-catalog-area {
    height: auto;
    overflow: visible;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .product-img-wrap {
    height: 105px;
  }

  .product-card-title {
    font-size: 12.5px;
  }

  .product-card-price {
    font-size: 13px;
  }

  /* Cart Drawer on Mobile */
  .pos-cart-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 360px;
    z-index: 150;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 25px rgba(0,0,0,0.15);
  }

  .pos-cart-panel.open {
    transform: translateX(0);
  }

  .cart-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 140;
  }

  .cart-backdrop.active {
    display: block;
  }

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

  .cart-header-close-btn {
    display: block !important;
  }

  /* Tables Floor Plan on Mobile */
  .table-grid-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Reports KPI cards on Mobile */
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  div[style*="grid-template-columns: 1.5fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Modals on Mobile */
  .modal-dialog {
    max-width: 100%;
    margin: 10px;
    max-height: 95vh;
  }

  .payment-tabs-grid,
  .payment-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ULTRA SMALL MOBILE (< 420px) */
@media (max-width: 420px) {
  .product-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .table-grid-container {
    grid-template-columns: 1fr;
  }

  .color-pickers-grid {
    grid-template-columns: 1fr;
  }
}
