/* ============================================
   Catalog Page — Styles v2
   Navy #001f3f  |  Gold #FFD700
   ============================================ */

/* === PAGE LAYOUT === */
.catalog-page {
  min-height: 100vh;
  background: var(--gray-50);
}

/* === STICKY HEADER === */
.catalog-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy);
  border-bottom: 3px solid var(--gold);
  padding: 0 24px;
}
.header-inner {
  max-width: 1300px; margin: 0 auto; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.header-brand {
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
}
.header-logo {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}
.header-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.header-brand h2 {
  font-size: 1.1rem; color: var(--white);
  font-weight: 700;
}
.header-brand h2 span { color: var(--gold); }

/* Search in header */
.header-search {
  flex: 1; max-width: 480px;
  position: relative;
}
.header-search .search-icon {
  position: absolute; right: 20px; top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  pointer-events: none;
  transition: var(--transition);
}
.header-search .search-input {
  width: 100%;
  padding: 10px 18px 10px 44px;
  padding-right: 44px;
  border-radius: var(--radius-xl);
  border: 1.5px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: var(--white);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}
.header-search .search-input::placeholder { color: rgba(255,255,255,0.4); }
.header-search .search-input:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(255,215,0,0.15);
}
.header-search .search-input:focus ~ .search-icon { color: var(--gold); }

.back-link {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem; font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.15);
  transition: var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
}
.back-link:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(255,215,0,0.08);
}

/* === CONTROLS STRIP === */
.controls-strip {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  position: relative; z-index: 90;
}
.controls-inner {
  max-width: 1300px; margin: 0 auto; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}

/* Mode Toggle (Brand / Category) */
.mode-toggle {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-xl);
  padding: 4px;
  border: 1px solid var(--gray-200);
  gap: 4px;
  flex-shrink: 0;
}
.mode-btn {
  padding: 8px 20px;
  border-radius: 20px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.88rem; font-weight: 600;
  color: var(--gray-600);
  background: transparent;
  transition: var(--transition);
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.mode-btn:hover { color: var(--navy); }
.mode-btn.active {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,31,63,0.25);
}

/* Results count */
.results-count {
  font-size: 0.85rem;
  color: var(--gray-500);
  flex: 1;
  text-align: center;
}
.results-count span { color: var(--navy); font-weight: 700; font-family: 'Inter', sans-serif; }

/* View Toggle (Grid / Table) */
.view-toggle {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 4px; gap: 2px;
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.view-btn {
  width: 36px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--gray-500);
  background: transparent;
  transition: var(--transition);
  title: attr(title);
}
.view-btn:hover { color: var(--navy); }
.view-btn.active {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,31,63,0.2);
}

/* === FILTER CHIPS === */
.filter-bar {
  position: sticky;
  top: 64px;
  z-index: 99;
  background: var(--gray-50);
  padding: 12px 24px;
  max-width: 100%;
  margin: 0 auto;
  border-bottom: 1.5px solid var(--gray-200);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.filter-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 4px;
  scrollbar-width: none; /* Hide scrollbar Firefox */
  animation: fadeSlideUp 0.3s ease;
}
.filter-chips::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}
.filter-chip {
  padding: 6px 18px;
  border-radius: var(--radius-xl);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.85rem; font-weight: 500;
  color: var(--gray-700);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.filter-chip:hover {
  background: rgba(255,215,0,0.08);
  border-color: var(--gold-dark);
  color: var(--gold-deeper);
}
.filter-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
  box-shadow: 0 3px 10px rgba(0,31,63,0.2);
}

/* === PRODUCT AREA === */
.product-area {
  max-width: 1300px; margin: 0 auto;
  padding: 24px;
}

/* ── Grouped View Container ── */
.product-area.grouped-view {
  display: flex; flex-direction: column; gap: 0;
}

/* ── Product Group ── */
.product-group {
  animation: fadeSlideUp 0.4s ease backwards;
  margin-bottom: 40px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding-bottom: 20px;
}

/* Group Header */
.group-header {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--navy), var(--navy-medium));
  color: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-bottom: 5px;
}
.group-icon-wrap {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.group-icon-wrap.is-brand {
  font-family: 'Inter', monospace;
  font-size: 0.85rem; font-weight: 900;
  background: rgba(255,215,0,0.2);
  color: var(--gold);
  letter-spacing: 0.5px;
}
.group-header-info { flex: 1; }
.group-title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--white); margin: 0 0 2px;
}
.group-subtitle {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55); font-weight: 400;
}
.group-count {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem; font-weight: 700;
  padding: 4px 14px;
  background: var(--gold);
  border-radius: 20px;
  color: var(--navy);
  white-space: nowrap; flex-shrink: 0;
}

/* ── Subgroup ── */
.product-subgroup {
  background: var(--white);
  border: 1px solid var(--gray-200);
  margin: 15px 20px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.product-subgroup:first-child { margin-top: 0; }

.subgroup-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.subgroup-icon {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  font-size: 0.8rem; font-weight: 900;
  color: var(--navy);
  font-family: 'Inter', monospace;
  flex-shrink: 0;
}
.subgroup-title {
  font-size: 0.9rem; font-weight: 600;
  color: var(--navy); flex: 1;
}
.subgroup-count {
  font-size: 0.75rem; font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-200);
  padding: 2px 10px;
  border-radius: 10px;
}

