/* ============================================================
   Botpey Storefront — seller mini-website design system.
   One template, two knobs: palette (--sf-* vars, set inline per
   store) and archetype (sf-arch-* classes). Mobile-first.
   ============================================================ */

:root {
    --sf-brand: #1BAC4B;
    --sf-brand-dark: #0E8A3C;
    --sf-brand-soft: #E8F7EE;
    --sf-hero: #052E16;
    --sf-ink: #1A1A1A;
    --sf-muted: #6B7280;
    --sf-faint: #9CA3AF;
    --sf-line: #ECEEF1;
    --sf-canvas: #F7F8F9;
    --sf-radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.sf {
    margin: 0;
    background: var(--sf-canvas);
    color: var(--sf-ink);
    font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
body.sf img { display: block; }
.sf a { color: inherit; text-decoration: none; }
.sf button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sf [x-cloak] { display: none !important; }

.sf-wrap { max-width: 720px; margin: 0 auto; }

/* ---------- hero ---------- */
.sf-hero {
    position: relative;
    height: 300px;
    background: var(--sf-hero);
    overflow: hidden;
}
.sf-hero img.sf-hero__img { width: 100%; height: 100%; object-fit: cover; }
.sf-hero::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,.42) 100%);
}
.sf-hero__badge {
    position: absolute; top: 14px; left: 14px; z-index: 2;
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,.95); color: var(--sf-brand-dark);
    border-radius: 999px; padding: 5px 11px; font-size: 11px; font-weight: 700;
}
.sf-hero__share {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 38px; height: 38px; border-radius: 50%; border: 0;
    background: rgba(255,255,255,.95); color: #333;
    display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.sf-hero__logo,
.sf-id__logo {
    width: 64px; height: 64px; border-radius: 16px;
    border: 3px solid #fff; object-fit: cover; background: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.14);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 800; color: #fff;
}
.sf-id__logo {
    background: var(--sf-brand);
    margin-top: -34px; position: relative; z-index: 3; flex-shrink: 0;
}
.sf-hero__fallback {
    position: absolute; inset: 0;
    background: radial-gradient(120% 120% at 20% 0%, var(--sf-brand) 0%, var(--sf-hero) 78%);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.9); font-size: 56px; font-weight: 800;
}

