/* ═══════════════════════════════════════════════════════
   WorkToGo — Components CSS v4 (2026)
   Changes from v3.1:
   + Grid breakpoints: 480px (3-col), 1280px (5-col)
   + Spring animation on product-add-btn press
   + Number flash animation on qty change
   + Shimmer skeleton (replaces flat gray)
   + out-for-delivery badge
   + Sticky elements cleaned up (no duplicate)
═══════════════════════════════════════════════════════ */

/* ── PRODUCT GRID ─────────────────────────────────────── */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
  contain: layout;
}

/* Large phones: 480–599px → 3 columns */
@media (min-width: 480px) and (max-width: 599px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px; }
}

/* Tablet: 600px+ → 3 columns */
@media (min-width: 600px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 14px; }
}

/* Desktop: 960px+ → 4 columns */
@media (min-width: 960px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 16px; }
}

/* Large desktop: 1280px+ → 5 columns */
@media (min-width: 1280px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); gap: 18px; padding: 18px; }
}

/* ── PRODUCT CARD ─────────────────────────────────────── */

.product-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transform: translateZ(0);
}

@media (hover: hover) {
  .product-card:hover { box-shadow: var(--shadow-md); }
}

.product-card:active { opacity: 0.88; }

.product-card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f8f9fa;
  overflow: hidden;
}

.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: #ef4444;
  color: white;
  font-size: 11px; font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  z-index: 1;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.product-oos-badge {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #9ca3af;
  pointer-events: none;
}

.product-card-body { padding: 10px 10px 8px; }

.product-card-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-1);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}

.product-card-vendor {
  font-size: 11px; color: var(--text-3);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 32px;
}

.price-current  { font-size: 15px; font-weight: 800; color: var(--text-1); flex-shrink: 0; }
.price-original { font-size: 11px; color: var(--text-3); text-decoration: line-through; }

/* ── ADD BUTTON — Spring press feel ──────────────────── */

.product-add-btn {
  width: 32px; height: 32px; min-width: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px; font-weight: 300;
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: transform 0.12s var(--spring), opacity 0.1s;
  line-height: 1;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.product-add-btn:active {
  transform: scale(0.82);
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  .product-add-btn { transition: opacity 0.1s; }
  .product-add-btn:active { transform: none; }
}

/* ── QTY CONTROL (inline card) ───────────────────────── */

.card-qty-control {
  display: flex;
  align-items: center;
  background: var(--primary);
  border-radius: 20px;
  overflow: hidden;
  height: 32px;
  margin-left: auto;
  flex-shrink: 0;
  animation: qtyAppear 0.2s var(--spring) both;
}

@keyframes qtyAppear {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .card-qty-control { animation: none; }
}

.card-qty-btn {
  width: 28px; height: 32px;
  background: none;
  border: none;
  color: white;
  font-size: 18px; font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  min-width: 28px;
  transition: background 0.08s;
}

.card-qty-btn:active { background: rgba(0,0,0,0.18); }

.card-qty-val {
  min-width: 22px;
  text-align: center;
  font-size: 13px; font-weight: 700;
  color: white;
  padding: 0 2px;
  line-height: 32px;
}

/* Number flash when qty changes — Blinkit feel */
.card-qty-val.flash {
  animation: numFlash 0.16s var(--spring) both;
}

@keyframes numFlash {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .card-qty-val.flash { animation: none; }
}

/* ── FLY TO CART ──────────────────────────────────────── */

.fly-to-cart {
  position: fixed;
  width: 40px; height: 40px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .fly-to-cart { display: none; }
}

/* Badge pulse */
.cart-badge-pulse {
  will-change: transform;
  animation: badgePulse 0.3s var(--spring) both;
}

@keyframes badgePulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.6); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .cart-badge-pulse { animation: none; }
}

/* Cart icon bounce */
.cart-icon-bounce {
  will-change: transform;
  animation: cartBounce 0.38s var(--spring) both;
}

@keyframes cartBounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.2) rotate(-8deg); }
  65%  { transform: scale(1.07) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .cart-icon-bounce { animation: none; }
}

/* ── BOTTOM SHEET (variation modal) ─────────────────── */

.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 1000;
  transition: background 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.bottom-sheet-overlay.visible {
  background: rgba(0,0,0,0.48);
}

.bottom-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.bottom-sheet-overlay.visible .bottom-sheet {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 36px; height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
  cursor: grab;
}

