/* =============================================================================
   theme.css — additions on top of styles.css + pages.css.

   The static template had no add-to-cart on cards, no mini-cart, no account
   dropdown, no mobile category drawer, no modals and no server-error states.
   Those live here so the two original stylesheets stay byte-for-byte as
   designed and every dynamic addition is reviewable in one place.
   Tokens are inherited from styles.css :root.
   ========================================================================== */

/* ---------- utilities ---------- */

/* The components below set an explicit `display`, which beats the user-agent
   [hidden] { display: none } rule and leaves drawers and dropdowns stuck open.
   Every panel in this theme is toggled via the hidden attribute, so it wins. */
[hidden] { display: none !important; }


.btn.block { width: 100%; }
.btn-solid { background: var(--blue); color: #fff; }
.btn-solid:hover { background: var(--blue-dark); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.is-busy { opacity: .55; pointer-events: none; }

.muted { color: var(--muted); }

.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--muted); display: inline-flex; align-items: center; gap: 5px;
}
.linkbtn svg { width: 16px; height: 16px; }
.linkbtn.blue { color: var(--blue); }
.linkbtn.red { color: var(--red); }

.field-err { display: block; color: var(--red); font-size: 12.5px; margin-top: 5px; font-style: normal; }

.notice {
  border-radius: 14px; padding: 13px 16px; font-size: 14px;
  background: var(--blue-soft); color: var(--blue-dark);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.notice.ok   { background: #E6F4EC; color: #1F7A44; }
.notice.warn { background: #FBF0E1; color: #8A5A12; }

.empty {
  display: grid; justify-items: center; gap: 8px; text-align: center;
  padding: 46px 20px; color: var(--muted);
}
.empty svg { width: 44px; height: 44px; opacity: .45; }
.empty b { color: var(--ink); font-size: 16px; }

.toast.is-ok  { border-inline-start: 3px solid #1F7A44; }
.toast.is-err { border-inline-start: 3px solid var(--red); }

/* ---------- top ad strip ---------- */

.adsbar { display: block; }
.adsbar img { width: 100%; height: auto; }

/* ---------- hero: adapt to real banner artwork ----------
   The design's hero is a fixed 542px card built for purpose-made art or video.
   Shops usually have wide banners with the headline baked in (2880x600 here),
   and cropping those to 2.37:1 cuts the text off. When a slide carries no
   overlay copy the card follows the picture's own ratio, so the whole banner
   is visible. Slides with copy are untouched and keep the designed height. */

.hero-card.is-media-only {
  height: auto;
  aspect-ratio: var(--hero-aspect, 1284 / 542);
  max-height: 542px;
}
.hero-card.is-media-only .hero-media { object-fit: contain; }

@media (max-width: 980px) {
  .hero-card.is-media-only { max-height: 470px; }
}

@media (max-width: 640px) {
  /* the mobile rule stacks copy over a 180px media strip; with no copy the
     picture is the whole card again */
  .hero-card.is-media-only {
    padding-bottom: 0;
    aspect-ratio: var(--hero-aspect-m, var(--hero-aspect, 1284 / 542));
    max-height: none;
  }
  .hero-card.is-media-only .hero-media {
    position: absolute; inset: 0; height: 100%;
    border-radius: inherit;
  }
}

/* ---------- header: mini cart ---------- */

.cart-wrap { position: relative; }

.cart-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 12px); z-index: 60;
  width: 320px; background: var(--white); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--sh-bar); padding: 14px; text-align: start;
}
.cart-panel-list { display: grid; gap: 12px; max-height: 320px; overflow-y: auto; }

.cart-mini-row { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; }
.cart-mini-thumb img { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; background: var(--strip); }
.cart-mini-info a { display: block; font-size: 13px; line-height: 1.7; }
.cart-mini-info .q { color: var(--muted); font-size: 12.5px; }

.cart-panel-foot { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; display: grid; gap: 10px; }
.cart-panel-foot .row { display: flex; justify-content: space-between; align-items: baseline; }
.cart-panel-foot i { font-style: normal; font-size: 11.5px; color: var(--muted); }

.cart-panel-empty { display: grid; justify-items: center; gap: 8px; padding: 22px; color: var(--muted); }
.cart-panel-empty svg { width: 34px; height: 34px; }

/* ---------- header: account dropdown + language ---------- */

.acct-drop, .lang-switch { position: relative; }

.acct-drop-panel, .lang-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 10px); z-index: 60;
  min-width: 190px; background: var(--white); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--sh-bar); padding: 8px; display: grid; gap: 2px;
}
.acct-drop-panel a, .lang-panel a {
  display: block; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; color: var(--ink);
}
.acct-drop-panel a:hover, .lang-panel a:hover { background: var(--strip); }
.acct-drop-panel .out { color: var(--red); }
.lang-panel a.is-on { background: var(--blue-soft); color: var(--blue); }

