/* =========================================================
   PolliBazar - Main Stylesheet
   Mobile-first, professional e-commerce design
   ========================================================= */

:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #f0fdf4;
  --accent: #f59e0b;
  --danger: #dc2626;
  --text: #111827;
  --text-muted: #6b7280;
  --bg: #f9fafb;
  --card: #ffffff;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

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

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--primary-dark);
  color: #fff;
  text-align: center;
  font-size: 0.8rem;
  padding: 0.45rem 1rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}
.logo img { width: 36px; height: 36px; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  min-width: 44px;
  min-height: 44px;
}

.header-search {
  flex: 1;
  display: flex;
  max-width: 520px;
  order: 3;
  flex-basis: 100%;
  margin-top: 0.5rem;
}
.header-search input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 2px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  outline: none;
  min-height: 44px;
}
.header-search input:focus { border-color: var(--primary); }
.header-search button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-weight: 600;
  min-height: 44px;
}
.header-search button:hover { background: var(--primary-dark); }

.header-nav { display: flex; align-items: center; gap: 1.25rem; margin-left: auto; }
.header-nav a { font-weight: 500; color: var(--text); padding: 0.4rem 0.2rem; }
.header-nav a:hover, .header-nav a.active { color: var(--primary); }

.cart-link { position: relative; font-size: 1.35rem; }
.cart-count {
  position: absolute;
  top: -6px; right: -10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem 1rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.mobile-nav a:last-child { border-bottom: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  min-height: 44px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-dark { background: var(--text); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero { background: var(--card); border-bottom: 1px solid var(--border); }
.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
  padding: 2.5rem 1rem;
}
.hero-text h1 { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin-bottom: 1rem; }
.hero-text h1 span { color: var(--primary); }
.hero-text p { color: var(--text-muted); margin-bottom: 1.5rem; max-width: 520px; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-media img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section-alt { background: var(--card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; margin-bottom: 2.25rem; }
.section-head h2 { font-size: 1.6rem; font-weight: 800; }
.section-head p { color: var(--text-muted); margin-top: 0.4rem; }

/* ---------- Category cards ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.category-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.category-card img { width: 100%; height: 140px; object-fit: cover; }
.category-card span {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.6rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Product grid & cards ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.product-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-media { position: relative; aspect-ratio: 1/1; background: var(--primary-light); overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.product-card:hover .product-media img { transform: scale(1.05); }
.badge {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.badge.new { background: var(--primary); }
.badge.stock-out { background: var(--text-muted); }
.product-body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.product-cat { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.product-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-name a:hover { color: var(--primary); }
.price-row { display: flex; align-items: baseline; gap: 0.5rem; margin-top: auto; }
.price-now { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.price-old { font-size: 0.85rem; color: var(--text-muted); text-decoration: line-through; }
.stock-note { font-size: 0.78rem; }
.stock-note.in { color: var(--primary); }
.stock-note.out { color: var(--danger); }
.product-body .btn { margin-top: 0.5rem; padding: 0.55rem 1rem; font-size: 0.88rem; }

/* ---------- Promo banner ---------- */
.promo {
  background: linear-gradient(120deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius);
  color: #fff;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.promo h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.promo p { opacity: 0.92; margin-bottom: 1.25rem; }
.promo .btn { background: #fff; color: var(--primary-dark); }
.promo .btn:hover { background: #f3f4f6; }

/* ---------- Why us ---------- */
.why-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.why-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.why-card .icon { font-size: 2rem; margin-bottom: 0.75rem; }
.why-card h3 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.why-card p { font-size: 0.9rem; color: var(--text-muted); }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1rem;
  text-align: center;
}
.page-hero h1 { font-size: 1.6rem; font-weight: 800; }
.page-hero p { color: var(--text-muted); margin-top: 0.3rem; }
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }
.breadcrumb a { color: var(--primary); }

/* ---------- Shop layout ---------- */
.shop-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; padding: 2rem 0; }
.filters-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.filters-card h3 { font-size: 1rem; margin-bottom: 0.9rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); }
.filter-group { margin-bottom: 1.25rem; }
.filter-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; }
.filter-group select, .filter-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  min-height: 44px;
}
.price-inputs { display: flex; gap: 0.5rem; align-items: center; }
.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.shop-toolbar select {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  min-height: 44px;
}
.result-count { color: var(--text-muted); font-size: 0.9rem; }
.load-more-wrap { text-align: center; margin-top: 2rem; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 0.75rem; }

/* ---------- Product detail ---------- */
.pd-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; padding: 2rem 0; }
.pd-gallery .main-img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  aspect-ratio: 1/1;
  background: var(--primary-light);
}
.pd-gallery .main-img img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumbs { display: flex; gap: 0.6rem; margin-top: 0.75rem; }
.pd-thumbs img {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
}
.pd-thumbs img.active { border-color: var(--primary); }
.pd-info h1 { font-size: 1.5rem; font-weight: 800; margin: 0.35rem 0 0.75rem; }
.pd-price { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.75rem; }
.pd-price .now { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.pd-price .old { font-size: 1.1rem; color: var(--text-muted); text-decoration: line-through; }
.pd-price .save { background: var(--primary-light); color: var(--primary-dark); font-size: 0.8rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; }
.pd-short { color: var(--text-muted); margin-bottom: 1.25rem; }
.pd-meta { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.pd-meta div { padding: 0.3rem 0; }
.pd-meta strong { color: var(--text); }
.qty-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.qty-box { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--card); }
.qty-box button { width: 44px; height: 44px; border: none; background: var(--bg); font-size: 1.2rem; }
.qty-box input { width: 56px; height: 44px; border: none; text-align: center; font-weight: 700; outline: none; }
.pd-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.pd-tabs { padding: 1.5rem 0 3rem; }
.pd-tabs .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.pd-tabs h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }

