/* ============================================================
   Garg Farms — Shop page
   Product grid · filter bar · cart drawer · checkout · success
   ============================================================ */

.shop {
  min-height: 100vh;
  background-color: hsl(var(--background));
  padding-top: 5rem; /* clears fixed navbar */
}

/* ---------- Shop header ---------- */
.shop-header {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding-block: 3rem;
  padding-inline: 1rem;
}
.shop-header-inner {
  width: 100%;
  margin-inline: auto;
  max-width: 80rem;
}
@media (min-width: 1536px) { .shop-header-inner { max-width: 96rem; } }
.shop-header h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}
@media (min-width: 768px) { .shop-header h1 { font-size: 3rem; } }
.shop-header p {
  color: hsl(var(--primary-foreground) / 0.8);
  font-size: 1.125rem;
}

/* ---------- Sticky filter bar ---------- */
.shop-filterbar {
  position: sticky;
  top: 4rem;
  z-index: 30;
  background-color: hsl(var(--background) / 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
  box-shadow: var(--shadow-sm);
}
.shop-filterbar-inner {
  width: 100%;
  margin-inline: auto;
  max-width: 80rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}
@media (min-width: 768px) {
  .shop-filterbar-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (min-width: 1536px) { .shop-filterbar-inner { max-width: 96rem; } }

.shop-categories {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.shop-cat {
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all .2s;
  border: 1px solid hsl(var(--border));
  background-color: transparent;
  color: hsl(var(--foreground));
}
.shop-cat:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.shop-cat.is-active {
  background-color: hsl(var(--primary));
  color: #fff;
  border-color: hsl(var(--primary));
}

.shop-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}
@media (min-width: 768px) { .shop-tools { width: auto; } }

.shop-search {
  position: relative;
  flex: 1;
}
@media (min-width: 768px) { .shop-search { width: 16rem; flex: none; } }
.shop-search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}
.shop-search input {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}
.shop-search input:focus { outline: none; border-color: hsl(var(--ring)); box-shadow: 0 0 0 1px hsl(var(--ring)); }

.cart-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: hsl(var(--secondary));
  color: #fff;
  border: 1px solid var(--secondary-border);
  border-radius: var(--radius);
  min-height: 2.25rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .2s;
}
.cart-button:hover { background-color: hsl(33 69% 51% / 0.9); }
.cart-count {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  height: 1.25rem;
  width: 1.25rem;
  background-color: hsl(var(--primary));
  color: #fff;
  font-size: 0.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.cart-count.is-hidden { display: none; }

/* ---------- Product grid ---------- */
.shop-main {
  width: 100%;
  margin-inline: auto;
  max-width: 80rem;
  padding: 2.5rem 1rem;
}
@media (min-width: 1536px) { .shop-main { max-width: 96rem; } }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
@media (min-width: 640px) { .shop-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .shop-grid { grid-template-columns: repeat(4, 1fr); } }

.shop-empty {
  text-align: center;
  padding-block: 6rem;
  color: hsl(var(--muted-foreground));
}
.shop-empty p:first-child { font-size: 1.25rem; font-weight: 500; }
.shop-empty p:last-child { font-size: 0.875rem; margin-top: 0.5rem; }

.shop-card {
  background-color: hsl(var(--card));
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .3s, transform .3s;
  display: flex;
  flex-direction: column;
}
.shop-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-0.25rem); }

.shop-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: hsl(var(--muted));
}
.shop-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s;
}
.shop-card:hover .shop-card-media img { transform: scale(1.05); }

.shop-badge {
  position: absolute;
  top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}
