/**
 * Donicowo Smart Search — search box + live suggest dropdown.
 * All selectors tightly prefixed `donicowo-ss` to avoid theme collisions.
 */

.donicowo-ss {
    position: relative;
    width: 260px;
    max-width: 100%;
}

.donicowo-ss-form {
    display: flex;
    align-items: stretch;
    margin: 0;
}

/* Dark-header friendly input (navbar-dark + blur background). */
.donicowo-ss-input {
    flex: 1 1 auto;
    min-width: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-right: 0;
    border-radius: 6px 0 0 6px;
    color: #fff;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.donicowo-ss-input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.donicowo-ss-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: none;
}

/* Hide the native clear button for a consistent look. */
.donicowo-ss-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.donicowo-ss-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0 6px 6px 0;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.donicowo-ss-btn:hover,
.donicowo-ss-btn:focus {
    background: rgba(255, 255, 255, 0.25);
}

/* --- Dropdown --- */

.donicowo-ss-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    overflow: hidden auto;
    max-height: 420px;
    color: #212529;
}

.donicowo-ss-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #212529;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}

.donicowo-ss-item:hover,
.donicowo-ss-item.active {
    background: #f5f5f5;
    color: #212529;
    text-decoration: none;
}

.donicowo-ss-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    background: #eee;
}

.donicowo-ss-item-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.donicowo-ss-item-title {
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.donicowo-ss-item-price {
    font-size: 13px;
    font-weight: 600;
    color: #3d3d3d;
}

.donicowo-ss-item-price del {
    font-weight: 400;
    color: #999;
    margin-right: 4px;
}

.donicowo-ss-seeall {
    /*
     * Sticky, NOT a plain last child. The dropdown scrolls (max-height 420px)
     * and with a full result set the content runs ~680px, so as a normal last
     * child this link rendered ~220px BELOW the visible edge: invisible, and a
     * click at its coordinates landed on the page underneath (closing the
     * dropdown, going nowhere). Sticky keeps it pinned to the bottom edge of
     * the scrollport while the list scrolls behind it.
     */
    position: sticky;
    bottom: 0;
    z-index: 1;
    border-top: 1px solid #e9ecef;
    display: block;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: #212529;
    background: #fafafa;
    text-decoration: none;
}

.donicowo-ss-seeall:hover,
.donicowo-ss-seeall.active {
    background: #f0f0f0;
    color: #212529;
    text-decoration: none;
}

.donicowo-ss-empty {
    padding: 12px;
    font-size: 13px;
    color: #777;
    text-align: center;
}

/* --- Dropdown: category section (above product suggestions) --- */

.donicowo-ss-cat-header {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
}

.donicowo-ss-cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #212529;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}

.donicowo-ss-cat:hover,
.donicowo-ss-cat.active {
    background: #f5f5f5;
    color: #212529;
    text-decoration: none;
}

.donicowo-ss-cat-count {
    flex: 0 0 auto;
    font-weight: 400;
    color: #999;
}

/* --- Search results page: matched-category box above the product loop --- */

.donicowo-ss-cats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    font-size: 14px;
}

.donicowo-ss-cats-label {
    color: #666;
}

.donicowo-ss-cats-link {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #d5d5d5;
    border-radius: 16px;
    color: #212529;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.donicowo-ss-cats-link:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #212529;
    text-decoration: none;
}

.donicowo-ss-cats-count {
    color: #999;
    font-size: 13px;
}

/* "Czy chodziło Ci o…" notice on the results page. */
.donicowo-ss-didyoumean {
    margin: 0 0 16px;
    font-size: 15px;
}

/* --- Mobile: full-width dropdown --- */
@media (max-width: 576px) {
    .donicowo-ss {
        width: 100%;
    }

    .donicowo-ss-results {
        position: absolute;
        left: 0;
        right: 0;
        max-height: 60vh;
    }
}

/* --- Header wrapper positioning --- */

/* Mobile (below the lg navbar/hamburger breakpoint): the search bar moves to
   its own line, AFTER the account/cart/hamburger icons. */
@media (max-width: 991.98px) {
    .donicowo-ss-wrap {
        order: 99;
        margin-top: 0.5rem;
    }
    .donicowo-ss-wrap .donicowo-ss {
        width: 100%;
    }
}

/* --- Search results page: product grid --- */

/* XXL: 3 product columns. WooCommerce's own CSS is broken here — its mobile
   rule `ul.products[class*=columns] li.product { width: 48% }` wins at every
   viewport in the minified bundle — so switch the loop to grid and neutralize
   the float layout. Scoped to the search results page only. */
@media (min-width: 1400px) {
    body.search-results ul.products {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        column-gap: 3.8%;
    }
    body.search-results ul.products::before,
    body.search-results ul.products::after {
        content: none;
    }
    body.search-results ul.products li.product,
    body.search-results ul.products li.product.first,
    body.search-results ul.products li.product.last {
        width: auto !important;
        float: none;
        clear: none;
        margin-left: 0;
        margin-right: 0;
    }
}
