/* =========================================================================
   SegasoftBD store (/store). Built on the sg-* design tokens in segasoft.css.
   Mobile first; desktop layout from 900px (where the mobile action bar hides).
   ========================================================================= */

/* Elements the store script shows and hides keep working even when a class sets display. */
.st-section [hidden], .st-hero [hidden] { display: none !important; }

/* ---------- Hero + search ---------- */
.st-hero { padding: 32px 0 28px; }
.st-hero__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.st-hero h1 { margin: 0 0 8px; }
.st-hero p { margin: 0; color: var(--sg-muted); max-width: 640px; }
.st-hero__cart { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--sg-border); border-radius: 999px; background: #fff; color: var(--sg-navy); font-weight: 650; text-decoration: none; }
.st-hero__cart:hover { border-color: var(--sg-blue); color: var(--sg-blue); }
.st-hero__count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--sg-blue); color: #fff; font-size: .78rem; font-weight: 700; text-align: center; }
.st-hero__count[hidden] { display: none; }

.st-search { position: relative; display: flex; gap: 8px; margin-top: 22px; max-width: 640px; }
.st-search__icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--sg-muted); pointer-events: none; display: inline-flex; }
.st-search input { flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 10px 14px 10px 42px; border: 1.5px solid #cbd5e1; border-radius: 999px; background: #fff; color: var(--sg-navy); font: 400 1rem var(--sg-font); }
.st-search input:focus { outline: none; border-color: var(--sg-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.st-search .sg-btn { flex: none; min-height: 48px; }

/* ---------- Sections ---------- */
.st-section { padding: 28px 0 64px; }
.st-section--flow { padding-top: 32px; }
.st-title { margin: 0 0 20px; font-size: clamp(1.8rem, 4vw, 2.5rem); }
.st-layout { display: block; }
.st-main { min-width: 0; }

/* ---------- Category navigation ---------- */
.st-sidebar { display: none; }
.st-sidebar__title { margin: 0 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sg-muted); }
.st-catnav, .st-catnav ul { list-style: none; margin: 0; padding: 0; }
.st-catnav ul { margin: 2px 0 6px 12px; padding-left: 10px; border-left: 1px solid var(--sg-border); }
.st-catnav a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--sg-text); font-weight: 550; text-decoration: none; line-height: 1.35; }
.st-catnav ul a { padding: 6px 10px; font-size: .94rem; }
.st-catnav a:hover { background: #f1f5f9; color: var(--sg-navy); }
.st-catnav a.is-open { color: var(--sg-navy); }
.st-catnav a.is-active { background: var(--sg-blue-soft); color: var(--sg-blue-dark); font-weight: 650; }

.st-chips { display: flex; gap: 8px; margin: 0 calc(var(--sg-gutter) * -1) 14px; padding: 2px var(--sg-gutter) 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.st-chips::-webkit-scrollbar { display: none; }
.st-chip { flex: none; padding: 8px 14px; border: 1px solid var(--sg-border); border-radius: 999px; background: #fff; color: var(--sg-text); font-size: .92rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.st-chip:hover { border-color: #b8c2d1; color: var(--sg-navy); }
.st-chip.is-active { border-color: transparent; background: var(--sg-navy); color: #fff; }
.st-chips--sub .st-chip.is-active { background: var(--sg-blue); }

/* ---------- Toolbar ---------- */
.st-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.st-count { margin: 0; color: var(--sg-muted); font-size: .95rem; }
.st-count strong { color: var(--sg-navy); }
.st-clear { margin-left: 6px; color: var(--sg-blue); font-weight: 600; }
.st-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.st-sort select { min-height: 40px; padding: 6px 34px 6px 12px; border: 1px solid var(--sg-border); border-radius: 10px; background: #fff; color: var(--sg-navy); font: 500 .92rem var(--sg-font); }
.st-check { display: inline-flex; align-items: center; gap: 8px; color: var(--sg-text); font-size: .92rem; font-weight: 550; cursor: pointer; }
.st-check input { width: 18px; height: 18px; accent-color: var(--sg-blue); }

/* ---------- Product grid + cards ---------- */
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.st-card { display: flex; flex-direction: column; min-width: 0; background: #fff; border: 1px solid var(--sg-border); border-radius: 16px; overflow: hidden; transition: border-color .2s, box-shadow .2s, transform .2s; }
.st-card:hover { border-color: #cdd6e3; box-shadow: var(--sg-shadow); transform: translateY(-2px); }
.st-card__media { position: relative; display: block; aspect-ratio: 1 / 1; background: #f5f7fb; overflow: hidden; }
.st-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.st-card:hover .st-card__media img { transform: scale(1.03); }
.st-card.is-out .st-card__media img { opacity: .55; filter: grayscale(.4); }
.st-card__placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: #b8c2d1; }
.st-card__placeholder .sg-i { width: 44px; height: 44px; }
.st-card__placeholder--lg .sg-i { width: 72px; height: 72px; }
.st-card__body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 6px; padding: 12px 12px 14px; }
.st-card__cat { margin: 0; color: var(--sg-muted); font-size: .76rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; }
.st-card__cat a { color: inherit; text-decoration: none; }
.st-card__cat a:hover { color: var(--sg-blue); }
.st-card__title { margin: 0; font-size: .98rem; font-weight: 650; line-height: 1.3; letter-spacing: -.01em !important; }
.st-card__title a { color: var(--sg-navy); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-card__title a:hover { color: var(--sg-blue); }
.st-card__title a::after { content: ""; position: absolute; inset: 0; }
.st-card { position: relative; }
.st-card__add { position: relative; z-index: 1; margin-top: auto; width: 100%; gap: 6px; min-height: 40px; padding: 8px 10px; font-size: .9rem; }
.st-card__add:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.st-tag { position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 1.2; }
.st-tag--sale { background: #dc2626; color: #fff; }
.st-tag--out { top: auto; bottom: 10px; background: rgba(16, 33, 58, .86); color: #fff; }

/* ---------- Price ---------- */
.st-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; }
.st-price__now { color: var(--sg-navy); font-size: 1.05rem; font-weight: 750; letter-spacing: -.01em; }
.st-price__now--ask { color: var(--sg-blue-dark); font-size: .95rem; font-weight: 650; }
.st-price__was { color: var(--sg-muted); font-size: .88rem; }
.st-price__unit { margin-left: -4px; color: var(--sg-muted); font-size: .85rem; font-weight: 600; }
.st-card__moq { margin: -4px 0 0; color: var(--sg-blue-dark); font-size: .8rem; font-weight: 650; }
.st-moq { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 9px 14px; border-radius: 12px; background: #eff6ff; color: var(--sg-blue-dark); font-size: .92rem; font-weight: 600; line-height: 1.45; }
.st-moq .sg-i { flex: none; margin-top: 2px; }
.st-price__save { padding: 2px 8px; border-radius: 999px; background: #fee2e2; color: #b91c1c; font-size: .8rem; font-weight: 700; }
.st-price--lg { margin: 4px 0 12px; }
.st-price--lg .st-price__now { font-size: 1.9rem; }
.st-price--lg .st-price__now--ask { font-size: 1.35rem; }
.st-price--lg .st-price__was { font-size: 1.05rem; }
.st-price--lg .st-price__unit { font-size: 1rem; }

/* ---------- Empty / loading / notices / pager ---------- */
.st-empty { padding: 48px 24px; border: 1px dashed #cbd5e1; border-radius: 18px; background: #f8fafc; text-align: center; }
.st-empty__icon { display: inline-grid; place-items: center; width: 56px; height: 56px; margin-bottom: 10px; border-radius: 50%; background: #fff; color: var(--sg-blue); box-shadow: var(--sg-shadow); }
.st-empty h2 { margin: 0 0 6px; font-size: 1.3rem; }
.st-empty p { margin: 0 auto; max-width: 420px; color: var(--sg-muted); }
.st-empty .sg-actions { justify-content: center; margin-top: 20px; }
.st-loading { color: var(--sg-muted); }
.st-notice { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--sg-amber-soft); color: var(--sg-amber); font-size: .92rem; font-weight: 600; }
.st-notice[hidden], [data-cart-error][hidden] { display: none; }
.st-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; margin-top: 32px; color: var(--sg-muted); font-size: .92rem; }
.st-link { display: inline-flex; align-items: center; gap: 6px; color: var(--sg-blue); font-weight: 650; text-decoration: none; }
.st-link:hover { text-decoration: underline; }
.st-flip { transform: scaleX(-1); }

/* ---------- Product page ---------- */
.st-section--product { padding-top: 24px; }
.st-product { display: grid; gap: 28px; }
.st-gallery__main { position: relative; aspect-ratio: 1 / 1; border: 1px solid var(--sg-border); border-radius: 20px; background: #f5f7fb; overflow: hidden; display: grid; place-items: center; }
.st-gallery__main img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.st-gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.st-gallery__thumb { flex: none; width: 72px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: 12px; background: #f5f7fb; overflow: hidden; cursor: pointer; }
.st-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.st-gallery__thumb.is-active { border-color: var(--sg-blue); }
.st-info h1 { margin: 6px 0 10px; font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.12; }
.st-info .st-card__cat { font-size: .8rem; }
.st-info__lead { margin: 0 0 18px; color: var(--sg-text); font-size: 1.05rem; line-height: 1.6; }
.st-info__note { margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; background: #f1f5f9; color: var(--sg-text); }
.st-stock { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 4px 12px; border-radius: 999px; font-size: .88rem; font-weight: 650; }
.st-stock.is-in { background: var(--sg-green-soft); color: var(--sg-green); }
.st-stock.is-out { background: #fee2e2; color: #b91c1c; }
.st-buy { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.st-buy__add, .st-buy__now { flex: 1 1 160px; gap: 8px; }
.st-qty { display: inline-flex; align-items: stretch; height: 46px; border: 1.5px solid #cbd5e1; border-radius: 999px; background: #fff; overflow: hidden; }
.st-qty button { width: 42px; border: 0; background: transparent; color: var(--sg-navy); cursor: pointer; display: grid; place-items: center; }
.st-qty button:hover { background: #f1f5f9; }
.st-qty button:disabled { color: #cbd5e1; cursor: not-allowed; background: transparent; }
.st-qty input { width: 56px; border: 0; background: transparent; color: var(--sg-navy); font: 650 1rem var(--sg-font); text-align: center; -moz-appearance: textfield; appearance: textfield; }
.st-qty input::-webkit-inner-spin-button, .st-qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.st-qty input:focus { outline: none; }
.st-qty:focus-within { border-color: var(--sg-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .16); }
.st-qty--sm { height: 38px; }
.st-qty--sm button { width: 34px; }
.st-qty--sm input { width: 48px; font-size: .95rem; }
.st-qty__unit { align-self: center; padding-right: 4px; color: var(--sg-muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.st-qty--unit input { width: 50px; padding-left: 6px; text-align: right; }
.st-qty--sm.st-qty--unit input { width: 44px; }
.st-assure { list-style: none; margin: 0 0 16px; padding: 16px; border: 1px solid var(--sg-border); border-radius: 16px; background: #f8fafc; display: grid; gap: 12px; }
.st-assure li { display: flex; gap: 10px; align-items: flex-start; color: var(--sg-text); font-size: .93rem; line-height: 1.5; }
.st-assure strong { color: var(--sg-navy); }
.st-assure .sg-i { margin-top: 2px; color: var(--sg-blue); }
.st-ask { display: inline-flex; align-items: center; gap: 8px; color: #0f7a41; font-weight: 650; text-decoration: none; }
.st-ask:hover { text-decoration: underline; }
.st-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--sg-line, #eef1f5); }
.st-meta dt { color: var(--sg-muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.st-meta dd { margin: 2px 0 0; color: var(--sg-navy); font-weight: 600; }
.st-details, .st-related { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--sg-border); }
.st-details h2, .st-related h2 { margin: 0 0 18px; font-size: 1.5rem; }
.st-details .sg-article { max-width: 820px; }

/* ---------- Cart ---------- */
.st-cart { display: grid; gap: 24px; align-items: start; }
.st-lines { list-style: none; margin: 0 0 18px; padding: 0; border: 1px solid var(--sg-border); border-radius: 18px; background: #fff; }
.st-line { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 4px 14px; padding: 16px; border-top: 1px solid var(--sg-border); }
.st-line:first-child { border-top: 0; }
.st-line__media { grid-row: span 2; width: 76px; height: 76px; border-radius: 12px; background: #f5f7fb; overflow: hidden; display: grid; place-items: center; color: #b8c2d1; }
.st-line__media img { width: 100%; height: 100%; object-fit: cover; }
.st-line__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.st-line__name { color: var(--sg-navy); font-weight: 650; text-decoration: none; line-height: 1.35; }
.st-line__name:hover { color: var(--sg-blue); }
.st-line__type, .st-line__unit { color: var(--sg-muted); font-size: .86rem; }
.st-line__rule { color: var(--sg-blue-dark); font-size: .82rem; font-weight: 600; }
.st-line__out { color: #b91c1c; font-size: .86rem; font-weight: 650; }
.st-line.is-out .st-line__media img { opacity: .5; }
.st-line__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 8px; }
.st-line__remove { display: inline-flex; align-items: center; gap: 4px; padding: 6px 4px; border: 0; background: transparent; color: var(--sg-muted); font: 600 .86rem var(--sg-font); cursor: pointer; }
.st-line__remove:hover { color: #b91c1c; }
.st-line__remove .sg-i { width: 1.05em; height: 1.05em; }
.st-line__total { grid-column: 2; color: var(--sg-navy); font-size: 1.02rem; }

/* ---------- Summary (cart, checkout, order) ---------- */
.st-summary { padding: 20px; border: 1px solid var(--sg-border); border-radius: 18px; background: #fff; }
.st-summary h2 { margin: 0 0 14px; font-size: 1.15rem; }
.st-totals { margin: 0; display: grid; gap: 10px; }
.st-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.st-totals > div[hidden] { display: none; }
.st-totals dt { color: var(--sg-text); }
.st-totals dd { margin: 0; color: var(--sg-navy); font-weight: 650; text-align: right; }
.st-totals__grand { padding-top: 10px; border-top: 1px solid var(--sg-border); }
.st-totals__grand dt, .st-totals__grand dd { font-size: 1.1rem; font-weight: 750; color: var(--sg-navy); }
.st-summary__cta { width: 100%; margin-top: 18px; gap: 8px; }
.st-summary__cta.is-disabled { opacity: .5; pointer-events: none; }
.st-summary__cta:disabled { opacity: .7; cursor: progress; transform: none; }
.st-summary__note { margin: 12px 0 0; color: var(--sg-muted); font-size: .86rem; line-height: 1.5; }
.st-summary__note[hidden] { display: none; }
.st-summary .st-link { margin-top: 12px; }
.st-mini { list-style: none; margin: 0 0 14px; padding: 0 0 14px; border-bottom: 1px solid var(--sg-border); display: grid; gap: 10px; }
.st-mini li { display: flex; justify-content: space-between; gap: 12px; font-size: .94rem; }
.st-mini__name { color: var(--sg-navy); font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.st-mini__qty { color: var(--sg-muted); font-weight: 500; white-space: nowrap; }
.st-mini__price { flex: none; color: var(--sg-navy); font-weight: 650; }

/* ---------- Checkout ---------- */
.st-steps { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; margin: -6px 0 24px; padding: 0; color: var(--sg-muted); font-size: .92rem; font-weight: 600; }
.st-steps li { display: inline-flex; align-items: center; gap: 8px; }
.st-steps span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #cbd5e1; font-size: .82rem; }
.st-steps .is-active { color: var(--sg-navy); }
.st-steps .is-active span { border-color: var(--sg-navy); background: var(--sg-navy); color: #fff; }
.st-steps .is-done span { border-color: var(--sg-green); background: var(--sg-green); color: #fff; }
.st-steps .is-done span .sg-i { width: 14px; height: 14px; }
.st-checkout { display: grid; gap: 24px; align-items: start; }
.st-checkout[hidden] { display: none; }
.st-checkout__form { padding: 20px; border: 1px solid var(--sg-border); border-radius: 18px; background: #fff; }
.st-checkout__form h2 { margin: 6px 0 14px; font-size: 1.15rem; }
.st-checkout__form > .sg-form__grid, .st-checkout__form [data-delivery-fields] { margin-bottom: 22px; }
.st-checkout__form [data-delivery-fields][hidden] { display: none; }

/* ---------- Order placed ---------- */
.st-done { max-width: 980px; }
.st-done__card { position: relative; margin-bottom: 20px; padding: 32px 22px; border: 1px solid #bfe3d6; border-radius: 22px; background: linear-gradient(180deg, #f0fbf6 0%, #fff 70%); text-align: center; }
.st-done__icon { display: inline-grid; place-items: center; width: 60px; height: 60px; margin-bottom: 12px; border-radius: 50%; background: #128c4a; color: #fff; }
.st-done__icon .sg-i { width: 30px; height: 30px; stroke-width: 2.5; }
.st-done__card h1 { margin: 6px auto 10px; max-width: 620px; font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.15; }
.st-done__card > p { margin: 0 auto; max-width: 560px; color: var(--sg-text); }
.st-done__wa { margin-top: 22px; min-height: 54px; padding: 14px 28px; gap: 10px; font-size: 1.05rem; }
.st-done__grid { display: grid; gap: 20px; }
.st-facts { margin: 0; display: grid; gap: 12px; }
.st-facts dt { color: var(--sg-muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.st-facts dd { margin: 2px 0 0; color: var(--sg-navy); font-weight: 600; overflow-wrap: anywhere; }
.st-done__foot { margin: 22px 0 0; color: var(--sg-muted); font-size: .9rem; text-align: center; }

/* ---------- Toast ---------- */
.st-toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 1200; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 14px; background: var(--sg-navy); color: #fff; font: 600 .94rem var(--sg-font); box-shadow: var(--sg-shadow-lg); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s; }
.st-toast.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.st-toast a { flex: none; color: #93c5fd; font-weight: 700; text-decoration: underline; }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
    .st-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
    .st-card__body { padding: 14px 16px 16px; }
    .st-card__add { width: auto; align-self: flex-start; padding: 8px 16px; }
    .st-line { grid-template-columns: 96px minmax(0, 1fr) auto; }
    .st-line__media { width: 96px; height: 96px; }
    .st-line__total { grid-column: 3; grid-row: 1; align-self: start; }
    .st-done__grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
    .st-hero { padding: 48px 0 40px; }
    .st-section { padding: 40px 0 96px; }
    .st-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; align-items: start; }
    .st-sidebar { display: block; position: sticky; top: calc(var(--sg-header-h) + 20px); }
    .st-chips--mobile { display: none; }
    .st-chips { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; overflow: visible; }
    .st-product { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: start; }
    .st-gallery { position: sticky; top: calc(var(--sg-header-h) + 20px); }
    .st-cart { grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; }
    .st-checkout { grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; }
    .st-checkout__form { padding: 28px; }
    .st-summary { position: sticky; top: calc(var(--sg-header-h) + 20px); padding: 24px; }
    .st-done__grid .st-summary { position: static; }
    .st-done__card { padding: 44px 40px; }
    .st-toast { bottom: 28px; }
}

@media (min-width: 1200px) {
    .st-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .st-layout .st-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1360px) {
    .st-layout .st-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .st-card, .st-card__media img, .st-toast { transition: none; }
    .st-card:hover { transform: none; }
    .st-card:hover .st-card__media img { transform: none; }
}
