/*
  ============================================
  LOCALSHOP — Shared Storefront Stylesheet
  ============================================

  All branding is controlled via CSS custom properties.
  Clients override these in their theme.css or via the
  brand setup panel. No inline styles needed.

  To customize a store:
  1. Override the variables in :root {} in theme.css
  2. Or inject them via the admin brand setup UI
  ============================================
*/

/* --- THEME DEFAULTS (overridden per-store) --- */
:root {
  /* Brand colors */
  --brand-primary: #4a7c2f;
  --brand-primary-hover: #3a6424;
  --brand-primary-light: #7ab648;
  --brand-accent: #d4e8b8;
  --brand-accent-pale: #f0f7e6;

  /* Backgrounds */
  --bg-page: #faf7f0;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --bg-footer: #1a1a2e;
  --bg-hero: linear-gradient(135deg, var(--brand-accent-pale) 0%, var(--bg-page) 50%, var(--brand-accent-pale) 100%);

  /* Text */
  --text-heading: #1a1a1a;
  --text-body: #3d3d3d;
  --text-muted: #7a7a7a;
  --text-on-primary: #ffffff;
  --text-on-footer: rgba(255,255,255,0.7);

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --heading-weight: 700;

  /* Layout */
  --max-width: 1200px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-card: 0 2px 16px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-nav: 0 1px 4px rgba(0,0,0,0.06);

  /* Transitions */
  --transition: 0.2s ease;
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  font-weight: var(--heading-weight);
  line-height: 1.2;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* --- HEADER --- */
.site-header {
  background: var(--bg-header);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-nav);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-heading);
}
.logo .highlight { color: var(--brand-primary); }

.header-nav { display: flex; align-items: center; gap: 1.5rem; }
.header-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-body);
  transition: color var(--transition);
}
.header-nav a:hover { color: var(--brand-primary); }

.cart-btn {
  position: relative;
  background: var(--brand-accent-pale);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.cart-btn:hover { background: var(--brand-accent); }

.cart-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--brand-primary);
  color: var(--text-on-primary);
  font-size: 0.7rem;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.cart-badge.hidden { display: none; }

/* --- HERO --- */
.hero {
  background: var(--bg-hero);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin-bottom: 1rem;
}
.hero h1 em {
  font-style: italic;
  color: var(--brand-primary);
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 2rem;
}
.hero-cta {
  display: inline-block;
  background: var(--brand-primary);
  color: var(--text-on-primary);
  padding: 0.9rem 2rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.hero-cta:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-2px);
}
.hero-badges {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}
.hero-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.hero-badge span { font-size: 1.3rem; }

/* --- SECTIONS --- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}
.section-title {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 0.5rem;
}
.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
}

/* --- FILTERS --- */
.filters {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 0.45rem 1.1rem;
  border: 2px solid var(--brand-accent);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.filter-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.filter-btn.active {
  background: var(--brand-primary);
  color: var(--text-on-primary);
  border-color: var(--brand-primary);
}

/* --- SEARCH BAR --- */
.search-bar {
  max-width: 480px;
  margin: 0 auto 2rem;
  position: relative;
}
.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid var(--brand-accent);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-body);
  outline: none;
  background: var(--bg-card);
  transition: border-color var(--transition);
}
.search-bar input:focus { border-color: var(--brand-primary); }
.search-bar::before {
  content: "🔍";
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
}

/* --- PRODUCT GRID --- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.product-card-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: var(--brand-accent-pale);
}
.product-card-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.product-card-body { padding: 1.2rem; }
.product-card-body h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.product-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.product-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.product-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
}

.add-to-cart-btn {
  background: var(--brand-primary);
  color: var(--text-on-primary);
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.add-to-cart-btn:hover { background: var(--brand-primary-hover); }
.add-to-cart-btn:disabled { background: #ccc; cursor: not-allowed; }

.empty-shop {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-shop .icon { font-size: 3rem; margin-bottom: 1rem; }

/* --- ABOUT --- */
.about-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 3rem;
  align-items: center;
  box-shadow: var(--shadow-card);
}
.about-avatar {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-hero);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  overflow: hidden;
}
.about-avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-text h3 { font-size: 1.4rem; margin-bottom: 1rem; }
.about-text p { margin-bottom: 0.8rem; }