/* ── Grid inside subgroup ── */
.subgroup-grid {
  padding: 15px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* ── TABLE inside subgroup ── */
.subgroup-table {
  width: 100%;
  border-collapse: collapse;
}
.subgroup-table thead th {
  text-align: right;
  padding: 10px 16px;
  background: var(--navy-faint);
  color: var(--navy);
  font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.3px;
  border-bottom: 2px solid rgba(0,31,63,0.15);
}
.subgroup-table tbody tr {
  border-bottom: 1px solid var(--gray-200);
  transition: background 0.15s;
}
.subgroup-table tbody tr:last-child { border-bottom: none; }
.subgroup-table tbody tr:hover { background: var(--gold-faint); }
.subgroup-table tbody td {
  padding: 11px 16px;
  font-size: 0.88rem;
  color: var(--gray-800);
  vertical-align: middle;
}
.tbl-code {
  font-family: 'Inter', monospace;
  font-weight: 700; font-size: 0.82rem;
  color: var(--navy);
  background: var(--navy-faint);
  padding: 3px 10px;
  border-radius: 6px;
  display: inline-block;
  white-space: nowrap;
}
.tbl-name { font-weight: 600; color: var(--gray-900); }
.tbl-price {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  color: var(--gold-deeper);
  font-size: 0.95rem;
  white-space: nowrap;
}
.price-cell {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  color: var(--gold-dark);
}
.table-thumb {
  width: 45px; height: 45px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--gray-200);
}
.table-no-image {
  width: 45px; height: 45px;
  border-radius: 6px;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  opacity: 0.5;
}
.brand-tag-sm {
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── PRODUCT CARD (Grid Mode) ── */
.product-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  animation: fadeSlideUp 0.4s ease backwards;
  display: flex; 
  flex-direction: column;
  padding: 0;
  height: 280px; 
  position: relative;
  overflow: visible; /* To allow buttons to pop out if needed */
}
.product-card:hover {
  transform: translateY(-5px);
  border-color: var(--gold);
  box-shadow: 0 8px 32px rgba(255,215,0,0.15), var(--shadow-md);
}

/* Stock Status Styling */
.product-card.out-of-stock {
  border-color: #feb2b2 !important;
  box-shadow: none !important;
  border-width: 2px;
}
.product-card.out-of-stock .product-image img {
  filter: grayscale(0.5);
  opacity: 0.7;
}

/* Stock Watermark Style (Appears over image) */
.stock-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  background: rgba(229, 62, 62, 0.15);
  color: #c53030;
  border: 2px solid #c53030;
  padding: 5px 15px;
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
  border-radius: 8px;
  opacity: 0.8;
}
.stock-badge.available {
  background: rgba(56, 161, 105, 0.1);
  color: #2f855a;
}
.stock-badge.low-stock {
  background: rgba(237, 137, 54, 0.1);
  color: #c05621;
}
.stock-badge.out-of-stock {
  background: rgba(229, 62, 62, 0.1);
  color: #c53030;
}
.out-of-stock-label-sm {
  font-size: 0.75rem;
  font-weight: 700;
  color: #c53030;
  background: #fff5f5;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #feb2b2;
}

/* Card Image */
.product-image {
  height: 180px; /* Reduced from 200px to give more room for brand */
  background: var(--gray-50);
  border-radius: var(--radius-md) var(--radius-md) 0 0; /* Match card radius */
  overflow: hidden; /* Keep image inside its own rounded corners */
  display: flex; 
  align-items: center; 
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid var(--gray-100);
}
.product-image img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
  padding: 0;
}
.product-card:hover .product-image img {
  transform: scale(1.08);
}
.no-image {
  font-size: 3rem;
  opacity: 0.15;
}

