/* ════════════════════════════════════════════════════════════════════════════
   temu-sidebar.css  —  Temu-inspired global fixed cart sidebar (right edge)
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Sidebar container ──────────────────────────────────────────────────── */
.temu-sb {
  display: none; /* hidden on mobile; shown via media query */
}

@media (min-width: 1024px) {
  :root {
    /* Sleek Temu subtotal sidebar width (~12.5% viewport width) */
    --temu-sidebar-width: clamp(220px, 12.5vw, 255px);
    --temu-sidebar-top: 80px;
  }

  .temu-sb {
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: var(--temu-sidebar-top);
    width: var(--temu-sidebar-width);
    height: calc(100dvh - var(--temu-sidebar-top));
    /* The store header is z-index 400. Keep the cart beneath it so navigation
       and its menus are always fully usable. */
    z-index: 350;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    font-family: 'Poppins', sans-serif;
    border-left: 1px solid #eee;
  }

  /* layout_store.njk declares main at width: 100%. A margin alone therefore
     overflows rather than reserving space. Constrain storefront content and its
     footer to the remaining viewport width so neither can sit under the cart. */
  body:not(.hide-temu-sb) > main,
  body:not(.hide-temu-sb) .founding-member-banner {
    width: calc(100% - var(--temu-sidebar-width)) !important;
    margin-right: var(--temu-sidebar-width) !important;
    min-width: 0;
  }
}

/* ── Header (orange gradient) ───────────────────────────────────────────── */
.temu-sb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 12px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  flex-shrink: 0;
}
.temu-sb-header i {
  font-size: 1.1rem;
}
.temu-sb-header .temu-sb-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.temu-sb-header .temu-sb-total {
  margin-left: auto;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── Shipping note ──────────────────────────────────────────────────────── */
.temu-sb-ship {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f0fdf4;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.72rem;
  color: #166534;
  font-weight: 600;
  flex-shrink: 0;
}
.temu-sb-ship i {
  font-size: 0.82rem;
  color: #22c55e;
}

/* ── Item list (scrollable) ─────────────────────────────────────────────── */
.temu-sb-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}
.temu-sb-items::-webkit-scrollbar {
  width: 5px;
}
.temu-sb-items::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.temu-sb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  text-align: center;
  color: #94a3b8;
}
.temu-sb-empty i {
  font-size: 2.4rem;
  color: #cbd5e1;
}
.temu-sb-empty span {
  font-size: 0.82rem;
  font-weight: 500;
}

/* ── Item card ──────────────────────────────────────────────────────────── */
.temu-sb-card {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.temu-sb-card:hover {
  background: #fafafa;
}
.temu-sb-card-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.temu-sb-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.temu-sb-card-img .temu-sb-emoji {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}
.temu-sb-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.temu-sb-card-name {
  font-size: 0.72rem;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.temu-sb-card-variant {
  font-size: 0.62rem;
  color: #94a3b8;
  font-weight: 500;
}
.temu-sb-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.temu-sb-card-price {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ea580c;
}
.temu-sb-card-qty {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 600;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

/* ── Select all / count header ──────────────────────────────────────────── */
.temu-sb-select-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  flex-shrink: 0;
}
.temu-sb-select-header i {
  color: #22c55e;
  font-size: 0.78rem;
}

/* ── Action buttons (sticky bottom) ─────────────────────────────────────── */
.temu-sb-actions {
  padding: 12px 14px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}
.temu-sb-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  text-align: center;
  transition:
    filter 0.15s,
    transform 0.1s;
  border: none;
  cursor: pointer;
}
.temu-sb-checkout:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.temu-sb-checkout:active {
  transform: translateY(0);
}
.temu-sb-gocart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  background: #fff;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  text-decoration: none;
  text-align: center;
  transition:
    border-color 0.15s,
    background 0.15s;
  cursor: pointer;
}
.temu-sb-gocart:hover {
  border-color: #f97316;
  background: #fff7ed;
  color: #ea580c;
}

/* ── Pulse animation on add ─────────────────────────────────────────────── */
@keyframes temuSbPulse {
  0% {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow:
      -4px 0 24px rgba(249, 115, 22, 0.35),
      0 0 0 4px rgba(249, 115, 22, 0.12);
  }
  100% {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  }
}
.temu-sb.pulse {
  animation: temuSbPulse 0.6s ease;
}

/* ── New-item highlight ─────────────────────────────────────────────────── */
@keyframes temuCardFlash {
  0% {
    background: #fff7ed;
  }
  100% {
    background: transparent;
  }
}
.temu-sb-card.just-added {
  animation: temuCardFlash 1.2s ease;
}