/* ---------- identity ---------- */
.sf-id { padding: 40px 16px 0; }
.sf-id__top { display: flex; align-items: flex-start; gap: 12px; }
.sf-id__top > div { flex: 1; min-width: 0; }
.sf-id__name { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.sf-id__cat { margin: 5px 0 0; font-size: 12.5px; color: var(--sf-muted); font-weight: 600; }
.sf-id__cat span + span::before { content: " · "; color: var(--sf-faint); }
.sf-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.sf-chip {
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: 999px; padding: 6px 11px;
    font-size: 11.5px; font-weight: 700;
    background: #fff; border: 1px solid var(--sf-line); color: var(--sf-muted);
}
.sf-chip i { font-size: 11px; }
.sf-chip--rating { color: #92400E; background: #FFFBEB; border-color: #FDE68A; }
.sf-chip--open { color: #166534; background: var(--sf-brand-soft); border-color: transparent; }
.sf-chip--closed { color: #991B1B; background: #FEF2F2; border-color: transparent; }
.sf-chip--cashback { color: var(--sf-brand-dark); background: var(--sf-brand-soft); border-color: transparent; }

/* ---------- action row ---------- */
.sf-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 15px; }
.sf-action {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    height: 44px; border-radius: 12px; border: 1px solid var(--sf-line);
    background: #fff; font-size: 13px; font-weight: 700; color: var(--sf-ink);
}
.sf-action i { color: var(--sf-brand); }
.sf-action:active { transform: scale(.98); }

/* ---------- sections ---------- */
.sf-section { margin-top: 14px; background: #fff; border-top: 1px solid var(--sf-line); border-bottom: 1px solid var(--sf-line); padding: 16px; }
.sf-section__title { margin: 0 0 12px; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.sf-section__title i { color: var(--sf-brand); margin-right: 6px; }

/* ---------- category quick-nav ---------- */
.sf-cats { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; margin-top: 14px; scrollbar-width: none; }
.sf-cats::-webkit-scrollbar { display: none; }
.sf-cat {
    flex-shrink: 0; border-radius: 999px; padding: 8px 14px;
    background: #fff; border: 1px solid var(--sf-line);
    font-size: 12.5px; font-weight: 700; color: var(--sf-muted);
}
.sf-cat.is-active { background: var(--sf-brand); border-color: var(--sf-brand); color: #fff; }

/* ---------- product grid (retail / fashion / general) ---------- */
.sf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .sf-grid { grid-template-columns: repeat(3, 1fr); } }
.sf-card {
    background: #fff; border: 1px solid var(--sf-line); border-radius: var(--sf-radius);
    overflow: hidden; display: flex; flex-direction: column;
}
.sf-card__img { aspect-ratio: 1; background: var(--sf-canvas); width: 100%; object-fit: cover; }
.sf-card__ph { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; color: var(--sf-faint); font-size: 26px; background: var(--sf-canvas); }
.sf-card__body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sf-card__name { font-size: 13px; font-weight: 700; line-height: 1.35; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-card__meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sf-price { font-size: 14px; font-weight: 800; }
.sf-price del { font-size: 11px; color: var(--sf-faint); font-weight: 500; margin-left: 4px; }
.sf-add {
    width: 32px; height: 32px; border: 0; border-radius: 10px;
    background: var(--sf-brand); color: #fff; font-size: 16px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform .1s ease;
}
.sf-add:active { transform: scale(.92); }

/* ---------- menu rows (food) ---------- */
.sf-menu { display: flex; flex-direction: column; }
.sf-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--sf-line); }
.sf-row:last-child { border-bottom: 0; }
.sf-row__img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: var(--sf-canvas); }
.sf-row__ph { width: 84px; height: 84px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--sf-faint); font-size: 22px; background: var(--sf-canvas); }
.sf-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sf-row__name { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.3; }
.sf-row__desc { margin: 3px 0 0; font-size: 12px; color: var(--sf-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-row__foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; }
.sf-row__add {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--sf-brand);
    background: #fff; color: var(--sf-brand-dark); font-size: 12.5px; font-weight: 800;
}
.sf-row__add:active { background: var(--sf-brand-soft); }

/* ---------- services ---------- */
.sf-service {
    background: #fff; border: 1px solid var(--sf-line); border-radius: var(--sf-radius);
    padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.sf-service__name { margin: 0; font-size: 14px; font-weight: 800; }
.sf-service__desc { margin: 0; font-size: 12.5px; color: var(--sf-muted); line-height: 1.45; }
.sf-service__foot { margin-top: 6px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- info / about / hours ---------- */
.sf-about p { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--sf-muted); }
.sf-info-list { display: flex; flex-direction: column; gap: 11px; }
.sf-info { display: flex; gap: 11px; font-size: 13px; color: var(--sf-ink); align-items: flex-start; }
.sf-info i { color: var(--sf-brand); width: 17px; text-align: center; margin-top: 2px; }
.sf-info span { line-height: 1.5; }
.sf-hours { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sf-hours td { padding: 6px 0; border-bottom: 1px dashed var(--sf-line); color: var(--sf-muted); }
.sf-hours tr:last-child td { border-bottom: 0; }
.sf-hours td:last-child { text-align: right; font-weight: 700; color: var(--sf-ink); }
.sf-hours tr.is-today td { color: var(--sf-brand-dark); font-weight: 800; }

/* ---------- rating ---------- */
.sf-rating { display: flex; gap: 18px; align-items: center; }
.sf-rating__score { text-align: center; }
.sf-rating__score strong { display: block; font-size: 34px; font-weight: 800; line-height: 1; }
.sf-rating__score span { font-size: 11px; color: var(--sf-faint); }
.sf-rating__bars { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.sf-rating__bar { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--sf-muted); }
.sf-rating__bar em { font-style: normal; width: 18px; font-weight: 700; }
.sf-rating__track { flex: 1; height: 6px; border-radius: 999px; background: var(--sf-line); overflow: hidden; }
.sf-rating__fill { height: 100%; border-radius: 999px; background: #F59E0B; }

/* ---------- gallery ---------- */
.sf-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sf-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }

/* ---------- footer ---------- */
.sf-footer { margin-top: 14px; padding: 22px 16px calc(76px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--sf-line); text-align: center; }
.sf-footer__name { font-size: 14px; font-weight: 800; }
.sf-footer__social { display: flex; justify-content: center; gap: 18px; margin-top: 10px; }
.sf-footer__social a { color: var(--sf-faint); font-size: 17px; }
.sf-footer__social a:active { color: var(--sf-brand); }
.sf-footer__copy { margin-top: 12px; font-size: 11px; color: var(--sf-faint); }

/* ---------- sticky cart bar ---------- */
.sf-cartbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: none;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--sf-line);
}
.sf-cartbar.is-visible { display: block; }
.sf-cartbar__inner {
    max-width: 692px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px;
}
.sf-cartbar__count {
    min-width: 40px; height: 40px; border-radius: 12px;
    background: var(--sf-brand-soft); color: var(--sf-brand-dark);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.sf-cartbar__total { flex: 1; min-width: 0; }
.sf-cartbar__total strong { display: block; font-size: 15px; }
.sf-cartbar__total span { font-size: 11px; color: var(--sf-muted); }
.sf-cartbar__btn {
    height: 44px; padding: 0 20px; border: 0; border-radius: 12px;
    background: var(--sf-brand); color: #fff; font-size: 14px; font-weight: 800;
}

/* ---------- cart drawer ---------- */
.sf-drawer { position: fixed; inset: 0; z-index: 90; visibility: hidden; }
.sf-drawer.is-open { visibility: visible; }
.sf-drawer__overlay { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; }
.sf-drawer.is-open .sf-drawer__overlay { opacity: 1; }
.sf-drawer__panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 92vw);
    background: #fff; display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform .25s cubic-bezier(.32,.72,.25,1);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.sf-drawer.is-open .sf-drawer__panel { transform: translateX(0); }
.sf-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; border-bottom: 1px solid var(--sf-line); }
.sf-drawer__head strong { font-size: 15px; }
.sf-drawer__close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--sf-canvas); color: var(--sf-muted); font-size: 15px; }
.sf-drawer__items { flex: 1; overflow-y: auto; padding: 6px 16px; }
.sf-drawer__empty { text-align: center; padding: 40px 0; color: var(--sf-faint); font-size: 13px; }
.sf-cartitem { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--sf-line); }
.sf-cartitem:last-child { border-bottom: 0; }
.sf-cartitem__img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--sf-canvas); }
.sf-cartitem__body { flex: 1; min-width: 0; }
.sf-cartitem__name { margin: 0; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-cartitem__price { font-size: 12px; color: var(--sf-muted); margin: 2px 0 0; }
.sf-cartitem__qty { display: flex; align-items: center; gap: 2px; border: 1px solid var(--sf-line); border-radius: 9px; }
.sf-cartitem__qty button { width: 27px; height: 29px; border: 0; background: #fff; color: var(--sf-brand-dark); font-weight: 800; border-radius: 8px; }
.sf-cartitem__qty span { min-width: 20px; text-align: center; font-size: 13px; font-weight: 700; }
.sf-drawer__foot { padding: 13px 16px calc(13px + env(safe-area-inset-bottom)); border-top: 1px solid var(--sf-line); display: flex; flex-direction: column; gap: 8px; }
.sf-drawer__total { display: flex; justify-content: space-between; font-size: 14px; font-weight: 800; }
.sf-drawer__btn {
    height: 46px; border: 0; border-radius: 12px;
    background: var(--sf-brand); color: #fff; font-size: 14px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.sf-drawer__btn--wa { background: #16A34A; }

/* ---------- whatsapp float ---------- */
.sf-wa {
    position: fixed; right: 14px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 35;
    width: 46px; height: 46px; border-radius: 50%;
    background: #25D366; color: #fff; font-size: 21px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,.18);
}

/* ---------- toast ---------- */
.sf-toast {
    position: fixed; left: 50%; bottom: 118px; transform: translateX(-50%);
    z-index: 120; background: #111827; color: #fff;
    border-radius: 999px; padding: 9px 18px; font-size: 13px; font-weight: 700;
    opacity: 0; pointer-events: none; transition: opacity .25s, bottom .25s;
    white-space: nowrap;
}
.sf-toast.is-visible { opacity: 1; bottom: 130px; }

@media (min-width: 640px) {
    .sf-hero { height: 340px; }
    .sf-id { padding-top: 44px; }
    .sf-cats, .sf-section, .sf-id { padding-left: 0; padding-right: 0; }
    .sf-wrap { padding: 0 20px; }
    .sf-section, .sf-footer { border-radius: 4px; }
}