.lang-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.lang-btn svg { width: 16px; height: 16px; }

/* ---------- header: search suggestions ---------- */

.search { position: relative; }

.search-suggest {
  position: absolute; inset-inline: 0; top: calc(100% + 8px); z-index: 70;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--sh-bar); padding: 8px; max-height: 380px; overflow-y: auto;
}
.ss-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; }
.ss-item:hover { background: var(--strip); }
.ss-item img { width: 44px; height: 44px; object-fit: contain; background: var(--strip); border-radius: 9px; }
.ss-item b { display: block; font-size: 13px; font-weight: 600; }
.ss-item i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.ss-item em { font-style: normal; font-size: 12.5px; color: var(--blue); white-space: nowrap; }

/* ---------- mega-menu: category images in place of the fixed SVGs ---------- */

.mm-ic img { width: 20px; height: 20px; object-fit: contain; }
.cat-arch img { width: 34px; height: 34px; object-fit: contain; }

/* ---------- mobile category drawer ---------- */

.mnav {
  position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 120;
  width: min(88vw, 360px); background: var(--white);
  box-shadow: -12px 0 40px rgba(20, 44, 50, .18);
  display: flex; flex-direction: column; overflow-y: auto;
}
.mnav-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.mnav-close { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--strip); }
.mnav-close svg { width: 18px; height: 18px; }

.mnav-main { display: grid; padding: 10px 12px; gap: 2px; border-bottom: 1px solid var(--line); }
.mnav-main a { padding: 11px 12px; border-radius: 11px; font-weight: 600; font-size: 14px; }
.mnav-main a:hover { background: var(--strip); }

.mnav-cats { padding: 10px 12px; }
.mnav-cats summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-radius: 11px; cursor: pointer; font-size: 14px; }
.mnav-cats summary::-webkit-details-marker { display: none; }
.mnav-cats summary .chev svg { width: 18px; height: 18px; transition: transform .2s; }
.mnav-cats details[open] summary .chev svg { transform: rotate(180deg); }
.mnav-sub { display: grid; gap: 2px; padding: 2px 12px 10px; }
.mnav-sub a { padding: 8px 12px; border-radius: 9px; font-size: 13.5px; color: var(--muted); }
.mnav-sub a:hover { background: var(--strip); color: var(--ink); }
.mnav-all { color: var(--blue) !important; }

.mnav-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.mnav-foot a { font-size: 13.5px; color: var(--blue); }

@media (min-width: 981px) { .mnav { display: none; } }

/* ---------- modals + popup ---------- */

.hk-modal, .hk-popup {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(15, 32, 37, .5); padding: 20px;
}

.hk-modal-card, .hk-popup-card {
  background: var(--white); border-radius: 20px; padding: 18px;
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto; position: relative;
}
.hk-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hk-modal-close, .hk-popup-close {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--strip);
}
.hk-modal-close svg, .hk-popup-close svg { width: 17px; height: 17px; }
.hk-popup-close { position: absolute; inset-inline-end: 12px; top: 12px; z-index: 2; }
.hk-popup-title { display: block; margin-bottom: 10px; }
.hk-popup-card img { border-radius: 14px; }

.cmp-pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.cmp-pick-item { display: grid; justify-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; text-align: center; font-size: 13px; }
.cmp-pick-item img { width: 76px; height: 76px; object-fit: contain; }

/* ---------- product card ----------
   The card matches the design exactly (badge, image, title, view + price).
   Add-to-cart lives on the product page, as in the reference. */

