@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --secondary-color: #a855f7; /* Purple */
  --accent-color: #f43f5e; /* Rose */
  --bg-dark: #0f172a; /* Deep Slate */
  --bg-dark-card: rgba(30, 41, 59, 0.7);
  --bg-dark-nav: rgba(15, 23, 42, 0.8);
  --text-dark: #f8fafc;
  --text-dark-muted: #94a3b8;
  
  --bg-light: #f8fafc; /* Cool White */
  --bg-light-card: rgba(255, 255, 255, 0.8);
  --bg-light-nav: rgba(248, 250, 252, 0.8);
  --text-light: #0f172a;
  --text-light-muted: #64748b;
  
  /* Current active variables (default: Dark Mode) */
  --bg-main: var(--bg-dark);
  --bg-card: var(--bg-dark-card);
  --bg-nav: var(--bg-dark-nav);
  --text-main: var(--text-dark);
  --text-muted: var(--text-dark-muted);
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow-color: rgba(0, 0, 0, 0.3);
  
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Inter', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
}

[data-theme="light"] {
  --bg-main: var(--bg-light);
  --bg-card: var(--bg-light-card);
  --bg-nav: var(--bg-light-nav);
  --text-main: var(--text-light);
  --text-muted: var(--text-light-muted);
  --border-color: rgba(0, 0, 0, 0.08);
  --shadow-color: rgba(15, 23, 42, 0.08);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
}

/* Custom Scrollbars */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: var(--primary-color);
  border-radius: 20px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: var(--transition-smooth);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Glassmorphism utility */
.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  box-shadow: 0 8px 32px 0 var(--shadow-color);
}

/* App Header & Navbar */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  transition: var(--transition-smooth);
}

header.scrolled {
  height: 70px;
  box-shadow: 0 4px 20px var(--shadow-color);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo-img {
  height: 74px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
  transition: var(--transition-smooth);
}
.header-logo-img:hover {
  transform: scale(1.03);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Theme Toggle Button */
.theme-toggle, .cart-trigger, .admin-trigger, .btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle:hover, .cart-trigger:hover, .admin-trigger:hover, .btn-icon:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.cart-trigger {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--accent-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Hero Section */
.hero {
  padding: 140px 5% 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* Dynamic Background Glows */
.glow-1, .glow-2 {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}
.glow-1 {
  background: var(--primary-color);
  top: 10%;
  left: 20%;
}
.glow-2 {
  background: var(--secondary-color);
  bottom: 20%;
  right: 20%;
}

.hero-main-logo {
  height: 140px;
  max-width: 90%;
  object-fit: contain;
  margin-bottom: 25px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 15px;
  letter-spacing: -1px;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin-bottom: 30px;
}

/* Search and Filter Section */
.controls-container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 30px;
  padding: 20px;
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  height: 54px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0 20px 0 50px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Filter Tags */
.filter-tags {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 5px 0;
  scrollbar-width: none; /* Hide standard scrollbar */
}
.filter-tags::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.filter-btn *, .sub-filter-btn * {
  pointer-events: none;
}

.filter-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transform: translateY(-1px);
}

.filter-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

/* Sorting, Counters & Stats */
.catalog-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 15px;
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sort-select {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  outline: none;
}
.sort-select option {
  background-color: var(--bg-dark);
  color: white;
}

/* Products Grid */
.products-grid {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 25px;
  min-height: 70vh; /* Prevents page jump during redraw */
}

/* Product Card */
.product-card {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: var(--transition-smooth);
  position: relative;
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px var(--shadow-color);
  border-color: rgba(99, 102, 241, 0.3);
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 85%; /* 4:3 Aspect Ratio */
  background-color: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.product-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 15px;
  transition: var(--transition-smooth);
}

.product-card:hover .product-image {
  transform: scale(1.06);
}

.category-badge {
  position: absolute;
  z-index: 2;
  top: 15px;
  left: 15px;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-name {
  word-break: break-word;
  overflow-wrap: break-word;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
  min-height: 2.6rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.product-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-item {
  display: flex;
  justify-content: space-between;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.price-container {
  display: flex;
  flex-direction: column;
}

.price-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.price-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-color);
}

.add-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.add-btn:hover {
  background-color: var(--primary-hover);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Sidebar Drawer (Cart) */
.drawer {
  position: fixed;
  top: 0;
  right: -450px; /* Hidden by default */
  width: 100%;
  max-width: 420px;
  height: 100%;
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,0.5);
  overscroll-behavior: contain;
}

.drawer.open {
  transform: translateX(-450px);
}

.drawer-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.close-btn:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

.clear-cart-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-fast);
}
.clear-cart-btn:hover {
  color: var(--accent-color);
  background: rgba(244, 63, 94, 0.1);
  transform: scale(1.05);
}

.drawer-content {
  flex-grow: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  margin: auto 0;
  padding: 40px 0;
}
.cart-empty-icon {
  font-size: 3rem;
  color: rgba(99, 102, 241, 0.2);
  margin-bottom: 10px;
}

/* Cart Item */
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--border-radius-sm);
  background-color: rgba(255,255,255,0.01);
  border: 1px solid var(--border-color);
  align-items: center;
}

