/* JPCASIO — OpenCart integration tweaks (loaded after the design CSS) */

/* FIX: header/footer carry .jp AND the design class on the SAME element, so the
   generated descendant selectors (.jp .site-head / .jp .site-foot) never match.
   Re-apply the container rules via compound selectors. */
.jp.site-head { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 1px solid var(--line); }
.jp.site-foot { background: var(--paper-2); border-top: 1px solid var(--line); padding-top: 56px; color: var(--ink); }

/* FIX: cart widget sat 5px higher — stock stylesheet sets `#cart{margin-bottom:10px}`
   (ID specificity), inflating the flex line to 52px. Kill it with an ID-strength selector. */
.jp .head-actions #cart.jp-cart { display: flex; align-items: center; margin: 0; }

/* FIX: "Подробнее" on product cards slid in from below ("плывёт"). Use a clean centered fade. */
.jp .card-add { transform: none; opacity: 0; transition: opacity .18s ease; display: flex; align-items: center; justify-content: center; }
.jp .card-top:hover .card-add { transform: none; opacity: 1; }

/* FIX: gift "lifestyle" block overflowed (aspect-ratio:3/4 derived width from the tall row → horizontal scroll) */
.jp .gift-life { aspect-ratio: auto; width: 100%; }

/* FIX: cart dropdown action buttons were on different levels (btn-block width:100% in a flex row) */
.jp .jp-cart-actions { display: flex; gap: 8px; align-items: stretch; }
.jp .jp-cart-actions .btn { flex: 1 1 0; width: auto; min-width: 0; margin: 0; }

/* empty count badges (wishlist/compare) stay hidden until populated by common.js */
.jp .ic-count:empty { display: none; }

/* ---------- search: magnifier is a real (clickable) button for common.js ---------- */
.jp .search .search-ic {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  pointer-events: auto; cursor: pointer; background: none; border: 0;
  color: var(--ink-2); display: flex; padding: 0;
}
.jp .search .search-ic:hover { color: var(--ink); }

/* ---------- header cart widget + dropdown ---------- */
.jp .jp-cart { position: relative; }
.jp .jp-cart-drop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 340px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--sh-2); padding: 14px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility .16s;
}
.jp .jp-cart:hover .jp-cart-drop,
.jp .jp-cart.open .jp-cart-drop { opacity: 1; visibility: visible; transform: none; }
.jp .jp-cart-list { list-style: none; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.jp .jp-cart-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; }
.jp .jp-cart-thumb { width: 48px; height: 48px; border-radius: var(--r-s); overflow: hidden; background: var(--paper-2); display: block; flex: none; }
.jp .jp-cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.jp .jp-cart-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jp .jp-cart-name { font-size: 13px; font-weight: 700; line-height: 1.25; }
.jp .jp-cart-name:hover { color: var(--acc-ink); }
.jp .jp-cart-opt { font-size: 11px; color: var(--ink-3); }
.jp .jp-cart-qty { font-size: 12px; color: var(--ink-2); }
.jp .jp-cart-rm { width: 26px; height: 26px; flex: none; border-radius: 999px; color: var(--ink-3); display: flex; align-items: center; justify-content: center; }
.jp .jp-cart-rm:hover { color: var(--sale); background: var(--paper-2); }
.jp .jp-cart-totals { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.jp .jp-cart-total-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.jp .jp-cart-total-row:last-child { font-weight: 800; }
.jp .jp-cart-actions { display: flex; gap: 8px; margin-top: 14px; }
.jp .jp-cart-empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 22px 0; }

/* ---------- main nav: dropdown for categories with children ---------- */
.jp .navitem { position: relative; display: flex; align-items: center; }
.jp .navitem.has-sub:hover .jp-subnav { opacity: 1; visibility: visible; transform: none; }
.jp .jp-subnav {
  position: absolute; top: 100%; left: 0; z-index: 60; min-width: 280px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--sh-2); padding: 18px 20px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility .16s;
}
.jp .jp-subnav-in { display: flex; gap: 28px; }
.jp .jp-subnav-in ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.jp .jp-subnav-in a { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.jp .jp-subnav-in a:hover { color: var(--acc-ink); }
.jp .jp-subnav-all { display: inline-block; margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--acc-ink); font-family: 'IBM Plex Mono', monospace; }

