/* ============================================================
   AL-DUKAN PLATFORM - MAIN STYLESHEET
   منصة الدكان - الستايل الرئيسي
   ============================================================ */

:root {
  --primary: #0e9447;
  --primary-dark: #0a7838;
  --primary-light: #d4f5e1;
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-600: #0e9447;
  --primary-700: #0a7838;
  --primary-900: #064e2c;
  
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-green: 0 10px 30px -10px rgba(14, 148, 71, 0.4);
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --font-ar: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
  --font-en: 'Inter', 'Plus Jakarta Sans', system-ui, sans-serif;
  
  --container: 1280px;
  --header-height: 130px;
}

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ar);
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body[dir="ltr"] { font-family: var(--font-en); }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary); }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
ul, ol { list-style: none; }
input, select, textarea { font: inherit; }

/* ===== Container ===== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 768px) { .container { padding: 0 24px; } }

/* ===== Header / Top Bar ===== */
.topbar {
  background: var(--gray-900);
  color: #fff;
  font-size: 13px;
  padding: 8px 0;
}
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar a { color: #fff; opacity: .85; transition: opacity .2s; }
.topbar a:hover { opacity: 1; color: #fff; }
.topbar-links { display: flex; gap: 20px; align-items: center; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-full);
  font-weight: 500;
}
.lang-switch:hover { background: rgba(255,255,255,.08); }

/* ===== Main Header ===== */
.header {
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 16px 0;
}
/* شريط البحث العلوي مخفي في كل الشاشات (البحث متاح من صفحة /search ومن الـ bottom nav) */
.search-bar { display: none !important; }
@media (max-width: 900px) { .header-inner { grid-template-columns: auto 1fr; gap: 12px; } }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 26px;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: #fff; font-size: 20px;
  box-shadow: var(--shadow-green);
}

/* ===== Search Bar ===== */
.search-bar {
  position: relative;
  max-width: 580px;
  width: 100%;
  margin: 0 auto;
}
.search-bar input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  border: 2px solid var(--gray-100);
  border-radius: var(--radius);
  background: var(--gray-50);
  font-size: 15px;
  transition: all .2s;
  outline: none;
}
[dir="ltr"] .search-bar input { padding: 14px 20px 14px 50px; }
.search-bar input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--primary-100);
}
.search-bar button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: 6px;
  width: 40px; height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  transition: background .2s;
}
.search-bar button:hover { background: var(--primary-dark); }

@media (max-width: 768px) { .search-bar { display: none; } }

/* ===== Header Actions ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;       /* تُحاذى لنهاية الصف (يسار في RTL) */
  margin-inline-start: auto;
}
.header-action {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}
.header-action:hover { background: var(--primary-50); color: var(--primary); }
.header-action i { font-size: 20px; }
.header-action .label { display: none; }
@media (min-width: 768px) { .header-action .label { display: inline; } }

.badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  border: 2px solid #fff;
}

/* ===== Navigation ===== */
.nav-bar {
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
}
.nav-bar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-bar-inner::-webkit-scrollbar { display: none; }

.nav-link {
  padding: 14px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
  position: relative;
  transition: color .2s;
}
.nav-link:hover { color: var(--primary); }
.nav-link.active { color: var(--primary); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: all .2s;
  cursor: pointer;
  border: 0;
  text-align: center;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-green);
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -10px rgba(14, 148, 71, 0.5);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-light {
  background: var(--gray-100);
  color: var(--gray-800);
}
.btn-light:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* ===== Hero / Banner ===== */
.hero {
  margin: 24px 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  min-height: 380px;
  display: flex;
  align-items: center;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  inset-inline-end: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,.1) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  inset-inline-start: -5%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
  padding: 60px 40px;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.hero p {
  font-size: clamp(15px, 2vw, 18px);
  opacity: .95;
  margin-bottom: 28px;
  max-width: 480px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
}
.hero .btn-primary:hover { background: #fff; transform: translateY(-2px); }
.hero .btn-outline { border-color: rgba(255,255,255,.5); color: #fff; }
.hero .btn-outline:hover { background: #fff; color: var(--primary); }

/* ===== Features Bar ===== */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 32px 0;
}
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .features { grid-template-columns: 1fr; } }

.feature {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all .3s;
  border: 1px solid var(--gray-100);
}
.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-100);
}
.feature-icon {
  width: 56px; height: 56px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex-shrink: 0;
}
.feature-title { font-size: 15px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.feature-desc { font-size: 13px; color: var(--gray-500); }

/* ===== Section Heading ===== */
.section { margin: 48px 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-head h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}
.section-head .view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
}
.section-head .view-all-link:hover { gap: 10px; }

/* ===== Categories Grid ===== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) { .categories-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .categories-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 400px) { .categories-grid { grid-template-columns: repeat(2, 1fr); } }

.category-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  border: 1px solid var(--gray-100);
  transition: all .3s;
  cursor: pointer;
}
.category-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}
.category-card-icon {
  width: 64px; height: 64px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 28px;
  transition: all .3s;
}
.category-card:hover .category-card-icon {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  transform: scale(1.05);
}
.category-card h3 { font-size: 14px; font-weight: 700; color: var(--gray-900); }

/* ===== Products Grid ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}
@media (max-width: 1100px) { .products-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }

.product-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-100);
  transition: all .3s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-100);
}
.product-card-image {
  position: relative;
  aspect-ratio: 1;
  background: var(--gray-50);
  overflow: hidden;
}
.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.product-card:hover .product-card-image img { transform: scale(1.05); }

.product-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  padding: 4px 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.product-badge.new { background: var(--primary); }

.wishlist-btn {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.9);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--gray-600);
  transition: all .2s;
  backdrop-filter: blur(8px);
}
.wishlist-btn:hover { background: var(--danger); color: #fff; }

.product-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.product-brand {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 4px;
}
.product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 10px;
}
.product-rating .stars { color: var(--accent); }

.product-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 10px;
}
.product-price .current {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.product-price .old {
  font-size: 13px;
  text-decoration: line-through;
  color: var(--gray-400);
}

.product-card-actions {
  display: flex;
  gap: 6px;
}
.product-card-actions .btn { flex: 1; padding: 9px 12px; font-size: 13px; }

/* ===== Footer ===== */
.footer {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: 60px 0 0;
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px;
  margin-bottom: 40px;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }

.footer h4 {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
}
.footer ul li { margin-bottom: 10px; }
.footer ul li a { color: var(--gray-400); font-size: 14px; }
.footer ul li a:hover { color: var(--primary); }

.footer-about p { font-size: 14px; margin-bottom: 16px; max-width: 320px; }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.05);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--gray-400);
  transition: all .2s;
}
.footer-social a:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 24px 0;
  text-align: center;
  font-size: 13px;
  color: var(--gray-500);
}

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  font-size: 14px;
  color: var(--gray-900);
  transition: all .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-hint { color: var(--gray-500); font-size: 12px; margin-top: 4px; }

/* ===== Auth Pages ===== */
.auth-wrapper {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 40px 16px;
  background: linear-gradient(135deg, var(--primary-50) 0%, #fff 60%);
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-100);
}
.auth-card.wide { max-width: 720px; }
.auth-head { text-align: center; margin-bottom: 28px; }
.auth-head h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 6px;
}
.auth-head p { color: var(--gray-500); font-size: 14px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 14px; color: var(--gray-600); }
.auth-foot a { color: var(--primary); font-weight: 600; }

/* ===== Cards & Boxes ===== */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}
.card-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head h3 { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 20px; }
.card-foot { padding: 16px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}
.table th, .table td {
  padding: 14px 16px;
  text-align: start;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}
.table thead th {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--gray-700);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--gray-50); }
.table-actions { display: flex; gap: 6px; }

/* ===== Status Pills ===== */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.pill-success { background: var(--primary-50); color: var(--primary-700); }
.pill-warning { background: var(--accent-light); color: #92400e; }
.pill-danger { background: #fee2e2; color: #991b1b; }
.pill-info { background: #dbeafe; color: #1e40af; }
.pill-gray { background: var(--gray-100); color: var(--gray-700); }

/* ===== Flash Messages ===== */
.flash-message {
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-end { text-align: end; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--gray-500); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fs-sm { font-size: 13px; }
.fs-lg { font-size: 17px; }
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:16px}.mt-4{margin-top:24px}.mt-5{margin-top:40px}
.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:16px}.mb-4{margin-bottom:24px}.mb-5{margin-bottom:40px}
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:16px}.gap-4{gap:24px}

/* ===== Empty State ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.empty-icon {
  font-size: 64px;
  color: var(--gray-300);
  margin-bottom: 16px;
}
.empty h3 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .4s ease-out; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ===== Mobile Menu ===== */
.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  font-size: 20px;
}
@media (max-width: 768px) { .menu-toggle { display: flex; } }

/* ========== Additional storefront styles ========== */
.empty { text-align:center; padding:60px 20px; }
.empty-icon { font-size:64px; color:var(--gray-300); margin-bottom:16px; }
.empty h3 { font-size:18px; font-weight:700; margin-bottom:8px; color:var(--gray-700); }
.empty p { color:var(--gray-500); margin-bottom:14px; }

.card { background:#fff; border-radius:var(--radius-lg); padding:20px; border:1px solid var(--gray-100); margin-bottom:20px; }
.card-head { margin-bottom:14px; }
.card-head h3 { font-size:16px; font-weight:700; color:var(--gray-900); }
.card-body { padding-top:8px; }

.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 16px; border:none; border-radius:var(--radius-sm); cursor:pointer; font-size:14px; font-weight:600; font-family:inherit; transition:all .15s; text-decoration:none; }
.btn-sm { padding:6px 12px; font-size:12px; }
.btn-lg { padding:14px 24px; font-size:16px; }
.btn-block { display:flex; width:100%; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-outline { background:#fff; color:var(--gray-700); border:1.5px solid var(--gray-200); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }
.btn-light { background:var(--gray-100); color:var(--gray-700); }

.form-control { width:100%; padding:10px 12px; border:1.5px solid var(--gray-200); border-radius:var(--radius-sm); font-size:14px; font-family:inherit; }
.form-control:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-100); }
.form-label { display:block; font-size:13px; font-weight:600; color:var(--gray-700); margin-bottom:6px; }
.form-group { margin-bottom:14px; }
.required { color:var(--danger); }

.pill { display:inline-flex; align-items:center; padding:3px 10px; border-radius:var(--radius-full); font-size:11px; font-weight:600; background:var(--gray-100); color:var(--gray-700); }
.pill-success { background:#d1fae5; color:#065f46; }
.pill-danger { background:#fee2e2; color:#991b1b; }

.table { width:100%; border-collapse:collapse; }
.table th { text-align:start; padding:10px 12px; background:var(--gray-50); border-bottom:1px solid var(--gray-200); font-weight:700; font-size:13px; color:var(--gray-700); }
.table td { padding:12px; border-bottom:1px solid var(--gray-100); font-size:14px; vertical-align:middle; }
.table-wrapper { overflow-x:auto; }

.mb-3 { margin-bottom:14px; }
.mt-2 { margin-top:8px; }
.mt-3 { margin-top:14px; }

.flash-message { padding:12px 16px; border-radius:var(--radius); margin-bottom:14px; font-size:14px; }
.bg-emerald-50 { background:#ecfdf5; color:#065f46; border:1px solid #a7f3d0; }
.bg-red-50 { background:#fef2f2; color:#991b1b; border:1px solid #fecaca; }
.bg-amber-50 { background:#fffbeb; color:#92400e; border:1px solid #fde68a; }
.bg-blue-50 { background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; }

/* ===== Home page additional styles ===== */
.hero-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  position: relative;
  z-index: 2;
  padding: 60px 40px;
  width: 100%;
}
.hero-title {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  font-size: clamp(15px, 1.6vw, 18px);
  opacity: .95;
  margin-bottom: 26px;
  max-width: 520px;
  line-height: 1.6;
}
.hero-search {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius-full);
  padding: 6px;
  max-width: 540px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  margin-bottom: 22px;
}
.hero-search input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 20px;
  font-size: 15px;
  background: transparent;
  color: var(--gray-800);
  font-family: inherit;
}
.hero-search button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 12px 24px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  transition: background .2s;
}
.hero-search button:hover { background: var(--primary-dark); }

.hero-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-tags .hero-tag {
  margin: 0;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-decoration {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  font-size: 80px;
  opacity: .15;
  padding: 0 40px;
}
.hero-decoration i {
  margin: 12px;
}

@media (max-width: 900px) {
  .hero-decoration { display: none; }
  .hero-container { padding: 40px 20px; }
}

/* Fix search button (header) */
.search-bar button {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* (شريط البحث العلوي مخفي في كل الشاشات - انظر القاعدة بالأعلى) */

/* ===== Features Bar ===== */
.features-bar { padding: 30px 0; background: var(--gray-50); margin-top: 20px; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.feature-item i {
  font-size: 28px;
  color: var(--primary);
  background: var(--primary-50);
  padding: 12px;
  border-radius: var(--radius-sm);
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
}
.feature-item strong {
  display: block;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 2px;
}
.feature-item span {
  font-size: 13px;
  color: var(--gray-500);
}

/* ===== Sections ===== */
.section { padding: 40px 0; }
.section-light { background: var(--gray-50); }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.section-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-link:hover { color: var(--primary-dark); }

/* ===== Categories Grid ===== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--gray-700);
  transition: all .2s;
  text-align: center;
}
.category-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(14, 148, 71, .12);
  color: var(--primary);
}
.category-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 26px;
}
.category-card:hover .category-icon {
  background: var(--primary);
  color: #fff;
}
.category-name {
  font-weight: 700;
  font-size: 14px;
}

/* ===== Offers Grid ===== */
.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.offer-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 180px;
  background-color: var(--gray-200);
  background-size: cover;
  background-position: center;
  text-decoration: none;
  transition: transform .25s;
  display: block;
}
.offer-card:hover { transform: scale(1.02); }
.offer-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(14,148,71,.85), rgba(10,120,56,.85));
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
}
.offer-overlay h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}
.offer-overlay p {
  font-size: 14px;
  opacity: .95;
}
.offer-badge {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  background: var(--accent);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

/* ===== Products Grid ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  border-color: var(--primary-100);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  transform: translateY(-2px);
}
.product-card-image {
  position: relative;
  aspect-ratio: 1;
  background: var(--gray-50);
  overflow: hidden;
}
.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .product-card-image img { transform: scale(1.05); }
.product-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  background: var(--danger);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
}
.product-badge.new { background: var(--accent); }
.wishlist-btn {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 36px;
  height: 36px;
  background: #fff;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--gray-500);
  transition: all .2s;
  z-index: 2;
}
.wishlist-btn:hover { color: var(--danger); }
.product-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.product-brand {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 600;
}
.product-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 8px;
  min-height: 40px;
}
.product-name:hover { color: var(--primary); }
.product-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.product-rating .stars { color: var(--accent); }
.product-rating .fa-star { font-size: 11px; }
.product-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.product-price .current {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.product-price .old {
  font-size: 13px;
  text-decoration: line-through;
  color: var(--gray-400);
}
.product-card-actions {
  margin-top: auto;
}
.product-card-actions .btn {
  width: 100%;
  font-size: 13px;
  padding: 8px;
}

/* ===== Product Detail Page ===== */
.product-page { padding: 20px 0 40px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--gray-600);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--gray-900); font-weight: 600; }
.breadcrumb i { font-size: 10px; color: var(--gray-400); }

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--gray-100);
  margin-bottom: 30px;
}
@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; gap: 20px; padding: 16px; }
}