.cart-item-image {
  width: 50px;
  height: 50px;
  object-fit: contain;
  background-color: white;
  border-radius: var(--border-radius-sm);
  padding: 4px;
}

.cart-item-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.cart-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cart-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Quantity controls in cart */
.qty-controls {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  background-color: rgba(0,0,0,0.1);
}

.qty-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}
.qty-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

.qty-val {
  font-size: 0.8rem;
  font-weight: 600;
  width: 24px;
  text-align: center;
}

.remove-item {
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  transition: var(--transition-fast);
}
.remove-item:hover {
  color: var(--accent-color);
  transform: scale(1.1);
}

/* Drawer Footer / Checkout */
.drawer-footer {
  padding: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cart-summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}
.cart-total-line {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-family: var(--font-display);
  font-weight: 800;
}

.customer-info-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 5px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-input {
  width: 100%;
  height: 38px;
  background-color: rgba(0,0,0,0.1);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 0 10px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
}
.form-input option, select option {
  background-color: var(--bg-main);
  color: var(--text-main);
}

/* Hide default browser HTML5 number inputs spin buttons */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}


.whatsapp-submit {
  width: 100%;
  height: 50px;
  background-color: #25d366; /* WhatsApp Green */
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-fast);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.whatsapp-submit:hover {
  background-color: #128c7e;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.whatsapp-submit:disabled {
  background-color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Backdrop overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  display: none;
}
.overlay.active {
  display: block;
}

/* Admin / Product CRUD Panel */
.admin-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 600px;
  max-height: 90vh; /* Increased from 85vh for better resolution scaling */
  z-index: 110;
  border-radius: var(--border-radius-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.admin-modal form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.admin-modal.active {
  display: flex;
  transform: translate(-50%, -50%) scale(1);
}

#adminModal {
  max-width: 1050px;
  width: 95%;
  max-height: 90vh;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: rgba(255,255,255,0.05);
}

.btn-danger {
  background-color: var(--accent-color);
  color: white;
}
.btn-danger:hover {
  background-color: #e11d48;
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
}
.admin-list-item:last-child {
  border-bottom: none;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%) translateY(150px);
  padding: 16px 32px;
  border-radius: var(--border-radius-md);
  color: white;
  z-index: 9999;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background-color: #1e293b; /* Default solid background color */
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  pointer-events: none;
  min-width: 280px;
  max-width: 90%;
}