/* ---------- Cart page ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; padding: 2rem 0; align-items: start; }
.cart-item {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.9rem;
  align-items: center;
}
.cart-item img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); }
.cart-item .name { font-weight: 600; font-size: 0.95rem; }
.cart-item .unit { color: var(--text-muted); font-size: 0.85rem; }
.cart-item .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.cart-item .line-total { font-weight: 800; color: var(--primary); }
.link-danger { background: none; border: none; color: var(--danger); font-size: 0.82rem; padding: 0.25rem; }
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky;
  top: 90px;
}
.summary-card h3 { margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.summary-row { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.95rem; }
.summary-row.total { font-size: 1.15rem; font-weight: 800; color: var(--primary); border-top: 1px solid var(--border); margin-top: 0.5rem; padding-top: 0.75rem; }

/* ---------- Checkout ---------- */
.checkout-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; padding: 2rem 0; align-items: start; }
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.form-card h2 { font-size: 1.15rem; margin-bottom: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: 1fr; gap: 0.9rem; margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.field label .opt { color: var(--text-muted); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  outline: none;
  min-height: 44px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field .error-text { color: var(--danger); font-size: 0.8rem; margin-top: 0.25rem; display: none; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field.invalid .error-text { display: block; }

.pay-option {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  background: var(--bg);
}
.pay-option:hover { border-color: var(--primary); }
.pay-option input { margin-top: 0.3rem; }
.pay-option.selected { border-color: var(--primary); background: var(--primary-light); }
.pay-option .pay-name { font-weight: 700; }
.pay-option .pay-desc { font-size: 0.85rem; color: var(--text-muted); }
.pay-instructions {
  display: none;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
}
.pay-instructions.show { display: block; }
.pay-instructions .merchant { font-weight: 800; color: var(--primary-dark); font-size: 1.05rem; }

.mini-item { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.4rem 0; font-size: 0.9rem; }
.mini-item .q { color: var(--text-muted); }

/* ---------- Order success ---------- */
.success-wrap { max-width: 720px; margin: 3rem auto; padding: 0 1rem; }
.success-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.success-icon { font-size: 4rem; }
.success-card h1 { font-size: 1.6rem; margin: 0.75rem 0 0.5rem; }
.order-box {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: left;
}
.order-box .row { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.92rem; gap: 1rem; }
.order-box .row .k { color: var(--text-muted); }
.order-box .row .v { font-weight: 600; text-align: right; }
.order-box .row .v.hl { color: var(--primary); font-weight: 800; }

/* ---------- Static pages ---------- */
.prose { max-width: 820px; margin: 0 auto; padding: 2.5rem 1rem; }
.prose h1 { font-size: 1.7rem; margin-bottom: 1rem; }
.prose h2 { font-size: 1.25rem; margin: 1.75rem 0 0.6rem; }
.prose p { margin-bottom: 1rem; color: #374151; }
.prose ul { margin: 0 0 1rem 1.25rem; color: #374151; }
.prose li { margin-bottom: 0.35rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; padding: 2.5rem 0; }
.contact-info-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.contact-info-card h3 { margin-bottom: 1rem; }
.contact-info-card p { padding: 0.4rem 0; color: #374151; }

/* ---------- Footer ---------- */
.site-footer { background: #111827; color: #d1d5db; margin-top: 3rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 3rem 1rem 2rem;
}
.footer-col .f-logo { color: #fff; font-size: 1.35rem; font-weight: 800; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.footer-col p { font-size: 0.9rem; color: #9ca3af; }
.footer-col h4 { color: #fff; font-size: 1rem; margin-bottom: 0.9rem; }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col ul a { font-size: 0.9rem; color: #9ca3af; }
.footer-col ul a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #1f2937;
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: 0.85rem;
  color: #9ca3af;
}
.pay-badges { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.pay-badges span {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--text);
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 4px solid var(--primary);
  animation: toastIn 0.25s ease;
  max-width: 320px;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Loading skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 37%, #f3f4f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.hidden { display: none !important; }