.product-gallery {
  position: relative;
  background: var(--gray-50);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.product-main-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.product-no-image {
  font-size: 80px;
  color: var(--gray-300);
}
.product-detail-badge {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  background: var(--warning);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.product-detail-brand {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}
.product-detail-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.25;
  margin: 0;
}
.product-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--gray-600);
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--gray-200);
}
.product-meta strong { color: var(--gray-900); margin-inline-end: 4px; }
.product-short-desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--gray-700);
  padding-bottom: 6px;
}

/* Vendor prices section */
.vendor-prices {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 6px;
}
.vendor-prices-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}
.vendor-prices-subtitle {
  font-size: 13px;
  color: var(--gray-600);
  margin: 0 0 14px;
}

.vendor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vendor-row {
  background: #fff;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  transition: all .2s;
}
.vendor-row:hover { border-color: var(--primary-100); }
.vendor-row.is-cheapest {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
  background: linear-gradient(135deg, #fff 0%, var(--primary-50) 100%);
}
.vendor-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}
.vendor-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 6px;
  border: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.vendor-logo-placeholder {
  width: 56px;
  height: 56px;
  background: var(--gray-100);
  color: var(--gray-500);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.vendor-text { flex: 1; min-width: 0; }
.vendor-name {
  font-weight: 700;
  color: var(--gray-900);
  font-size: 15px;
  margin-bottom: 4px;
}
.vendor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--gray-500);
}
.vendor-meta small i { margin-inline-end: 4px; }
.cheapest-badge {
  background: var(--primary);
  color: #fff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.vendor-price-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.vendor-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.vendor-price-action .btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .vendor-row { flex-direction: column; align-items: stretch; }
  .vendor-price-action { flex-direction: row; align-items: center; justify-content: space-between; }
}

.product-no-vendors {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-description-block {
  margin-top: 20px;
  padding: 18px;
  background: var(--gray-50);
  border-radius: var(--radius);
}
.product-description-block h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.product-description-block h3 i { color: var(--primary); }
.product-description-block > div {
  font-size: 14px;
  line-height: 1.7;
  color: var(--gray-700);
}

/* ===== Patient prescription page (main layout) ===== */
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }
@media (max-width:900px) { .grid-2 { grid-template-columns:1fr; } }

.card-subtitle { color:var(--gray-500); font-size:13px; margin: -4px 0 14px; }

.info-banner { display:flex; gap:12px; padding:14px; background:var(--primary-50); border:1px solid var(--primary-100); border-radius:var(--radius); margin-bottom:16px; }
.info-banner i { color:var(--primary); font-size:18px; flex-shrink:0; margin-top:2px; }
.info-banner strong { display:block; margin-bottom:4px; color:var(--gray-900); }
.info-banner p { font-size:13px; color:var(--gray-600); margin:0; }

.patient-rx-page { padding:30px 0; max-width:1100px; margin:0 auto; }
.rx-patient-header { display:flex; gap:16px; align-items:center; padding:20px; background:linear-gradient(135deg, var(--primary-50), #fff); border-radius:var(--radius-lg); margin-bottom:20px; border:1px solid var(--primary-100); }
.rx-patient-icon { width:60px; height:60px; background:var(--primary); color:#fff; border-radius:14px; display:grid; place-items:center; font-size:24px; flex-shrink:0; }
.rx-patient-header h1 { font-size:22px; font-weight:800; margin-bottom:4px; }
.rx-patient-header p { color:var(--gray-600); font-size:14px; margin:0; }
.rx-patient-header small { color:var(--gray-500); font-size:12px; }

/* Vendor pick cards */
.vendor-pick-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:10px; }
.vendor-pick input { display:none; }
.vendor-pick-card { padding:14px; border:2px solid var(--gray-200); border-radius:var(--radius); text-align:center; cursor:pointer; transition:all .15s; background:#fff; }
.vendor-pick-card img { max-width:80px; max-height:40px; object-fit:contain; display:block; margin:0 auto 6px; }
.vendor-pick-card strong { display:block; font-size:13px; margin-bottom:4px; color:var(--gray-900); }
.vendor-pick-card small { color:var(--gray-500); font-size:11px; }
.vendor-pick input:checked + .vendor-pick-card { border-color:var(--primary); background:var(--primary-50); transform:scale(1.02); }
.vendor-logo-placeholder { width:80px; height:40px; background:var(--gray-100); margin:0 auto 6px; border-radius:6px; display:grid; place-items:center; color:var(--gray-500); }

/* Rx items (patient) */
.rx-patient-item { display:flex; justify-content:space-between; gap:16px; padding:14px; border:1.5px solid var(--gray-200); border-radius:var(--radius); margin-bottom:10px; transition:opacity .15s; background:#fff; }
.rx-patient-item.removed { opacity:.4; }
.rx-patient-item-main { display:flex; gap:12px; flex:1; min-width:0; }
.rx-item-img { width:72px; height:72px; border-radius:8px; object-fit:cover; flex-shrink:0; }
.rx-item-img.no-image { background:var(--gray-100); display:grid; place-items:center; color:var(--gray-400); font-size:24px; }
.rx-patient-item-info { flex:1; min-width:0; }
.rx-patient-item-info h4 { font-size:14px; font-weight:700; margin:0 0 4px; color:var(--gray-900); }
.rx-patient-item-info small { color:var(--gray-500); font-size:12px; }
.rx-patient-item-info > div { font-size:12px; color:var(--gray-600); margin-top:2px; }
.rx-patient-item-actions { display:flex; flex-direction:column; gap:8px; align-items:flex-end; flex-shrink:0; }
.rx-qty-label { font-size:11px; color:var(--gray-500); }
.rx-remove-label { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--danger); cursor:pointer; }
.vendor-prices-mini { display:flex; gap:8px; flex-wrap:wrap; font-size:11px; margin-top:8px; }
.vendor-prices-mini span { padding:3px 8px; background:var(--gray-100); border-radius:var(--radius-full); color:var(--gray-700); }

/* Qty stepper */
.qty-stepper { display:inline-flex; align-items:center; border:1.5px solid var(--gray-200); border-radius:var(--radius-sm); overflow:hidden; background:#fff; }
.qty-stepper button { width:30px; height:30px; border:none; background:#fff; cursor:pointer; font-size:16px; color:var(--gray-700); padding:0; }
.qty-stepper button:hover { background:var(--gray-100); }
.qty-stepper input { width:42px; border:none; text-align:center; padding:5px 0; font-size:13px; font-weight:600; }
.qty-stepper input:focus { outline:none; }

/* Summary card */
.rx-summary-card { background:linear-gradient(135deg, var(--primary), var(--primary-dark)); color:#fff; padding:20px; border-radius:var(--radius-lg); position:sticky; top:20px; }
.rx-summary-card h3 { color:#fff; margin:0 0 14px; font-size:18px; }
.rx-summary-card .summary-items { background:rgba(255,255,255,.1); border-radius:8px; padding:10px; margin-bottom:10px; max-height:200px; overflow-y:auto; }
.rx-summary-card .summary-item { display:flex; justify-content:space-between; padding:4px 0; font-size:13px; }
.rx-summary-card hr { border:none; border-top:1px solid rgba(255,255,255,.2); margin:10px 0; }
.rx-summary-card .summary-row { display:flex; justify-content:space-between; padding:4px 0; font-size:14px; }
.rx-summary-card .summary-total { font-size:18px; padding-top:10px; border-top:1px solid rgba(255,255,255,.3); margin-top:4px; font-weight:700; }
.rx-summary-card .btn-primary { background:#fff; color:var(--primary); }
.rx-summary-card .btn-primary:hover { background:var(--gray-100); }
.rx-summary-card .btn-primary:disabled { background:rgba(255,255,255,.3); color:rgba(255,255,255,.6); cursor:not-allowed; }

/* Form grid (form fields) */
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-group-full { grid-column:1/-1; }
@media (max-width:600px) { .form-grid { grid-template-columns:1fr; } }
.required { color:var(--danger); }

/* ===== Form inputs (universal for patient & store forms) ===== */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="search"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--gray-900);
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-group input[type="file"] {
  padding: 8px;
  background: var(--gray-50);
  cursor: pointer;
}

/* Cards in patient/storefront context */
.card { background: #fff; border-radius: var(--radius-lg); padding: 18px; border: 1px solid var(--gray-100); margin-bottom: 16px; }
.card h3 { font-size: 16px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; color: var(--gray-900); }
.card h3 i { color: var(--primary); }

/* ===== Overrides to ensure rx-summary-card stays green ===== */
.card.rx-summary-card { background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important; color: #fff !important; }
.card.rx-summary-card h3,
.card.rx-summary-card strong { color: #fff !important; }
.card.rx-summary-card .btn-primary { background: #fff !important; color: var(--primary) !important; }
.card.rx-summary-card .btn-primary:hover { background: var(--gray-50) !important; color: var(--primary-dark) !important; }
.card.rx-summary-card .btn-primary:disabled { background: rgba(255,255,255,.3) !important; color: rgba(255,255,255,.7) !important; }

/* ===== Fix btn hover - keep text white ===== */
.btn-primary { color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff !important; }
.btn-success { color: #fff; }
.btn-success:hover { color: #fff !important; }
.btn-danger { color: #fff; }
.btn-danger:hover { color: #fff !important; }

/* ===== Modal - improved design (mobile-friendly) ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal.active { display: flex; }
.modal-content {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .35);
  animation: modalIn .25s cubic-bezier(.4, 0, .2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: rgba(255, 255, 255, .15);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s;
}
.modal-close:hover { background: rgba(255, 255, 255, .25); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
}
.modal-body input[type="text"],
.modal-body input[type="search"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 15px;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color .15s;
}
.modal-body input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}

/* Search results */
.search-results { margin-top: 14px; max-height: 380px; overflow-y: auto; }
.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-100);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
}
.search-result-item:hover {
  border-color: var(--primary);
  background: var(--primary-50);
  transform: translateX(4px);
}
[dir="ltr"] .search-result-item:hover { transform: translateX(-4px); }
.search-result-item small { display: block; color: var(--gray-500); font-size: 12px; margin-top: 2px; }
.result-price { font-weight: 700; color: var(--primary); font-size: 15px; white-space: nowrap; }

@media (max-width: 600px) {
  .modal { padding: 0; }
  .modal-content { max-width: 100%; max-height: 100vh; border-radius: 16px 16px 0 0; margin-top: auto; }
}

/* ===================================================================
   MOBILE-FIRST APP-LIKE DESIGN
   Bottom Navigation + Touch-friendly cards + Native feel
=================================================================== */

/* Mobile Bottom Navigation - always visible on mobile, hidden on desktop */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: #fff;
  border-top: 1px solid var(--gray-100);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .08);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 999;
  justify-content: space-around;
  align-items: center;
}
.mbn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--gray-500);
  text-decoration: none;
  padding: 6px 4px;
  border-radius: 10px;
  flex: 1;
  max-width: 80px;
  font-size: 10px;
  font-weight: 600;
  position: relative;
  transition: color .15s, transform .15s;
  min-height: 50px;
}
.mbn-item i { font-size: 19px; }
.mbn-item span { font-size: 10px; white-space: nowrap; }
.mbn-item:hover, .mbn-item.active { color: var(--primary); }
.mbn-item:active { transform: scale(0.92); }

/* Floating action button style for new prescription */
.mbn-fab {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff !important;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-top: -28px;
  box-shadow: 0 6px 20px rgba(14, 148, 71, .35);
  flex: 0 0 56px;
  font-size: 12px;
}
.mbn-fab i { font-size: 20px; }
.mbn-fab span { display: none; }

.mbn-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 12px;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1;
}

/* Show bottom nav only on mobile */
@media (max-width: 900px) {
  .mobile-bottom-nav { display: flex; }
  /* Add padding to body bottom so content doesn't hide behind bottom nav */
  body { padding-bottom: 70px; }
  /* Hide top topbar on mobile (already have header) */
  .topbar { display: none; }
  /* Compact header on mobile */
  .header { padding: 8px 0; position: sticky; top: 0; z-index: 100; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
  .header-inner { gap: 8px; }
  .logo span { font-size: 18px; }
  .logo-icon { width: 36px; height: 36px; font-size: 16px; }
  /* Hide desktop-only header actions (login text, wishlist) on mobile */
  .header-action .label { display: none; }
  .header-action { padding: 8px; }
  .header-actions .menu-toggle, .header-actions a[href*="login"]:not(.mbn-item),
  .header-actions a[href*="account"]:not(.mbn-item) { display: none; }
  /* Hide categories nav bar on mobile - they're in the menu */
  .nav-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-bar-inner { white-space: nowrap; flex-wrap: nowrap; padding: 0 12px; }
  .nav-link { font-size: 13px; padding: 10px 12px; flex-shrink: 0; }
}

/* ============= DASHBOARD MOBILE LAYOUT ============= */
@media (max-width: 1024px) {
  /* The .sidebar.open class is already handled in dashboard.css */
  /* We just add the overlay effect */
  body.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 998;
    animation: fadeIn .2s;
  }
  .sidebar { z-index: 999 !important; }
  .dash-main { margin-inline-start: 0 !important; width: 100%; }
}
@media (max-width: 900px) {
  .dash-topbar { padding: 10px 14px; position: sticky; top: 0; z-index: 50; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
  .dash-topbar-title { font-size: 16px; font-weight: 700; }
  .dash-menu-toggle {
    display: grid !important;
    place-items: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-50, #f0fdf4);
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    color: var(--primary, #0e9447);
  }
  .dash-menu-toggle:hover { background: var(--primary-100, #dcfce7); }
  .dash-content { padding: 14px 12px 90px; }
  .user-chip .info { display: none; }
}
@media (min-width: 1025px) {
  .dash-menu-toggle { display: none !important; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============= APP-LIKE CARDS ON MOBILE ============= */
@media (max-width: 600px) {
  /* Cards: tighter, more native */
  .card { padding: 14px; border-radius: 14px; margin-bottom: 12px; }
  .card h3 { font-size: 15px; }

  /* Stats grid: 2 cols on mobile */
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .stat-card { padding: 14px; border-radius: 14px; }
  .stat-card .stat-value { font-size: 20px; }
  .stat-card .stat-label { font-size: 11px; }
  .stat-icon { width: 40px; height: 40px; font-size: 16px; }

  /* Tables: horizontal scroll wrapped + native feel */
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 6px; }
  .card:has(.data-table) { padding: 12px 8px; }
  .data-table thead { background: var(--gray-50); }

  /* Forms: full width, larger touch */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-group input, .form-group select, .form-group textarea {
    font-size: 16px; /* prevents iOS zoom */
    padding: 12px;
  }

  /* Buttons: larger touch */
  .btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }
  .btn-sm { padding: 8px 12px; min-height: 36px; }

  /* Page actions: stack */
  .page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
  .page-actions .btn { flex: 1 1 auto; }

  /* Rx items on mobile - native feel */
  .rx-patient-item { flex-direction: column; padding: 12px; gap: 12px; }
  .rx-patient-item-actions { flex-direction: row; justify-content: space-between; width: 100%; align-items: center; }
  .rx-item-img { width: 56px; height: 56px; }

  /* Vendor pick: 2 cols */
  .vendor-pick-grid { grid-template-columns: 1fr 1fr; }
  .vendor-pick-card { padding: 10px; }

  /* Modal full screen on mobile */
  .modal-content { border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }

  /* Bottom nav adjustments */
  .mbn-item { font-size: 9px; }
  .mbn-item i { font-size: 17px; }

  /* Hero section on mobile */
  .hero { padding: 30px 16px; min-height: auto; }
  .hero h1 { font-size: 24px; }
  .hero-subtitle { font-size: 14px; }

  /* Product card on mobile */
  .product-card { font-size: 13px; }
  .product-card h4, .product-card .product-name { font-size: 13px; }

  /* Sidebar links larger touch on mobile */
  .sidebar-link { padding: 14px 16px; font-size: 14px; }
}

/* Active link highlight in bottom nav based on URL */
/* This is handled by adding 'active' class dynamically via JS */

/* ===================================================================
   STOREFRONT PAGE STYLES (Category, Search, Offers)
=================================================================== */

/* Page header */
.page-header {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, var(--primary-50), #fff);
  border-radius: 16px;
  margin-bottom: 24px;
  border: 1px solid var(--primary-100);
}
.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0 0 8px;
}
.page-header h1 i { color: var(--primary); margin-inline-end: 8px; }
.page-header .page-meta {
  color: var(--gray-600);
  font-size: 14px;
  margin: 0;
}
.text-primary { color: var(--primary); }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--gray-100);
  flex-wrap: wrap;
}
.filter-bar > span {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-700);
}
.filter-bar select {
  padding: 8px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  min-width: 180px;
}
.filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--gray-100);
}
.empty-state i {
  font-size: 64px;
  color: var(--gray-300);
  margin-bottom: 16px;
}
.empty-state h3 {
  font-size: 20px;
  color: var(--gray-700);
  margin: 12px 0 6px;
}
.empty-state p {
  color: var(--gray-500);
  margin: 0;
}

/* Large search bar */
.search-large {
  display: flex;
  gap: 0;
  max-width: 700px;
  margin: 24px auto;
  background: #fff;
  border: 2px solid var(--gray-200);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .15s;
}
.search-large:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}
.search-large input {
  flex: 1;
  padding: 14px 18px;
  border: none;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
}
.search-large input:focus { outline: none; }
.search-large button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .15s;
}
.search-large button:hover { background: var(--primary-dark); }

/* Offers grid large */
.offers-grid-large {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.offer-card-large {
  position: relative;
  display: block;
  min-height: 240px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  background-size: cover !important;
  background-position: center !important;
  text-decoration: none;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.offer-card-large:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(14, 148, 71, .25);
}
.offer-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, .3) 50%, transparent 100%);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
}
.offer-overlay h3 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 8px;
  color: #fff;
}
.offer-overlay p {
  font-size: 14px;
  opacity: .9;
  margin: 0 0 14px;
  line-height: 1.5;
}
.offer-badge {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  background: var(--danger);
  color: #fff;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
}
.offer-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .page-header { padding: 20px 14px; margin-bottom: 16px; border-radius: 12px; }
  .page-header h1 { font-size: 20px; }
  .filter-bar { padding: 10px 12px; }
  .filter-bar select { flex: 1; min-width: 0; }
  .search-large { margin: 16px 0; }
  .search-large input { padding: 12px; font-size: 14px; }
  .search-large button { padding: 12px 16px; font-size: 13px; }
  .search-large button span { display: none; }
  .offers-grid-large { grid-template-columns: 1fr; gap: 12px; }
  .offer-card-large { min-height: 180px; }
  .offer-overlay { padding: 16px; }
  .offer-overlay h3 { font-size: 18px; }
  .empty-state { padding: 40px 16px; }
  .empty-state i { font-size: 48px; }
  .empty-state h3 { font-size: 16px; }
}