/* Hero Image Overlays */
.badges-wrapper {
  position: absolute;
  top: 8px;
  right: 8px; /* Starting corner in RTL */
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Aligns left corners of badges */
  gap: 4px;
  z-index: 5;
}
.price-label {
  background: rgba(255, 215, 0, 0.85);
  color: #001329;
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.code-label {
  background: rgba(0, 31, 63, 0.7); /* Back to sticker style */
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Mobile specific sizing for badges */
@media (max-width: 768px) {
  .badges-wrapper {
    top: 6px;
    right: 6px;
    gap: 3px;
  }
  .price-label {
    font-size: 0.65rem;
    padding: 1px 6px;
  }
  .code-label {
    font-size: 0.5rem;
    padding: 1px 5px;
  }
}
.placeholder-icon {
  font-size: 4rem;
  opacity: 0.15;
}

/* Category background colors */
.cat-charger    { background: linear-gradient(135deg, #001f3f, #003577); }
.cat-headphone  { background: linear-gradient(135deg, #2c0066, #4a0099); }
.cat-cable      { background: linear-gradient(135deg, #003322, #005533); }
.cat-powerbank  { background: linear-gradient(135deg, #7a1f00, #b33000); }
.cat-holder     { background: linear-gradient(135deg, #4a003f, #780060); }
.cat-earbuds    { background: linear-gradient(135deg, #003366, #005599); }
.cat-gaming     { background: linear-gradient(135deg, #1a0033, #330066); }
.cat-watch      { background: linear-gradient(135deg, #003322, #006644); }
.cat-tablet     { background: linear-gradient(135deg, #001f3f, #004080); }
.cat-projector  { background: linear-gradient(135deg, #1a1100, #443300); }
.cat-mic        { background: linear-gradient(135deg, #001f3f, #002d5a); }
.cat-camera     { background: linear-gradient(135deg, #1a0a00, #441500); }
.cat-gimbal     { background: linear-gradient(135deg, #001a33, #003366); }
.cat-usb        { background: linear-gradient(135deg, #001a1a, #003333); }
.cat-speaker    { background: linear-gradient(135deg, #1a001f, #33003f); }
.cat-fan        { background: linear-gradient(135deg, #00111f, #002233); }
.cat-car        { background: linear-gradient(135deg, #1a1100, #332200); }
.cat-mobile     { background: linear-gradient(135deg, #001f3f, #003566); }
.cat-keyboard   { background: linear-gradient(135deg, #0d001f, #1a0044); }
.cat-beauty     { background: linear-gradient(135deg, #3f0011, #66001c); }
.cat-glasses    { background: linear-gradient(135deg, #001f1f, #003333); }
.cat-home       { background: linear-gradient(135deg, #1a1700, #332e00); }
.cat-vr         { background: linear-gradient(135deg, #1a0033, #2d0055); }
.cat-accessories{ background: linear-gradient(135deg, #001a3f, #002b66); }
.cat-screen     { background: linear-gradient(135deg, #001f1f, #004444); }

/* Details Button (floating !) */
.details-btn {
  position: absolute; top: 8px; left: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 1.5px solid rgba(255,255,255,0.6);
  color: var(--navy);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem; font-weight: 900;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 10;
  backdrop-filter: blur(4px);
}
.details-btn:hover {
  background: var(--white);
  transform: scale(1.2);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.details-btn.open {
  background: var(--gold);
  border-color: #ffe033;
  color: var(--navy);
  box-shadow: 0 4px 14px rgba(255,215,0,0.5);
}

/* Card Body */
.card-body {
  padding: 8px;
  display: flex; 
  flex-direction: column; 
  gap: 6px;
  flex: 1;
  position: relative;
  justify-content: flex-start;
}

.card-title-row {
  display: block;
  height: 32px; /* Reduced height due to 80% image */
  overflow: hidden;
}

.card-title-row h3 {
  font-weight: 700;
  color: var(--navy); 
  line-height: 1.3;
  margin: 0;
  display: block;
}

/* Dynamic Font Sizing for Names (Smaller for 80% image layout) */
.name-normal { font-size: 0.8rem; }
.name-sm { font-size: 0.7rem; }
.name-xs { font-size: 0.6rem; }

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: auto;
  padding-bottom: 2px;
}
.card-brand {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--gray-400);
}

/* Action Corner */
.action-corner {
  position: absolute;
  bottom: 4px;
  left: 4px; /* Securely inside the corner */
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.mini-add-btn {
  width: 38px;
  height: 38px;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem !important;
  box-shadow: 0 4px 12px rgba(0,31,63,0.3);
  margin-left: 2px;
  border: 2px solid var(--white) !important; /* Stand out over edge */
}
.mini-add-btn.in-cart {
  width: auto;
  min-width: 38px;
  border-radius: 19px !important;
  padding: 0 10px !important;
  font-size: 0.85rem !important;
  background: #38a169 !important;
}

/* Details Panel (accordion) */
.details-panel {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}
.details-list {
  list-style: none; padding: 10px 0 2px; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.details-list li {
  display: flex; gap: 8px;
  font-size: 0.79rem; line-height: 1.5;
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}
.detail-label {
  font-weight: 700; color: var(--navy);
  min-width: 80px; flex-shrink: 0;
}
.detail-value { color: var(--gray-700); flex: 1; }

/* No Results */
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: var(--gray-500);
  grid-column: 1 / -1;
}
.no-results .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.no-results h3 { color: var(--gray-400); margin-bottom: 8px; }

/* === CATALOG FOOTER === */
.catalog-footer {
  padding: 40px 24px; text-align: center;
  border-top: 1px solid var(--gray-200);
  background: var(--white); margin-top: 40px;
}
.catalog-footer p { color: var(--gray-600); font-size: 0.88rem; }
.catalog-footer .brand { color: var(--gold-dark); font-weight: 700; }
.catalog-footer .phone {
  display: block; margin-top: 6px;
  font-family: 'Inter', sans-serif; font-weight: 700;
  color: var(--navy); letter-spacing: 1px;
}

/* === ANIMATIONS === */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === RESPONSIVE === */
@media (min-width: 769px) {
  .desktop-hide { display: none !important; }
}

@media (max-width: 992px) {
  .subgroup-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}
@media (max-width: 768px) {
  .header-brand h2 { display: none; }
  .controls-inner  { gap: 10px; }
  .mode-btn span   { display: none; }
  .mode-btn        { padding: 8px 14px; }
  .filter-bar      { padding: 12px 16px 0; }
  .product-area    { padding: 16px; }
  .subgroup-grid   { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-image      { height: 130px; }
  /* Table on mobile: hide brand column */
  .subgroup-table thead th:last-child,
  .subgroup-table tbody td:last-child { display: none; }
}
@media (max-width: 480px) {
  .header-inner    { height: 56px; padding: 0 10px; }
  .controls-strip  { top: 56px; padding: 4px 10px; }
  .controls-inner  { height: 50px; gap: 5px; }
  .mode-btn        { padding: 6px 10px; font-size: 0.75rem; }
  .results-count   { font-size: 0.7rem; }
  
  .product-area    { padding: 8px; }
  
  /* 2 Columns with tight fit */
  .subgroup-grid { 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    padding: 5px; 
  }
  
  .product-card {
    height: 280px;
    border-radius: 12px;
  }
  
  .product-image {
    height: 140px;
  }
  
  .card-body {
    padding: 6px;
    gap: 4px;
  }
  
  .card-title-row {
    height: 34px;
  }
  
  .card-title-row h3 {
    font-size: 0.72rem !important;
    line-height: 1.2;
  }
  
  .card-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    border: none;
    padding: 0;
  }
  
  .card-brand {
    font-size: 0.6rem;
  }
  
  .stock-badge {
    font-size: 0.55rem;
    padding: 2px 6px;
    top: 6px;
    left: 6px;
  }
  
  /* Position cart button carefully in 2-column mode */
  .action-corner {
    position: absolute;
    bottom: 5px;
    left: 5px;
    margin-top: 0;
    width: auto;
  }
  
  .mini-add-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.85rem !important;
    border-radius: 50% !important;
  }
  
  .mini-add-btn.in-cart {
    width: auto !important;
    min-width: 32px !important;
    padding: 0 6px !important;
    border-radius: 16px !important;
    font-size: 0.7rem !important;
  }
}

/* ═══════════════════════════════════════
   SHOPPING CART STYLES
   ═══════════════════════════════════════ */

/* ── Add to Cart Buttons ── */
.cart-add-btn {
  flex: 1; /* Take all available space */
  margin-top: 0; /* Remove margin-top because parent handle spacing */
  padding: 10px 8px;
  border: 2px solid var(--navy);
  border-radius: 8px;
  background: transparent;
  color: var(--navy);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap; /* Prevent text wrapping */
}
.cart-add-btn:hover {
  background: var(--navy);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,31,63,0.2);
}
.cart-add-btn.in-cart {
  background: #f0fff4;
  border-color: #38a169;
  color: #276749;
}

.cart-add-btn-sm {
  padding: 6px 12px;
  border: 1.5px solid var(--navy);
  border-radius: 6px;
  background: transparent;
  color: var(--navy);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.cart-add-btn-sm:hover { background: var(--navy); color: white; }
.cart-add-btn-sm.in-cart { background: #f0fff4; border-color: #38a169; color: #276749; }

/* ── Floating Cart Bar ── */
#cartBar {
  position: fixed;
  bottom: -120px;
  left: 0; right: 0;
  z-index: 500;
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0 16px 16px;
}
#cartBar.visible { bottom: 0; }
#cartBar.flash .cart-bar-inner {
  animation: cartPulse 0.4s ease;
}
.cart-bar-inner {
  max-width: 900px;
  margin: 0 auto;
  background: var(--navy);
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 -4px 40px rgba(0,31,63,0.35);
  border: 1px solid rgba(255,215,0,0.3);
}
.cart-bar-info {
  display: flex; align-items: center; gap: 14px;
  color: white; font-size: 0.9rem;
}
.cart-bar-icon { font-size: 1.4rem; }
.cart-bar-label { color: rgba(255,255,255,0.75); }
.cart-bar-label strong { color: white; font-family: 'Inter', sans-serif; }
.cart-bar-total { color: var(--gold); font-weight: 700; font-size: 1rem; }
.cart-bar-total strong { font-family: 'Inter', sans-serif; font-size: 1.1rem; }
.cart-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Cart Buttons Shared ── */
.cart-btn-cancel {
  background: rgba(229,62,62,0.15);
  color: #fc8181;
  border: 1px solid rgba(229,62,62,0.3);
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s;
  white-space: nowrap;
}
.cart-btn-cancel:hover { background: rgba(229,62,62,0.3); }

.cart-btn-review {
  background: rgba(255,215,0,0.15);
  color: var(--gold);
  border: 1px solid rgba(255,215,0,0.3);
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s;
  white-space: nowrap;
}
.cart-btn-review:hover { background: rgba(255,215,0,0.25); }

.cart-btn-send {
  background: #25D366;
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(37,211,102,0.4);
}
.cart-btn-send:hover { background: #1da851; transform: translateY(-1px); }

.cart-btn-back {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s;
  white-space: nowrap;
}
.cart-btn-back:hover { background: rgba(255,255,255,0.2); }

/* ── Cart Modal ── */
#cartModal {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  pointer-events: none; opacity: 0;
  transition: opacity 0.3s;
}
#cartModal.open { pointer-events: all; opacity: 1; }

.cart-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.cart-modal-box {
  position: relative; z-index: 1;
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 760px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.25);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#cartModal.open .cart-modal-box { transform: translateY(0); }

.cart-modal-header {
  background: var(--navy);
  color: white;
  padding: 18px 24px;
  border-radius: 20px 20px 0 0;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 1.1rem; font-weight: 700;
  flex-shrink: 0;
}
.cart-modal-close {
  background: rgba(255,255,255,0.1);
  border: none; color: white;
  width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer;
  font-size: 1.2rem; line-height: 1;
  transition: background 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.cart-modal-close:hover { background: rgba(255,255,255,0.2); }

.cart-modal-body {
  flex: 1; overflow-y: auto; padding: 0;
}
.cart-empty {
  text-align: center; padding: 60px 20px;
  font-size: 1.5rem; color: #9ca3af;
  line-height: 2;
}

/* ── Cart Table ── */
.cart-table {
  width: 100%; border-collapse: collapse;
}
.cart-table thead th {
  background: #f9fafb;
  padding: 12px 16px;
  text-align: right;
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 700;
  border-bottom: 2px solid #e5e7eb;
  position: sticky; top: 0;
}
.cart-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}
.cart-table tbody tr:hover { background: #fafafa; }
.cart-table tbody td { padding: 14px 16px; vertical-align: middle; }

.cart-product-name { font-weight: 700; color: var(--navy); font-size: 0.9rem; }
.cart-product-code { font-size: 0.78rem; color: #9ca3af; margin-top: 2px; font-family: 'Inter', monospace; }
.cart-price { font-family: 'Inter', sans-serif; font-weight: 700; color: #374151; white-space: nowrap; }
.cart-line-total { font-family: 'Inter', sans-serif; font-weight: 800; color: var(--navy); white-space: nowrap; }
.cart-remove-btn {
  background: #fff5f5; border: 1px solid #fed7d7;
  color: #e53e3e; border-radius: 6px;
  padding: 6px 8px; cursor: pointer;
  transition: all 0.2s; font-size: 0.9rem;
}
.cart-remove-btn:hover { background: #e53e3e; color: white; }

/* ── Qty Control ── */
.qty-control {
  display: flex; align-items: center; gap: 6px;
}
.qty-control button {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer; font-size: 1rem; font-weight: 700;
  color: var(--navy); transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.qty-control button:hover { background: var(--navy); color: white; border-color: var(--navy); }
.qty-control input {
  width: 48px; height: 28px;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px; text-align: center;
  font-family: 'Inter', sans-serif; font-weight: 700;
  font-size: 0.88rem; color: var(--navy);
  outline: none;
}
.qty-control input:focus { border-color: var(--navy); }

/* ── Modal Footer ── */
.cart-modal-footer {
  border-top: 2px solid #f3f4f6;
  padding: 16px 24px;
  flex-shrink: 0;
  background: white;
  border-radius: 0 0 0 0;
}
.cart-modal-total-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font-size: 1rem; font-weight: 700; color: var(--navy);
}
.cart-modal-total-row strong {
  font-family: 'Inter', sans-serif;
  font-size: 1.4rem; color: var(--gold-dark, #c9a900);
}
.cart-modal-btns {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

/* ── Animations ── */
@keyframes cartPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(255,215,0,0.2); }
  100% { transform: scale(1); }
}

/* ── Responsive Cart ── */
@media (max-width: 600px) {
  .cart-bar-inner { flex-direction: column; gap: 8px; padding: 10px; }
  .cart-bar-info { width: 100%; justify-content: space-between; gap: 4px; font-size: 0.8rem; }
  .cart-bar-icon { display: none; } /* Hide icon to save space */
  .cart-bar-actions { width: 100%; justify-content: stretch; gap: 6px; }
  .cart-bar-actions button { flex: 1; padding: 8px 4px; font-size: 0.75rem; white-space: nowrap; }
  .cart-table thead th:nth-child(2) { display: none; }
  .cart-table tbody td:nth-child(2) { display: none; }
  .cart-modal-btns { justify-content: stretch; }
  .cart-modal-btns button { flex: 1; }
}

/* Add padding to page bottom so floating bar doesn't cover content */
.catalog-footer { padding-bottom: 100px; }

/* ── Qty Picker Extras ── */
.cart-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px; /* Add spacing from content above */
}

.qty-picker-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0; /* Prevent squishing */
}

.btn-qty-trigger {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 2px solid var(--navy);
  background: white;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-qty-trigger:hover {
  background: var(--navy);
  color: white;
}

.qty-btn-tip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: #333;
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.qty-btn-tip.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.qty-btn-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
}

.qty-popover {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) scale(0.9) translateY(10px);
  background: white;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  width: 130px;
  transition: all 0.2s;
}
.qty-popover.open {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) scale(1) translateY(0);
}
.qty-popover input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
}
.qty-popover button {
  background: var(--navy);
  color: white;
  border: none;
  padding: 8px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 480px) {
  .cart-btn-group { flex-direction: column; gap: 4px; }
  .btn-qty-trigger { width: 100%; height: 32px; }
}

/* =========================================
   TOC SIDEBAR & GLASS OVERLAY
   ========================================= */

/* Desktop Layout */
.catalog-layout {
  display: flex;
  max-width: 1300px;
  margin: 0 auto;
  position: relative;
  align-items: flex-start;
}

.toc-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  height: 100vh;
  background: var(--white);
  box-shadow: -10px 0 30px rgba(0,0,0,0.1);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.product-area {
  width: 100%;
  flex: 1;
  min-width: 0;
}

/* Sidebar Internals */
.toc-header {
  padding: 16px;
  background: linear-gradient(135deg, var(--navy), var(--navy-medium));
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toc-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.close-toc-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  display: none; /* Desktop hides close btn */
  padding: 0 8px;
}

.toc-search {
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
  background: #fafafa;
}
.toc-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.88rem;
  transition: all 0.2s;
}
.toc-search input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,31,63,0.1);
}

.toc-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  position: relative;
}

/* Timeline Line */
.toc-timeline::before {
  content: '';
  position: absolute;
  top: 20px;
  bottom: 20px;
  right: 28px; /* RTL */
  width: 2px;
  background: var(--gray-200);
  z-index: 1;
}

.toc-node {
  position: relative;
  padding-right: 32px;
  margin-bottom: 18px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  z-index: 2;
}
/* The dot */
.toc-node::before {
  content: '';
  position: absolute;
  right: -5px; /* relative to padding */
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gray-300);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--gray-300);
  transition: all 0.2s;
}

.toc-node:hover {
  color: var(--navy);
  transform: translateX(-4px);
}
.toc-node:hover::before {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--gold);
  border-color: var(--navy);
}

/* Floating Action Button (FAB) */
.toc-fab {
  position: fixed;
  bottom: 30px;
  right: 30px; /* Right side usually better for thumb reach on RTL */
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), #003366);
  color: white;
  border: none;
  box-shadow: 0 6px 20px rgba(0, 31, 63, 0.4), 0 0 0 4px rgba(255,255,255,0.2);
  cursor: pointer;
  z-index: 2001;
  display: flex; /* Always visible if JS manages it */
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), bottom 0.4s ease;
}

.toc-fab.pushed-up {
  bottom: 85px;
}
.toc-fab:hover {
  transform: scale(1.1) rotate(5deg);
}
.fab-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fab-search-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.7rem;
  background: var(--gold);
  border-radius: 50%;
  padding: 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  color: var(--navy);
  border: 2px solid var(--navy);
}

/* Mobile Responsive - Glassmorphism Overlay */
@media (max-width: 992px) {
  .catalog-layout {
    display: block;
  }
  
  .toc-sidebar {
    width: 320px;
    max-width: 85vw;
    /* Glassmorphism Effect on Mobile */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  
  .close-toc-btn {
    display: block;
  }
  
  /* When sidebar is open, prevent body scroll */
  body.toc-open {
    overflow: hidden;
  }
  
  /* Overlay background */
  .toc-overlay-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(3px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
  }
  .toc-overlay-bg.open {
    opacity: 1;
    pointer-events: all;
  }
}

/* === MOBILE OPTIMIZATIONS (2 COLUMNS & CART BUTTON) === */
@media (max-width: 600px) {
  .subgroup-grid { 
    grid-template-columns: repeat(2, 1fr) !important; 
    gap: 8px !important; 
    padding: 8px 14px !important; /* Increased side padding for sticking-out badges */
  }
  
  .product-card {
    padding: 0 !important;
    height: 230px !important;
    overflow: visible !important;
  }

  .product-image {
    height: 165px !important; /* Reduced from 184px to bring brand up */
    margin-bottom: 0 !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    overflow: visible !important; /* Key fix: allows badges to be seen outside */
    z-index: 5;
  }
  .product-image img {
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  }
  
  .card-body {
    padding: 6px 8px !important;
  }

  /* Right-side product (Odd in RTL) */
  .subgroup-grid > .product-card:nth-child(2n+1) .badges-wrapper {
    right: -18px !important;
    left: auto !important;
    align-items: flex-end !important;
  }
  .subgroup-grid > .product-card:nth-child(2n+1) .price-label,
  .subgroup-grid > .product-card:nth-child(2n+1) .code-label {
    border-radius: 4px 12px 12px 4px !important;
    padding: 1px 5px !important;
    font-size: 0.55rem !important;
    box-shadow: -4px 4px 12px rgba(0,0,0,0.2) !important;
  }

  /* Left-side product (Even in RTL) */
  .subgroup-grid > .product-card:nth-child(2n) .badges-wrapper {
    left: -18px !important;
    right: auto !important;
    align-items: flex-start !important;
  }
  .subgroup-grid > .product-card:nth-child(2n) .price-label,
  .subgroup-grid > .product-card:nth-child(2n) .code-label {
    border-radius: 12px 4px 4px 12px !important;
    padding: 1px 5px !important;
    font-size: 0.55rem !important;
    box-shadow: 4px 4px 12px rgba(0,0,0,0.2) !important;
  }

  .name-normal { font-size: 0.75rem !important; }
  .name-sm { font-size: 0.7rem !important; }
  .name-xs { font-size: 0.6rem !important; }

  .card-brand {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }
  
  /* Put the button securely inside the corner */
  .action-corner {
    bottom: 8px !important;
    left: 8px !important;
    gap: 5px !important;
  }
  
  .qty-picker-wrapper {
    flex-shrink: 0 !important;
  }
  
  .btn-qty-trigger {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
  }
  
  .mini-add-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.9rem !important;
    border-width: 2px !important;
  }
  
  .mini-add-btn.in-cart {
    min-width: 32px !important;
    padding: 0 6px !important;
    font-size: 0.75rem !important;
  }

  .toc-fab.pushed-up {
    bottom: 155px !important; /* Higher for mobile to clear the cart bar */
  }
}

/* ============================================
   Barcode Scanner & Price Lookup Styles
   ============================================ */

.header-search {
  display: flex;
  align-items: center;
  position: relative;
}

.barcode-scan-btn {
  position: absolute;
  left: 10px; /* Inside search bar left side */
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,215,0,0.3);
  color: var(--gold);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
}
.barcode-scan-btn:hover {
  color: var(--white);
  border-color: var(--gold);
  background: rgba(255,215,0,0.15);
  transform: translateY(-50%) scale(1.05);
}
.barcode-scan-btn svg {
  width: 18px;
  height: 18px;
}

/* Scanner Overlay */
.scanner-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 13, 26, 0.9);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}
.scanner-overlay.active { display: flex; }

.scanner-box {
  width: 90%;
  max-width: 450px;
  background: var(--white);
  border-radius: 24px;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,215,0,0.2);
}
#reader {
  width: 100%;
  min-height: 250px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--navy);
  background: #000;
}
.scanner-label {
  text-align: center;
  margin-top: 15px;
  font-weight: 700;
  color: var(--navy);
  font-size: 0.95rem;
}
.scanner-close {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 40px;
  height: 40px;
  background: var(--gold);
  border: none;
  border-radius: 50%;
  color: var(--navy);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.scanner-close:hover { transform: scale(1.1); }

/* Price Popup for Scan Result */
.scan-price-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: var(--white);
  padding: 40px 60px;
  border-radius: 30px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
  z-index: 10000;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 5px solid var(--gold);
}
.scan-price-popup.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.popup-name {
  font-size: 1.2rem;
  color: var(--gray-600);
  margin-bottom: 15px;
  font-weight: 700;
}
.popup-price {
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--navy);
  font-family: 'Inter', sans-serif;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.05);
}

@media (max-width: 480px) {
  .scan-price-popup {
    width: 85%;
    padding: 30px 20px;
  }
  .popup-price {
    font-size: 3.5rem;
  }
  .popup-name {
    font-size: 1rem;
  }
}

/* === BACK TO TOP BUTTON === */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy);
  border: 2px solid var(--gold);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 31, 63, 0.3);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.back-to-top:hover {
  background: var(--gold);
  color: var(--navy);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Adjust for cart bar if active */
.back-to-top.pushed-up {
  bottom: 96px; /* Push above cart bar */
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
  }
  .back-to-top.pushed-up {
    bottom: 85px; /* Adjust for mobile cart bar */
  }
}

/* ═══════════════════════════════════════════
   AUTH MODAL STYLES
═══════════════════════════════════════════ */
.auth-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0, 31, 63, 0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.auth-modal-overlay.open {
  opacity: 1; pointer-events: all;
}
.auth-modal-box {
  background: white;
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%; max-width: 420px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  border-top: 4px solid var(--gold);
  transform: translateY(20px);
  transition: transform 0.25s ease;
  direction: rtl;
}
.auth-modal-overlay.open .auth-modal-box {
  transform: translateY(0);
}
.auth-modal-close {
  position: absolute; top: 14px; left: 16px;
  background: none; border: none; font-size: 1.6rem;
  cursor: pointer; color: var(--gray-500);
  line-height: 1; transition: color 0.2s;
}
.auth-modal-close:hover { color: var(--navy); }
.auth-tabs {
  display: flex; gap: 0; border-radius: 10px;
  background: var(--gray-100); padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1; border: none; background: none;
  padding: 9px 12px; border-radius: 8px;
  font-family: inherit; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; color: var(--gray-500);
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--navy); color: var(--gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.auth-header {
  text-align: center; margin-bottom: 22px;
}
.auth-icon {
  font-size: 2.5rem; margin-bottom: 8px;
}
.auth-header h3 {
  font-size: 1.3rem; font-weight: 900; color: var(--navy); margin-bottom: 4px;
}
.auth-header p {
  font-size: 0.85rem; color: var(--gray-500);
}
.auth-field-group {
  margin-bottom: 16px;
}
.auth-field-group label {
  display: block; font-weight: 700; font-size: 0.85rem;
  color: var(--gray-700); margin-bottom: 6px;
}
.auth-phone-row {
  display: flex; gap: 8px;
}
.auth-country-select {
  flex: 0 0 auto; padding: 11px 8px;
  border: 2px solid var(--gray-200); border-radius: 10px;
  font-family: inherit; font-size: 0.9rem;
  background: white; cursor: pointer;
  transition: border-color 0.2s;
}
.auth-country-select:focus {
  outline: none; border-color: var(--navy);
}
.auth-input {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--gray-200); border-radius: 10px;
  font-family: inherit; font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: ltr; text-align: right;
}
.auth-input:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,31,63,0.08);
}
.auth-code-input {
  letter-spacing: 6px; font-size: 1.3rem;
  font-weight: 900; text-align: center;
  text-transform: uppercase;
}
.auth-error {
  background: #fff5f5; border: 1.5px solid #fed7d7;
  color: #c53030; padding: 10px 14px;
  border-radius: 8px; font-size: 0.85rem;
  margin-bottom: 14px;
}
.auth-success {
  background: #f0fff4; border: 1.5px solid #9ae6b4;
  color: #2f855a; padding: 10px 14px;
  border-radius: 8px; font-size: 0.85rem;
  margin-bottom: 14px;
}
.auth-submit-btn {
  width: 100%; background: var(--navy); color: var(--gold);
  border: none; border-radius: 10px; padding: 14px;
  font-family: inherit; font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: opacity 0.2s, transform 0.15s;
  margin-top: 4px;
}
.auth-submit-btn:hover:not(:disabled) {
  opacity: 0.9; transform: translateY(-1px);
}
.auth-submit-btn:disabled {
  opacity: 0.6; cursor: not-allowed;
}

/* Customer Status Bar */
.customer-status-bar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; padding: 8px 20px;
  font-size: 0.85rem; font-weight: 600;
  direction: rtl;
}
.customer-status-bar.guest {
  background: linear-gradient(135deg, #fffbf0, #fef9e7);
  border-bottom: 1px solid #fde68a;
  color: #92400e;
}
.customer-status-bar.logged-in {
  background: linear-gradient(135deg, #f0fff4, #e6ffed);
  border-bottom: 1px solid #9ae6b4;
  color: #065f46;
}
.btn-login-catalog {
  background: var(--navy); color: var(--gold);
  border: none; border-radius: 20px; padding: 5px 16px;
  font-family: inherit; font-size: 0.82rem; font-weight: 800;
  cursor: pointer; transition: opacity 0.2s;
}
.btn-login-catalog:hover { opacity: 0.85; }
.btn-logout-catalog {
  background: transparent; color: #065f46;
  border: 1.5px solid #9ae6b4; border-radius: 20px; padding: 4px 14px;
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.btn-logout-catalog:hover { background: #9ae6b4; }

/* Price Lock Icon for Guests */
.price-locked {
  cursor: pointer;
  opacity: 0.75;
  font-size: 0.85rem;
  transition: opacity 0.2s;
}
.price-locked:hover { opacity: 1; }

/* ═══════════════════════════════════════════
   UPDATE NOTIFICATION BANNER
═══════════════════════════════════════════ */
#updateBanner {
  position: fixed;
  bottom: -120px;
  left: 0; right: 0;
  z-index: 9999;
  padding: 0 16px 12px;
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  direction: rtl;
}
#updateBanner.visible {
  bottom: 0;
}
/* على الهاتف: فوق شريط السلة */
@media (max-width: 768px) {
  #updateBanner.visible {
    bottom: 70px;
  }
}
.update-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #001f3f, #002d5c);
  color: white;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0, 31, 63, 0.45);
  border: 1.5px solid rgba(255, 215, 0, 0.35);
  max-width: 640px;
  margin: 0 auto;
}
.update-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  animation: spin-once 0.5s ease-out 0.3s both;
}
@keyframes spin-once {
  from { transform: rotate(-20deg) scale(0.8); }
  to { transform: rotate(0deg) scale(1); }
}
.update-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.update-banner-text strong {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--gold);
}
.update-banner-text span {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
}
.update-banner-btn {
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35);
  animation: pulse-gold 2s ease-in-out infinite;
}
@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35); }
  50% { box-shadow: 0 4px 20px rgba(255, 215, 0, 0.65); }
}
.update-banner-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 215, 0, 0.5);
}
.update-banner-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  animation: none;
}
.update-banner-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
  transition: color 0.2s;
}
.update-banner-dismiss:hover { color: white; }

/* ===== MY ORDERS MODAL STYLES (PREMIUM GLASSMORPHISM & ANIMATED SLIDE-IN) ===== */
.c-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 15, 30, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.c-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.c-modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  position: relative;
  box-shadow: var(--shadow-lg), 0 20px 40px rgba(0, 31, 63, 0.15);
  border: 1px solid rgba(0, 31, 63, 0.08);
  border-top: 4px solid var(--gold);
  transform: translateY(30px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  direction: rtl;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.c-modal-overlay.open .c-modal {
  transform: translateY(0) scale(1);
}

.c-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
}

.c-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.c-modal-close {
  background: var(--gray-50);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
}

.c-modal-close:hover {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold-dark);
  transform: rotate(90deg);
}

.c-modal-body {
  overflow-y: auto;
  flex: 1;
  background: var(--gray-50);
  padding: 20px !important;
  max-height: calc(90vh - 80px);
}

/* Elegant Scrollbar for the orders modal body */
.c-modal-body::-webkit-scrollbar {
  width: 6px;
}
.c-modal-body::-webkit-scrollbar-track {
  background: var(--gray-50);
}
.c-modal-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 10px;
}
.c-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}




/* Inline Cart Controls */
.cart-qty-controls { display: flex; align-items: center; gap: 6px; background: var(--white); padding: 4px; border-radius: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border: 1px solid var(--gray-200); }
.cart-qty-controls button { width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--gray-100); color: var(--navy); font-weight: bold; font-size: 1rem; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; padding: 0; line-height: 1; }
.cart-qty-controls button:hover { background: var(--gray-200); }
.cart-qty-controls input { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #38a169; background: #c6f6d5; color: #276749; font-weight: 800; font-size: 0.9rem; text-align: center; outline: none; -moz-appearance: textfield; padding: 0; }
.cart-qty-controls input::-webkit-outer-spin-button, .cart-qty-controls input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