/* --- HOW IT WORKS --- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}
.step-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.step-number {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: var(--text-on-primary);
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.step-card h4 { margin-bottom: 0.5rem; font-family: var(--font-body); font-weight: 600; }
.step-card p { font-size: 0.9rem; color: var(--text-muted); }

/* --- CART DRAWER --- */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
}
.cart-overlay.open { display: block; }

.cart-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -8px 0 32px rgba(0,0,0,0.15);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.cart-overlay.open .cart-drawer { transform: translateX(0); }

.cart-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h2 { font-size: 1.2rem; font-family: var(--font-body); font-weight: 700; }
.cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
}

.cart-items { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }

.cart-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.cart-item-img {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--brand-accent-pale);
}
.cart-item-name { font-weight: 600; font-size: 0.9rem; }
.cart-item-price { font-size: 0.85rem; color: var(--text-muted); }

.cart-item-qty { display: flex; align-items: center; gap: 0.5rem; }
.qty-btn {
  width: 28px; height: 28px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center; justify-content: center;
  font-family: var(--font-body);
}
.qty-btn:hover { background: var(--brand-accent-pale); }

.cart-empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

.cart-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.08);
  background: var(--brand-accent-pale);
}
.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
}

.checkout-btn {
  width: 100%;
  padding: 0.9rem;
  background: var(--brand-primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.checkout-btn:hover { background: var(--brand-primary-hover); }
.checkout-btn:disabled { background: #aaa; cursor: not-allowed; }

/* Checkout form in cart */
.checkout-form { display: none; padding: 0 1.5rem 1.5rem; }
.checkout-form.visible { display: block; }
.checkout-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  margin-top: 0.8rem;
}
.checkout-form input,
.checkout-form textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
}
.checkout-form input:focus,
.checkout-form textarea:focus { border-color: var(--brand-primary); }
.checkout-form textarea { resize: vertical; min-height: 60px; }

/* --- FOOTER --- */
.site-footer {
  background: var(--bg-footer);
  color: var(--text-on-footer);
  padding: 3rem 1.5rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-on-primary);
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
  color: var(--text-on-footer);
  font-size: 0.85rem;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--text-on-primary); }

/* --- TOAST --- */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  padding: 0.8rem 1.5rem;
  background: var(--text-heading);
  color: var(--text-on-primary);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 300;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #dc3545; }

/* --- LOADING --- */
.skeleton {
  background: linear-gradient(90deg, var(--brand-accent-pale) 25%, var(--bg-page) 50%, var(--brand-accent-pale) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- PAGINATION --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}
.page-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--brand-accent);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-body);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--brand-primary); }
.page-btn.active { background: var(--brand-primary); color: var(--text-on-primary); border-color: var(--brand-primary); }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .about-section { grid-template-columns: 1fr; }
  .about-avatar { max-width: 200px; margin: 0 auto; }
  .hero { padding: 3rem 1.5rem 2.5rem; }
  .header-nav a.hide-mobile { display: none; }
}

@media (max-width: 480px) {
  .shop-grid { grid-template-columns: 1fr; }
  .hero-badges { gap: 1rem; }
  .steps-grid { grid-template-columns: 1fr; }
}

/* --- DARK MODE VARIANT --- */
.theme-dark {
  --bg-page: #121212;
  --bg-card: #1e1e1e;
  --bg-header: #1a1a1a;
  --text-heading: #f5f5f0;
  --text-body: #d0d0d0;
  --text-muted: #888888;
  --shadow-card: 0 2px 16px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.4);
}

/* --- POWERED BY BADGE --- */
.powered-by {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}
.powered-by a { color: rgba(255,255,255,0.6); }
.powered-by a:hover { color: var(--text-on-primary); }