/* ===== Qty Stepper - Mobile Fix ===== */
.qty-stepper {
  display: inline-flex !important;
  align-items: center;
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(14, 148, 71, .1);
}
.qty-stepper button {
  width: 36px !important;
  height: 36px !important;
  border: none;
  background: var(--primary-50, #f0fdf4);
  cursor: pointer;
  font-size: 18px !important;
  color: var(--primary, #0e9447);
  padding: 0;
  display: grid;
  place-items: center;
  transition: background .15s;
  font-weight: 700;
  line-height: 1;
}
.qty-stepper button:hover, .qty-stepper button:active {
  background: var(--primary, #0e9447);
  color: #fff;
}
.qty-stepper input {
  width: 50px !important;
  border: none;
  text-align: center;
  padding: 0;
  font-size: 14px !important;
  font-weight: 700;
  background: transparent;
  height: 36px;
  color: var(--gray-900);
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper input[type=number] { -moz-appearance: textfield; }
.qty-stepper input:focus { outline: none; background: var(--primary-50); }

@media (max-width: 600px) {
  .qty-stepper button { width: 40px !important; height: 40px !important; }
  .qty-stepper input { width: 48px !important; height: 40px; }
}

/* ===== Mobile logout button & user chip improvements ===== */
.logout-link, a[href*="logout"] {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fef2f2;
  color: #dc2626 !important;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid #fecaca;
  transition: all .15s;
}
.logout-link:hover, a[href*="logout"]:hover {
  background: #dc2626;
  color: #fff !important;
  border-color: #dc2626;
}
@media (max-width: 600px) {
  .logout-link, a[href*="logout"] {
    width: 100%;
    justify-content: center;
    padding: 12px;
    margin-top: 10px;
  }
  .user-chip { padding: 8px; }
  .user-chip .avatar { width: 36px; height: 36px; }
}

/* ==================================================================
   FILTERS SIDEBAR (Amazon-style)
================================================================== */
.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  margin-top: 20px;
}
.filters-sidebar {
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: 14px;
  padding: 18px;
  height: fit-content;
  position: sticky;
  top: 80px;
}
.filters-sidebar h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
}
.filters-sidebar h3 i { color: var(--primary); margin-inline-end: 6px; }
.filter-section { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--gray-50); }
.filter-section:last-child { border-bottom: none; }
.filter-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-700);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
  transition: color .15s;
}
.filter-checkbox:hover { color: var(--primary); }
.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.filter-checkbox span { flex: 1; }
.filter-checkbox small { color: var(--gray-400); font-size: 11px; }
/* قوائم الفلاتر قابلة للسكرول حتى لا يطول السايدبار */
.filter-scrollable { max-height: 220px; overflow-y: auto; padding-inline-end: 4px; }
.filter-scrollable::-webkit-scrollbar { width: 4px; }
.filter-scrollable::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 2px; }
/* قائمة التصنيفات أيضاً محدودة الارتفاع وتسكرول */
.filter-section .filter-checkbox { /* تبقى كما هي */ }
.catalog-main { min-width: 0; }
.mobile-filter-toggle { display: none; margin-bottom: 14px; }
.mobile-close-filters { display: none; }
/* الخلفية المعتمة مخفية تماماً على الديسكتوب */
.filters-backdrop { display: none; }

/* السايدبار على الديسكتوب: ارتفاع محدود بنافذة العرض مع سكرول داخلي */
@media (min-width: 901px) {
  .filters-sidebar {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
  .filters-sidebar::-webkit-scrollbar { width: 5px; }
  .filters-sidebar::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }
}

/* ===== لوحة الفلاتر المنزلقة (موبايل) — التطبيق الوحيد ===== */
@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .mobile-filter-toggle { display: inline-flex; }

  .filters-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;            /* تبدأ من الحافة المنطقية */
    width: 86%;
    max-width: 360px;
    z-index: 10001;                 /* فوق الـ bottom nav (9998) */
    background: #fff;
    border: none;
    border-radius: 0;
    box-shadow: -8px 0 30px rgba(0,0,0,.18);
    padding: 56px 16px calc(24px + env(safe-area-inset-bottom)) 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);    /* مخفية خارج الشاشة (LTR) */
    transition: transform .28s ease;
  }
  [dir="rtl"] .filters-sidebar { transform: translateX(-100%); } /* مخفية يميناً في RTL */
  .filters-sidebar.open { transform: translateX(0) !important; } /* تظهر */

  /* الخلفية المعتمة */
  .filters-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }
  .filters-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-close-filters {
    display: grid;
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    place-items: center;
    color: var(--gray-700);
    z-index: 2;
  }

  /* داخل اللوحة على الموبايل، القوائم تأخذ ارتفاعاً أكبر */
  .filter-scrollable { max-height: 260px; }
}

/* ==================================================================
   TOPBAR LOGOUT BUTTON (visible on all screens)
================================================================== */
.dash-topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fef2f2;
  color: #dc2626 !important;
  border: 1px solid #fecaca;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
}
.topbar-logout:hover { background: #dc2626; color: #fff !important; border-color: #dc2626; }
.topbar-logout i { font-size: 14px; }

@media (max-width: 600px) {
  .topbar-logout-text { display: none; }
  .topbar-logout { padding: 8px 10px; }
  .user-chip .info { display: none; }
}

/* ==================================================================
   LOCATION PICKER (Leaflet + Nominatim)
================================================================== */
.location-picker {
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.loc-search-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.loc-search-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.loc-search-row input:focus { outline: none; border-color: var(--primary); }
.loc-search-results {
  display: none;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
}
.loc-result-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-50);
  transition: background .15s;
}
.loc-result-item:hover { background: var(--primary-50); color: var(--primary); }
.loc-result-item i { color: var(--primary); margin-inline-end: 6px; font-size: 11px; }
.loc-map-container {
  width: 100%;
  height: 300px;
  position: relative;
  z-index: 1;
}
.loc-selected-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--primary-50);
  border-top: 1px solid var(--primary-100);
}
.loc-selected-bar > i { color: var(--primary); font-size: 18px; }
.loc-edit-btn {
  background: #fff;
  border: 1px solid var(--gray-200);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--gray-600);
  display: grid;
  place-items: center;
}
.loc-edit-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.hidden-xs { display: inline; }
@media (max-width: 480px) {
  .hidden-xs { display: none; }
  .loc-map-container { height: 240px; }
}

/* ============================================
   MOBILE FIXES & POLISH
   ============================================ */

/* Logout button in bottom nav - clean compact style */
.mbn-logout {
  color: #94a3b8 !important;
  position: relative;
}
.mbn-logout i {
  font-size: 17px !important;
  color: #ef4444;
  background: #fef2f2;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: all .15s;
}
.mbn-logout span {
  font-size: 9px !important;
  color: #ef4444;
  font-weight: 600;
}
.mbn-logout:active i {
  transform: scale(0.92);
  background: #fee2e2;
}

/* Mobile tables - horizontal scroll for all data-tables */
@media (max-width: 900px) {
  .card .data-table,
  .data-table {
    min-width: 100%;
  }
  /* Wrap data-table in horizontal scroll automatically */
  .card > .data-table:not(:has(thead th[colspan])) {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .data-table th, .data-table td {
    white-space: nowrap;
    font-size: 13px;
    padding: 10px 8px;
  }
  .data-table td small {
    font-size: 11px;
  }
}

/* Dashboard stats grid - better mobile layout */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .stat-card {
    padding: 12px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .stat-card .stat-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
  }
  .stat-value {
    font-size: 18px !important;
    line-height: 1.2;
    word-break: break-word;
  }
  .stat-label {
    font-size: 11px !important;
    line-height: 1.3;
  }
}

/* Doctor dashboard stats - single column when value is currency */
@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Favorites grid on mobile - 2 columns, smaller */
@media (max-width: 600px) {
  .fav-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .fav-card {
    padding: 8px !important;
  }
  .fav-card img, .fav-no-img {
    height: 80px !important;
  }
  .fav-info h4 {
    font-size: 11px !important;
    line-height: 1.3 !important;
  }
  .fav-info small {
    font-size: 9px !important;
  }
  .fav-price {
    font-size: 12px !important;
  }
  .fav-heart {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
  }
}

/* Profile page on mobile - stack vertical */
@media (max-width: 900px) {
  .grid-2[style*="grid-template-columns:1fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile profile picture - center it and limit size */
@media (max-width: 600px) {
  .card[style*="text-align:center"] img[alt="Avatar"],
  .card[style*="text-align:center"] > div > div[style*="border-radius:50%"] {
    width: 100px !important;
    height: 100px !important;
    font-size: 36px !important;
  }
}

/* Quick actions on mobile - 2 columns */
@media (max-width: 600px) {
  .quick-actions {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .quick-action-card {
    padding: 14px 8px !important;
    font-size: 12px !important;
  }
  .quick-action-card i {
    font-size: 24px !important;
  }
}

/* Page actions wrap nicely */
.page-actions {
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 600px) {
  .page-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    padding: 8px 10px;
  }
  .page-actions .btn-primary {
    flex-basis: 100%;
  }
}

/* Card subtitle font on mobile */
@media (max-width: 600px) {
  .card { padding: 12px !important; }
  .card h3 { font-size: 15px; }
  .card .card-subtitle { font-size: 12px; line-height: 1.5; }
}

/* Form groups stack on mobile */
@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Forms inputs better touch targets */
@media (max-width: 600px) {
  .form-group input, .form-group select, .form-group textarea {
    font-size: 16px; /* prevents zoom on iOS */
    padding: 12px;
  }
}


/* Profile layout */
.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}
.profile-avatar-card { position: sticky; top: 80px; }
@media (max-width: 900px) {
  .profile-avatar-card { position: static; }
}

/* Quick action cards - base style (clickable + hover) */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 14px;
  background: #fff;
  border: 1.5px solid var(--gray-100);
  border-radius: 14px;
  text-decoration: none !important;
  color: var(--gray-800);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
}
.quick-action-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(14,148,71,.12);
  color: var(--primary);
}
.quick-action-card:active { transform: translateY(-1px); }
.quick-action-card i {
  font-size: 28px;
  color: var(--primary);
  transition: transform .18s;
}
.quick-action-card:hover i { transform: scale(1.1); }

/* Make sure all stat-cards and links are clickable visually */
a.stat-card, a.report-card, a.fav-card, a.prod-pick-card {
  text-decoration: none !important;
  color: inherit;
}