.toast.active {
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  background-color: #10b981 !important; /* Emerald */
  border-color: rgba(16, 185, 129, 0.2);
}
.toast-info {
  background-color: var(--primary-color) !important;
  border-color: rgba(99, 102, 241, 0.2);
}
.toast-warning {
  background-color: #f59e0b !important; /* Amber */
  border-color: rgba(245, 158, 11, 0.2);
}
.toast-error {
  background-color: #ef4444 !important; /* Red */
  border-color: rgba(239, 68, 68, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header {
    padding: 0 4%;
  }
  .hero h1 {
    font-size: 2.2rem;
  }
  .hero p {
    font-size: 0.95rem;
  }
  .controls-container {
    padding: 15px;
  }
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
  }
  .product-card {
    border-radius: var(--border-radius-md);
  }
  .card-content {
    padding: 12px;
  }
  .product-name {
  word-break: break-word;
  overflow-wrap: break-word;
    font-size: 0.9rem;
    min-height: 2.2rem;
    margin-bottom: 4px;
  }
  .product-meta {
    font-size: 0.75rem;
    margin-bottom: 10px;
  }
  .price-value {
    font-size: 1.1rem;
  }
  .add-btn {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
  .add-btn span {
    display: none; /* Hide text, show only icon + on small mobile */
  }
  .drawer {
    max-width: 100%;
    right: -100%;
  }
  .drawer.open {
    transform: translateX(-100%);
  }
}

@media (max-width: 576px) {
  header {
    height: 65px;
  }
  header.scrolled {
    height: 60px;
  }
  .header-logo-img {
    height: 48px;
  }
  .theme-toggle, .cart-trigger {
    width: 36px;
    height: 36px;
  }
  .hero {
    padding: 100px 4% 25px;
  }
  .hero h1 {
    font-size: 1.85rem;
    line-height: 1.2;
    margin-bottom: 8px;
  }
  .hero p {
    font-size: 0.85rem;
    margin-bottom: 20px;
  }
  .controls-container {
    width: 94%;
    padding: 12px;
    gap: 12px;
    margin-bottom: 20px;
  }
  .search-input {
    height: 44px;
    font-size: 0.9rem;
    padding-left: 40px;
  }
  .search-icon {
    left: 14px;
    width: 16px;
    height: 16px;
  }
  .filter-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
  .sub-filter-btn {
    padding: 5px 12px;
    font-size: 0.7rem;
    min-height: 38px;
  }
  .brand-logo-img {
    height: 22px;
    width: 73px;
  }
  .catalog-info {
    width: 94%;
    font-size: 0.8rem;
    margin-bottom: 10px;
  }
  .sort-select {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  .products-grid {
    width: 94%;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 40px;
  }
  .product-card {
    border-radius: var(--border-radius-md);
  }
  .card-image-wrapper {
    padding-top: 100%; /* Square is cleaner on narrow cards */
  }
  .product-image {
    padding: 10px;
  }
  .category-badge {
    top: 8px;
    left: 8px;
    font-size: 0.6rem;
    padding: 2px 6px;
  }
  .card-content {
    padding: 10px;
  }
  .product-name {
  word-break: break-word;
  overflow-wrap: break-word;
    font-size: 0.8rem;
    min-height: 2.2rem;
    line-height: 1.25;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .product-meta {
    font-size: 0.7rem;
    gap: 2px;
    margin-bottom: 8px;
  }
  /* Labels are now shown on mobile per user request */
  .meta-item {
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
  }
  [data-theme="dark"] .meta-item {
    background: rgba(255, 255, 255, 0.04);
  }
  .card-footer {
    padding-top: 8px;
  }
  .price-label {
    font-size: 0.55rem;
  }
  .price-value {
    font-size: 1.05rem;
  }
  .add-btn {
    padding: 6px 10px;
    border-radius: 6px;
  }
  .add-btn svg {
    width: 16px;
    height: 16px;
  }
  .drawer-header {
    padding: 16px;
  }
  .drawer-content {
    padding: 16px;
    gap: 10px;
  }
  .cart-item {
    padding: 8px;
    gap: 8px;
  }
  .cart-item-image {
    width: 40px;
    height: 40px;
    padding: 2px;
  }
  .cart-item-name {
    font-size: 0.75rem;
  }
  .cart-item-price {
    font-size: 0.75rem;
  }
  .qty-btn {
    width: 22px;
    height: 22px;
  }
  .qty-val {
    width: 18px;
    font-size: 0.75rem;
  }
  .drawer-footer {
    padding: 16px;
    gap: 10px;
  }
  .cart-total-line {
    font-size: 1.05rem;
  }
  .whatsapp-submit {
    height: 44px;
    font-size: 0.9rem;
  }
  
  /* Sections headers spacing for mobile */
  .category-section-header {
    font-size: 1.15rem;
    padding: 8px 12px;
    margin-top: 25px;
    margin-bottom: 10px;
    border-left-width: 4px;
  }
  .brand-section-header {
    font-size: 1rem;
    margin-top: 15px;
    margin-bottom: 5px;
  }
  
  /* Admin Modal on mobile */
  #adminModal {
    width: 96%;
    max-height: 95vh;
  }
  .admin-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
  }
  .admin-list-item > div:last-child {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
}

/* Premium Admin Password Shake Feedback */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Wholesaler Print Layout (PDF Export) */
.print-only {
  display: none !important;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: white !important;
    color: #0f172a !important;
    font-family: 'Outfit', 'Inter', sans-serif !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  body > *:not(#printContainer) {
    display: none !important;
  }
  
  #printContainer {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
  }
  
  .print-page {
    page-break-after: always;
    break-after: page;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    padding: 12mm 15mm 12mm 15mm;
    background: white !important;
    overflow: hidden;
  }
  
  .print-page:last-child {
    page-break-after: avoid;
    break-after: avoid;
  }
  
  .print-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 10px;
    margin-bottom: 20px;
    height: 115px;
  }
  
  .print-logo-section {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }
  
  .print-logo-img {
    height: 108px;
    object-fit: contain;
  }
  
  .print-header-brand {
    flex: 1.2;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .print-header-category {
    flex: 1;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-family: 'Outfit', sans-serif !important;
    font-style: italic !important;
    font-size: 1.8rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    color: #6366f1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding-right: 15px !important;
  }
  
  .print-header-brand svg, .print-header-brand img, .print-header-brand .brand-logo-img {
    height: 55px; /* Double the size of brand logos in PDF header! */
    width: 183px;
    object-fit: contain;
    transition: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .print-header-brand-text {
    font-size: 1.55rem;
    color: #0f172a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-weight: 800;
    letter-spacing: -0.2px;
  }
  
  .print-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 20px;
    flex-grow: 1;
    height: calc(100% - 100px); /* Fill the vertical space */
  }
  
  .print-card {
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 20px;
    align-items: center;
    background: white !important;
    box-sizing: border-box;
    height: 100%;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .print-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px;
    background: white !important;
    flex-shrink: 0;
  }
  
  .print-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    height: 100%;
    justify-content: center;
  }
  
  .print-category {
    font-family: 'Outfit', sans-serif !important;
    font-style: italic !important;
    font-weight: 800 !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6366f1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    display: inline-block;
    padding-right: 10px !important;
  }
  
  .print-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    margin-bottom: 2px;
    word-wrap: break-word;
  }
  
  .print-details {
    font-size: 0.8rem;
    color: #1e293b;
    line-height: 1.4;
  }
  
  .print-price-row {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 8px;
  }
  
  .print-price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .print-price-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #475569;
  }
  
  .print-price-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .print-page-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #cbd5e1;
    padding-top: 8px;
    margin-top: 15px;
    font-size: 0.75rem;
    color: #475569;
    height: 20px;
  }
}

