/* ============================================================
   Apon BD — Storefront Phase 5: catalog / product / cart / checkout
   ============================================================ */

/* ── Product cards ── */
.p-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.p-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.p-media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--bg-alt); }
.p-media img { width: 100%; height: 100%; object-fit: cover; }
.p-media-empty { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 48px; color: var(--brand); background: var(--brand-soft); }
.p-badge { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 10px; }
.p-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.p-name { font-size: 15px; margin: 0; line-height: 1.4; min-height: calc(1.4em * 2); }
.p-name a { color: var(--ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-price { display: flex; align-items: baseline; gap: 8px; }
.p-price strong { color: var(--brand-dark); font-size: 17px; }
.p-price s { color: var(--muted); font-size: 13px; }
.p-add .btn { width: 100%; margin-top: auto; }
.p-stock-out { color: var(--danger); font-weight: 700; margin: 0; }

/* ── Sections ── */
.section-sub { text-align: center; color: var(--muted); margin: -10px 0 20px; }
.cat-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.cat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); text-align: center; }
.cat-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.cat-empty { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; font-size: 40px; color: var(--brand); background: var(--brand-soft); }
.cat-card strong { display: block; padding: 10px; }
.promo-band { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); text-align: center; background: var(--brand-dark); color: #fff; text-decoration: none; padding: 28px 20px; }
.promo-band img { width: 100%; }
.muted { color: var(--muted); }

/* ── Shop / filters ── */
.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filters-bar .input { flex: 1 1 180px; min-height: 48px; padding: 11px 14px; font-size: 16px; border: 1.5px solid var(--line); border-radius: 8px; font-family: inherit; }
.filters-bar select.input { flex: 0 1 200px; }
.crumbs { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.crumbs a { color: var(--brand); }

/* ── Product page ── */
.product-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
.product-gallery img#p-main { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.p-media-lg { min-height: 280px; border-radius: var(--radius); }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumbs button { border: 2px solid var(--line); border-radius: 8px; padding: 0; background: #fff; cursor: pointer; flex: 0 0 72px; }
.thumbs button img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.product-info h1 { font-size: 24px; }
.stars { color: #eab308; font-size: 18px; }
.stars-off { color: #d1d5db; }
.stars small { color: var(--muted); font-size: 13px; }
.p-price-lg { display: flex; align-items: baseline; gap: 10px; margin: 10px 0; }
.p-price-lg strong { font-size: 28px; color: var(--brand-dark); }
.p-price-lg s { color: var(--muted); }
.buy-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; margin: 16px 0 8px; }
.qty { display: inline-flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 48px; min-height: 52px; font-size: 20px; background: var(--bg-alt); border: 0; cursor: pointer; }
.qty input { width: 56px; border: 0; text-align: center; font-size: 17px; font-weight: 700; }
.stock-ok { color: var(--brand-dark); font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.p-section { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 20px; }
.p-section h2 { font-size: 20px; }
.richtext { white-space: normal; }
.review { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; }
.review p { margin: 0 0 6px; }
.sticky-price { align-self: center; font-size: 20px; font-weight: 800; color: var(--brand-dark); }
.sticky-cta form { flex: 1; display: flex; }
.sticky-cta .btn { flex: 1; }

/* ── Landing chrome ── */
.landing-bar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 0; text-align: center; }
.landing-foot { border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); font-size: 14px; margin-top: 30px; }

/* ── Cart / checkout ── */
.cart-layout, .checkout-layout { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
/* Grid children must not force tracks wider than the viewport. */
.cart-layout > *, .checkout-layout > *, .grid-2 > *, .product-grid > *, .hero-inner > * { min-width: 0; }
fieldset { min-width: 0; max-width: 100%; }
.coupon-row .input, .filters-bar .input { min-width: 0; }
.cart-table .qty-form { display: flex; gap: 6px; align-items: center; }
.qty-input { width: 70px; min-height: 44px; padding: 8px 10px; font-size: 15px; border: 1.5px solid var(--line); border-radius: 8px; }
.cart-item { display: flex; align-items: center; gap: 10px; }
.cart-item img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.link-danger { background: none; border: 0; color: var(--danger); font-size: 18px; cursor: pointer; min-width: 44px; min-height: 44px; }
.cart-summary { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.cart-summary h2 { font-size: 19px; margin-top: 0; }
.coupon-row { display: flex; gap: 8px; margin-bottom: 12px; }
.coupon-row .input { flex: 1; min-height: 44px; padding: 8px 12px; font-size: 15px; border: 1.5px solid var(--line); border-radius: 8px; }
fieldset.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
fieldset.card legend { font-weight: 800; padding: 0 8px; }
.pay-option { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--brand); border-radius: var(--radius-sm); padding: 14px; background: var(--brand-soft); cursor: pointer; }
.pay-option input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); }
.sum-items { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.sum-items li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 6px; }
.form-group .input, .form-group textarea.input { width: 100%; min-height: 48px; padding: 11px 14px; font-size: 16px; border: 1.5px solid var(--line); border-radius: 8px; font-family: inherit; }
textarea.input { min-height: 96px; resize: vertical; }
.field-error { color: var(--danger); font-size: 14px; font-weight: 600; margin: 6px 0 0; }
.form-errors { background: #fdecea; color: #9c2318; border: 1px solid var(--danger); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; }

/* ── Success ── */
.success-page { text-align: center; }
.success-check { width: 72px; height: 72px; margin: 10px auto; border-radius: 50%; background: var(--brand); color: #fff; font-size: 36px; display: flex; align-items: center; justify-content: center; }
.order-no { font-size: 18px; }
.success-page .panel { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.empty-cart { text-align: center; padding: 30px 0; }

/* ── Toast ── */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); background: #1a1a1a; color: #fff; border-radius: 10px; padding: 12px 20px; font-weight: 600; z-index: 200; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; }

/* ── Pagination (storefront) ── */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }
.pager a, .pager .current { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 700; color: var(--ink); background: #fff; }
.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }

@media (min-width: 640px) {
    .p-grid { grid-template-columns: repeat(3, 1fr); }
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
    .p-grid { grid-template-columns: repeat(4, 1fr); }
    .product-grid { grid-template-columns: 1fr 1fr; }
    .product-info h1 { font-size: 30px; }
    .cart-layout { grid-template-columns: 1fr 340px; }
    .checkout-layout { grid-template-columns: 1fr 360px; }
    .cart-summary { position: sticky; top: 130px; }
}

/* Phase 6 — conversion button styles */
.btn-secondary { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.btn-whatsapp { background: #1da851; color: #fff; border: 2px solid transparent; }
.btn-whatsapp:hover { background: #178542; }
.btn-block { width: 100%; }
.buy-cta { margin: 0 0 10px; }
.buy-cta .btn { margin: 0; }
.buy-stack { margin: 16px 0 8px; }

/* Phase 7 — reviews + video reviews */
.reviews-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.reviews-head h2 { margin: 0; }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.video-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.video-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.video-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer; background: #111; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-card iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.video-link { text-decoration: none; }
.video-generic { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 56px; background: var(--bg-alt); }
.play { position: absolute; inset: 0; margin: auto; width: 60px; height: 60px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; }
.video-meta { padding: 12px 14px; }
.video-meta p { margin: 0 0 6px; font-size: 14px; }
@media (min-width: 640px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
    .video-grid { grid-template-columns: repeat(3, 1fr); }
}