/* Quantity stepper - mobile touch friendly */
.qty-stepper {
  display: inline-flex !important;
  align-items: center;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  height: 40px;
}
.qty-stepper button {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px;
  border: none;
  background: var(--gray-50);
  cursor: pointer;
  font-size: 20px !important;
  font-weight: 700;
  color: var(--gray-700);
  padding: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.qty-stepper button:hover { background: var(--primary-50); color: var(--primary); }
.qty-stepper button:active { background: var(--primary); color: #fff; }
.qty-stepper input {
  width: 50px;
  height: 40px;
  border: none;
  border-inline: 1.5px solid var(--gray-200);
  text-align: center;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  background: #fff;
  -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-stepper input:focus { outline: none; background: var(--primary-50); }

@media (max-width: 600px) {
  .qty-stepper { height: 44px; }
  .qty-stepper button { width: 44px !important; height: 44px !important; min-width: 44px; font-size: 22px !important; }
  .qty-stepper input { width: 56px; height: 44px; font-size: 17px; }
}

/* ============================================
   جداول جوال محسَّنة - حل scroll
   ============================================ */

/* Wrapper class - apply to any table-wrap div */
.table-responsive {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--gray-100);
  background: #fff;
}

/* Smart scroll indicator - shows arrow when content overflows */
.table-responsive::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  pointer-events: none;
  background: linear-gradient(to left, rgba(255,255,255,.95), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity .2s;
}
[dir="rtl"] .table-responsive::after {
  background: linear-gradient(to right, rgba(255,255,255,.95), rgba(255,255,255,0));
  left: 0;
  right: auto;
}
[dir="ltr"] .table-responsive::after { right: 0; }
.table-responsive.has-overflow::after { opacity: 1; }

.table-responsive table { margin: 0; min-width: 100%; }

/* Force all .card > .data-table to scroll on mobile */
@media (max-width: 900px) {
  .card .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    max-width: 100%;
  }
  .card .data-table thead, .card .data-table tbody, .card .data-table tr {
    display: table;
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }
  .card .data-table th, .card .data-table td {
    white-space: nowrap;
    padding: 12px 10px;
    font-size: 13px;
  }
  .card .data-table td small { font-size: 11px; }
  /* فقاعة "اسحب يميناً لرؤية المزيد" */
  .card .data-table::before {
    content: '← اسحب';
    position: sticky;
    top: 0;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 99px;
    display: inline-block;
    opacity: 0.8;
    z-index: 5;
  }
}

/* Scrollbar styling */
.table-responsive::-webkit-scrollbar,
.card .data-table::-webkit-scrollbar {
  height: 8px;
}
.table-responsive::-webkit-scrollbar-track,
.card .data-table::-webkit-scrollbar-track {
  background: var(--gray-50);
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb,
.card .data-table::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover,
.card .data-table::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Header logo image */
.logo-img {
  height: 44px;
  max-width: 220px;
  object-fit: contain;
  display: block;
}
@media (max-width: 600px) {
  .logo-img { height: 36px; max-width: 160px; }
}

/* Sidebar logo image */
.sidebar-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
}

/* ==================================================
   🚀 PATCH A: Mobile Storefront Improvements
   ================================================== */

/* Prevent horizontal scroll on the whole site - MOBILE ONLY
   (Desktop needs no overflow-x: hidden because it breaks position:sticky on sidebars,
    and no * { max-width: 100% } because it caps sidebar widths) */
@media (max-width: 768px) {
    html, body { 
        overflow-x: hidden !important; 
        max-width: 100vw;
    }
    * {
        max-width: 100%;
    }
    /* استثناء اللوحات المنزلقة الثابتة من قيد max-width حتى تعمل بشكل صحيح */
    .filters-sidebar, .filters-backdrop {
        max-width: 360px;
    }
    .filters-backdrop { max-width: 100vw; }
}

/* Mobile hero search - bigger and centered */
@media (max-width: 768px) {
    .hero { padding: 40px 16px !important; }
    .hero-title { font-size: 24px !important; line-height: 1.3 !important; }
    .hero-subtitle { font-size: 14px !important; }
    .hero-search {
        max-width: 100% !important;
        width: 100% !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    .hero-search input {
        width: 100% !important;
        padding: 14px 18px !important;
        font-size: 16px !important;
        border-radius: 12px !important;
        height: 50px;
    }
    .hero-search button {
        width: 100% !important;
        padding: 14px !important;
        font-size: 15px !important;
        border-radius: 12px !important;
        height: 50px;
    }
    .hero-decoration { display: none; }
    .hero-container { padding: 0 !important; }
    .hero-tags {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px !important;
        margin-top: 14px !important;
    }
    .hero-tag {
        font-size: 11px !important;
        padding: 5px 10px !important;
    }
}

/* Mobile category page - 2 products per row */
@media (max-width: 768px) {
    .products-grid,
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .product-card {
        padding: 8px !important;
    }
    .product-card-img,
    .product-card .product-img {
        height: 130px !important;
    }
    .product-card-body { padding: 10px 6px !important; }
    .product-card-title,
    .product-card h3 {
        font-size: 13px !important;
        line-height: 1.4 !important;
        height: 36px !important;
        overflow: hidden !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
    }
    .product-card .price,
    .product-card-price {
        font-size: 14px !important;
    }
    .product-card-brand,
    .product-card small {
        font-size: 10px !important;
    }
    .product-card .btn,
    .product-card button {
        font-size: 12px !important;
        padding: 7px 10px !important;
    }
}

/* Mobile cart icon badge in bottom nav */
.mbn-item { position: relative !important; overflow: visible !important; }
.mbn-cart-badge {
    position: absolute !important;
    top: -2px !important;
    inset-inline-end: 6px !important;
    background: #ef4444 !important;
    color: #fff !important;
    border-radius: 999px !important;
    min-width: 20px !important;
    height: 20px !important;
    padding: 0 6px !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, .5) !important;
    border: 2px solid #fff !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    z-index: 1000 !important;
    pointer-events: none !important;
}
/* احترم inline style: display:none تعمل، display:flex تعمل */
.mbn-cart-badge[style*="display:none"] { display: none !important; }
.mbn-cart-badge[style*="display:flex"],
.mbn-cart-badge[style*="display: flex"],
.mbn-cart-badge:not([style*="display:none"]) { display: flex !important; }

/* Mobile cart page - card layout instead of table */
@media (max-width: 768px) {
    .cart-table,
    .cart-table thead { display: none !important; }
    .cart-table,
    .cart-table tbody,
    .cart-table tr,
    .cart-table td { display: block !important; width: 100% !important; }
    .cart-table tr {
        background: #fff;
        border: 1px solid var(--gray-100);
        border-radius: 14px;
        padding: 14px;
        margin-bottom: 12px;
        position: relative;
    }
    .cart-table td {
        padding: 6px 0 !important;
        border: none !important;
        text-align: start !important;
    }
    .cart-table td::before {
        content: attr(data-label) ': ';
        font-weight: 600;
        color: var(--gray-600);
        font-size: 12px;
        display: inline-block;
        margin-inline-end: 6px;
    }
    .cart-table td.cart-img-cell::before { display: none; }
    .cart-table .cart-img-cell img {
        width: 80px !important;
        height: 80px !important;
        object-fit: contain;
        background: var(--gray-50);
        border-radius: 10px;
        margin-bottom: 8px;
    }
    .cart-table td.cart-name-cell {
        font-weight: 700;
        font-size: 15px;
        color: var(--gray-900);
    }
    .cart-table td.cart-name-cell::before { display: none; }
    .cart-table td.cart-actions-cell::before { display: none; }
    .cart-table td.cart-actions-cell {
        display: flex !important;
        gap: 10px;
        margin-top: 10px;
        justify-content: space-between;
        align-items: center;
        border-top: 1px dashed var(--gray-200) !important;
        padding-top: 10px !important;
    }
}

/* Universal quantity stepper - applies everywhere */
.qty-stepper-universal {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    height: 40px;
}
.qty-stepper-universal button {
    width: 36px; height: 40px; min-width: 36px;
    border: none; background: var(--gray-50); cursor: pointer;
    font-size: 18px; font-weight: 700; color: var(--gray-700);
    padding: 0; display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.qty-stepper-universal button:hover { background: var(--primary-50); color: var(--primary); }
.qty-stepper-universal button:active { background: var(--primary); color: #fff; }
.qty-stepper-universal input {
    width: 50px; height: 40px;
    border: none; border-inline: 1.5px solid var(--gray-200);
    text-align: center; padding: 0;
    font-size: 16px; font-weight: 700; background: #fff;
    -moz-appearance: textfield;
}
.qty-stepper-universal input::-webkit-outer-spin-button,
.qty-stepper-universal input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}
.qty-stepper-universal input:focus { outline: none; background: var(--primary-50); }

@media (max-width: 600px) {
    .qty-stepper-universal { height: 44px; }
    .qty-stepper-universal button { width: 40px; height: 44px; min-width: 40px; font-size: 20px; }
    .qty-stepper-universal input { width: 54px; height: 44px; font-size: 17px; }
}

/* (تطبيق لوحة الفلاتر المنزلقة موحّد بالأعلى عند max-width:900px) */

/* Cart layout: stack on mobile */
@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    .cart-layout > .card:last-child {
        position: static !important;
    }
}

/* ==================================================
   🚀 PATCH B+C+D: Mobile Dashboard Accordion Tables
   ================================================== */

/* Mobile accordion table: hide table on mobile, show cards instead */
@media (max-width: 768px) {
    .data-table.acc-table,
    table.data-table.acc-table { display: none !important; }
    .acc-cards { display: block !important; }
}
@media (min-width: 769px) {
    .acc-cards { display: none !important; }
}

/* Accordion card layout */
.acc-cards { display: none; }
.acc-card {
    background: #fff;
    border: 1.5px solid var(--gray-100);
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: all .2s;
}
.acc-card.open {
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(14,148,71,.1);
}
.acc-card-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.acc-card-header:active { background: var(--gray-50); }
.acc-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-50);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 18px;
    flex-shrink: 0;
}
.acc-card-summary {
    flex: 1;
    min-width: 0;
}
.acc-card-summary h4 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.acc-card-summary p {
    margin: 0;
    font-size: 12px;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.acc-card-meta {
    text-align: end;
    font-size: 12px;
    color: var(--gray-700);
    flex-shrink: 0;
}
.acc-card-meta strong { color: var(--primary); display: block; font-size: 14px; font-weight: 700; }
.acc-card-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-50);
    border: none;
    display: grid;
    place-items: center;
    color: var(--gray-500);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s;
}
.acc-card.open .acc-card-toggle {
    background: var(--primary);
    color: #fff;
    transform: rotate(180deg);
}
.acc-card-body {
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: all .3s;
}
.acc-card.open .acc-card-body {
    padding: 14px 16px;
    max-height: 2000px;
    border-top: 1px dashed var(--gray-200);
}
.acc-card-body .info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--gray-100);
    gap: 12px;
}
.acc-card-body .info-row:last-child { border-bottom: none; }
.acc-card-body .info-row .label {
    color: var(--gray-500);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}
.acc-card-body .info-row .value {
    color: var(--gray-900);
    font-size: 13px;
    font-weight: 600;
    text-align: end;
    word-break: break-word;
}
.acc-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.acc-card-actions .btn {
    flex: 1;
    min-width: 80px;
    font-size: 12px;
    padding: 8px 10px;
}