/* Premium Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox-modal.active {
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 25px;
  right: 30px;
  background: transparent;
  border: none;
  color: white;
  font-size: 2.8rem;
  cursor: pointer;
  z-index: 310;
  transition: var(--transition-fast);
}

.lightbox-close:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-modal.active .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.lightbox-caption {
  margin-top: 15px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  text-align: center;
  background-color: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(5px);
  padding: 8px 24px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Premium Subcategory / Brand Tags */
.sub-filter-btn {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* Larger buttons for actual brand logos! */
}

/* Fix Safari inline SVG sizing in flex/button containers */
.sub-filter-btn svg,
.brand-section-header svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 30px; /* Noticeably larger brand logos! */
  width: 100px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
  transition: var(--transition-fast);
  pointer-events: none;
  flex-shrink: 0; /* Prevent Safari from shrinking logo to 0 */
  display: block;
}

.sub-filter-btn svg {
  transition: var(--transition-fast);
}

.sub-filter-btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  transform: translateY(-2.5px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.sub-filter-btn:hover .brand-logo-img {
  transform: scale(1.08);
}

.sub-filter-btn:hover svg {
  transform: scale(1.08);
}

.sub-filter-btn.active {
  background-color: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
  box-shadow: 0 6px 16px rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
}

.sub-filter-btn.active .brand-logo-img {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

.sub-filter-btn.active svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Brand Section Headers in Grid */
.brand-section-header {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 25px;
  margin-bottom: 5px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-section-header::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.3rem;
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

.brand-section-header.has-logo {
  border-bottom: none;
  padding-bottom: 0;
}

.brand-section-header.has-logo::before {
  display: none;
}

/* Brand Section Header spacing adjustment for the first element */
.products-grid > .brand-section-header:first-child {
  margin-top: 10px;
}

/* Category Section Headers in Grid */
.category-section-header {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 45px;
  margin-bottom: 15px;
  padding: 12px 20px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.04));
  border-left: 5px solid var(--primary-color);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.category-section-header span {
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.products-grid > .category-section-header:first-child {
  margin-top: 15px;
}

/* Custom Category Icon Image Styles */
.category-icon-img {
  width: 1.3rem;
  height: 1.3rem;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 6px;
  display: inline-block;
}

.category-icon-img-lg {
  width: 2.2rem;
  height: 2.2rem;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 8px;
  display: inline-block;
}

/* ==========================================================================
   PERSISTENT RESPONSIVE TWO-ROW WRAPPING FOR CATEGORY TAGS (LXC FILED FIXED)
   ========================================================================== */
#categoryTags {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 8px 10px !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  width: 100% !important;
  max-width: 780px !important; /* Forces 9 categories into exactly 2 rows on PC */
  margin: 15px auto 5px !important;
  padding: 5px 0 !important;
}

#categoryTags::-webkit-scrollbar {
  display: none !important;
}

/* On mobile devices, adapt fully and wrap into multiple rows to prevent screen overflow */
@media (max-width: 768px) {
  #categoryTags {
    max-width: 100% !important;
    gap: 6px 8px !important;
    margin: 10px auto 5px !important;
  }
}

