:root {
  --primary: #000000;
  --secondary: #ffffff;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666666;
  --border: #e0e0e0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

html, body { overflow-x: clip; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Store note ticker ── */
.store-note-bar {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  padding: 6px 0;
  border-bottom: 1px solid #fde68a;
}
.store-note-bar:hover { background: #fde68a; }
.store-note-track {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: storeNoteScroll 25s linear infinite;
}
.store-note-track:hover { animation-play-state: paused; }
@keyframes storeNoteScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ── Header ── */
#site-header {
  background: var(--primary);
  color: var(--secondary);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

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

#store-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
}

.brand-text { display: flex; flex-direction: column; gap: 2px; }
#store-name { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
.store-tagline { font-size: 0.78rem; opacity: 0.8; font-weight: 400; letter-spacing: 0.3px; }

.search-bar { flex: 0 1 320px; min-width: 200px; margin-left: auto; }

.search-bar input {
  width: 100%;
  padding: 10px 16px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  background: rgba(255,255,255,0.15);
  color: white;
  transition: all 0.2s;
}

.search-bar input::placeholder { color: rgba(255,255,255,0.6); }
.search-bar input:focus {
  outline: none;
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}

.sort-select {
  padding: 10px 14px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.15);
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.sort-select:focus, .sort-select:hover {
  outline: none;
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}
.sort-select option { background: var(--primary); color: white; }

/* ── Cart toggle in header ── */
.cart-toggle {
  position: relative;
  background: rgba(255,255,255,0.15);
  border: 2px solid transparent;
  border-radius: 8px;
  color: white;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.cart-toggle:hover { background: rgba(255,255,255,0.25); }
.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Cart drawer ── */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
}
.cart-drawer.open { display: block; }
.cart-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: white;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
  animation: slideInRight 0.25s ease-out;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cart-header h2 { font-size: 1.15rem; }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}
.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-item img,
.cart-item-placeholder {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}
.cart-item-name { font-weight: 600; font-size: 0.9rem; line-height: 1.3; }
.cart-item-variant { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.cart-item-price { font-size: 0.85rem; color: var(--primary); font-weight: 700; margin-top: 4px; }
.cart-item-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cart-qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.cart-qty button {
  width: 24px;
  height: 24px;
  border: none;
  background: #f5f5f5;
  font-size: 0.85rem;
  cursor: pointer;
}
.cart-qty span { width: 28px; text-align: center; font-size: 0.85rem; font-weight: 600; }
.cart-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}
.cart-remove:hover { color: #ef4444; }

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-totals {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}
.cart-totals strong { font-size: 1.2rem; color: var(--primary); }

.cart-btn { background: var(--primary); }
.cart-btn:hover { filter: brightness(1.15); }
.cart-btn::before {
  content: '';
  width: 22px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 4h-2l-2 5h2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-10h2l-2-5h-2zm0 0h10v-2h-10v2zm6 14h-2v-6h2v6z'/%3E%3C/svg%3E") center/contain no-repeat;
}

#checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.location-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1200;
}
.location-result {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.location-result:last-child { border-bottom: none; }
.location-result:hover { background: var(--bg); }
.location-result-price { color: var(--primary); font-weight: 600; font-size: 0.85rem; }
.location-no-results { padding: 12px 14px; color: var(--text-muted); font-size: 0.85rem; }

/* ── Category Nav ── */
#category-nav {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
#category-nav::-webkit-scrollbar { display: none; }

.cat-btn {
  padding: 6px 16px 6px 6px;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: white;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cat-btn:not(:has(.cat-img)) { padding: 8px 18px; }
.cat-img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}
.cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.cat-btn.active { background: var(--primary); border-color: var(--primary); color: var(--secondary); }

/* ── Products Grid ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 48px;
  flex: 1;
  width: 100%;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

.product-card-image-wrap { position: relative; }

.product-card-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f0f0f0;
  display: block;
}

.stock-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stock-badge.stock-out { background: #ef4444; }
.stock-badge.stock-low { background: #f59e0b; }
.product-card.out-of-stock .product-card-image { opacity: 0.6; }

.product-card-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #ccc;
}

.product-card-body { padding: 14px; }
.product-card-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.product-card-category { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.product-card-price { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.08);
  font-size: 1rem;
  cursor: pointer;
  z-index: 1;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(0,0,0,0.15); }

.modal-body { display: grid; grid-template-columns: 1fr 1fr; }

.modal-images {
  padding: 20px;
  background: #f8f8f8;
  border-radius: var(--radius) 0 0 var(--radius);
}

#modal-main-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
  background: white;
}

.thumbnails { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.thumb.active { border-color: var(--primary); }

.modal-details {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#modal-product-name { font-size: 1.4rem; font-weight: 700; line-height: 1.3; }
.price { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.description { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

/* ── Variants ── */
.variant-group { display: flex; flex-direction: column; gap: 8px; }

.variant-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.variant-options { display: flex; gap: 8px; flex-wrap: wrap; }

.variant-option {
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}
.variant-option:hover { border-color: var(--primary); }
.variant-option.selected { background: var(--primary); border-color: var(--primary); color: var(--secondary); }

/* ── Quantity ── */
.quantity-row { display: flex; align-items: center; gap: 16px; }

.quantity-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qty-control {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.qty-control button {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}
.qty-control button:hover { background: #e8e8e8; }
#qty-value { width: 40px; text-align: center; font-weight: 600; }

/* ── Order Buttons ── */
.order-buttons { display: flex; flex-direction: row; gap: 8px; margin-top: auto; flex-wrap: wrap; }

.order-btn {
  flex: 1;
  min-width: 130px;
  padding: 10px 14px;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.order-btn:active { transform: scale(0.98); }

.whatsapp-btn { background: #25D366; }
.whatsapp-btn:hover { background: #1da851; }
.whatsapp-btn::before {
  content: '';
  width: 22px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.call-btn { background: var(--primary); }
.call-btn:hover { filter: brightness(1.15); }
.call-btn::before {
  content: '';
  width: 22px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.6.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1-9.4 0-17-7.6-17-17 0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.5.6 3.6.1.3 0 .7-.2 1L6.6 10.8z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ── Footer ── */
#site-footer {
  border-top: 1px solid var(--border);
  background: white;
  padding: 12px 16px;
  margin-top: 16px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.footer-inner a { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer-inner a:hover { text-decoration: underline; }
.footer-divider { opacity: 0.5; }

/* ── Empty & Skeleton ── */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }

.skeleton {
  animation: shimmer 1.5s infinite;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .modal-body { grid-template-columns: 1fr; }
  .modal-images { border-radius: var(--radius) var(--radius) 0 0; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  main { padding: 12px 12px 24px; }
  #store-name { font-size: 1.1rem; }
  #category-nav { padding: 12px 12px 6px; }
  .header-inner { padding: 0; gap: 10px; }
  #site-header { padding: 12px 16px; }
  .brand { flex: 1 1 100%; order: 1; }
  .search-bar { flex: 1 1 auto; min-width: 0; margin-left: 0; order: 2; }
  .search-bar input { padding: 9px 14px; font-size: 0.9rem; }
  .sort-select { padding: 9px 10px; font-size: 0.85rem; order: 3; flex-shrink: 0; margin-left: auto; }

  .product-card-name { font-size: 0.85rem; }
  .product-card-price { font-size: 1rem; }
  .product-card-body { padding: 10px; }

  #site-footer { padding: 10px 12px; margin-top: 12px; }
  .footer-inner { font-size: 0.72rem; gap: 6px; }
}