/* Stat cards grid - 2 per row on mobile */
.stat-cards-mobile {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
@media (max-width: 768px) {
    .stat-cards-mobile {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
}

/* Colored stat card style */
.stat-card-v2 {
    background: linear-gradient(135deg, var(--card-bg-1, var(--primary)), var(--card-bg-2, var(--primary)));
    color: #fff;
    border-radius: 14px;
    padding: 16px;
    text-decoration: none;
    display: block;
    transition: transform .15s;
}
.stat-card-v2:hover { transform: translateY(-3px); }
.stat-card-v2:active { transform: translateY(-1px); }
.stat-card-v2 .icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: .9;
}
.stat-card-v2 .num {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 4px;
}
.stat-card-v2 .label {
    font-size: 12px;
    opacity: .92;
    font-weight: 600;
}
@media (max-width: 768px) {
    .stat-card-v2 { padding: 14px 12px; }
    .stat-card-v2 .icon { font-size: 22px; }
    .stat-card-v2 .num { font-size: 20px; }
    .stat-card-v2 .label { font-size: 11px; }
}

/* Color variants for stat cards */
.scv-primary { --card-bg-1: #0e9447; --card-bg-2: #16a34a; }
.scv-blue { --card-bg-1: #2563eb; --card-bg-2: #3b82f6; }
.scv-purple { --card-bg-1: #9333ea; --card-bg-2: #a855f7; }
.scv-orange { --card-bg-1: #ea580c; --card-bg-2: #f97316; }
.scv-pink { --card-bg-1: #db2777; --card-bg-2: #ec4899; }
.scv-teal { --card-bg-1: #0d9488; --card-bg-2: #14b8a6; }
.scv-amber { --card-bg-1: #d97706; --card-bg-2: #f59e0b; }
.scv-red { --card-bg-1: #dc2626; --card-bg-2: #ef4444; }
.scv-cyan { --card-bg-1: #0891b2; --card-bg-2: #06b6d4; }

/* Mobile bottom nav fixes - smaller logout/icons */
@media (max-width: 768px) {
    .mobile-bottom-nav { padding: 6px 0 !important; }
    .mbn-item {
        padding: 6px 4px !important;
        font-size: 10px !important;
    }
    .mbn-item i { font-size: 18px !important; }
    .mbn-item span {
        font-size: 10px !important;
        margin-top: 2px;
    }
    .mbn-logout, .mbn-item[href*="logout"] {
        max-width: 80px;
    }
}

/* Mobile sidebar fixes - own scroll + don't hide content (FIX v2) */
@media (max-width: 992px) {
    .sidebar {
        position: fixed !important;
        top: 0;
        bottom: 0;
        height: 100vh !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 90px !important; /* space for bottom nav */
        z-index: 9999 !important;
    }
    .sidebar-nav {
        overflow-y: visible !important;
        max-height: none !important;
        padding-bottom: 20px;
    }
    /* Ensure last items are reachable */
    .sidebar-link:last-child,
    .sidebar > *:last-child {
        margin-bottom: 60px;
    }
    /* bottom nav should not block content but visible above */
    .mobile-bottom-nav {
        z-index: 9998;
    }
}

/* Mobile filter bar - filter button instead of inline pills */
@media (max-width: 768px) {
    .filter-bar,
    .filters-row {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .filter-bar > *,
    .filters-row > * {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
        font-size: 12px !important;
    }
    .filter-bar .pill,
    .filters-row .pill {
        padding: 8px 10px !important;
        font-size: 11px !important;
    }
}

/* Status filter mobile dropdown wrapper */
.status-filter-mobile {
    display: none;
}
@media (max-width: 768px) {
    .status-filter-mobile { display: block; margin-bottom: 12px; }
    .status-filter-mobile select {
        width: 100%;
        padding: 12px;
        border: 1.5px solid var(--gray-200);
        border-radius: 10px;
        font-size: 14px;
        background: #fff;
    }
    .status-filter-pills { display: none !important; }
}

/* User chip clickable */
.user-chip {
    cursor: pointer;
    transition: all .15s;
    padding: 4px 8px;
    border-radius: 10px;
}
.user-chip:hover {
    background: var(--gray-50);
}

/* Grid-2 stacks on mobile */
@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
}

/* ==================================================
   Header Mobile Optimization
   ================================================== */
.header-action-mobile-only { display: none; }
.header-action-desktop-only { display: flex; }

@media (max-width: 768px) {
    /* Show only the partner register button + menu toggle */
    .header-action-mobile-only { display: flex !important; align-items: center; gap: 6px; }
    .header-action-desktop-only { display: none !important; }
    
    /* Smaller header search */
    .search-bar {
        max-width: 200px !important;
        margin: 0 8px !important;
    }
    .search-bar input {
        padding: 8px 12px !important;
        font-size: 13px !important;
        height: 36px !important;
    }
    .search-bar button {
        padding: 0 12px !important;
        height: 36px !important;
    }
    
    /* Smaller header overall */
    .header { padding: 8px 0 !important; }
    .header-content { padding: 0 12px !important; gap: 6px !important; }
    .logo { font-size: 16px !important; }
    .logo img, .logo-img { height: 36px !important; max-width: 120px; object-fit: contain; }
    .logo-icon { width: 32px; height: 32px; font-size: 16px; }
    
    .menu-toggle {
        padding: 6px 8px !important;
        font-size: 16px !important;
    }
    
    .header-actions { gap: 6px !important; }
}

/* Make sure cart users still have option to access cart from bottom nav */

/* Flash message - error stays visible with stronger styling */
.flash-message {
    position: relative;
    padding: 14px 18px !important;
    border-radius: 10px !important;
    margin-bottom: 12px !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.flash-error,
.flash-danger {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border: 1.5px solid #fecaca !important;
    border-inline-start: 4px solid #dc2626 !important;
    font-size: 14px;
}
.flash-error::before,
.flash-danger::before {
    content: '⚠️ ';
    font-size: 16px;
}
.flash-success {
    border-inline-start: 4px solid #16a34a !important;
}
.flash-close {
    position: absolute !important;
    top: 8px !important;
    inset-inline-end: 12px !important;
    background: transparent !important;
    border: none !important;
    font-size: 22px !important;
    cursor: pointer !important;
    color: inherit !important;
    opacity: .6 !important;
    padding: 0 6px !important;
    line-height: 1 !important;
}
.flash-close:hover { opacity: 1 !important; }

/* ====================================================================
   🛍️ STOREFRONT REDESIGN - Amazon/Noon Style
   ==================================================================== */

/* Reset some old styles that conflict */
.store-page * { box-sizing: border-box; }
.store-page {
    background: #f7f8fa;
    min-height: 100vh;
}

/* ===== Hero Section ===== */
.store-hero {
    background: linear-gradient(135deg, #0e9447 0%, #16a34a 100%);
    color: #fff;
    padding: 30px 14px;
    margin: 0;
}
.store-hero-inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}
.store-hero h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
    color: #fff;
    line-height: 1.3;
}
.store-hero p {
    font-size: 13px;
    margin: 0 0 14px;
    opacity: .95;
}
.store-hero-search {
    display: flex;
    background: #fff;
    border-radius: 12px;
    padding: 4px;
    align-items: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.store-hero-search i {
    color: var(--gray-400);
    padding: 0 12px;
    font-size: 16px;
}
.store-hero-search input {
    flex: 1;
    border: none;
    padding: 12px 4px;
    font-size: 14px;
    background: transparent;
    outline: none;
    min-width: 0;
    color: var(--gray-900);
}
.store-hero-search button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ===== Badges Row ===== */
.store-badges {
    background: #fff;
    padding: 12px 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    border-bottom: 1px solid var(--gray-100);
}
.store-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    padding: 6px 4px;
}
.store-badge i {
    font-size: 18px;
    color: var(--primary);
}
.store-badge span {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-700);
    line-height: 1.2;
}

/* ===== Sections ===== */
.store-section {
    padding: 18px 14px;
    background: #fff;
    margin-top: 8px;
}
.store-section-light {
    background: #f7f8fa;
}
.store-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.store-section-header h2 {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    color: var(--gray-900);
}
.store-section-header a {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== Categories Horizontal Scroll (Noon style) ===== */
.store-categories-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0 10px;
    margin: 0 -14px;
    padding-inline: 14px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.store-categories-scroll::-webkit-scrollbar { display: none; }

.store-cat-tile {
    flex: 0 0 auto;
    width: 88px;
    text-align: center;
    text-decoration: none;
    scroll-snap-align: start;
    transition: transform .15s;
}
.store-cat-tile:active { transform: scale(.95); }

.store-cat-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    display: grid;
    place-items: center;
    margin: 0 auto 6px;
    border: 2px solid var(--primary-100, #d1fae5);
    transition: all .2s;
}
.store-cat-icon i {
    font-size: 26px;
    color: var(--primary);
}
.store-cat-tile:hover .store-cat-icon {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(14,148,71,.2);
}
.store-cat-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Offers Horizontal Scroll ===== */
.store-offers-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 0 10px;
    margin: 0 -14px;
    padding-inline: 14px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.store-offers-scroll::-webkit-scrollbar { display: none; }

.store-offer-card {
    flex: 0 0 auto;
    width: 280px;
    height: 140px;
    border-radius: 14px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-color: var(--primary);
    position: relative;
    text-decoration: none;
    color: #fff;
    scroll-snap-align: start;
}
.store-offer-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.25) 100%);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.store-offer-overlay h3 {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 4px;
    color: #fff;
}
.store-offer-overlay p {
    font-size: 12px;
    margin: 0;
    opacity: .95;
}
.store-offer-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    background: #fbbf24;
    color: #78350f;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

/* ===== Products Grid - 2 cols mobile, more on desktop ===== */
.store-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 600px) { .store-products-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 900px) { .store-products-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .store-products-grid { grid-template-columns: repeat(5, 1fr); } }

/* ===== Product Card v2 (Amazon/Noon style) ===== */
.store-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    transition: all .2s;
}
.store-product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 16px rgba(14,148,71,.12);
    transform: translateY(-2px);
}
.spc-image {
    position: relative;
    aspect-ratio: 1;
    background: #f9fafb;
    overflow: hidden;
}
.spc-image-link {
    display: block;
    width: 100%;
    height: 100%;
}
.spc-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    transition: transform .3s;
}
.store-product-card:hover .spc-image img { transform: scale(1.05); }

.spc-badge {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    z-index: 2;
}
.spc-badge-discount { background: #dc2626; color: #fff; }
.spc-badge-new { background: #2563eb; color: #fff; }

.spc-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
}
.spc-brand {
    font-size: 10px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .3px;
    font-weight: 600;
}
.spc-name {
    color: var(--gray-900);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 36px;
}
.spc-name:hover { color: var(--primary); }

.spc-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}
.spc-stars { color: #f59e0b; font-size: 10px; }
.spc-rating-count { color: var(--gray-500); }

.spc-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}
.spc-current {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}
.spc-old {
    font-size: 12px;
    color: var(--gray-400);
    text-decoration: line-through;
}

.spc-cart-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: stretch;
}

.spc-qty {
    display: flex;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.spc-qty-btn {
    width: 28px;
    height: 36px;
    border: none;
    background: var(--gray-50);
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-700);
    padding: 0;
    transition: all .15s;
}
.spc-qty-btn:hover { background: var(--primary-50, #ecfdf5); color: var(--primary); }
.spc-qty-btn:active { background: var(--primary); color: #fff; }
.spc-qty-input {
    width: 32px;
    height: 36px;
    border: none;
    border-inline: 1px solid var(--gray-200);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    -moz-appearance: textfield;
    padding: 0;
}
.spc-qty-input::-webkit-outer-spin-button,
.spc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

.spc-add-btn {
    flex: 1;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 8px;
    height: 36px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all .15s;
}
.spc-add-btn:hover { background: #047857; }
.spc-add-btn:active { transform: scale(.97); }
.spc-add-btn.added {
    background: #16a34a;
    animation: spcPulse .3s;
}
@keyframes spcPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* On very narrow phones (~360px), hide the label */
@media (max-width: 380px) {
    .spc-add-label { display: none; }
    .spc-add-btn { padding: 0 6px; }
    .spc-qty-btn { width: 26px; }
    .spc-qty-input { width: 28px; font-size: 12px; }
}

/* ====================================================================
   📁 Category Page redesign  
   ==================================================================== */

.store-cat-page .breadcrumb {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 10px;
}
.store-cat-page .breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.store-cat-page .breadcrumb i { font-size: 9px; margin: 0 6px; }

.store-cat-header {
    margin-bottom: 14px;
}
.store-cat-header h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 4px;
    color: var(--gray-900);
}
.store-cat-meta {
    color: var(--gray-500);
    font-size: 13px;
    margin: 0;
}
.store-cat-meta span { color: var(--primary); font-weight: 700; }

/* Toolbar: filter button + sort */
.store-cat-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    position: sticky;
    top: 60px;
    z-index: 10;
    background: #f7f8fa;
    padding: 8px 0;
}
.store-cat-tool {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--gray-700);
    position: relative;
}
.store-cat-tool:active { background: var(--gray-50); }
.store-cat-tool i { color: var(--primary); }
.store-cat-tool-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 800;
}

.store-cat-tool-sort {
    flex: 1;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.store-cat-tool-sort i { color: var(--primary); font-size: 14px; }
.store-cat-tool-sort select {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    outline: none;
}

/* Filter drawer */
.store-filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.store-filter-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.store-filter-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;
    width: 88%;
    max-width: 380px;
    background: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s ease-out;
    box-shadow: -8px 0 30px rgba(0,0,0,.2);
}
[dir="rtl"] .store-filter-drawer {
    transform: translateX(-100%);
}
.store-filter-drawer.open {
    transform: translateX(0);
}

.store-filter-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.store-filter-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}
.store-filter-header h3 i { color: var(--primary); margin-inline-end: 6px; }
.store-filter-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--gray-700);
}

.store-filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
    -webkit-overflow-scrolling: touch;
}

.store-filter-group {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--gray-100);
}
.store-filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.store-filter-group h4 {
    font-size: 13px;
    font-weight: 800;
    margin: 0 0 10px;
    color: var(--gray-900);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.store-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
}
.store-filter-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin: 0;
}
.store-filter-label {
    flex: 1;
    color: var(--gray-800);
}
.store-filter-count {
    color: var(--gray-400);
    font-size: 12px;
}

.store-filter-price {
    display: flex;
    gap: 8px;
}
.store-filter-price input {
    flex: 1;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
}

.store-filter-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--gray-100);
    background: #fff;
    display: flex;
    gap: 8px;
}
.store-filter-footer .btn {
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
}

/* ====================================================================
   📁 Category Page - Desktop Grid Fix
   ==================================================================== */

/* Desktop: filters in column 1, products in column 2 */
@media (min-width: 992px) {
    .store-cat-toolbar { display: none !important; }
    .store-filter-backdrop { display: none !important; }
    
    .store-cat-page {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 24px;
        align-items: start;
        margin-top: 16px;
    }
    
    /* Filter sidebar - desktop position (FIXED: no double scroll) */
    .store-filter-drawer {
        position: sticky !important;
        top: 80px !important;
        bottom: auto !important;
        inset-inline-end: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;        /* prevent horizontal overflow */
        max-height: calc(100vh - 100px) !important;
        box-shadow: 0 2px 12px rgba(0,0,0,.06) !important;
        border: 1px solid var(--gray-100);
        border-radius: 14px;
        background: #fff;
        display: flex !important;
        flex-direction: column;
        overflow: hidden !important;        /* prevent outer scroll */
    }
    /* Inner body scrolls only when content is too tall */
    .store-filter-drawer .store-filter-body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 14px 16px !important;
        scrollbar-width: thin;
    }
    .store-filter-drawer .store-filter-body::-webkit-scrollbar {
        width: 6px;
    }
    .store-filter-drawer .store-filter-body::-webkit-scrollbar-thumb {
        background: var(--gray-300);
        border-radius: 3px;
    }
    .store-filter-drawer .store-filter-body::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .store-filter-close { display: none !important; }
    .store-filter-footer { display: none !important; }
    .store-filter-desktop-actions { 
        display: block !important; 
        padding: 14px 16px;
        border-top: 1px solid var(--gray-100);
        background: #fff;
        flex-shrink: 0;
    }
    
    /* Products area */
    .store-cat-main {
        min-width: 0; /* prevent grid overflow */
    }
    
    /* Desktop sort bar */
    .store-cat-sort-desktop {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        background: #fff;
        padding: 12px 18px;
        border-radius: 12px;
        border: 1px solid var(--gray-100);
        margin-bottom: 16px;
    }
    .store-cat-result-count {
        font-weight: 700;
        color: var(--gray-700);
        font-size: 14px;
    }
    .store-cat-sort-desktop .store-cat-tool-sort {
        flex: 0 0 220px;
    }
}

/* Mobile/tablet: hide desktop bar, show drawer */
@media (max-width: 991px) {
    .store-cat-sort-desktop { display: none !important; }
    .store-filter-desktop-actions { display: none !important; }
    
    .store-cat-page {
        display: block;
    }
}

.store-filter-desktop-actions { display: none; }
.store-cat-sort-desktop { display: none; }

/* Page wrap background */
.store-cat-page-wrap {
    background: #f7f8fa;
    min-height: 60vh;
    padding: 14px 0 30px;
}
@media (min-width: 992px) {
    .store-cat-page-wrap {
        padding: 20px 0 60px;
    }
}


/* ====================================================================
   Hide old style classes
   ==================================================================== */
.hero,
.features-bar,
.section,
.categories-grid,
.offers-grid {
    /* Hide old homepage sections when new ones are rendering */
}

/* On mobile: smaller hero, hide decoration */
@media (max-width: 768px) {
    .hero-decoration { display: none; }
}

/* ====================================================================
   🛒 Header Cart Icon with Badge
   ==================================================================== */
