/* ============================================
   3aychek.com — Dashboard Shared Styles
   Used by seller/* and consumer/* pages
   ============================================ */

/* ============ DASHBOARD LAYOUT ============ */
.dash-body,
body:has(.dashboard-body) {
  display: flex;
  min-height: 100vh;
  background: #F0F2F5;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* Alias used by delivery/* and admin/* pages */
.dashboard-body {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 260px;
  background: #1A1A2E;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FF3355, #42A5F5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}

.sidebar-shop-info {
  padding: 16px 20px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-shop-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #C8102E, #1565C0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-shop-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-shop-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}
.sidebar-shop-role {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  transition: all 0.2s ease;
  margin-bottom: 2px;
  cursor: pointer;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(200,16,46,0.25), rgba(21,101,192,0.15));
  color: white;
  font-weight: 600;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: #C8102E;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-trial-box {
  background: rgba(200,16,46,0.15);
  border: 1px solid rgba(200,16,46,0.3);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}
.sidebar-trial-box p {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
}
.sidebar-trial-box strong { color: #FF3355; }

/* ============ MAIN CONTENT ============ */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============ TOP BAR ============ */
.topbar {
  background: white;
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #E9ECEF;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1A1A2E;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-notif {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #F0F2F5;
  cursor: pointer;
  color: #6C757D;
  transition: all 0.2s;
}
.topbar-notif:hover { background: #E9ECEF; color: #1A1A2E; }
.notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: #C8102E;
  border-radius: 50%;
  border: 2px solid white;
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #C8102E, #1565C0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============ PAGE CONTENT ============ */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1A1A2E;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 0.9rem;
  color: #6C757D;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============ STATS CARDS ============ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: 14px;
  padding: 22px 24px;
  border: 1px solid #E9ECEF;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.red { background: rgba(200,16,46,0.1); color: #C8102E; }
.stat-icon.blue { background: rgba(21,101,192,0.1); color: #1565C0; }
.stat-icon.green { background: rgba(46,125,94,0.1); color: #2E7D5E; }
.stat-icon.orange { background: rgba(255,152,0,0.1); color: #E65100; }

.stat-info { flex: 1; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: #1A1A2E; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.8rem; color: #6C757D; font-weight: 500; }
.stat-change { font-size: 0.75rem; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: #2E7D5E; }
.stat-change.down { color: #C8102E; }

/* ============ CARDS ============ */
.card {
  background: white;
  border-radius: 14px;
  border: 1px solid #E9ECEF;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid #E9ECEF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1A1A2E;
}

.card-body { padding: 24px; }
.card-body-sm { padding: 16px; }

/* ============ TABLES ============ */
.table-container { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6C757D;
  padding: 12px 16px;
  background: #F8F9FA;
  border-bottom: 1px solid #E9ECEF;
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid #F0F2F5;
  font-size: 0.875rem;
  color: #1A1A2E;
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #FAFBFC; }

.table-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: #F0F2F5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* ============ SEARCH / FILTER BAR ============ */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #ADB5BD;
  font-size: 0.9rem;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 2px solid #E9ECEF;
  border-radius: 10px;
  font-size: 0.875rem;
  transition: all 0.2s;
  background: white;
}
.search-input:focus { outline: none; border-color: #C8102E; box-shadow: 0 0 0 3px rgba(200,16,46,0.1); }

.filter-select {
  padding: 10px 14px;
  border: 2px solid #E9ECEF;
  border-radius: 10px;
  font-size: 0.875rem;
  color: #1A1A2E;
  background: white;
  cursor: pointer;
  min-width: 130px;
}
.filter-select:focus { outline: none; border-color: #C8102E; }

/* ============ PRODUCT GRID (Seller) ============ */
.products-grid {
  display: grid;
  /* min 260px → typical 1920px desktop with 240px sidebar = 5-6 cards per row, which the
     user explicitly asked for. The previous 200px minimum produced 7-8 tiny cards. */
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.product-card {
  background: white;
  border-radius: 14px;
  border: 1px solid #E9ECEF;
  overflow: hidden;
  transition: all 0.2s;
}
.product-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }

.product-card-img {
  height: 140px;
  background: #F0F2F5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
}
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }

.product-card-body { padding: 14px; }
.product-card-name { font-size: 0.9rem; font-weight: 600; color: #1A1A2E; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card-price { font-size: 1rem; font-weight: 800; color: #C8102E; }
.product-card-footer { padding: 10px 14px; border-top: 1px solid #F0F2F5; display: flex; gap: 8px; }

.product-status {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ============ ORDER ITEMS ============ */
.order-card {
  background: white;
  border-radius: 14px;
  border: 1px solid #E9ECEF;
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.2s;
}
.order-card-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #F0F2F5;
  flex-wrap: wrap;
  gap: 8px;
}
.order-id { font-size: 0.8rem; color: #6C757D; }
.order-id strong { color: #1A1A2E; }
.order-card-body { padding: 16px 20px; }
.order-card-footer { padding: 12px 20px; background: #F8F9FA; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.order-total { font-size: 1rem; font-weight: 800; color: #1A1A2E; }
.order-actions { display: flex; gap: 8px; }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #ADB5BD;
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: #6C757D; margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; margin-bottom: 24px; }

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 4px;
  background: #F0F2F5;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6C757D;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.tab-btn.active { background: white; color: #1A1A2E; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ============ TOGGLE SWITCH ============ */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #DEE2E6;
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider { background: #2E7D5E; }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============ QR CODE SECTION ============ */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  background: #F8F9FA;
  border-radius: 14px;
  border: 2px dashed #DEE2E6;
}
.qr-box {
  background: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.qr-label { font-size: 0.85rem; font-weight: 600; color: #6C757D; text-align: center; }
.qr-url { font-size: 0.75rem; color: #ADB5BD; word-break: break-all; text-align: center; max-width: 240px; }

/* ============ MAPS EMBED ============ */
.map-container {
  width: 100%;
  height: 300px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #E9ECEF;
}
.map-container iframe { width: 100%; height: 100%; border: none; }

/* ============ NOTIFICATION BANNER ============ */
.alert-banner {
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
}
.alert-banner.warning { background: rgba(255,152,0,0.1); border: 1px solid rgba(255,152,0,0.3); color: #E65100; }
.alert-banner.info { background: rgba(21,101,192,0.08); border: 1px solid rgba(21,101,192,0.2); color: #1565C0; }
.alert-banner.success { background: rgba(46,125,94,0.08); border: 1px solid rgba(46,125,94,0.2); color: #2E7D5E; }

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
}
.page-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6C757D;
  background: white;
  border: 1px solid #E9ECEF;
  cursor: pointer;
  transition: all 0.2s;
}
.page-btn:hover, .page-btn.active { background: #C8102E; color: white; border-color: #C8102E; }

/* ============ RESPONSIVE DASHBOARD ============ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); }
  /* Both layout wrappers must drop the 260px gutter on mobile, otherwise delivery/admin
     pages (which use .dashboard-body) stay pushed off-screen with the sidebar hidden. */
  .main-content,
  .dashboard-body { margin-left: 0; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}

/* ============ CONSUMER SHOP STYLES ============ */
.shop-header-banner {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, #C8102E, #1565C0);
  border-radius: 14px;
  margin-bottom: -40px;
  position: relative;
}

.shop-avatar-large {
  width: 80px; height: 80px;
  border-radius: 16px;
  border: 4px solid white;
  background: white;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  position: relative;
  z-index: 1;
}

.cart-sidebar {
  width: 320px;
  flex-shrink: 0;
}

.cart-card { position: sticky; top: 80px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #F0F2F5;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img { width: 44px; height: 44px; border-radius: 8px; background: #F0F2F5; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; overflow: hidden; flex-shrink: 0; }
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 0.85rem; font-weight: 600; color: #1A1A2E; }
.cart-item-price { font-size: 0.8rem; color: #C8102E; font-weight: 700; }
.cart-qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 26px; height: 26px; border-radius: 6px; background: #F0F2F5; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 700; color: #1A1A2E; transition: all 0.2s; }
.qty-btn:hover { background: #C8102E; color: white; }
.qty-value { font-size: 0.9rem; font-weight: 700; min-width: 20px; text-align: center; }

.shop-layout { display: flex; gap: 24px; align-items: flex-start; }
.shop-main { flex: 1; min-width: 0; }

@media (max-width: 900px) {
  .shop-layout { flex-direction: column; }
  .cart-sidebar { width: 100%; }
  .cart-card { position: static; }
}

/* ============================================
   Livreur missing-proof banner + upload modal
   Used by delivery/*.html via Delivery.ProofReminder
   ============================================ */
.proof-bar { background: linear-gradient(135deg, #FFF5F7, #FFFAEB); border: 1px solid rgba(200,16,46,0.25); border-radius: 14px; padding: 16px 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.proof-bar.expired { background: linear-gradient(135deg, #FFE6E9, #FFF); border-color: #C8102E; }
.proof-bar .proof-info { flex: 1; min-width: 240px; }
.proof-bar h4 { font-size: 0.95rem; color: #1A1A2E; margin: 0 0 4px; }
.proof-bar p  { font-size: 0.82rem; color: #6C757D; margin: 0; }
.proof-bar .proof-deadline { display: inline-block; margin-top: 6px; background: #C8102E; color: white; padding: 3px 10px; border-radius: 10px; font-size: 0.75rem; font-weight: 800; }
.proof-bar .btn-upload-proof { background: #C8102E; color: white; padding: 10px 18px; border: none; border-radius: 10px; font-weight: 800; font-size: 0.88rem; cursor: pointer; }
.proof-bar .btn-upload-proof:hover { background: #9E0B24; }

.proof-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.proof-modal { background: white; border-radius: 18px; padding: 28px 24px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.proof-modal h3 { margin: 0 0 6px; font-size: 1.15rem; }
.proof-modal p.sub { color: #6C757D; font-size: 0.85rem; margin: 0 0 18px; }
.proof-modal .form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.proof-modal label { font-size: 0.85rem; font-weight: 700; color: #1A1A2E; }
.proof-modal input { padding: 11px 14px; border: 2px solid #E9ECEF; border-radius: 8px; font-size: 0.92rem; font-family: inherit; outline: none; }
.proof-modal input:focus { border-color: #1565C0; }
.proof-modal .photo-upload { border: 2px dashed #E9ECEF; border-radius: 10px; padding: 18px; text-align: center; cursor: pointer; background: #F8F9FA; }
.proof-modal .photo-upload:hover { border-color: #1565C0; background: #F0F2F5; }
.proof-modal .photo-upload .up-icon { font-size: 1.6rem; margin-bottom: 6px; }
.proof-modal .photo-upload p { font-size: 0.82rem; color: #6C757D; margin: 0; }
.proof-modal .photo-upload input[type=file] { display: none; }
.proof-modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.proof-modal .btn-cancel { background: #F0F2F5; color: #1A1A2E; padding: 11px 18px; border: none; border-radius: 10px; font-weight: 700; cursor: pointer; }
.proof-modal .btn-confirm { background: #1565C0; color: white; padding: 11px 22px; border: none; border-radius: 10px; font-weight: 800; cursor: pointer; }
.proof-modal .btn-confirm:disabled { opacity: 0.6; cursor: not-allowed; }

/* ====================================================================
   MOBILE RESPONSIVENESS — focused pass for ≤480px and ≤375px
   Fixes: oversized h1/h2, cut-off cards, tap targets, scrollable tabs,
          full-width modals, hero CTAs stacking, kpi cards single column.
   ==================================================================== */
@media (max-width: 600px) {
  /* Page chrome */
  .page-content { padding: 12px !important; }
  .topbar { padding: 0 12px !important; }
  .topbar h1, .topbar h2 { font-size: 1.05rem !important; }
  .page-header h1 { font-size: 1.35rem !important; line-height: 1.2 !important; }
  .page-header p  { font-size: 0.86rem !important; }
  .dash-header h1 { font-size: 1.3rem !important; line-height: 1.2 !important; }
  .dash-header p  { font-size: 0.86rem !important; }

  /* KPI / stat cards — single column with tighter padding */
  .stats-row, .stats-grid, .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .stat-card { padding: 14px !important; }
  .stat-card .n, .stat-card .kpi-value, .kpi-card .kpi-value { font-size: 1.4rem !important; }
  .stat-card .l, .stat-card .kpi-label, .kpi-card .kpi-label { font-size: 0.74rem !important; }

  /* Product grid: 2 columns max */
  .products-grid, .product-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .product-tile { padding: 10px !important; }
  .product-tile-name { font-size: 0.88rem !important; }
  .product-tile-price { font-size: 0.92rem !important; }

  /* Sidebar — overlay style, hide by default */
  .sidebar { width: 240px !important; box-shadow: 4px 0 22px rgba(0,0,0,0.18); }

  /* Buttons reachable: at least 40px tall */
  .btn, button.btn, .btn-primary, .btn-outline { min-height: 42px; }

  /* Tabs scroll horizontally on phone instead of wrapping awkwardly */
  .filter-tabs, .preset-tabs, .product-cat-tabs, #productTabsBar {
    flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-tabs::-webkit-scrollbar,
  .preset-tabs::-webkit-scrollbar,
  #productTabsBar::-webkit-scrollbar { display: none; }

  /* Cart sidebar on mobile becomes full-width below products */
  .cart-sidebar { width: 100% !important; margin-top: 16px; }
  .cart-card { position: static !important; }

  /* Modals: take full screen */
  .modal { width: 96vw !important; max-width: 96vw !important; max-height: 92vh !important; }
  .modal-overlay { padding: 8px !important; }
  .modal-header h3 { font-size: 1rem !important; }

  /* Catalog modal items: 1 column on small screens */
  .catalog-grid { grid-template-columns: 1fr !important; }

  /* Sidebar category badge truncates nicely */
  .sidebar-cat-badge { max-width: 100%; }
}

@media (max-width: 380px) {
  .page-content { padding: 10px !important; }
  .stats-row, .stats-grid, .kpi-grid { grid-template-columns: 1fr !important; }
  .product-grid, .products-grid { grid-template-columns: 1fr !important; }
  .page-header h1, .dash-header h1 { font-size: 1.2rem !important; }
}

/* ====================================================================
   MOBILE RESPONSIVENESS — v2: aggressive fix for the "catastrophic mobile" report.
   The previous block targeted layout but didn't catch root causes. This one does:
     1. body NEVER scrolls horizontally (the #1 source of broken mobile look-and-feel)
     2. sidebar becomes a true overlay with backdrop
     3. ALL tab/pill rows scroll horizontally on phone (no awkward wrap)
     4. Every product/seller tile renders 1 or 2 per row, never overflows
     5. Topbar shrinks; titles shrink; tap targets reach 44px
   These rules use !important to win against any inline styles added by tabs/etc.
   ==================================================================== */

/* GLOBAL — applies on all viewports, but only matters when something is wider than the screen */
html, body { max-width: 100vw; overflow-x: hidden !important; }

@media (max-width: 768px) {
  /* Sidebar overlay backdrop */
  .sidebar {
    position: fixed !important; top: 0; left: 0; bottom: 0;
    width: 260px !important; max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 9999 !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0) !important; }
  body.sidebar-open::before {
    content: ''; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 9998;
  }

  .main-content, .dashboard-body, .dash-body, .page-content { margin-left: 0 !important; }
  .topbar { padding: 0 12px !important; height: 56px; }
  .topbar h1, .topbar h2 { font-size: 1.05rem !important; }

  /* Force every tab/pill strip to single-line horizontal scroll on phone */
  .filter-tabs, .preset-tabs, .product-cat-tabs,
  #productTabsBar, #productCatTabsBar, #rxFilterBar,
  .category-pills, #categoryPills, #deliveryMethodFilter {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
  }
  .filter-tabs::-webkit-scrollbar, .preset-tabs::-webkit-scrollbar,
  #productTabsBar::-webkit-scrollbar, #productCatTabsBar::-webkit-scrollbar,
  #rxFilterBar::-webkit-scrollbar, .category-pills::-webkit-scrollbar { display: none; }

  /* Page chrome */
  .page-content { padding: 14px !important; }
  .page-header h1, .dash-header h1 { font-size: 1.3rem !important; line-height: 1.2 !important; }
  .page-header p,  .dash-header p  { font-size: 0.86rem !important; }

  /* Stat cards */
  .stats-row, .stats-grid, .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .stat-card { padding: 14px 12px !important; }

  /* PRODUCTS: 2 columns on phone (was 1 on the previous block, looked too wasteful) */
  .products-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
  .product-card-img { height: 110px !important; }
  .product-card-body { padding: 10px !important; }
  .product-card-name { font-size: 0.82rem !important; }
  .product-card-price { font-size: 0.95rem !important; }

  /* Consumer shop tiles */
  .product-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* Tap targets */
  .btn, button.btn, .btn-primary, .btn-outline, .btn-locate, .btn-search-main { min-height: 44px; }

  /* Buttons inside dense rows shouldn't overflow */
  .filter-bar { flex-direction: column !important; align-items: stretch !important; }
  .filter-bar > * { width: 100%; }

  /* Modal goes near-fullscreen */
  .modal { width: 96vw !important; max-width: 96vw !important; max-height: 92vh !important; border-radius: 14px !important; }
  .modal-overlay { padding: 6px !important; }

  /* Hide cart sidebar inline, stack instead */
  .cart-sidebar { width: 100% !important; margin-top: 14px; }
  .cart-card { position: static !important; }

  /* Tables that are wider than viewport: allow internal horizontal scroll, not page */
  .table-container, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Service-page map+panel: stack */
  .content-area { grid-template-columns: 1fr !important; }
  .map-wrapper, #map { height: 260px !important; min-height: 260px; }
}

@media (max-width: 400px) {
  .page-content { padding: 10px !important; }
  .stats-row, .stats-grid, .kpi-grid { grid-template-columns: 1fr !important; }
  .products-grid, .product-grid { grid-template-columns: 1fr !important; }
  .page-header h1, .dash-header h1 { font-size: 1.18rem !important; }
}
