/* ==========================================================================
   Header search dropdown (js/search_ui.js). Classes: swq-*.
   Desktop: light panel under the dark header + page overlay.
   Mobile (<= 960px, same as header_new.css): full-screen sheet under the
   dark input bar #sw2MobileSearch.
   Colours / radii come from design-tokens.css. Fallbacks only guard a
   partial deploy.
   ========================================================================== */

/* header inputs are type="search": drop the native look and clear button */
.header-search-input { -webkit-appearance: none; appearance: none; }
.header-search-input::-webkit-search-cancel-button,
.header-search-input::-webkit-search-decoration { -webkit-appearance: none; display: none; }

.swq-overlay {
     position: fixed; inset: 0; z-index: 1190;          /* below header (1200) and sticky bar (1199) */
     background: rgba(12,12,12,.45);
     opacity: 0; transition: opacity .15s ease;
}
.swq-overlay.is-open { opacity: 1; }
.swq-overlay[hidden], .swq-panel[hidden], .swq-foot[hidden] { display: none !important; }

/* ---------- panel shell ---------- */
.swq-panel {
     position: fixed; z-index: 1205;                       /* over the nav row, under modals (2000) */
     display: flex; flex-direction: column;
     box-sizing: border-box;
     background: var(--sw-bg, #fff);
     color: var(--sw-ink, #1a1a1a);
     font-family: var(--sw-font, 'Montserrat', sans-serif);
     font-size: 14px; line-height: 1.35; text-align: left;
     opacity: 0; transform: translateY(6px);
     transition: opacity .15s ease, transform .15s ease;
}
.swq-panel.is-open { opacity: 1; transform: none; }
.swq-panel *, .swq-panel *::before, .swq-panel *::after { box-sizing: border-box; }
.swq-panel p { margin: 0; }
.swq-panel a, .swq-panel a:hover, .swq-panel a:focus { text-decoration: none; }
.swq-panel button { font-family: inherit; margin: 0; }

.swq-panel--desktop {
     max-height: min(72vh, 640px);
     border: 1px solid var(--sw-line, #eaeaea);
     border-radius: 16px;
     box-shadow: 0 16px 48px rgba(0,0,0,.18);
     overflow: hidden;
}

/* close (desktop; the mobile bar has its own) */
.swq-close {
     position: absolute; top: 10px; right: 10px; z-index: 2;
     width: 32px; height: 32px; padding: 0;
     display: flex; align-items: center; justify-content: center;
     border: 0; border-radius: 10px; background: transparent;
     color: var(--sw-muted, #9ca3af); cursor: pointer;
     transition: background .15s ease, color .15s ease;
}
.swq-close:hover { background: var(--sw-bg-soft, #f5f5f7); color: var(--sw-ink, #1a1a1a); }
.swq-close svg { width: 16px; height: 16px; }
.swq-panel--mobile .swq-close { display: none; }

/* ---------- body: two columns on desktop ---------- */
.swq-panel--desktop .swq-body {
     flex: 1 1 auto; min-height: 0;
     display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
}
.swq-panel--desktop .swq-side {
     order: -1;                                             /* DOM: main first (keyboard order), shown left */
     background: var(--sw-bg-soft, #f5f5f7);
     border-right: 1px solid var(--sw-line, #eaeaea);
     padding: 4px 12px 16px;
     overflow-y: auto; overscroll-behavior: contain;
}
.swq-panel--desktop .swq-main {
     padding: 4px 16px 16px;
     overflow-y: auto; overscroll-behavior: contain;
     min-width: 0;
}
.swq-panel--desktop[data-state="loading"] .swq-body { display: block; }
.swq-panel--desktop .swq-main > :first-child .swq-head,
.swq-panel--desktop .swq-main > .swq-empty:first-child,
.swq-panel--desktop .swq-main > .swq-note:first-child { margin-right: 40px; }   /* clear the close button */

/* wide desktop: device rows in two columns */
@media (min-width: 1100px) {
     .swq-panel--desktop .swq-sec--models { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; }
     .swq-panel--desktop .swq-sec--models > .swq-head { grid-column: 1 / -1; }
}

/* the dark nav row behind the panel's top gap stays empty while it is open */
body.swq-d-open .sw2-header .sw2-nav .sw2-container { visibility: hidden; }

/* ---------- section ---------- */
.swq-sec { min-width: 0; }
.swq-head {
     display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
     margin: 16px 0 8px; padding: 0 12px;
}
.swq-label {
     font-size: 11px; font-weight: 700; line-height: 1.2;
     text-transform: uppercase; letter-spacing: .08em;
     color: var(--sw-muted, #9ca3af);
}
.swq-clear {
     border: 0; background: none; padding: 0; cursor: pointer;
     font-size: 12px; font-weight: 600; color: var(--sw-grey, #6b7280);
}
.swq-clear:hover { color: var(--sw-purple, #7735d5); }
.swq-sec--sell { margin-top: 12px; }

.swq-note, .swq-loading {
     margin: 16px 12px 0 !important;
     font-size: 12px; color: var(--sw-grey, #6b7280);
}
.swq-empty {
     margin: 18px 12px 2px !important;
     font-size: 14px; color: var(--sw-ink-2, #374151);
     overflow-wrap: anywhere;
}
.swq-empty strong { font-weight: 700; color: var(--sw-ink, #1a1a1a); }

/* ---------- result rows ---------- */
.swq-row {
     position: relative;
     display: flex; align-items: center; gap: 12px;
     width: 100%; min-width: 0;
     border-radius: 10px;
     color: var(--sw-ink, #1a1a1a);
     cursor: pointer;
     transition: background .12s ease, color .12s ease;
     -webkit-tap-highlight-color: transparent;
}
a.swq-row, a.swq-row:hover, a.swq-row:focus { color: var(--sw-ink, #1a1a1a); }

.swq-row--item, .swq-row--sell { min-height: 56px; padding: 8px 12px; }
.swq-row--item:hover, .swq-row--item.is-active,
.swq-row--side:hover, .swq-row--side.is-active { background: var(--sw-bg-soft, #f5f5f7); }
.swq-row.is-active::before {
     content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
     width: 2px; border-radius: 2px; background: var(--sw-purple, #7735d5);
}
.swq-panel--desktop .swq-side .swq-row--side:hover,
.swq-panel--desktop .swq-side .swq-row--side.is-active { background: var(--sw-bg, #fff); }

.swq-thumb {
     flex: 0 0 48px; width: 48px; height: 48px;
     display: flex; align-items: center; justify-content: center;
     border-radius: 10px; background: var(--sw-bg-soft, #f5f5f7);
     overflow: hidden;
}
.swq-thumb img {
     width: 48px; height: 48px; display: block;
     object-fit: contain; padding: 4px;
     mix-blend-mode: multiply;
}
.swq-thumb.is-out img { opacity: .55; }

.swq-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.swq-title {
     font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--sw-ink, #1a1a1a);
     white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.swq-hl { font-weight: 800; }
.swq-meta {
     display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px;
     font-size: 12px; line-height: 1.35; color: var(--sw-grey, #6b7280);
     white-space: nowrap;
}
.swq-price { color: var(--sw-price, #fb7b24); font-weight: 700; margin-left: -2px; }
.swq-row--acc .swq-price, .swq-row--outlet .swq-price { margin-left: 0; }
.swq-dot { color: var(--sw-muted, #9ca3af); }
.swq-stock { color: var(--sw-success, #15803d); font-weight: 600; }
.swq-pill {
     display: inline-flex; align-items: center; gap: 5px;
     padding: 2px 8px 2px 7px;
     border: 1px solid var(--sw-line-2, #d4d4d8); border-radius: 100px;
     background: var(--sw-bg-soft, #f5f5f7);
     font-size: 11px; font-weight: 600; line-height: 1.4; color: var(--sw-grey, #6b7280);
}
.swq-pill svg { width: 11px; height: 11px; flex: none; }

/* sell row */
.swq-row--sell { background: var(--sw-tint-teal, #e7fdfc); }
.swq-row--sell:hover, .swq-row--sell.is-active { background: var(--sw-tint-teal, #e7fdfc); box-shadow: inset 0 0 0 1px rgba(43,187,188,.35); }
.swq-sell-ico {
     flex: 0 0 48px; width: 48px; height: 48px; border-radius: 10px;
     display: flex; align-items: center; justify-content: center;
     background: var(--sw-bg, #fff); color: var(--sw-teal-deep, #0f7f7c);
}
.swq-sell-ico svg { width: 22px; height: 22px; }
.swq-go { flex: none; width: 18px; height: 18px; color: var(--sw-teal-deep, #0f7f7c); transition: transform .15s ease; }
.swq-row--sell:hover .swq-go { transform: translateX(2px); }

/* left column rows (suggestions, categories, recent) */
.swq-row--side {
     min-height: 38px; padding: 8px 12px; gap: 10px;
     border: 0; background: none; text-align: left;
     font-size: 13px; font-weight: 500; line-height: 1.3;
     color: var(--sw-ink-2, #374151);
}
a.swq-row--side, a.swq-row--side:hover, a.swq-row--side:focus { color: var(--sw-ink-2, #374151); }
.swq-row--side:hover, a.swq-row--side:hover, .swq-row--side.is-active { color: var(--sw-purple, #7735d5); }
.swq-side-ico { flex: none; width: 15px; height: 15px; color: var(--sw-muted, #9ca3af); transition: color .12s ease; }
.swq-row--side:hover .swq-side-ico, .swq-row--side.is-active .swq-side-ico { color: var(--sw-purple, #7735d5); }
.swq-side-txt { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* chips */
.swq-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 4px; }
/* chip skin = the shared .sw-pill (css/components.css) */
.swq-chip { margin: 0; white-space: nowrap; }

/* footer */
.swq-foot {
     flex: none;
     border-top: 1px solid var(--sw-line, #eaeaea);
     padding: 12px;
     text-align: center;
     background: var(--sw-bg, #fff);
}
.swq-all, .swq-all:hover, .swq-all:focus {
     display: inline-flex; align-items: center; gap: 8px;
     font-size: 14px; font-weight: 600; color: var(--sw-purple, #7735d5);
}
.swq-all svg { width: 16px; height: 16px; transition: transform .15s ease; }
.swq-all:hover svg { transform: translateX(3px); }

/* keyboard focus ring for real focus (Tab) */
.swq-row:focus-visible, .swq-chip:focus-visible, .swq-all:focus-visible,
.swq-clear:focus-visible, .swq-close:focus-visible { outline: 2px solid var(--sw-purple, #7735d5); outline-offset: 1px; }

/* ==========================================================================
   Mobile sheet
   ========================================================================== */
@media (max-width: 960px) {
     /* the dark input bar becomes the top of the sheet, above the header */
     body.swq-m-open .sw2-mobile-search {
          top: 0; bottom: auto; z-index: 1310;
          padding: calc(10px + env(safe-area-inset-top, 0px)) 0 10px;
          animation: none;
     }
     body.swq-m-open .sw2-mobile-search .sw2-container {
          padding-left: max(16px, env(safe-area-inset-left, 0px));
          padding-right: max(16px, env(safe-area-inset-right, 0px));
     }

     /* The bar's close button is the sheet's close. Its stroke is set on the svg itself: in
        Chrome touch emulation the <button>'s own colour was computed as black after a tap. */
     body.swq-m-open .sw2-mobile-search-close svg { stroke: rgba(255,255,255,.75); width: 18px; height: 18px; }
     body.swq-m-open .sw2-mobile-search-close { padding: 10px; right: 2px; }

     /* the Crisp chat bubble (z 1000001) would sit on the sheet's bottom bar */
     body.swq-m-open .crisp-client { display: none !important; }

     .swq-panel--mobile {
          left: 0; right: 0; bottom: 0; z-index: 1310;
          transform: none;
     }
     .swq-panel--mobile .swq-body {
          flex: 1 1 auto; min-height: 0;
          display: flex; flex-direction: column;
          overflow-y: auto; overscroll-behavior: contain;
          -webkit-overflow-scrolling: touch;
          padding: 0 max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px));
     }
     /* one column: sections ordered across both blocks */
     .swq-panel--mobile .swq-main, .swq-panel--mobile .swq-side { display: contents; }
     .swq-panel--mobile .swq-empty   { order: 0; }
     .swq-panel--mobile .swq-note    { order: 0; }
     .swq-panel--mobile .swq-sec--recent { order: 1; }
     .swq-panel--mobile .swq-sec--pop    { order: 2; }
     .swq-panel--mobile .swq-sec--models { order: 3; }
     .swq-panel--mobile .swq-sec--sell   { order: 4; }
     .swq-panel--mobile .swq-sec--acc    { order: 5; }
     .swq-panel--mobile .swq-sec--outlet { order: 6; }
     .swq-panel--mobile .swq-sec--cats   { order: 7; }
     .swq-panel--mobile .swq-sec--sugg   { order: 8; }

     .swq-panel--mobile .swq-head { padding: 0 4px; margin-top: 18px; }
     .swq-panel--mobile .swq-chips { padding: 0 4px 4px; }
     .swq-panel--mobile .swq-row--item,
     .swq-panel--mobile .swq-row--sell { min-height: 60px; padding: 6px 4px; }
     .swq-panel--mobile .swq-row--item:hover { background: transparent; }
     .swq-panel--mobile .swq-row--item:active { background: var(--sw-bg-soft, #f5f5f7); }
     .swq-panel--mobile .swq-row--sell { padding: 6px 12px 6px 6px; }
     .swq-panel--mobile .swq-row--side { min-height: 44px; padding: 10px 4px; font-size: 14px; }
     .swq-panel--mobile .swq-row--side:hover { background: transparent; color: var(--sw-ink-2, #374151); }
     .swq-panel--mobile .swq-row--side:hover .swq-side-ico { color: var(--sw-muted, #9ca3af); }
     .swq-panel--mobile .swq-sec--models .swq-row + .swq-row,
     .swq-panel--mobile .swq-sec--acc .swq-row + .swq-row { border-top: 1px solid var(--sw-line, #eaeaea); border-radius: 0; }
     .swq-panel--mobile .swq-chip { padding: 8px 14px; flex: none; }
     /* chips: one horizontally scrolling line, bleeding to the screen edges, soft fade on the right */
     .swq-panel--mobile .swq-chips {
          flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
          -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
          scrollbar-width: none;
          margin: 0 -16px; padding: 0 0 4px 20px;
          -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
     }
     .swq-panel--mobile .swq-chips::-webkit-scrollbar { display: none; }
     .swq-panel--mobile .swq-chips::after { content: ''; flex: 0 0 28px; }   /* end spacer: last chip clears the fade */
     .swq-panel--mobile .swq-note, .swq-panel--mobile .swq-loading, .swq-panel--mobile .swq-empty { margin-left: 4px !important; margin-right: 4px !important; }

     .swq-panel--mobile .swq-foot {
          padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
          box-shadow: 0 -6px 16px rgba(0,0,0,.04);
     }
     .swq-panel--mobile .swq-all { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
     .swq-panel, .swq-overlay, .swq-row, .swq-chip, .swq-go, .swq-all svg { transition: none !important; }
}

/* ==========================================================================
   Results page /search?q=  (templates/search/results.php + js/search_page.js)
   Cards are the site's real product cards (css/product_card.css); only the
   page furniture and the few model-card extras live here.
   ========================================================================== */
.swq-page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 16px; }
.swq-page-count { font-size: 14px; font-weight: 500; color: var(--sw-grey, #6b7280); }
.swq-page-body { min-height: 100vh; }   /* keeps the footer off the first screen while results load */
.swq-page-note { font-size: 14px; color: var(--sw-ink-2, #374151); margin: 4px 0 14px; }
.swq-page-label { padding: 0; margin: 18px 0 8px; }
.swq-page-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* tabs + brand pills */
.swq-tabs, .swq-brands { display: flex; gap: 8px; }
.swq-tabs { margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.swq-tabs::-webkit-scrollbar { display: none; }
.swq-brands { flex-wrap: wrap; }
/* tab + brand pill skin = the shared .sw-pill (css/components.css) */
.swq-tab { flex: none; }
.swq-tab:disabled { opacity: .45; cursor: default; pointer-events: none; }
.swq-tab:focus { outline: none; }
.swq-tab:focus-visible, .swq-sort:focus-visible, .swq-page-more:focus-visible, .swq-page-loadmore:focus-visible {
     outline: 2px solid var(--sw-purple, #7735d5); outline-offset: 2px;
}

/* filter row */
.swq-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 4px; }
.swq-filters-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.swq-switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font: 500 13px/1 'Montserrat', sans-serif; color: var(--sw-ink, #1a1a1a); }
.swq-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swq-switch-ui { position: relative; width: 36px; height: 20px; border-radius: 100px; background: var(--sw-line-2, #d4d4d8); transition: background .15s; flex: none; }
.swq-switch-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.swq-switch input:checked + .swq-switch-ui { background: var(--sw-purple, #7735d5); }
.swq-switch input:checked + .swq-switch-ui::after { transform: translateX(16px); }
.swq-switch input:focus-visible + .swq-switch-ui { outline: 2px solid var(--sw-purple, #7735d5); outline-offset: 2px; }
.swq-sort {
     height: 36px; border-radius: 10px; border: 1px solid var(--sw-line-2, #d4d4d8);
     background: var(--sw-bg, #fff); padding: 0 10px;
     font: 500 13px/1 'Montserrat', sans-serif; color: var(--sw-ink, #1a1a1a);
}

/* sections + grid */
.swq-page-sec { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; }
.swq-page-sec .swq-label { padding: 0; margin: 0; }
.swq-page-sec-n { font: 600 11px/1 'Montserrat', sans-serif; color: var(--sw-muted, #9ca3af); }
.swq-page-more { margin-left: auto; border: 0; background: none; padding: 4px 0; font: 600 13px/1 'Montserrat', sans-serif; color: var(--sw-purple, #7735d5); cursor: pointer; }
.swq-page-more:hover { color: var(--sw-purple-d, #650ce4); }
.swq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 768px) { .swq-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 992px) {
     /* results page has no sidebar: 5 cards per row (listings show 4 beside their filters) */
     .swq-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
     .swq-srvblock .row > .pcard-wrap, .swq-srvblock .row > .pcard { flex: 0 0 20%; max-width: 20%; }
}
.swq-page-morewrap { text-align: center; margin-top: 22px; }
/* "Покажи още" = the shared .sw-btn--ghost (css/components.css) */

/* card extras (model / accessory cards built by search_page.js) */
.swq-card { height: 100%; min-width: 0; }
.swq-card .p3-body { flex: 1; }
/* two classes: product_card.css loads after this file and sets .p3-title { display: block } */
.swq-card .swq-card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.swq-card-stock { font-size: 12.5px; font-weight: 600; color: var(--sw-success, #15803d); }
.swq-card-from { font-size: 12px; font-weight: 500; color: var(--sw-grey, #6b7280); }
.swq-card--out .pcard-img { opacity: .55; }
.swq-card .p3-sub .swq-pill { vertical-align: middle; }
.swq-card-noimg { background: var(--sw-bg-soft, #f5f5f7); }
.swq-card-noprice { visibility: hidden; }
.swq-card-notify { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--sw-purple, #7735d5); white-space: nowrap; }
.swq-card-notify svg { width: 14px; height: 14px; flex: none; }

@media (max-width: 767px) {
     .swq-page-head { margin-bottom: 12px; }
     .swq-filters-right { margin-left: 0; width: 100%; justify-content: space-between; }
     .swq-brands { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; -webkit-overflow-scrolling: touch; }
     .swq-brands::-webkit-scrollbar { display: none; }
     /* outlet strip: one row that scrolls sideways */
     .swq-grid--strip { display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
     .swq-grid--strip::-webkit-scrollbar { display: none; }
     .swq-grid--strip > .swq-card { flex: 0 0 46%; }
}