.header-cart {
    position: relative;
    background: var(--primary-50, #ecfdf5);
    color: var(--primary);
    border-radius: 10px;
    padding: 8px 12px;
    border: 1.5px solid var(--primary-100, #d1fae5);
    transition: all .15s;
}
.header-cart:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.header-cart i { font-size: 18px; }
.header-cart-badge {
    position: absolute;
    top: -6px;
    inset-inline-end: -6px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(239,68,68,.4);
    line-height: 1;
}

/* Mobile: cart icon is icon-only and smaller */
@media (max-width: 768px) {
    .header-cart { padding: 8px 10px !important; }
    .header-cart i { font-size: 16px; }
}

/* Update JS-managed badge */
.header-cart[data-cart-count="0"] .header-cart-badge,
.header-cart-badge:empty { display: none !important; }

/* ====================================================================
   FIX: Footer + bottom nav spacing
   IMPORTANT: do NOT make body display:flex - it breaks position:sticky on .header
   ==================================================================== */
@media (max-width: 768px) {
    /* Make sure footer comes after content with proper background */
    body { 
        background: #f7f8fa;
        min-height: 100vh;
        /* NOTE: We do NOT use display:flex here because it breaks position:sticky
           on the header. Instead, use min-height + margin auto on footer. */
    }
    main { 
        background: transparent;
    }
    
    /* Footer mobile styling */
    .footer {
        margin-top: 20px;
        padding-bottom: 90px !important; /* space for bottom nav */
        background: #1f2937 !important;
        color: #fff !important;
    }
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 24px 16px !important;
    }
    .footer h4 {
        font-size: 14px !important;
        margin-bottom: 10px !important;
        color: #fff !important;
    }
    .footer ul {
        padding: 0 !important;
        list-style: none !important;
    }
    .footer ul li {
        padding: 4px 0 !important;
    }
    .footer a {
        color: #d1d5db !important;
        font-size: 13px !important;
    }
    .footer-bottom {
        text-align: center;
        padding: 16px;
        border-top: 1px solid rgba(255,255,255,.1);
        color: #9ca3af;
        font-size: 12px;
    }
    .footer-social {
        display: flex;
        gap: 10px;
        margin-top: 10px;
    }
    .footer-social a {
        width: 36px;
        height: 36px;
        background: rgba(255,255,255,.1);
        border-radius: 50%;
        display: grid;
        place-items: center;
        color: #fff !important;
    }
}

/* Desktop footer */
@media (min-width: 769px) {
    .footer {
        background: #1f2937;
        color: #fff;
        padding: 40px 0 0;
        margin-top: 40px;
    }
    .footer .container { padding: 0 16px; }
    .footer-grid {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: 30px;
    }
    .footer h4 { color: #fff; margin-bottom: 12px; }
    .footer a { color: #d1d5db; text-decoration: none; font-size: 14px; }
    .footer a:hover { color: var(--primary); }
    .footer ul { padding: 0; list-style: none; }
    .footer ul li { padding: 4px 0; }
    .footer-bottom { 
        text-align: center; 
        padding: 20px; 
        margin-top: 30px;
        border-top: 1px solid rgba(255,255,255,.1); 
        color: #9ca3af; 
    }
    .footer-social {
        display: flex;
        gap: 10px;
        margin-top: 14px;
    }
    .footer-social a {
        width: 38px;
        height: 38px;
        background: rgba(255,255,255,.1);
        border-radius: 50%;
        display: grid;
        place-items: center;
        color: #fff;
    }
}

/* Force store page to fill remaining space */
.store-page {
    background: #f7f8fa !important;
    padding-bottom: 0 !important;
}
@media (max-width: 768px) {
    .store-page {
        margin-bottom: 0;
    }
}

/* ====================================================================
   Partner CTA Card
   ==================================================================== */
.store-cta,
section.store-cta,
.store-section.store-cta {
    background: linear-gradient(135deg, #0e9447 0%, #047857 100%) !important;
    color: #fff !important;
    text-align: center;
    border-radius: 0;
    margin-top: 8px;
}
.store-cta * { color: #fff; }
.store-cta-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 14px 0;
}
.store-cta-icon {
    font-size: 48px;
    opacity: .9;
    margin-bottom: 12px;
    color: #fff !important;
}
.store-cta h3 {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 8px;
    color: #fff !important;
}
.store-cta p {
    font-size: 14px;
    margin: 0 0 16px;
    opacity: .95;
    line-height: 1.6;
    color: #fff !important;
}
.store-cta .btn {
    background: #fff !important;
    color: #0e9447 !important;
    font-weight: 800 !important;
    padding: 12px 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px;
}
.store-cta .btn i { color: #0e9447 !important; }
.store-cta .btn:hover {
    background: #fef3c7 !important;
    color: #92400e !important;
}
.store-cta .btn:hover i { color: #92400e !important; }

/* ====================================================================
   🖥️ DESKTOP REDESIGN - Storefront Polish
   ==================================================================== */
@media (min-width: 769px) {
    /* Hero is more grand on desktop */
    .store-hero {
        padding: 60px 14px 70px !important;
        position: relative;
        overflow: hidden;
    }
    .store-hero::before {
        content: '';
        position: absolute;
        top: -50px;
        right: -50px;
        width: 200px;
        height: 200px;
        background: rgba(255,255,255,.08);
        border-radius: 50%;
    }
    .store-hero::after {
        content: '';
        position: absolute;
        bottom: -80px;
        left: -80px;
        width: 280px;
        height: 280px;
        background: rgba(255,255,255,.06);
        border-radius: 50%;
    }
    .store-hero-inner {
        position: relative;
        z-index: 2;
        max-width: 720px;
    }
    .store-hero h1 {
        font-size: 42px !important;
        margin-bottom: 12px !important;
        line-height: 1.2 !important;
    }
    .store-hero p {
        font-size: 17px !important;
        margin-bottom: 24px !important;
    }
    .store-hero-search {
        max-width: 640px;
        margin: 0 auto;
        padding: 6px;
    }
    .store-hero-search i {
        font-size: 18px;
        padding: 0 16px;
    }
    .store-hero-search input {
        padding: 16px 6px;
        font-size: 16px;
    }
    .store-hero-search button {
        padding: 14px 32px;
        font-size: 15px;
    }

    /* Badges bar on desktop - bigger */
    .store-badges {
        max-width: 1240px;
        margin: 0 auto;
        padding: 20px 24px !important;
        gap: 16px !important;
        border-radius: 0 0 18px 18px;
        margin-top: -24px;
        position: relative;
        z-index: 3;
        background: #fff;
        box-shadow: 0 10px 30px rgba(0,0,0,.08);
    }
    .store-badge {
        flex-direction: row !important;
        gap: 12px !important;
        text-align: start !important;
        padding: 10px !important;
    }
    .store-badge i {
        font-size: 24px !important;
        background: var(--primary-50, #ecfdf5);
        width: 48px;
        height: 48px;
        border-radius: 50%;
        display: grid;
        place-items: center;
        flex-shrink: 0;
    }
    .store-badge span {
        font-size: 13px !important;
        font-weight: 700 !important;
    }

    /* Sections wider on desktop */
    .store-section {
        max-width: 1240px;
        margin: 0 auto !important;
        padding: 24px !important;
        border-radius: 16px;
        margin-top: 20px !important;
        background: #fff !important;
        box-shadow: 0 2px 10px rgba(0,0,0,.04);
    }
    .store-section-header {
        margin-bottom: 20px !important;
    }
    .store-section-header h2 {
        font-size: 22px !important;
        font-weight: 800 !important;
        position: relative;
        padding-bottom: 8px;
    }
    .store-section-header h2::after {
        content: '';
        position: absolute;
        bottom: 0;
        inset-inline-start: 0;
        width: 50px;
        height: 3px;
        background: var(--primary);
        border-radius: 2px;
    }
    .store-section-header a {
        font-size: 14px !important;
        padding: 6px 14px;
        background: var(--primary-50, #ecfdf5);
        border-radius: 8px;
        transition: all .15s;
    }
    .store-section-header a:hover {
        background: var(--primary);
        color: #fff !important;
    }

    /* Categories desktop - bigger circles, no scroll needed */
    .store-categories-scroll {
        overflow: visible !important;
        flex-wrap: wrap !important;
        justify-content: center;
        gap: 18px !important;
        padding: 4px !important;
        margin: 0 !important;
    }
    .store-cat-tile {
        width: 110px !important;
    }
    .store-cat-icon {
        width: 90px !important;
        height: 90px !important;
    }
    .store-cat-icon i {
        font-size: 32px !important;
    }
    .store-cat-name {
        font-size: 13px !important;
    }

    /* Offers desktop - 2 cards visible at once */
    .store-offers-scroll {
        overflow-x: auto;
        gap: 18px !important;
    }
    .store-offer-card {
        width: 380px !important;
        height: 180px !important;
    }
    .store-offer-overlay h3 {
        font-size: 20px !important;
    }

    /* Products grid: wider gap */
    .store-products-grid {
        gap: 16px !important;
    }

    /* Product card hover effect */
    .store-product-card {
        border-radius: 14px !important;
    }
    .store-product-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(14,148,71,.18) !important;
    }
    .spc-body {
        padding: 14px !important;
        gap: 6px !important;
    }
    .spc-name {
        font-size: 14px !important;
        height: 38px !important;
    }
    .spc-current {
        font-size: 18px !important;
    }
    .spc-old {
        font-size: 13px !important;
    }
    .spc-qty-btn {
        width: 32px !important;
        height: 38px !important;
        font-size: 17px !important;
    }
    .spc-qty-input {
        width: 38px !important;
        height: 38px !important;
        font-size: 14px !important;
    }
    .spc-add-btn {
        font-size: 12px !important;
        height: 38px !important;
        padding: 0 12px !important;
    }
    .spc-add-btn i { font-size: 13px; }

    /* CTA section on desktop */
    .store-cta {
        padding: 50px 24px !important;
        margin-top: 30px !important;
    }
    .store-cta-icon {
        font-size: 64px !important;
    }
    .store-cta h3 {
        font-size: 28px !important;
    }
    .store-cta p {
        font-size: 16px !important;
    }
    .store-cta .btn {
        font-size: 16px !important;
        padding: 14px 36px !important;
    }
}

/* On very wide screens, give it more breathing room */
@media (min-width: 1240px) {
    .store-section {
        max-width: 1240px;
    }
}

/* ====================================================================
   🛒 Floating Cart Widget (Desktop only)
   ==================================================================== */
.floating-cart {
    position: fixed;
    bottom: 30px;
    inset-inline-end: 30px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: none; /* shown via JS when items > 0 */
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(14,148,71,.4);
    z-index: 9000;
    transition: all .3s;
    cursor: pointer;
}
.floating-cart.show {
    display: flex;
    animation: floatingCartIn .4s ease-out;
}
.floating-cart:hover {
    transform: scale(1.08);
    box-shadow: 0 14px 40px rgba(14,148,71,.5);
}
.floating-cart i {
    font-size: 26px;
}
.floating-cart-badge {
    position: absolute;
    top: -6px;
    inset-inline-end: -6px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    box-shadow: 0 3px 8px rgba(239,68,68,.4);
}
.floating-cart-tooltip {
    position: absolute;
    inset-inline-end: 76px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-900);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all .2s;
}
.floating-cart-tooltip::after {
    content: '';
    position: absolute;
    inset-inline-end: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-inline-start-color: var(--gray-900);
}
.floating-cart:hover .floating-cart-tooltip {
    opacity: 1;
}

@keyframes floatingCartIn {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    60% { transform: scale(1.15) rotate(10deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes floatingCartBump {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.15); }
    60% { transform: scale(.95); }
}
.floating-cart.bump { animation: floatingCartBump .5s; }

/* Hide floating cart on mobile (bottom nav has it) */
@media (max-width: 768px) {
    .floating-cart { display: none !important; }
}

/* Hide on cart/checkout pages */
body.no-floating-cart .floating-cart { display: none !important; }

/* ====================================================================
   🪂 Fly-to-cart Animation
   ==================================================================== */
.fly-to-cart {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 10000;
    pointer-events: none;
    transition: all .8s cubic-bezier(.4, .0, 1, 1);
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    border: 3px solid var(--primary);
    background-color: #fff;
}

/* ====================================================================
   Tablet adjustments (768-991px)
   ==================================================================== */
@media (min-width: 769px) and (max-width: 991px) {
    .store-section { padding: 20px !important; }
    .store-section-header h2 { font-size: 19px !important; }
    .store-cat-tile { width: 100px !important; }
    .store-cat-icon { width: 80px !important; height: 80px !important; }
    .store-products-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* Force body padding on desktop for floating cart (storefront only, NOT dashboard) */
@media (min-width: 769px) {
    /* Prevent floating cart from blocking content at the bottom */
    body:not(.dash-body) { padding-bottom: 100px; }
}

/* ====================================================================
   🛒 PRODUCT PAGE - Amazon/Noon Style (Desktop + Mobile)
   ==================================================================== */

.store-product-page {
    background: #f7f8fa;
    padding: 14px 0 30px;
    min-height: 60vh;
}
@media (min-width: 769px) {
    .store-product-page {
        padding: 24px 0 60px;
    }
}

.store-product-page .breadcrumb {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 14px;
}
.store-product-page .breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.store-product-page .breadcrumb i { font-size: 9px; margin: 0 6px; }

/* Main grid: image left, info right */
.spp-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
@media (min-width: 769px) {
    .spp-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        padding: 30px;
    }
}
@media (min-width: 1100px) {
    .spp-grid {
        grid-template-columns: 45% 55%;
        gap: 40px;
    }
}

/* Gallery */
.spp-gallery {
    position: relative;
}
.spp-main-image {
    position: relative;
    aspect-ratio: 1;
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid var(--gray-100);
}
.spp-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}
.spp-no-image {
    font-size: 80px;
    color: var(--gray-200);
}

.spp-discount-badge {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    background: #dc2626;
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    z-index: 2;
}
.spp-rx-badge {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    background: #fef3c7;
    color: #92400e;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    z-index: 2;
}

/* Info section */
.spp-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.spp-brand {
    color: var(--gray-500);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
}

.spp-title {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.35;
    color: var(--gray-900);
    margin: 0;
}
@media (min-width: 769px) {
    .spp-title { font-size: 26px; }
}

/* Rating */
.spp-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}
.spp-stars { color: #f59e0b; font-size: 16px; }
.spp-rating-text {
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
}

/* Meta */
.spp-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--gray-600);
}
.spp-meta strong { color: var(--gray-900); font-weight: 700; }

/* Price section */
.spp-price-section {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--primary-100, #d1fae5);
}
.spp-price-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.spp-price-current {
    font-size: 30px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}
@media (min-width: 769px) {
    .spp-price-current { font-size: 36px; }
}
.spp-price-old {
    font-size: 16px;
    color: var(--gray-400);
    text-decoration: line-through;
}
.spp-price-save {
    background: #16a34a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}
.spp-price-tax {
    display: block;
    color: var(--gray-500);
    font-size: 12px;
    margin-top: 6px;
}

/* Short description */
.spp-short-desc {
    color: var(--gray-700);
    font-size: 14px;
    line-height: 1.7;
    padding: 4px 0;
}

/* Perks (delivery/genuine/COD) */
.spp-perks {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid var(--gray-100);
}
@media (min-width: 500px) {
    .spp-perks { grid-template-columns: repeat(3, 1fr); }
}
.spp-perk {
    display: flex;
    gap: 10px;
    align-items: center;
}
.spp-perk i {
    font-size: 22px;
    color: var(--primary);
    width: 38px;
    height: 38px;
    background: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.spp-perk strong {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}
.spp-perk small {
    display: block;
    font-size: 10px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Cart section */
.spp-cart-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border: 2px solid var(--primary-100, #d1fae5);
    border-radius: 14px;
    padding: 16px;
    margin-top: 6px;
}

.spp-qty-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.spp-qty-label {
    font-weight: 700;
    color: var(--gray-700);
    font-size: 14px;
}
.spp-qty {
    display: flex;
    border: 2px solid var(--primary);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.spp-qty-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--primary-50, #ecfdf5);
    cursor: pointer;
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    padding: 0;
    transition: all .15s;
}
.spp-qty-btn:hover { background: var(--primary); color: #fff; }
.spp-qty-btn:active { transform: scale(.95); }
.spp-qty input {
    width: 60px;
    height: 44px;
    border: none;
    border-inline: 2px solid var(--primary);
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    background: #fff;
    color: var(--gray-900);
    -moz-appearance: textfield;
    padding: 0;
}
.spp-qty input::-webkit-outer-spin-button,
.spp-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

.spp-add-btn,
.spp-buy-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .15s;
}
.spp-add-btn {
    background: var(--primary);
    color: #fff;
}
.spp-add-btn:hover { background: #047857; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(14,148,71,.3); }
.spp-add-btn:disabled { opacity: .6; cursor: not-allowed; }

.spp-buy-btn {
    background: #f59e0b;
    color: #78350f;
}
.spp-buy-btn:hover { background: #d97706; color: #fff; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(245,158,11,.3); }
.spp-buy-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Description (long) */
.spp-description {
    margin-top: 14px;
    padding: 18px 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
}
.spp-description h3 {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 14px;
    color: var(--gray-900);
}
.spp-description h3 i { color: var(--primary); margin-inline-end: 6px; }

/* محتوى HTML داخل الوصف — تنسيق شامل لكل الوسوم */
.spp-description-content {
    color: var(--gray-700);
    line-height: 1.85;
    font-size: 14px;
}
.spp-description-content p { margin: 0 0 12px; }
.spp-description-content p:last-child { margin-bottom: 0; }
.spp-description-content h2,
.spp-description-content h3,
.spp-description-content h4 {
    color: var(--gray-900);
    font-weight: 700;
    margin: 16px 0 10px;
    line-height: 1.4;
}
.spp-description-content h2 { font-size: 18px; }
.spp-description-content h3 { font-size: 16px; }
.spp-description-content h4 { font-size: 15px; }
.spp-description-content ul,
.spp-description-content ol {
    margin: 10px 0;
    padding-inline-start: 22px;
}
.spp-description-content li { padding: 4px 0; }
.spp-description-content li strong { color: var(--gray-900); }
.spp-description-content strong,
.spp-description-content b { color: var(--gray-900); font-weight: 700; }
.spp-description-content em,
.spp-description-content i { font-style: italic; }
.spp-description-content a {
    color: var(--primary);
    text-decoration: underline;
}
.spp-description-content a:hover { color: var(--primary-dark, #0a6a32); }
.spp-description-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
}
.spp-description-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}
.spp-description-content th,
.spp-description-content td {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    text-align: start;
}
.spp-description-content th {
    background: #f3f4f6;
    font-weight: 700;
    color: var(--gray-900);
}
.spp-description-content blockquote {
    margin: 12px 0;
    padding: 10px 16px;
    border-inline-start: 3px solid var(--primary);
    background: #fff;
    color: #6b7280;
    font-style: italic;
}
.spp-description-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 16px 0;
}
.spp-description-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    color: #be123c;
}
/* أخفِ أي class مخصص قد يكسر التنسيق (مثل text-[10px] الـ Tailwind من المصدر الخارجي) */
.spp-description-content [class*="text-["],
.spp-description-content [class*="text-primary"] {
    color: var(--gray-900) !important;
    font-size: inherit !important;
}
.spp-description-content .font-bold { font-weight: 700; }
.spp-description-content .mb-3 { margin-bottom: 12px; }

/* Related */
.spp-related {
    margin-top: 24px;
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

/* Hide OLD product page styles (vendor prices etc.) */
.vendor-prices,
.vendor-list,
.vendor-row,
.product-no-vendors,
.product-detail,
.product-gallery,
.product-info,
.product-description-block { display: none !important; }

/* Prevent any inner element from exceeding drawer width */
.store-filter-drawer * {
    max-width: 100%;
    box-sizing: border-box;
}
.store-filter-drawer .store-filter-row {
    flex-wrap: nowrap;
}
.store-filter-drawer .store-filter-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.store-filter-drawer form {
    width: 100%;
    max-width: 100%;
}

/* ====================================================================
   🖥️ DESKTOP SIDEBAR FIX — Force full height on all sidebars
   (Desktop only — does not touch mobile)
   ==================================================================== */
@media (min-width: 1025px) {
    /* Admin/Doctor dashboard sidebar */
    .dash-layout {
        min-height: 100vh !important;
        align-items: stretch !important;
    }
    .sidebar {
        position: sticky !important;
        top: 0 !important;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
        align-self: stretch !important;
        max-width: 280px !important;   /* override any global * { max-width: 100% } */
        width: 280px !important;
        flex-shrink: 0 !important;
    }
    
    /* The dash-main area must use full available height */
    .dash-main {
        min-height: 100vh;
    }
}

/* Category page filter sidebar - same treatment */
@media (min-width: 992px) {
    .store-cat-page {
        align-items: stretch !important;
    }
    .store-cat-page .store-filter-drawer {
        position: sticky !important;
        top: 80px !important;
        align-self: start !important;
        height: auto !important;
        max-height: calc(100vh - 100px) !important;
        max-width: 280px !important;
        width: 100% !important;
        overflow: hidden !important;
    }
}

/* ====================================================================
   🛒 CART PAGE — Mobile-first, Amazon/Noon style
   ==================================================================== */
.cart-page {
    background: #f7f8fa;
    min-height: 60vh;
    padding: 14px 0 30px;
}
@media (min-width: 769px) {
    .cart-page { padding: 24px 0 60px; }
}

.cart-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 0 4px;
}
.cart-page-header h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}
.cart-page-header h1 i { color: var(--primary); }
.cart-page-count {
    background: var(--primary-50, #ecfdf5);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}
@media (min-width: 769px) {
    .cart-page-header h1 { font-size: 28px; }
}

/* Empty state */
.cart-empty {
    background: #fff;
    padding: 50px 20px;
    text-align: center;
    border-radius: 16px;
    margin-top: 14px;
}
.cart-empty-icon {
    width: 100px;
    height: 100px;
    background: var(--primary-50, #ecfdf5);
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
}
.cart-empty-icon i {
    font-size: 44px;
    color: var(--primary);
    opacity: .6;
}
.cart-empty h2 {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--gray-900);
}
.cart-empty p {
    color: var(--gray-500);
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.7;
}
@media (min-width: 769px) {
    .cart-empty { padding: 70px 30px; }
    .cart-empty h2 { font-size: 24px; }
}

/* Grid */
.cart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 992px) {
    .cart-grid {
        grid-template-columns: 1fr 360px;
        gap: 24px;
        align-items: start;
    }
}

/* Items list */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-item {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-areas:
        "image info"
        "total total";
    gap: 10px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    transition: all .2s;
}
@media (min-width: 600px) {
    .cart-item {
        grid-template-columns: 100px 1fr auto;
        grid-template-areas: "image info total";
        align-items: center;
        gap: 14px;
        padding: 14px;
    }
}
.cart-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.cart-item-image {
    grid-area: image;
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    border: 1px solid var(--gray-100);
}
@media (min-width: 600px) {
    .cart-item-image { width: 100px; height: 100px; }
}
.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.cart-item-info {
    grid-area: info;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.cart-item-name {
    color: var(--gray-900);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cart-item-name:hover { color: var(--primary); }
@media (min-width: 600px) {
    .cart-item-name { font-size: 15px; }
}

.cart-item-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.cart-item-price-current {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}
.cart-item-price-old {
    font-size: 12px;
    color: var(--gray-400);
    text-decoration: line-through;
}

.cart-item-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.cart-qty {
    display: inline-flex;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.cart-qty-btn {
    width: 34px;
    height: 36px;
    border: none;
    background: var(--gray-50);
    cursor: pointer;
    font-size: 17px;
    font-weight: 800;
    color: var(--gray-700);
    padding: 0;
    transition: all .15s;
}
.cart-qty-btn:hover { background: var(--primary-50, #ecfdf5); color: var(--primary); }
.cart-qty-btn:active { background: var(--primary); color: #fff; }
.cart-qty-btn:disabled { opacity: .5; cursor: not-allowed; }
.cart-qty-input {
    width: 40px;
    height: 36px;
    border: none;
    border-inline: 1px solid var(--gray-200);
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    background: #fff;
    color: var(--gray-900);
    -moz-appearance: textfield;
    padding: 0;
}
.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cart-item-remove {
    background: transparent;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all .15s;
}
.cart-item-remove:hover { background: #fef2f2; }
.cart-item-remove i { font-size: 12px; }

.cart-item-total {
    grid-area: total;
    text-align: end;
    padding-top: 8px;
    border-top: 1px dashed var(--gray-100);
}
.cart-item-total small {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 2px;
}
.cart-item-total strong {
    font-size: 16px;
    font-weight: 800;
    color: var(--gray-900);
}
@media (min-width: 600px) {
    .cart-item-total {
        padding-top: 0;
        border-top: none;
        text-align: end;
        min-width: 100px;
    }
    .cart-item-total small { font-size: 12px; }
    .cart-item-total strong { font-size: 18px; }
}

/* Summary */
.cart-summary {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
@media (min-width: 992px) {
    .cart-summary {
        padding: 20px;
        position: sticky;
        top: 100px;
        align-self: start;
    }
}
.cart-summary h3 {
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 14px;
    color: var(--gray-900);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-100);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--gray-700);
}
.cart-summary-row strong {
    color: var(--gray-900);
    font-weight: 700;
}
.cart-free {
    color: #16a34a;
    font-weight: 800;
    font-size: 13px;
}

.cart-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 4px;
    margin-top: 6px;
    border-top: 2px dashed var(--gray-100);
    font-size: 16px;
}
.cart-summary-total span { font-weight: 700; color: var(--gray-700); }
.cart-summary-total strong {
    color: var(--primary);
    font-size: 22px;
    font-weight: 900;
}

.cart-checkout-btn {
    margin-top: 14px;
    padding: 14px !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
}

/* Free delivery progress banner */
.cart-free-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cart-free-banner i {
    font-size: 20px;
    color: #d97706;
    flex-shrink: 0;
}
.cart-free-banner p {
    font-size: 12px;
    color: #92400e;
    margin: 0 0 6px;
    line-height: 1.4;
}
.cart-free-banner strong { color: #b45309; font-weight: 800; }
.cart-free-progress {
    height: 6px;
    background: rgba(255,255,255,.6);
    border-radius: 3px;
    overflow: hidden;
}
.cart-free-progress > div {
    height: 100%;
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
    transition: width .3s;
}

/* Trust badges */
.cart-trust {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--gray-100);
}
.cart-trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    flex: 1;
}
.cart-trust-item i {
    font-size: 18px;
    color: var(--primary);
}
.cart-trust-item span {
    font-size: 10px;
    color: var(--gray-600);
    font-weight: 600;
    line-height: 1.2;
}

/* ====================================================================
   🎯 Cart Icon Bump Animation (when item added)
   Works on: header cart, bottom nav cart, floating cart
   ==================================================================== */
@keyframes cartBump {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.15) rotate(-5deg); }
    50% { transform: scale(.95) rotate(5deg); }
    75% { transform: scale(1.08) rotate(-3deg); }
}
.cart-bump {
    animation: cartBump .6s ease-in-out;
}
.floating-cart.cart-bump,
.header-cart.cart-bump {
    animation: cartBump .6s ease-in-out;
}
/* Bottom nav cart bump - animate the icon only */
.mbn-item[data-cart-icon].cart-bump i {
    animation: cartBump .6s ease-in-out;
    color: var(--primary);
}

/* Pulse the badge when count changes */
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}
.cart-bump .mbn-cart-badge,
.cart-bump .header-cart-badge,
.cart-bump .floating-cart-badge {
    animation: badgePulse .6s ease-in-out;
}

/* ====================================================================
   💊 Rx Quantity Stepper (Mobile + Desktop)
   For use in template_form, prescription_form, rx-item rendering
   ==================================================================== */
.rx-qty-stepper {
    display: inline-flex;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    width: 100%;
    max-width: 160px;
}
.rx-qty-btn {
    width: 40px;
    height: 42px;
    border: none;
    background: var(--gray-50);
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    padding: 0;
    transition: all .15s;
    flex-shrink: 0;
}
.rx-qty-btn:hover { background: var(--primary-50, #ecfdf5); }
.rx-qty-btn:active { background: var(--primary); color: #fff; }
.rx-qty-input {
    flex: 1;
    height: 42px;
    border: none !important;
    border-inline: 1.5px solid var(--gray-200) !important;
    text-align: center;
    font-size: 16px !important;
    font-weight: 700;
    background: #fff;
    color: var(--gray-900);
    -moz-appearance: textfield;
    padding: 0 !important;
    border-radius: 0 !important;
    min-width: 50px;
    width: 100%;
}
.rx-qty-input::-webkit-outer-spin-button,
.rx-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

/* rx-item card - mobile + desktop layout */
.rx-item {
    background: #fff;
    border: 1.5px solid var(--gray-100);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    transition: all .15s;
}
.rx-item:hover {
    border-color: var(--primary-100, #d1fae5);
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.rx-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--gray-100);
}
.rx-item-header strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.4;
}
.rx-item-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 600px) {
    .rx-item-fields {
        grid-template-columns: auto 1fr 1fr;
        gap: 14px;
        align-items: end;
    }
    .rx-item-fields .form-group-full {
        grid-column: 1 / -1;
    }
}
.rx-item-fields .form-group {
    margin: 0;
}
.rx-item-fields label {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 4px;
    display: block;
}
.rx-item-fields input[type="text"] {
    height: 42px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
    width: 100%;
    background: #fff;
}
.rx-item-fields input[type="text"]:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-icon-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: all .15s;
}
.btn-icon-danger:hover {
    background: #dc2626;
    color: #fff;
}

/* ====================================================================
   📋 Prescription View - Action buttons + items table fixes
   ==================================================================== */

/* Action buttons row */
.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.page-actions .btn,
.page-actions form {
    flex: 0 0 auto;
}
@media (max-width: 768px) {
    .page-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .page-actions .btn,
    .page-actions form {
        width: 100%;
    }
    .page-actions form button { width: 100%; }
    .page-actions .pill {
        grid-column: 1 / -1;
        text-align: center;
        padding: 10px !important;
        font-size: 14px !important;
        font-weight: 700;
    }
    .page-actions .btn-outline[onclick*="openReportModal"] {
        grid-column: 1 / -1;  /* full width for the report button */
    }
}

/* Prescription items - Accordion on mobile */
.rx-view-items {
    display: block;
}
.rx-view-items .rx-view-card {
    display: none;
}

@media (max-width: 768px) {
    .rx-view-items .data-table { display: none; }
    .rx-view-items .rx-view-card { display: block; }
}

.rx-view-card {
    background: #fff;
    border: 1.5px solid var(--gray-100);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
}
.rx-view-card-header {
    padding: 12px 14px;
    background: var(--primary-50, #ecfdf5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    gap: 10px;
}
.rx-view-card-header strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.4;
    flex: 1;
}
.rx-view-card-header .rx-card-toggle {
    width: 28px;
    height: 28px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform .2s;
    flex-shrink: 0;
}
.rx-view-card.open .rx-card-toggle { transform: rotate(180deg); }
.rx-view-card-body {
    padding: 0 14px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s, padding .3s;
}
.rx-view-card.open .rx-view-card-body {
    padding: 12px 14px 14px;
    max-height: 500px;
}
.rx-view-card-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--gray-100);
    font-size: 13px;
}
.rx-view-card-row:last-child { border-bottom: none; }
.rx-view-card-row .label {
    color: var(--gray-600);
    font-weight: 600;
}
.rx-view-card-row .value {
    color: var(--gray-900);
    font-weight: 600;
    text-align: end;
}
.rx-view-card-row.total {
    background: var(--primary-50, #ecfdf5);
    margin: 6px -14px -14px;
    padding: 10px 14px;
    font-size: 15px;
}
.rx-view-card-row.total .value {
    color: var(--primary);
    font-weight: 800;
}

/* Hide mobile total on desktop */
@media (min-width: 769px) {
    .rx-mobile-total { display: none !important; }
}

/* ====================================================================
   Hide top header search on mobile (search is in bottom nav)
   ==================================================================== */
@media (max-width: 768px) {
    .search-bar {
        display: none !important;
    }
}

/* ====================================================================
   Accordion cards - order/prescription items (admin view)
   Compatible class names: acc-card-head, acc-row, acc-label, acc-value
   ==================================================================== */
.acc-card-head {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.acc-card-head:active { background: var(--gray-50); }
.acc-card-chevron {
    color: var(--gray-400);
    font-size: 14px;
    transition: transform .2s;
    flex-shrink: 0;
}
.acc-card.open .acc-card-chevron { transform: rotate(180deg); }
.acc-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s, padding .3s;
    padding: 0 16px;
}
.acc-card.open .acc-card-body {
    max-height: 600px;
    padding: 0 16px 14px;
}
.acc-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--gray-100);
    font-size: 13px;
}
.acc-row:last-child { border-bottom: none; }
.acc-label { color: var(--gray-600); font-weight: 600; flex-shrink: 0; }
.acc-value { color: var(--gray-900); font-weight: 600; text-align: end; }

/* ====================================================================
   Cart badge pop animation (when count updates on add)
   ==================================================================== */
@keyframes badgePop {
    0%   { transform: scale(0); opacity: 0; }
    50%  { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.mbn-cart-badge.badge-pop,
.header-cart-badge.badge-pop {
    animation: badgePop .45s cubic-bezier(.4, 1.6, .6, 1);
}

/* ============ Cart prescription item highlight ============ */
.cart-item-rx {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5) !important;
    border: 2px solid #86efac !important;
    border-radius: 12px;
    padding-top: 30px !important;
    position: relative;
}
.cart-rx-badge {
    position: absolute;
    top: 0;
    inset-inline-start: 12px;
    background: #0e9447;
    color: #fff;
    padding: 4px 12px;
    border-radius: 0 0 8px 8px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(14,148,71,.3);
}
.cart-rx-badge i { font-size: 12px; }


/* ============= PWA Install (v2 — universal with dismiss) ============= */
.pwa-install-wrap {
    position: fixed;
    bottom: 90px;
    inset-inline-end: 16px;
    z-index: 9990;
    display: none;
    align-items: flex-start;
    gap: 4px;
}
.pwa-install-btn {
    background: linear-gradient(135deg, #0e9447, #0a6a32);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(14, 148, 71, .4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform .2s, box-shadow .2s;
    animation: pwaPulse 2.5s ease-in-out infinite;
}
.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(14, 148, 71, .5);
}
.pwa-install-btn:active { transform: translateY(0); }
.pwa-install-btn i { font-size: 16px; }
@keyframes pwaPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(14, 148, 71, .4); }
    50% { box-shadow: 0 6px 20px rgba(14, 148, 71, .4), 0 0 0 12px rgba(14, 148, 71, 0); }
}

/* زر الإغلاق (×) — صغير في أعلى يسار/يمين الزر الأخضر */
.pwa-dismiss-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
    font-size: 16px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    transition: all .15s;
    margin-top: -4px; /* يتداخل قليلاً مع الزر الرئيسي */
    flex-shrink: 0;
}
.pwa-dismiss-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    transform: scale(1.1);
}
.pwa-dismiss-btn:active { transform: scale(0.95); }

/* على الموبايل: ارفعه فوق الـ bottom nav */
@media (max-width: 768px) {
    .pwa-install-wrap { bottom: 110px; }
    .pwa-install-btn { padding: 10px 14px; font-size: 13px; }
    .pwa-install-btn span { display: inline; }
}
/* شاشات صغيرة جداً: أيقونة فقط */
@media (max-width: 360px) {
    .pwa-install-btn { padding: 12px; border-radius: 50%; }
    .pwa-install-btn span { display: none; }
}

/* ============= PWA Modal (instructions popup) ============= */
.pwa-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.pwa-modal.open { display: flex; }
.pwa-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
    animation: pwaFadeIn .2s ease;
}
.pwa-modal-content {
    position: relative;
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
    animation: pwaSlideUp .3s cubic-bezier(.4, 0, .2, 1);
}
@keyframes pwaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pwaSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.pwa-modal-close {
    position: absolute;
    top: 12px;
    inset-inline-end: 14px;
    background: #f3f4f6;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    transition: background .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pwa-modal-close:hover { background: #e5e7eb; color: #111827; }
.pwa-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0e9447, #0a6a32);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 28px;
    margin: 0 auto 16px;
    box-shadow: 0 8px 20px rgba(14, 148, 71, .25);
}
.pwa-modal-title {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    text-align: center;
    line-height: 1.4;
}
.pwa-modal-body { color: #374151; font-size: 14px; }
.pwa-steps {
    padding-inline-start: 22px;
    margin: 0;
    line-height: 1.9;
}
.pwa-steps li {
    padding: 8px 0;
    color: #374151;
}
.pwa-steps li strong { color: #0e9447; font-weight: 700; }
.pwa-steps li small { display: block; margin-top: 6px; font-size: 12px; line-height: 1.5; }
/* SVG icons inline داخل الخطوات */
.pwa-steps li svg {
    display: inline-block;
    vertical-align: -4px;
    margin: 0 4px;
    color: #0369a1;
    background: #e0f2fe;
    padding: 3px 5px;
    border-radius: 5px;
    box-sizing: content-box;
}
.pwa-icon-inline {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 14px;
    margin: 0 3px;
    vertical-align: middle;
}
.pwa-modal-footer {
    margin-top: 20px;
    text-align: center;
}
.pwa-modal-ok {
    background: linear-gradient(135deg, #0e9447, #0a6a32);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s;
}
.pwa-modal-ok:hover { transform: translateY(-1px); }

/* ============= Products Carousel (slider with arrows + autoplay) ============= */
.store-products-carousel {
    position: relative;
    margin: 0 -4px; /* compensate for inner padding */
}
.spc-viewport {
    overflow: hidden;
    padding: 4px 4px 8px;
    margin: 0 28px; /* leave room for arrows */
}
.spc-track {
    display: flex;
    gap: 12px;
    transition: transform .5s cubic-bezier(.25, .8, .25, 1);
    will-change: transform;
}
.spc-track > * {
    flex: 0 0 calc((100% - 12px) / 2); /* mobile: 2 per view */
    min-width: 0;
}
/* Tablet: 3 per view */
@media (min-width: 600px) {
    .spc-track > * { flex: 0 0 calc((100% - 24px) / 3); }
}
/* Small desktop: 4 per view */
@media (min-width: 900px) {
    .spc-track > * { flex: 0 0 calc((100% - 36px) / 4); }
}
/* Large desktop: 5 per view */
@media (min-width: 1200px) {
    .spc-track > * { flex: 0 0 calc((100% - 48px) / 5); }
    .spc-viewport { margin: 0 40px; }
}

/* Arrow buttons */
.spc-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    border: 1.5px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all .2s;
    font-size: 14px;
}
.spc-arrow:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.08);
}
.spc-arrow:active { transform: translateY(-50%) scale(0.96); }
.spc-arrow:disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}
/* For LTR: prev=left, next=right. For RTL: prev=right, next=left (reversed) */
.spc-arrow-prev { inset-inline-start: 0; }
.spc-arrow-next { inset-inline-end: 0; }
@media (min-width: 1200px) {
    .spc-arrow { width: 44px; height: 44px; font-size: 16px; }
}

