/* ds_aisearch — dropdown autosugestii */

/* ============================
   Base — domyślnie ukryty
   ============================ */
.ds-aisearch-dropdown {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e4e4e4;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    padding: 22px 20px 18px;
    width: 820px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    box-sizing: border-box;
}

.ds-aisearch-dropdown.ds-ac-visible {
    display: block;
}

/* Przycisk zamknij */
.ds-aisearch-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
    padding: 4px 7px;
    z-index: 10;
    transition: color 0.15s;
}
.ds-aisearch-close:hover { color: #222; }

/* ============================
   Desktop — 3 kolumny
   ============================ */
.ds-aisearch-columns {
    display: flex;
    gap: 0;
    align-items: flex-start;
}

.ds-aisearch-col-left {
    flex: 0 0 200px;
    min-width: 0;
    padding-right: 20px;
    border-right: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.ds-aisearch-col-middle {
    flex: 0 0 210px;
    min-width: 0;
    padding: 0 20px;
    border-right: 1px solid #f0f0f0;
}

.ds-aisearch-col-right {
    flex: 1;
    min-width: 0;
    padding-left: 20px;
}

/* ============================
   Nagłówki sekcji
   ============================ */
.ds-ac-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #aaa;
    text-transform: uppercase;
    margin: 0 0 10px;
}
.ds-ac-section-title--cats { margin-top: 18px; }

/* ============================
   Chipy zapytań
   ============================ */
.ds-aisearch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ds-aisearch-chip {
    display: inline-flex;
    align-items: center;
    background: #111;
    color: #fff;
    border: none;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    line-height: 1.4;
    transition: background 0.15s;
    white-space: nowrap;
}
.ds-aisearch-chip:hover { background: #555; }

/* ============================
   Kategorie
   ============================ */
.ds-aisearch-categories {
    list-style: none;
    padding: 0;
    margin: 0;
}
.ds-aisearch-categories li { margin-bottom: 4px; }
.ds-aisearch-categories a {
    font-size: 12px;
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
    transition: color 0.12s;
}
.ds-aisearch-categories a::before {
    content: '›';
    font-size: 14px;
    color: #bbb;
    flex-shrink: 0;
    line-height: 1;
}
.ds-aisearch-categories a:hover { color: #c00; }

/* ============================
   Baner (lewa kolumna, na dole)
   ============================ */
.ds-ac-banner {
    display: block;
    margin-top: auto;
    padding-top: 18px;
    text-decoration: none;
    line-height: 0;
}
.ds-ac-banner img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================
   Popularny produkt (środek)
   ============================ */
.ds-aisearch-product--featured {
    display: block;
    text-decoration: none;
    color: inherit;
}
.ds-aisearch-product--featured:hover .ds-aisearch-product__name { color: #c00; }

.ds-aisearch-product--featured .ds-aisearch-product__img {
    width: 100%;
    height: 190px;
    object-fit: contain;
    display: block;
    margin-bottom: 10px;
}
.ds-aisearch-product--featured .ds-aisearch-product__img-placeholder {
    width: 100%;
    height: 190px;
    background: #f5f5f5;
    margin-bottom: 10px;
}

/* ============================
   Grid produktów (prawa kolumna)
   ============================ */
.ds-aisearch-products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.ds-aisearch-product {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.ds-aisearch-product:hover .ds-aisearch-product__name { color: #c00; }

.ds-aisearch-product .ds-aisearch-product__img {
    width: 100%;
    height: 96px;
    object-fit: contain;
    display: block;
    margin-bottom: 6px;
}
.ds-aisearch-product .ds-aisearch-product__img-placeholder {
    width: 100%;
    height: 96px;
    background: #f5f5f5;
    margin-bottom: 6px;
}

/* Info produktu */
.ds-aisearch-product__info { padding: 0 1px; }
.ds-aisearch-product__name {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 3px;
    color: #111;
    transition: color 0.12s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ds-aisearch-product__prices {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
}
.ds-aisearch-product__price {
    font-size: 12px;
    font-weight: 700;
    color: #c00;
}
.ds-aisearch-product__price-old {
    font-size: 11px;
    color: #bbb;
    font-weight: 400;
}

/* ============================
   Przycisk "Pokaż wszystkie"
   ============================ */
.ds-ac-showall {
    display: block;
    text-align: center;
    background: #111;
    color: #fff !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none !important;
    padding: 10px 14px;
    transition: background 0.15s;
    cursor: pointer;
}
.ds-ac-showall:hover { background: #555; }

/* ============================
   Mobile elements (ukryte na desktop)
   ============================ */
.ds-ac-mobile-chips,
.ds-ac-mobile-tabs,
.ds-ac-mobile-panel {
    display: none;
}

/* ============================
   MOBILE — full-screen overlay
   ============================ */
@media (max-width: 767px) {

    /* Body lock */
    body.ds-ac-body-lock {
        overflow: hidden;
    }

    /* Full-screen overlay */
    .ds-aisearch-dropdown.ds-ac-visible {
        display: flex !important;
        flex-direction: column;
        position: fixed !important;
        top: var(--ds-ac-top, 0px) !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-width: 0 !important;
        max-width: none !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    /* Przycisk zamknij — pełna szerokość, prawy górny róg */
    .ds-aisearch-close {
        position: relative;
        top: auto;
        right: auto;
        align-self: flex-end;
        font-size: 20px;
        padding: 14px 18px;
        color: #444;
        flex-shrink: 0;
    }

    /* Ukryj desktop kolumny */
    .ds-aisearch-columns { display: none !important; }

    /* Chipy mobile */
    .ds-ac-mobile-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        padding: 4px 16px 14px;
        flex-shrink: 0;
    }

    /* Zakładki */
    .ds-ac-mobile-tabs {
        display: flex;
        flex-shrink: 0;
        border-bottom: 2px solid #ebebeb;
        padding: 0 16px;
    }
    .ds-ac-mobile-tab {
        flex: 1;
        background: none;
        border: none;
        border-bottom: 3px solid transparent;
        margin-bottom: -2px;
        padding: 12px 6px;
        font-size: 13px;
        font-weight: 600;
        color: #999;
        cursor: pointer;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        transition: color 0.15s, border-color 0.15s;
    }
    .ds-ac-mobile-tab--active {
        color: #111;
        border-bottom-color: #111;
    }

    /* Panele zakładek */
    .ds-ac-mobile-panel {
        display: flex;
        flex-direction: column;
        flex: 1;
        padding: 14px 16px;
        overflow-y: auto;
    }
    .ds-ac-mobile-panel--hidden {
        display: none !important;
    }

    /* Lista produktów mobile */
    .ds-ac-products-list { flex: 1; }
    .ds-ac-mp {
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        color: inherit;
        padding: 10px 0;
        border-bottom: 1px solid #f2f2f2;
        transition: background 0.1s;
    }
    .ds-ac-mp:last-child { border-bottom: none; }
    .ds-ac-mp:hover .ds-ac-mp__name { color: #c00; }

    .ds-ac-mp__img {
        width: 64px;
        height: 64px;
        object-fit: contain;
        flex-shrink: 0;
        display: block;
    }
    .ds-ac-mp__img-placeholder {
        width: 64px;
        height: 64px;
        background: #f0f0f0;
        flex-shrink: 0;
    }
    .ds-ac-mp__info { flex: 1; min-width: 0; }
    .ds-ac-mp__name {
        font-size: 13px;
        font-weight: 500;
        line-height: 1.35;
        color: #111;
        margin-bottom: 4px;
        transition: color 0.12s;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Kategorie mobile */
    .ds-aisearch-categories--mobile li { margin-bottom: 2px; }
    .ds-aisearch-categories--mobile a { font-size: 14px; padding: 6px 0; }

    /* Pokaż wszystkie — mobile */
    .ds-ac-showall--mobile {
        display: block;
        margin-top: 16px;
        flex-shrink: 0;
    }
}

/* Natywny dropdown ps_searchbar (jQuery UI) - zastapiony dropdownem ds_aisearch.
   Ukrywany takze przez CSS, bo jego widget inicjalizuje sie asynchronicznie. */
ul.ui-autocomplete.ui-front,
.ui-autocomplete.ui-menu {
    display: none !important;
}

/* Sekcje bez tresci - ukrywane klasa, nie inline stylem, zeby nie nadpisac
   media query rozdzielajacych uklad desktop/mobile. */
.ds-aisearch-dropdown .ds-ac-hidden {
    display: none !important;
}

/* Natywne okno podpowiedzi motywu (hummingbird / ps_searchbar) ustępuje naszemu. */
.searchbar__dropdown,
ul.ui-autocomplete.ui-front {
    display: none !important;
}

/* Natywna lista jquery.auto-complete (ps_searchbarjqauto) ustępuje naszemu oknu. */
.autocomplete-suggestions {
    display: none !important;
}

/* Fokus klawiatury widoczny. */
.ds-aisearch-dropdown a:focus-visible,
.ds-aisearch-dropdown button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ---- 2.1.0: "jak AI zrozumiało zapytanie" (okno podpowiedzi i strona wyników); neutralnie, motyw nadpisuje kolory ---- */
.ds-ai-understood { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 13px; line-height: 1.3; color: #333; }
.ds-ai-understood.ds-ac-hidden { display: none; }
#ds-aisearch-dropdown .ds-ai-understood { padding: 12px 48px 12px 20px; border-bottom: 1px solid #eee; }
.ds-ai-understood--page { margin: 0 0 16px; padding: 12px 14px; background: #f6f7f6; border-radius: 10px; }
.ds-ai-understood__label { font-weight: 600; }
.ds-ai-understood__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 0; min-width: 240px; }
.ds-ai-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px 4px 12px; border: 1px solid #c9ccc9; border-radius: 16px; background: #fff; color: #222; font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.ds-ai-chip:hover, .ds-ai-chip:focus-visible { border-color: #222; color: #222; text-decoration: none; }
.ds-ai-chip__x { font-size: 16px; line-height: 1; color: #777; }
.ds-ai-chip:hover .ds-ai-chip__x { color: #000; }
.ds-ai-understood__links { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.ds-ai-understood__link, .ds-ai-understood__plain { padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: #555; text-decoration: underline; cursor: pointer; }
.ds-ai-understood__link:hover, .ds-ai-understood__plain:hover { color: #000; }
.ds-ai-understood__note { flex-basis: 100%; margin: 2px 0 0; font-size: 13px; color: #555; }
.ds-ai-understood__thinking { color: #666; font-style: italic; }
.ds-ai-understood__thinking::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid #bbb; border-top-color: transparent; border-radius: 50%; vertical-align: -1px; animation: ds-ai-spin .8s linear infinite; }
@keyframes ds-ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ds-ai-understood__thinking::before { animation: none; } }
@media (max-width: 767px) {
  #ds-aisearch-dropdown .ds-ai-understood { padding: 10px 44px 10px 14px; }
  .ds-ai-understood__chips { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .ds-ai-chip { flex: 0 0 auto; }
}

/* 2.2.0: marka nad nazwą produktu i liczba wszystkich wyników przy nagłówku */
.ds-aisearch-product__brand { font-size: 11px; line-height: 1.3; text-transform: uppercase; letter-spacing: .4px; color: #6b6b6b; margin-bottom: 2px; }
.ds-ac-count { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 10px; background: #eef0ee; color: #333; font-size: 11px; line-height: 18px; vertical-align: middle; }
.ds-ac-count.ds-ac-hidden { display: none; }