.shop-badge--off { left: 0.5rem; background-color: #22c55e; }
.shop-badge--tag { right: 0.5rem; background-color: hsl(var(--secondary)); }
.shop-badge--tag.is-premium { background-color: #f59e0b; }
.shop-badge--tag.is-new { background-color: #3b82f6; }

.shop-card-body { padding: 1rem; display: flex; flex-direction: column; flex: 1; }
.shop-card-cat {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.shop-card-name { font-weight: 700; color: hsl(var(--primary)); font-size: 1rem; line-height: 1.2; margin-bottom: 0.125rem; }
.shop-card-weight { font-size: 0.75rem; color: hsl(var(--muted-foreground)); margin-bottom: 0.5rem; }
.shop-card-rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.shop-card-rating svg { width: 0.6875rem; height: 0.6875rem; fill: #fbbf24; color: #fbbf24; }
.shop-card-rating .rate { font-size: 0.75rem; font-weight: 600; color: hsl(var(--foreground)); }
.shop-card-rating .reviews { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.shop-card-price { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 1rem; }
.shop-card-price .now { font-size: 1.25rem; font-weight: 700; color: hsl(var(--primary)); }
.shop-card-price .mrp { font-size: 0.875rem; color: hsl(var(--muted-foreground)); text-decoration: line-through; }

.shop-add {
  width: 100%;
  margin-top: auto;
  min-height: 2rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  border-radius: var(--radius);
  background-color: hsl(var(--primary));
  border: 1px solid var(--primary-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  transition: background-color .2s;
}
.shop-add:hover { background-color: hsl(96 57% 20% / 0.9); }
.shop-add svg { width: 0.875rem; height: 0.875rem; }
.shop-add.in-cart { background-color: #16a34a; border-color: #16a34a; }
.shop-add.in-cart:hover { background-color: #15803d; }
.shop-add.is-loading,
.shop-add:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.shop-add.is-disabled {
  background-color: hsl(var(--muted-foreground));
  border-color: hsl(var(--muted-foreground));
}

/* ---------- Free shipping banner ---------- */
.shop-shipping {
  margin-top: 4rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: 1rem;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  text-align: center;
}
@media (min-width: 768px) { .shop-shipping { flex-direction: row; text-align: left; } }
.shop-shipping h3 { font-size: 1.25rem; font-weight: 700; color: #fff; margin-bottom: 0.25rem; }
.shop-shipping p { color: hsl(var(--primary-foreground) / 0.8); font-size: 0.875rem; }
.shop-shipping-stats { display: flex; gap: 2rem; text-align: center; }
.shop-shipping-stats .num { font-size: 1.875rem; font-weight: 700; color: hsl(var(--secondary)); }
.shop-shipping-stats .lbl { font-size: 0.75rem; color: hsl(var(--primary-foreground) / 0.7); }

/* ============================================================
   Cart drawer (Sheet)
   ============================================================ */
.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.cart-overlay.is-open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  width: 100%;
  background-color: hsl(var(--background));
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s ease;
}
@media (min-width: 640px) { .cart-drawer { max-width: 28rem; } }
.cart-drawer.is-open { transform: translateX(0); }

.cart-header {
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h2 { font-size: 1.25rem; font-weight: 700; color: hsl(var(--primary)); }
.cart-close {
  color: hsl(var(--muted-foreground));
  padding: 0.25rem;
  transition: color .2s;
}
.cart-close:hover { color: hsl(var(--foreground)); }

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-empty {
  text-align: center;
  padding-block: 5rem;
  color: hsl(var(--muted-foreground));
}
.cart-empty svg { width: 3rem; height: 3rem; margin: 0 auto 1rem; opacity: 0.3; }
.cart-empty p:first-of-type { font-size: 1.125rem; font-weight: 500; }
.cart-empty p:last-of-type { font-size: 0.875rem; margin-top: 0.25rem; }

.cart-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
}
.cart-item-img { height: 4rem; width: 4rem; object-fit: cover; border-radius: 0.5rem; flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 700; color: hsl(var(--primary)); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-weight { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.cart-item-price { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.cart-item-price .now { font-weight: 700; color: hsl(var(--primary)); font-size: 0.875rem; }
.cart-item-price .mrp { font-size: 0.75rem; color: hsl(var(--muted-foreground)); text-decoration: line-through; }
.cart-qty { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.cart-qty button {
  height: 1.5rem;
  width: 1.5rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s;
}
.cart-qty button:hover { background-color: hsl(var(--muted)); }
.cart-qty button svg { width: 0.625rem; height: 0.625rem; }
.cart-qty .qty { font-size: 0.875rem; font-weight: 700; width: 1rem; text-align: center; }
.cart-item-remove {
  color: hsl(var(--muted-foreground));
  transition: color .2s;
  margin-top: 0.25rem;
  align-self: flex-start;
}
.cart-item-remove:hover { color: hsl(var(--destructive)); }
.cart-item-remove svg { width: 0.9375rem; height: 0.9375rem; }
.cart-item-remove.is-loading,
.cart-qty button.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Cart footer / totals */
.cart-footer {
  padding: 1.5rem;
  border-top: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.cart-freehint {
  font-size: 0.75rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
  background-color: hsl(var(--muted));
  border-radius: 0.5rem;
  padding: 0.5rem;
}
.cart-freehint b { color: #16a34a; }

.cart-summary {
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--muted) / 0.4);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.cart-summary-row { display: flex; justify-content: space-between; color: hsl(var(--muted-foreground)); }
.cart-summary-row.savings { color: #16a34a; font-weight: 500; }
.cart-summary-row .free { color: #16a34a; font-weight: 600; }
.cart-summary-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
  color: hsl(var(--primary));
  border-top: 1px solid hsl(var(--border));
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.cart-cta {
  width: 100%;
  min-height: 3rem;
  background-color: hsl(var(--primary));
  color: #fff;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color .2s;
}
.cart-cta:hover { background-color: hsl(96 57% 20% / 0.9); }
.cart-cta svg { width: 1rem; height: 1rem; }
a.cart-cta { text-decoration: none; }

/* Checkout form */
.checkout-form { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.checkout-fields { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.checkout-note { font-size: 0.75rem; color: hsl(var(--muted-foreground)); text-align: center; }
.checkout-actions { padding: 1.5rem; border-top: 1px solid hsl(var(--border)); display: flex; gap: 0.75rem; }
.checkout-actions .btn { flex: 1; min-height: 2.5rem; }

/* Order success */
.cart-success {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  gap: 1.5rem;
}
.cart-success-icon {
  height: 5rem;
  width: 5rem;
  background-color: #dcfce7;
  color: #16a34a;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-success h3 { font-size: 1.5rem; font-weight: 700; color: hsl(var(--primary)); }
.cart-success p { color: hsl(var(--muted-foreground)); }

.is-hidden { display: none !important; }