/* On very small screens — arrows are smaller and slightly overlap */
@media (max-width: 600px) {
    .spc-arrow {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    .spc-viewport { margin: 0 22px; }
}

/* Dots indicator (optional - shows position) */
.spc-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}
.spc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    cursor: pointer;
    transition: all .25s;
    padding: 0;
}
.spc-dot.active {
    background: var(--primary);
    width: 22px;
    border-radius: 4px;
}

/* Hide old grid when carousel exists (defensive) */
.store-products-grid:empty { display: none; }

/* ============= RX Extras Search Box (redesigned v2) ============= */
.rx-search-wrap {
    position: relative;
    margin-bottom: 12px;
}
.rx-search-input {
    width: 100%;
    padding: 14px 44px 14px 44px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.rx-search-input:focus {
    outline: none;
    border-color: #0e9447;
    box-shadow: 0 0 0 4px rgba(14, 148, 71, .1);
}
.rx-search-input::placeholder { color: #9ca3af; font-size: 14px; }

.rx-search-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}
.rx-search-spinner {
    position: absolute;
    top: 50%;
    inset-inline-end: 14px;
    transform: translateY(-50%);
    color: #0e9447;
    font-size: 16px;
    pointer-events: none;
}
.rx-search-clear {
    position: absolute;
    top: 50%;
    inset-inline-end: 14px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.rx-search-clear:hover {
    background: #fee2e2;
    color: #dc2626;
}

.rx-search-results {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    max-height: 480px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
    display: none;
    padding: 6px;
}
.rx-search-results.open { display: block; }

/* عنصر نتيجة */
.rx-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    min-height: 60px; /* ضمان ارتفاع حتى لو الصورة لم تحمَّل */
    cursor: pointer;
    border-radius: 10px;
    transition: background .12s;
    border: 1.5px solid transparent;
    box-sizing: border-box;
}
.rx-search-item:hover {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.rx-search-item + .rx-search-item { margin-top: 2px; }

/* صورة المنتج */
.rx-search-item-img {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rx-search-item-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.rx-search-img-placeholder {
    width: 100%;
    height: 100%;
    background: #f3f4f6;
    color: #d1d5db;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* معلومات المنتج */
.rx-search-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.rx-search-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    margin-bottom: 3px;
    /* line-clamp 2 سطر فقط */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rx-search-item-brand {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.rx-search-item-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rx-search-item-price {
    font-size: 15px;
    font-weight: 700;
    color: #0e9447;
}
.rx-search-item-price small {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    margin-inline-start: 2px;
}
.rx-search-item-oldprice {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
}
.rx-search-item-discount {
    font-size: 11px;
    background: #fee2e2;
    color: #dc2626;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* زر الإضافة */
.rx-search-item-add {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #0e9447;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform .15s, background .15s;
}
.rx-search-item:hover .rx-search-item-add {
    background: #0a6a32;
    transform: scale(1.1);
}

/* حالة فارغة */
.rx-search-empty {
    padding: 30px 16px;
    text-align: center;
}

/* موبايل */
@media (max-width: 600px) {
    .rx-search-input { font-size: 14px; padding: 12px 40px 12px 40px; }
    .rx-search-item-img { width: 52px; height: 52px; }
    .rx-search-item-name { font-size: 13px; }
    .rx-search-item-add { width: 32px; height: 32px; }
    .rx-search-results { max-height: 60vh; }
}

/* ============= RX Search Modal (full-screen, responsive) ============= */

/* زر فتح البحث (يبدو كحقل بحث) */
.rx-open-search-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    text-align: start;
    font-family: inherit;
    font-size: 14px;
    color: #9ca3af;
    transition: border-color .15s, background .15s;
    margin-bottom: 8px;
}
.rx-open-search-btn:hover {
    border-color: #0e9447;
    background: #f0fdf4;
    color: #6b7280;
}
.rx-open-search-btn i {
    color: #0e9447;
    font-size: 16px;
}

/* Modal container */
.rx-search-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: stretch;
    justify-content: center;
}
.rx-search-modal.active { display: flex; }

.rx-search-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(2px);
}

.rx-search-modal-panel {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 720px;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    animation: rxModalIn .2s ease-out;
}
@keyframes rxModalIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Header */
.rx-search-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rx-search-modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.rx-search-modal-close:hover { background: #e5e7eb; }

.rx-search-modal-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.rx-search-modal-input {
    width: 100%;
    padding: 12px 44px 12px 40px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s;
}
.rx-search-modal-input:focus {
    outline: none;
    border-color: #0e9447;
}
.rx-search-modal-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 15px;
    pointer-events: none;
}
.rx-search-modal-spinner {
    position: absolute;
    top: 50%;
    inset-inline-end: 14px;
    transform: translateY(-50%);
    color: #0e9447;
    font-size: 15px;
    pointer-events: none;
}
.rx-search-modal-clear {
    position: absolute;
    top: 50%;
    inset-inline-end: 12px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
}
.rx-search-modal-clear:hover { background: #fee2e2; color: #dc2626; }

/* Body */
.rx-search-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f9fafb;
}

/* Initial state */
.rx-search-modal-initial {
    padding: 60px 20px;
    text-align: center;
    color: #9ca3af;
}
.rx-search-modal-initial i {
    font-size: 56px;
    color: #d1d5db;
    display: block;
    margin-bottom: 14px;
}
.rx-search-modal-initial div {
    font-size: 16px;
    color: #374151;
    font-weight: 600;
    margin-bottom: 6px;
}
.rx-search-modal-initial small { font-size: 13px; }

/* Empty state */
.rx-search-modal-empty {
    padding: 40px 20px;
    text-align: center;
}
.rx-search-modal-empty i {
    font-size: 48px;
    color: #d1d5db;
    display: block;
    margin-bottom: 12px;
}
.rx-search-modal-empty div {
    font-size: 15px;
    color: #374151;
    font-weight: 600;
    margin-bottom: 4px;
}
.rx-search-modal-empty small {
    font-size: 13px;
    color: #9ca3af;
}

/* بطاقة منتج */
.rx-modal-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
    min-height: 80px;
    box-sizing: border-box;
}
.rx-modal-product:hover {
    border-color: #0e9447;
    background: #f0fdf4;
}
.rx-modal-product:active {
    transform: scale(.98);
}

.rx-modal-product-img {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rx-modal-product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.rx-modal-product-placeholder {
    width: 100%;
    height: 100%;
    background: #f3f4f6;
    color: #d1d5db;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rx-modal-product-info {
    flex: 1;
    min-width: 0;
}
.rx-modal-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rx-modal-product-brand {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.rx-modal-product-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rx-modal-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #0e9447;
}
.rx-modal-product-price small {
    font-size: 10px;
    color: #6b7280;
    font-weight: 600;
}
.rx-modal-product-oldprice {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
}
.rx-modal-product-discount {
    font-size: 11px;
    background: #fee2e2;
    color: #dc2626;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.rx-modal-product-add {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #0e9447;
    color: #fff;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .15s;
}
.rx-modal-product:hover .rx-modal-product-add {
    background: #0a6a32;
    transform: scale(1.1);
}

/* Mobile */
@media (max-width: 600px) {
    .rx-search-modal-panel {
        max-width: 100%;
        max-height: 100vh;
        min-height: 100vh;
    }
    .rx-search-modal-input { font-size: 14px; }
    .rx-modal-product-img { width: 60px; height: 60px; }
    .rx-modal-product-name { font-size: 13px; }
    .rx-modal-product-add { width: 36px; height: 36px; }
}

/* ============= Header Language Switch Button (mobile + desktop) ============= */
.header-lang-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    text-decoration: none;
}
.header-lang-btn i {
    font-size: 16px;
}
.header-lang-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
}
/* على الموبايل، ضع label اختصار قصير */
@media (max-width: 768px) {
    .header-lang-btn {
        padding: 6px 8px;
    }
    .header-lang-label {
        font-size: 11px;
        font-weight: 800;
    }
}
