/* BetterSearchBar v1.1.3 – chabin-bar layout */

/* Ukryj oryginalne pole ps_searchbar jeśli jest obok naszego */
.chabin-bar #search_widget,
.chabin-bar .header-search { display: none !important; }

/* Wrapper – domyślnie ukryty do czasu przeniesienia przez JS */
#bsb-wrapper {
    position: relative;
    font-family: Arial, Helvetica, sans-serif;
    z-index: 500;
    box-sizing: border-box;
    /* JS ustawi flex:1 i marginesy po przeniesieniu do .chabin-bar */
}
.bsb-form { position: relative; width: 100%; }

/* ── Input group ──────────────────────────────────────────────────── */
.bsb-input-group {
    display: flex;
    align-items: stretch;
    height: 42px;
    width: 100%;
    border: 1px solid #cccccc;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.bsb-input-group:focus-within {
    border-color: #d01f26;
    box-shadow: 0 0 0 2px rgba(208,31,38,.12);
}
.bsb-input {
    flex: 1 1 auto; min-width: 0; border: none; outline: none;
    padding: 0 12px; font-size: 14px; color: #333; background: transparent;
    -webkit-appearance: none; appearance: none;
}
.bsb-input::placeholder { color: #aaa; }
.bsb-input::-webkit-search-cancel-button,
.bsb-input::-webkit-search-decoration { -webkit-appearance: none; }

.bsb-btn-clear {
    display: flex; align-items: center; justify-content: center;
    width: 26px; flex-shrink: 0; border: none; background: transparent;
    color: #bbb; cursor: pointer; padding: 0; transition: color .15s;
}
.bsb-btn-clear:hover { color: #555; }

.bsb-btn-submit {
    display: flex; align-items: center; justify-content: center;
    width: 44px; flex-shrink: 0; border: none;
    background: #d01f26; color: #fff; cursor: pointer; padding: 0;
    transition: background .15s;
}
.bsb-btn-submit:hover { background: #b01820; }

/* ── Dropdown ─────────────────────────────────────────────────────── */
.bsb-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: 3px solid #d01f26;
    box-shadow: 0 8px 28px rgba(0,0,0,.14);
    z-index: 99999;
    max-height: 540px;
    overflow-y: auto;
    min-width: 360px;
}
.bsb-status { padding: 14px 16px; font-size: 13px; color: #888; text-align: center; }
.bsb-results { list-style: none; margin: 0; padding: 0; }
.bsb-item { border-bottom: 1px solid #f2f2f2; }
.bsb-item:last-child { border-bottom: none; }
.bsb-item:hover, .bsb-item--active { background: #fafafa; }
.bsb-item-link {
    display: flex; align-items: center; gap: 14px; padding: 10px 14px;
    text-decoration: none !important; color: inherit !important; cursor: pointer;
}
.bsb-item-link:hover, .bsb-item-link:focus { text-decoration: none !important; outline: none; }
.bsb-img {
    flex-shrink: 0; width: 62px; height: 62px;
    background: #f8f8f8; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.bsb-img img { width: 100%; height: 100%; object-fit: contain; }
.bsb-img--empty { background: #f0f0f0; }
.bsb-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bsb-item-brand { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsb-item-name {
    font-size: 13px; font-weight: 500; color: #222; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bsb-item-name mark { background: transparent; color: #d01f26; font-weight: 700; padding: 0; }
.bsb-item-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.bsb-item-price { font-size: 14px; font-weight: 700; color: #d01f26; white-space: nowrap; }
.bsb-item-ref { font-size: 11px; color: #999; white-space: nowrap; }
.bsb-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 5px; }
.bsb-badge--ok { background: #e8f5e9; color: #1b7a2e; }
.bsb-badge--no { background: #fce4e4; color: #c62828; }
.bsb-footer { border-top: 2px solid #f0f0f0; background: #fff; padding: 12px 14px; }
button.bsb-see-all {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    width: 100%; background: none; border: none; cursor: pointer;
    font-family: inherit; font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: #d01f26; padding: 0;
}
button.bsb-see-all:hover { color: #a01520; }

/* ── Utilities ────────────────────────────────────────────────────── */
.bsb-hidden { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .bsb-input { font-size: 16px; }
    .bsb-input-group { height: 46px; }
    .bsb-dropdown {
        position: fixed; top: auto; left: 0; right: 0; bottom: 0;
        border-radius: 14px 14px 0 0; max-height: 75vh; min-width: unset;
    }
}