.bottom-sheet-header {
  padding: 14px 16px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bottom-sheet-product-img {
  width: 60px; height: 60px;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f5f5;
  flex-shrink: 0;
}

.bottom-sheet-product-info { flex: 1; min-width: 0; }

.bottom-sheet-product-name {
  font-size: 15px; font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bottom-sheet-product-price {
  font-size: 16px; font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.bottom-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Attribute group */
.var-attr-group  { margin-bottom: 20px; }

.var-attr-label {
  font-size: 12px; font-weight: 700;
  color: var(--text-3);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.var-option-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.var-option-btn {
  min-width: 48px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.1s var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.var-option-btn:active   { transform: scale(0.93); }
.var-option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.var-option-btn.unavailable {
  opacity: 0.38;
  text-decoration: line-through;
  cursor: not-allowed;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .var-option-btn { transition: border-color 0.12s, background 0.12s; }
  .var-option-btn:active { transform: none; }
}

/* Sheet footer */
.bottom-sheet-footer {
  padding: 10px 16px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Qty in sheet */
.sheet-qty-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
}

.sheet-qty-label { font-size: 14px; font-weight: 600; color: var(--text-2); }

.sheet-qty-control {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.sheet-qty-btn {
  width: 38px; height: 38px;
  background: white; border: none;
  font-size: 20px; font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-1);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s;
}

.sheet-qty-btn:active { background: #f3f4f6; }

.sheet-qty-val {
  min-width: 40px;
  text-align: center;
  font-size: 16px; font-weight: 700;
  color: var(--text-1);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 38px;
}

.btn-add-full {
  width: 100%; height: 50px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  margin-top: 10px;
  transition: transform 0.12s var(--spring), opacity 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-add-full:active   { transform: scale(0.97); opacity: 0.88; }
.btn-add-full:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .btn-add-full { transition: opacity 0.1s; }
  .btn-add-full:active { transform: none; }
}

/* ── CATEGORY STRIP ───────────────────────────────────── */

.cat-strip {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: white;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.cat-strip::-webkit-scrollbar { display: none; }

.cat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s var(--spring);
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.cat-chip:active { transform: scale(0.93); background: #f3f4f6; }
.cat-chip.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.cat-chip img    { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.cat-chip-icon   { font-size: 24px; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  .cat-chip { transition: background 0.12s; }
  .cat-chip:active { transform: none; }
}

/* ── CART ITEMS ───────────────────────────────────────── */

.cart-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: opacity 0.18s;
}

.cart-item-img {
  width: 68px; height: 68px;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f5f5;
  flex-shrink: 0;
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-size: 14px; font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cart-item-price { font-size: 15px; font-weight: 800; color: var(--text-1); }

.qty-control {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.qty-btn {
  width: 34px; height: 34px;
  background: none; border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-1);
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, transform 0.1s var(--spring);
}

.qty-btn:active { background: var(--primary); color: white; transform: scale(0.88); }

@media (prefers-reduced-motion: reduce) {
  .qty-btn { transition: background 0.1s; }
  .qty-btn:active { transform: none; }
}

.qty-value {
  min-width: 32px;
  text-align: center;
  font-size: 14px; font-weight: 700;
  color: var(--text-1);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0 4px;
  line-height: 34px;
}

/* ── SKELETON — Shimmer ───────────────────────────────── */

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #f8f8f8 40%,
    #f0f0f0 80%
  );
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0%   { background-position: 100% center; }
  100% { background-position: -100% center; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: #f0f0f0; }
}

/* Legacy .sk-box alias */
.sk-box { background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { .sk-box { animation: none; background: #f0f0f0; } }

.sk-product-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.sk-img   { aspect-ratio: 1/1; width: 100%; border-radius: 0; }
.sk-body  { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.sk-title { height: 14px; width: 90%; border-radius: 6px; }
.sk-text  { height: 12px; border-radius: 6px; }
.sk-price { height: 18px; width: 50%; border-radius: 6px; margin-top: 4px; }

.sk-category {
  min-width: 60px; height: 72px;
  border-radius: 12px;
  flex-shrink: 0;
}

.sk-cat {
  min-width: 60px; height: 72px;
  border-radius: 12px;
  flex-shrink: 0;
}

.sk-order-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  margin: 8px 12px;
}

/* ── ORDER CARDS ──────────────────────────────────────── */

.order-card { background: white; border-radius: var(--radius-md); border: 1px solid var(--border); margin: 8px 12px; overflow: hidden; }
.order-card-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.order-id   { font-size: 15px; font-weight: 700; color: var(--text-1); }
.order-date { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.order-status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.status-pending          { background: #fef3c7; color: #92400e; }
.status-processing       { background: #dbeafe; color: #1e3a8a; }
.status-completed        { background: #d1fae5; color: #065f46; }
.status-cancelled        { background: #fee2e2; color: #991b1b; }
.status-failed           { background: #fee2e2; color: #991b1b; }
.status-out-for-delivery { background: #e0f2fe; color: #0c4a6e; }
.status-refunded         { background: #f3f4f6; color: #374151; }
.order-card-body   { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.order-item-list   { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.order-card-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
.order-total { font-size: 16px; font-weight: 800; color: var(--text-1); }

/* ── TOAST ────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: calc(var(--top-h) + 8px);
  left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 420px;
  z-index: 9998;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}

.toast {
  background: #1a1a1a; color: white;
  padding: 11px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(-8px) scale(0.96);
  transition: opacity 0.18s, transform 0.18s var(--spring);
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  line-height: 1.4;
  will-change: transform, opacity;
}

.toast.show    { opacity: 1; transform: translateY(0) scale(1); }
.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
.toast.info    { background: #1e40af; }
.toast-icon    { font-size: 15px; flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 0.18s; }
  .toast.show { transform: none; }
}

/* ── RESPONSIVE — Sticky elements ────────────────────── */

@media (min-width: 768px) {
  .sticky-checkout, .pd-sticky-cta { max-width: 720px; }
}
@media (min-width: 1024px) {
  .sticky-checkout, .pd-sticky-cta { max-width: 960px; }
}
@media (min-width: 1280px) {
  .sticky-checkout, .pd-sticky-cta { max-width: 1100px; }
}