/* ---------- footer links (anchor variant of design .foot-col button) ---------- */
.jp .foot-link { display: block; font-size: 13.5px; color: var(--ink); padding: 6px 0; transition: color .15s; }
.jp .foot-link:hover { color: var(--acc-ink); }

/* keep the dropdowns from overflowing the sticky header clip context */
.jp.site-head { overflow: visible; }

/* ---------- product card: real image fills the 1:1 frame ---------- */
.jp .card-img { display: block; }
.jp .card-img img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- category page ---------- */
.jp .cat { padding-bottom: 80px; }
.jp .cat-head { padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.jp .cat-intro { display: flex; gap: 20px; align-items: flex-start; margin-top: 16px; }
.jp .cat-thumb { width: 120px; height: auto; border-radius: var(--r-m); border: 1px solid var(--line); }
.jp .cat-desc { font-size: 14px; color: var(--ink-2); line-height: 1.6; max-width: 760px; }
.jp .cat-desc p { margin-bottom: 8px; }
.jp .refine { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 24px; }
.jp .refine-h { color: var(--ink-3); margin-right: 4px; }

.jp .toolbar-right { display: flex; align-items: center; gap: 12px; }
.jp .cat-layout.no-aside { grid-template-columns: 1fr; }

.jp .cat-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 34px; flex-wrap: wrap; }
.jp .cat-res { color: var(--ink-3); font-size: 12px; }

/* pagination (OC outputs <ul class="pagination">) restyled inside .jp */
.jp .cat-pag .pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.jp .cat-pag .pagination > li > a,
.jp .cat-pag .pagination > li > span { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-m); color: var(--ink); font-size: 13px; background: #fff; }
.jp .cat-pag .pagination > li > a:hover { border-color: var(--ink); }
.jp .cat-pag .pagination > li.active > span { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- filters sidebar: restyle whatever module sits in column_left ---------- */
.jp .filters .panel,
.jp .filters .list-group { border: 0; box-shadow: none; background: transparent; margin: 0 0 18px; border-radius: 0; }
.jp .filters .panel-heading,
.jp .filters h4 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 0 0 12px; margin: 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.jp .filters .panel-body { padding: 0; }
.jp .filters .list-group-item { border: 0; padding: 6px 0; background: transparent; color: var(--ink-2); font-size: 14px; }
.jp .filters .list-group-item:hover { color: var(--ink); }
.jp .filters a { color: var(--ink-2); }
.jp .filters a:hover { color: var(--acc-ink); }

/* ---------- product page (PDP) ---------- */
.jp .pdp { padding-bottom: 70px; }
.jp .pdp-titlebar .eyebrow { display: block; margin-bottom: 6px; }
.jp .gallery-img { display: block; }
.jp .gallery-img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-l); }
.jp .thumb { aspect-ratio: 1; }
.jp .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jp .pdp-price-main { font-size: 30px; }
.jp .qty .qty-val { width: 48px; text-align: center; border: 0; background: transparent; font-weight: 700; font-size: 14px; outline: none; -moz-appearance: textfield; }
.jp .qty .qty-val::-webkit-outer-spin-button,
.jp .qty .qty-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.jp .pdp-actions .btn-block { flex: 1; }

