/* ===========================================
   RockBike Filter Bar — Horizontal AJAX Filter
   =========================================== */

.rb-filter-bar {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    /* no z-index here — avoids creating a stacking context that
       would trap dropdown panels below the product grid.
       Dropdowns use z-index:29 (just below header's 30). */
}

/* --- Filter Controls Row --- */
.rb-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* --- Mobile Toggle (hidden on desktop) --- */
.rb-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
}

.rb-filter-toggle:hover {
    border-color: #50d118;
    color: #50d118;
}

.rb-filter-toggle svg {
    flex-shrink: 0;
}

.rb-filter-count {
    background: #50d118;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

/* ===========================================
   Pill / Button Filters (e.g. Značka)
   =========================================== */
.rb-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    width: 100%;
    padding-bottom: 4px;
}

.rb-buttons-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-right: 4px;
    white-space: nowrap;
}

.rb-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    line-height: 1.3;
}

.rb-pill:hover {
    border-color: #50d118;
    color: #3ba30f;
    background: #f9fdf6;
}

.rb-pill-active {
    background: #50d118;
    border-color: #50d118;
    color: #fff;
}

.rb-pill-active:hover {
    background: #45b514;
    border-color: #45b514;
    color: #fff;
}

.rb-pill-count {
    display: none;
}

/* Unavailable pill — greyed out */
.rb-pill-unavailable {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* ===========================================
   Dropdown Filters (Farba, Veľkosť, etc.)
   =========================================== */

/* --- Trigger Button --- */
.rb-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    line-height: 1.4;
}

.rb-filter-trigger:hover {
    border-color: #50d118;
    color: #50d118;
}

.rb-filter-trigger.active {
    border-color: #50d118;
    background: #f0fbe8;
    color: #3ba30f;
}

.rb-trigger-count {
    background: #50d118;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.rb-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.rb-filter-dropdown.open .rb-chevron {
    transform: rotate(180deg);
}

/* --- Dropdown Panel --- */
.rb-filter-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    z-index: 29; /* below header (30), above products */
}

/* Dropdown container needs position for absolute panel */
.rb-filter-dropdown {
    position: relative;
    z-index: 29;
}

.rb-filter-dropdown.open {
    z-index: 29;
}

.rb-filter-dropdown.open .rb-filter-panel {
    display: block;
}

.rb-filter-panel-scroll {
    max-height: 280px;
    overflow-y: auto;
    padding: 8px 0;
}

/* Scrollbar */
.rb-filter-panel-scroll::-webkit-scrollbar {
    width: 5px;
}
.rb-filter-panel-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.rb-filter-panel-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* --- Filter Option (checkbox row) --- */
.rb-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    line-height: 1.4;
}

.rb-filter-option:hover {
    background: #f5f5f5;
}

.rb-filter-option input[type="checkbox"] {
    accent-color: #50d118;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.rb-option-name {
    flex: 1;
    color: #333;
}

.rb-option-count {
    display: none;
}

/* Unavailable option — greyed out */
.rb-option-unavailable {
    opacity: 0.35;
    pointer-events: none;
}

.rb-option-unavailable input[type="checkbox"] {
    cursor: default;
}

/* --- Price Filter Panel --- */
.rb-price-panel {
    padding: 14px;
    min-width: 280px;
}

.rb-price-inputs {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.rb-price-field {
    flex: 1;
}

.rb-price-field label {
    display: block;
    font-size: 12px;
    color: #777;
    margin-bottom: 4px;
    font-weight: 500;
}

.rb-price-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s;
}

.rb-price-input-wrap:focus-within {
    border-color: #50d118;
}

.rb-price-input-wrap input {
    border: none;
    outline: none;
    padding: 8px 6px 8px 10px;
    font-size: 14px;
    width: 100%;
    min-width: 0;
    background: transparent;
    -moz-appearance: textfield;
}
.rb-price-input-wrap input::-webkit-outer-spin-button,
.rb-price-input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rb-price-currency {
    padding: 8px 8px 8px 2px;
    font-size: 13px;
    color: #888;
    flex-shrink: 0;
}

.rb-price-sep {
    font-size: 16px;
    color: #aaa;
    padding-bottom: 6px;
    flex-shrink: 0;
}

.rb-price-apply {
    background: #50d118;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
    align-self: flex-end;
}

.rb-price-apply:hover {
    background: #45b514;
}

/* --- Reset Button --- */
.rb-filter-reset {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.rb-filter-reset:hover {
    border-color: #e53935;
    color: #e53935;
    background: #fff5f5;
}

/* --- Filter Chips --- */
.rb-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.rb-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0fbe8;
    border: 1px solid #c8e8b2;
    border-radius: 16px;
    padding: 4px 8px 4px 12px;
    font-size: 12px;
    color: #3ba30f;
    line-height: 1.4;
}

.rb-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #7cc55e;
    padding: 0 2px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
}

.rb-chip-remove:hover {
    color: #e53935;
}

/* --- No Products Message --- */
.rb-no-products {
    text-align: center;
    padding: 60px 20px;
    color: #777;
}

.rb-no-products p {
    font-size: 16px;
    margin-bottom: 16px;
}

.rb-no-products .rb-filter-reset {
    font-size: 14px;
    padding: 10px 24px;
}

/* --- Loading Overlay --- */
.products.rb-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.products.rb-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #e5e5e5;
    border-top-color: #50d118;
    border-radius: 50%;
    animation: rbSpin 0.6s linear infinite;
}

@keyframes rbSpin {
    to { transform: rotate(360deg); }
}

/* ===========================================
   Responsive — Mobile (< 849px)
   =========================================== */
@media (max-width: 849px) {
    .rb-filter-bar {
        padding: 10px 12px;
    }

    .rb-filter-toggle {
        display: flex;
    }

    .rb-filter-controls {
        display: none;
        flex-direction: column;
        gap: 6px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #f0f0f0;
    }

    .rb-filter-controls.rb-controls-visible {
        display: flex;
    }

    .rb-filter-dropdown {
        width: 100%;
    }

    .rb-filter-trigger {
        width: 100%;
        justify-content: space-between;
        padding: 10px 14px;
        font-size: 14px;
    }

    .rb-filter-panel {
        position: static;
        border: none;
        box-shadow: none;
        border-top: 1px solid #eee;
        border-radius: 0;
        margin-top: 2px;
    }

    .rb-filter-panel-scroll {
        max-height: 200px;
    }

    .rb-price-panel {
        min-width: 0;
    }

    .rb-price-inputs {
        flex-wrap: wrap;
    }

    .rb-price-field {
        min-width: 0;
    }

    .rb-price-sep {
        display: none;
    }

    .rb-price-apply {
        width: 100%;
        padding: 10px;
        margin-top: 4px;
    }

    .rb-filter-reset {
        width: 100%;
        text-align: center;
        padding: 10px 14px;
    }

    .rb-filter-chips {
        margin-top: 8px;
        padding-top: 8px;
    }

    /* Pill buttons wrap on mobile */
    .rb-filter-buttons {
        gap: 4px;
    }

    .rb-pill {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* ===========================================
   Tablet tweaks (850px - 1024px)
   =========================================== */
@media (min-width: 850px) and (max-width: 1024px) {
    .rb-filter-trigger {
        padding: 7px 10px;
        font-size: 12px;
    }

    .rb-pill {
        padding: 4px 10px;
        font-size: 12px;
    }
}