.pcard .badge-special { background: var(--gold); }
.pcard .price b.is-out { color: var(--muted); font-weight: 600; }

/* ---------- product page: variants, stock, files ---------- */

.pd-variant { margin-bottom: 14px; }
.pd-variant .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.pd-variant-list { display: flex; flex-wrap: wrap; gap: 8px; }

.product-attribute { cursor: pointer; }
.product-attribute input { position: absolute; opacity: 0; pointer-events: none; }
.product-attribute .v {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 11px; font-size: 13px;
}
.product-attribute input:checked + .v { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.product-attribute .sw { display: block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.product-attribute input:checked + .sw { border-color: #fff; box-shadow: 0 0 0 2px var(--blue); }

.pd-labels { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.pd-labels .tag { background: var(--blue-soft); color: var(--blue); border-radius: 8px; padding: 4px 10px; font-size: 12px; }

.pd-lead { color: var(--muted); font-size: 14px; margin: 10px 0; }
.pd-unit { display: block; margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: center; }
.pd-support { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); margin: 8px 0; }
.pd-support svg { width: 17px; height: 17px; }
.pd-meta .stock.is-out { color: var(--red); }
.pd-meta .rate { display: inline-flex; align-items: center; gap: 4px; }
.pd-meta .rate svg { width: 16px; height: 16px; color: var(--gold); }
.pd-meta .rate i { font-style: normal; color: var(--muted); }

.pd-sum b.off { color: #1F7A44; }
.pd-sum del { color: var(--muted); }

.pd-out { text-align: center; display: grid; gap: 10px; padding: 8px 0; }
.pd-out b { color: var(--red); font-size: 16px; }
.pd-out p { color: var(--muted); font-size: 13px; }

.pd-files { display: grid; gap: 10px; }
.pd-file { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.pd-file svg { width: 20px; height: 20px; color: var(--muted); }
.pd-file .p del { color: var(--muted); margin-inline-end: 6px; }
.pd-file i { font-style: normal; font-size: 11.5px; color: var(--muted); }

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th, .spec-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: start; font-size: 13.5px; }
.spec-table th { width: 34%; color: var(--muted); font-weight: 600; }

.price-chart { margin-top: 20px; }
.pchart { width: 100%; height: 140px; color: var(--blue); }
.pchart-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

/* ---------- reviews ---------- */

.rev-summary { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.rev-score b { font-size: 30px; font-weight: 800; }
.rev-score span, .rev-score i { color: var(--muted); font-size: 12.5px; font-style: normal; }
.rev-suggest { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.rev-suggest svg { width: 20px; height: 20px; color: #1F7A44; }
.rev-suggest b { color: #1F7A44; }

.rev-list { display: grid; gap: 14px; margin-top: 16px; }
.review { border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.review header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review .stars { display: inline-flex; gap: 2px; }
.review .stars svg { width: 15px; height: 15px; color: var(--marker); }
.review .stars svg.is-on { color: var(--gold); }
.rev-who { display: flex; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; }
.rev-who i { font-style: normal; }
.rev-product { display: block; color: var(--blue); font-size: 13px; margin-bottom: 8px; }
.rev-vote { display: flex; gap: 12px; margin-top: 10px; }
.rev-vote button { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; }
.rev-vote svg { width: 17px; height: 17px; }
.rev-form summary { cursor: pointer; font-weight: 600; }
.rev-form .field input + input { margin-top: 6px; }

/* ---------- comments ---------- */

.comments { margin-top: 26px; display: grid; gap: 16px; }
.cmnt-list { display: grid; gap: 12px; }
.cmnt { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.cmnt.is-reply { border-style: dashed; margin-top: 10px; }
.cmnt-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cmnt-head i { font-style: normal; color: var(--muted); font-size: 12px; }
.cmnt-replies { margin-inline-start: 18px; }
.cmnt-form { display: grid; gap: 10px; }
.cmnt-form textarea { width: 100%; }
.comment-replay-to { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }

.avatar {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 13px; flex: none;
}

/* ---------- account ---------- */

.acct-nav a.is-on { background: var(--blue-soft); color: var(--blue); }
.acct-hero { display: grid; gap: 6px; }
.acct-hero b { font-size: 22px; }
.acct-hero i { font-style: normal; font-size: 13px; color: var(--muted); }
.acct-hero .btn { justify-self: start; margin-top: 8px; }

.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.box-head .count { color: var(--muted); font-size: 13px; }

.pill.warn { background: #FBF0E1; color: #8A5A12; }

.order-rows { display: grid; gap: 12px; }
.order-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.order-row .o-date { display: block; color: var(--muted); font-size: 12.5px; }
.o-items { display: flex; gap: 6px; align-items: center; }
.o-items img { width: 42px; height: 42px; object-fit: contain; background: var(--strip); border-radius: 9px; }
.o-items .more { color: var(--muted); font-size: 12.5px; }
.o-end { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.o-end i { font-style: normal; font-size: 11.5px; color: var(--muted); }

.o-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0; }
.o-facts span { display: block; color: var(--muted); font-size: 12.5px; }
.o-address { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; font-size: 13.5px; }
.o-address .lat { color: var(--muted); font-size: 12.5px; }

.order-items { display: grid; gap: 12px; }
.sum-block { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; display: grid; gap: 8px; }
.pay-again { margin-top: 16px; display: grid; gap: 12px; }

.tx-rows, .tk-rows { display: grid; gap: 10px; }
.tx-row, .tk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; }
.tx-row span, .tk-row span { color: var(--muted); font-size: 12.5px; }
.tx-row b.up { color: #1F7A44; }
.tx-row b.down { color: var(--red); }

.tk-thread { display: grid; gap: 12px; margin: 14px 0; }
.tk-msg { border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.tk-msg.is-own { background: var(--blue-soft); border-color: transparent; }
.tk-msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tk-msg-head i { font-style: normal; color: var(--muted); font-size: 12px; }
.tk-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tk-files a { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--blue); }
.tk-files svg { width: 15px; height: 15px; }
.tk-reply { display: grid; gap: 10px; }

/* ---------- brands ---------- */

.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.brand-tile { display: grid; justify-items: center; gap: 6px; padding: 20px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); text-align: center; }
.brand-tile:hover { border-color: var(--blue); }
.brand-tile img { height: 46px; object-fit: contain; }
.brand-tile i { font-style: normal; color: var(--muted); font-size: 12.5px; }
.brand-initial { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 20px; font-weight: 700; }
.brand-mark { height: 44px; object-fit: contain; }
.brand-list a { display: contents; }

/* ---------- filters ---------- */

.filters form { display: grid; gap: 2px; }
.swatches .sw-wrap { display: inline-block; cursor: pointer; }
.swatches .sw-wrap input { position: absolute; opacity: 0; pointer-events: none; }
.swatches .sw-wrap input:checked + .sw { box-shadow: 0 0 0 2px var(--blue); }
.active-filters .tagx span { display: inline-flex; }
.active-filters .tagx svg { width: 12px; height: 12px; }

/* ---------- promos: admin banners win over the CSS backgrounds ---------- */

.promo.tan, .promo.blue { background-image: none; }

/* ---------- misc ---------- */

.blog-side { display: grid; gap: 16px; align-content: start; }
.w-post { display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: center; margin-top: 10px; }
.w-post img { width: 62px; height: 50px; object-fit: cover; border-radius: 10px; }
.w-post b { display: block; font-size: 13px; font-weight: 600; line-height: 1.7; }
.w-post i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.w-cta { display: grid; gap: 8px; }

.cat-tile .top b a { color: inherit; }
.foot-trust { display: flex; gap: 10px; align-items: center; }

.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row img { height: 44px; border-radius: 10px; }
.captcha-row input { flex: 1; }
#captcha-reload { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--strip); }
#captcha-reload svg { width: 18px; height: 18px; }

.auth-lead { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.auth-title { font-size: 22px; margin-bottom: 6px; }

.sortbar .count { margin-inline-start: auto; color: var(--muted); font-size: 13px; }
.pagination .is-off { opacity: .35; pointer-events: none; }

@media (max-width: 980px) {
  .order-row { grid-template-columns: 1fr; }
  .o-end { justify-content: flex-start; }
  .cart-panel { width: min(92vw, 320px); }
}