/* options */
.jp .pdp-options { display: flex; flex-direction: column; gap: 14px; margin: 16px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.jp .opt-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.jp .opt-choice { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1.5px solid var(--line-2); border-radius: var(--r-m); cursor: pointer; font-size: 13px; }
.jp .opt-choice input { accent-color: var(--ink); }

/* tabs panes */
.jp .pdp-pane { display: none; }
.jp .pdp-pane.on { display: block; }
.jp .pane-h { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 22px 0 10px; }
.jp .pane-h:first-child { margin-top: 0; }
.jp .rating-pick input { margin: 0 4px; accent-color: var(--ink); }
.jp .text-danger { color: var(--sale); font-size: 12px; margin-top: 4px; }

/* related */
.jp .pdp-related { padding: 36px 0 10px; }

/* PhotoSwipe gallery */
.jp .jp-pswp-gallery { display: none; }
.jp .gallery-img { cursor: zoom-in; position: relative; }
.jp .gallery-zoom { position: absolute; right: 14px; bottom: 14px; width: 38px; height: 38px; border-radius: 999px; background: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center; color: var(--ink); box-shadow: var(--sh-1); opacity: 0; transition: opacity .16s; }
.jp .gallery-main:hover .gallery-zoom { opacity: 1; }

/* ---------- alerts ---------- */
.jp .jp-alert { padding: 12px 16px; border-radius: var(--r-m); font-size: 13.5px; margin: 12px 0; border: 1px solid var(--line-2); }
.jp .jp-alert.ok { background: color-mix(in oklab, var(--ok), transparent 90%); border-color: color-mix(in oklab, var(--ok), transparent 70%); color: var(--ok); }
.jp .jp-alert.err { background: var(--acc-wash); border-color: color-mix(in oklab, var(--acc), transparent 70%); color: var(--acc-ink); }
.jp .jp-alert.info { background: var(--paper-2); }

/* ---------- cart ---------- */
.jp .cart-img { display: block; overflow: hidden; background: var(--paper-2); }
.jp .cart-img img { width: 100%; height: 100%; object-fit: cover; }
.jp .qty.sm .qty-val { width: 34px; text-align: center; border: 0; background: transparent; font-weight: 700; font-size: 14px; outline: none; -moz-appearance: textfield; }
.jp .qty.sm .qty-val::-webkit-outer-spin-button,
.jp .qty.sm .qty-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.jp .jp-cart-modules { margin-bottom: 18px; }
.jp .jp-cart-modules .panel,
.jp .jp-cart-modules .panel-group { border: 0; box-shadow: none; background: transparent; margin: 0 0 10px; }
.jp .jp-cart-modules .panel-heading { padding: 0 0 8px; background: transparent; border: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.jp .jp-cart-modules .panel-title { font-size: 12px; }
.jp .jp-cart-modules .panel-body { padding: 0; border: 0 !important; }
.jp .jp-cart-modules .input-group,
.jp .jp-cart-modules .form-group { display: flex; gap: 8px; margin: 0 0 8px; }
.jp .jp-cart-modules .form-control { flex: 1; height: 42px; padding: 0 12px; background: #fff; border: 1.5px solid var(--line-2); border-radius: var(--r-m); font-size: 14px; }
.jp .jp-cart-modules .btn,
.jp .jp-cart-modules .input-group-btn .btn { height: 42px; padding: 0 16px; background: var(--ink); color: #fff; border: 0; border-radius: var(--r-m); font-size: 12px; font-weight: 700; text-transform: uppercase; }

/* ---------- checkout (restyle of stock accordion under .jp) ---------- */
.jp.checkout-wrap { padding-bottom: 70px; }
.jp .co-h1 { text-align: center; margin: 14px 0 26px; }
.jp.checkout-wrap .panel-group { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.jp.checkout-wrap .panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.jp.checkout-wrap .panel-heading { background: var(--paper-2); padding: 16px 22px; border: 0; }
.jp.checkout-wrap .panel-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); }
.jp.checkout-wrap .panel-title a { color: var(--ink); display: block; }
.jp.checkout-wrap .panel-body { padding: 22px; }
.jp.checkout-wrap .form-group { margin-bottom: 14px; }
.jp.checkout-wrap .control-label,
.jp.checkout-wrap label.control-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.jp.checkout-wrap .form-control { width: 100%; height: 46px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: var(--r-m); background: #fff; font-size: 15px; }
.jp.checkout-wrap textarea.form-control { height: auto; padding: 10px 14px; }
.jp.checkout-wrap .form-control:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,20,15,.06); }
.jp.checkout-wrap .radio,
.jp.checkout-wrap .checkbox { margin: 8px 0; font-size: 14px; }
.jp.checkout-wrap .radio input,
.jp.checkout-wrap .checkbox input { accent-color: var(--ink); margin-right: 8px; }
.jp.checkout-wrap .table { width: 100%; border-collapse: collapse; margin: 0; }
.jp.checkout-wrap .table td,
.jp.checkout-wrap .table th { padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 14px; text-align: left; }
.jp.checkout-wrap .table tfoot td { font-weight: 700; }
.jp.checkout-wrap .buttons { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.jp.checkout-wrap .alert { padding: 12px 16px; border-radius: var(--r-m); background: var(--acc-wash); color: var(--acc-ink); font-size: 13.5px; margin-bottom: 14px; }
.jp.checkout-wrap .text-danger { color: var(--sale); font-size: 12px; }

/* ---------- home ---------- */
.jp .hero-img { display: flex; align-items: center; justify-content: center; padding: 22px; overflow: hidden; }
.jp .hero-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.jp .hero-art { position: relative; }
.jp .catrow { text-decoration: none; }
.jp .gift-life-img.ph, .jp .best-feature-img.ph, .jp .edit-banner-img.ph { width: 100%; height: 100%; }
.jp .blog-img.ph { width: 100%; }
.jp .best-feature { min-height: 320px; }
.jp .edit-banner { min-height: 360px; }
.jp .co-item-img { background-position: center; background-size: cover; }

/* ============================================================
   JPCASIO — responsive refinements (on top of the design media queries)
   ============================================================ */

/* tablet: bestseller grid 1 col already handled by design at <=1080 via 3 cols */
@media (max-width: 1080px) {
  /* feature block spans full width; keep a sane brand grid */
  .jp .best-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  /* hero: arrows overlap the stacked copy/art — keep dots + autoplay only */
  .jp .hero-arrow { display: none; }
  .jp .hero-dots { bottom: 10px; }
  .jp .hero-in { padding-top: 32px; padding-bottom: 40px; }

  /* bestsellers: 2-up on phones */
  .jp .best-grid { grid-template-columns: 1fr 1fr; }
  .jp .best-feature { grid-column: 1 / -1; min-height: 180px; }

  /* cart rows become flexible (the fixed 96/120/130 grid is too wide) */
  .jp .cart-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; }
  .jp .cart-img { width: 72px; height: 72px; }
  .jp .cart-prod-info { flex: 1; min-width: 150px; }
  .jp .cart-qtycol { order: 3; }
  .jp .cart-sum { order: 4; margin-left: auto; text-align: right; }

  /* footer: links 2-up, bottom bar stacks */
  .jp .foot-cols { grid-template-columns: 1fr 1fr; gap: 22px 16px; }
  .jp .foot-bottom { flex-direction: column; gap: 6px; align-items: flex-start; }

  /* PDP buy actions: keep qty + add-to-cart comfortable */
  .jp .pdp-actions { flex-wrap: wrap; }
  .jp .pdp-actions .btn-block { flex: 1 1 100%; }

  /* PDP specs (Характеристики): single column on mobile */
  .jp .spectable { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 480px) {
  /* very small: single-column product grids read better */
  .jp .prod-grid.g4, .jp .prod-grid.g5, .jp .prod-grid.g3, .jp .picks-grid, .jp .best-grid { grid-template-columns: 1fr 1fr; }
  .jp .foot-cols { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  /* section headers: nowrap htitle + "see more" link overflow narrow phones —
     let the row wrap (link drops below) and allow the title to break across lines */
  .jp .section-head { flex-wrap: wrap; gap: 10px 16px; }
  .jp .htitle { white-space: normal; flex-wrap: wrap; }
}

/* ---------- PDP description (imported HTML) — never overflow the viewport ----------
   Product descriptions ship their own embedded <style> (.cwd … grids). Those grids
   use non-wrapping text in 1fr columns, hitting min-content and overflowing narrow
   phones (horizontal scroll). Higher-specificity .jp .prose … rules win over the
   inline <style> regardless of source order. */
.jp .prose { overflow-wrap: break-word; }
.jp .prose img,
.jp .prose iframe,
.jp .prose video,
.jp .prose table { max-width: 100%; }
.jp .prose .cwd { max-width: 100%; }
/* let grid columns shrink below content min-width so text wraps instead of overflowing */
.jp .prose .cwd .feats > li,
.jp .prose .cwd .feats span,
.jp .prose .cwd .grid3 > *,
.jp .prose .cwd .grid2 > * { min-width: 0; }

@media (max-width: 600px) {
  /* feature list has unbreakable labels → stack to one column on phones */
  .jp .prose .cwd .feats { grid-template-columns: 1fr; }
}

/* ---------- information / article / manufacturer list / search ---------- */
.jp .jp-article { padding-bottom: 70px; }
.jp .jp-article-title { margin: 8px 0 24px; }
.jp .jp-prose { max-width: 820px; }
.jp .jp-prose p { font-size: 15px; line-height: 1.75; color: var(--ink-2); margin-bottom: 14px; }
.jp .jp-prose h2 { font-size: 22px; margin: 28px 0 12px; }
.jp .jp-prose h3 { font-size: 18px; margin: 22px 0 10px; }
.jp .jp-prose ul, .jp .jp-prose ol { margin: 0 0 14px 20px; color: var(--ink-2); }
.jp .jp-prose li { margin-bottom: 6px; }
.jp .jp-prose a { color: var(--acc-ink); border-bottom: 1px solid var(--line-2); }
.jp .jp-prose img { max-width: 100%; height: auto; border-radius: var(--r-m); margin: 10px 0; }

.jp .brand-index { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
.jp .brand-index a { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: var(--r-m); font-size: 13px; color: var(--ink); }
.jp .brand-index a:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.jp .brand-letter { margin-bottom: 30px; }
.jp .brand-letter-h { font-size: 24px; font-weight: 900; color: var(--acc); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.jp .brand-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 24px; }
.jp .brand-link { font-size: 15px; font-weight: 600; color: var(--ink); padding: 6px 0; }
.jp .brand-link:hover { color: var(--acc-ink); }

.jp .search-big { display: flex; gap: 10px; max-width: 560px; margin: 14px 0 6px; }
.jp .search-big .input { flex: 1; }

@media (max-width: 720px) { .jp .brand-grid { grid-template-columns: 1fr 1fr; } }

/* ===== Toast-уведомления (showNotification) — глобальные, в <body> вне .jp ===== */
#notification-container.jp-toast-wrap,
.jp-toast-wrap {
  position: fixed; top: 84px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 380px; pointer-events: none;
}
.jp-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 12px; border: 1px solid #e6e2d8;
  background: #fff; box-shadow: 0 12px 32px rgba(20,20,15,.16);
  font-family: 'Archivo', sans-serif; font-size: 14px; line-height: 1.45; color: #2c2920;
  transform: translateY(10px); opacity: 0; transition: transform .3s ease, opacity .3s ease;
}
.jp-toast.is-in { transform: none; opacity: 1; }
.jp-toast > svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.jp-toast .jp-toast-msg { flex: 1 1 auto; min-width: 0; }
.jp-toast .jp-toast-msg a { font-weight: 700; color: inherit; text-decoration: underline; }
.jp-toast .jp-toast-x { flex: 0 0 auto; padding: 0; background: none; border: 0; cursor: pointer; color: inherit; opacity: .55; }
.jp-toast .jp-toast-x:hover { opacity: 1; }
.jp-toast .jp-toast-x svg { width: 18px; height: 18px; display: block; }
.jp-toast--success { background: #f3faf6; border-color: #cfe8d8; color: #1f7a4d; }
.jp-toast--error   { background: #fdf4f3; border-color: #f0cfcf; color: #b5392a; }
.jp-toast--warning { background: #fcf8ee; border-color: #efe2c2; color: #9a6b16; }
.jp-toast--info    { background: #f5f6fc; border-color: #d6d9ee; color: #3a3f7a; }
@media (max-width: 600px) {
  .jp-toast-wrap { left: 12px; right: 12px; max-width: none; top: 72px; }
}