@media (max-width: 380px) {
  .products-grid {
    gap: 8px; /* Reduce gap to fit 2 columns better */
  }
  .card-content {
    padding: 8px;
  }
  .product-name {
    font-size: 0.72rem;
    min-height: 2.1rem;
  }
  .price-value {
    font-size: 0.95rem;
  }
  .add-btn {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
  .add-btn svg {
    width: 14px;
    height: 14px;
  }
}

/* Premium Barcode Scanner Styles */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input {
  flex: 1;
  padding-right: 50px !important; /* Space for barcode button */
}

.barcode-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  z-index: 5;
}

.barcode-btn:hover {
  color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.05);
  transform: scale(1.08);
}

.barcode-btn svg {
  transition: var(--transition-fast);
  stroke: currentColor;
}

/* Scanner Modal */
.scanner-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scanner-modal.active {
  opacity: 1;
}

.scanner-container {
  width: 90%;
  max-width: 450px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scanner-modal.active .scanner-container {
  transform: scale(1);
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.scanner-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

/* Laser animation overlay */
.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ef4444, transparent);
  box-shadow: 0 0 10px #ef4444;
  z-index: 10;
  animation: laserScan 2s linear infinite;
  pointer-events: none;
}

@keyframes laserScan {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* Premium overrides for html5-qrcode library UI */
#scannerReader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: var(--border-radius-md) !important;
}

#scannerReader {
  border: 2px solid var(--border-color) !important;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.6);
  position: relative;
}
