/* ============================================================
   Filter Drawer – offcanvas panel, světlý motiv
   ============================================================ */

:root {
    --fd-bg:      #ffffff;
    --fd-panel:   #ffffff;
    --fd-panel2:  #f8f9fa;
    --fd-text:    #212529;
    --fd-muted:   #6c757d;
    --fd-border:  #dee2e6;
    --fd-accent:  #e63946;
    --fd-accent2: #6366f1;
    --fd-hover:   #f1f3f5;
}

/* ?? Overlay ??????????????????????????????????????????????? */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1040;
}
#overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* ?? Drawer ???????????????????????????????????????????????? */
#filterDrawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(440px, 94vw);
    background: var(--fd-panel);
    border-right: 1px solid var(--fd-border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .10);
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    color: var(--fd-text);
}
#filterDrawer.open {
    transform: translateX(0);
}

/* ?? Header ???????????????????????????????????????????????? */
#filterDrawer .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--fd-border);
    position: sticky;
    top: 0;
    background: var(--fd-panel);
    z-index: 1;
}
#filterDrawer .offcanvas-header strong {
    font-size: 17px;
    font-weight: 700;
    color: var(--fd-text);
}
#filterDrawer #closeFilterBtn {
    border: 1px solid var(--fd-border);
    background: transparent;
    color: var(--fd-muted);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
#filterDrawer #closeFilterBtn:hover {
    background: var(--fd-hover);
    color: var(--fd-text);
}

/* ?? Body ??????????????????????????????????????????????????? */
#filterDrawer .offcanvas-body {
    overflow-y: auto;
    padding: 16px 18px;
    padding-bottom: 90px;
}

/* ?? Footer ???????????????????????????????????????????????? */
#filterDrawer .offcanvas-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-top: 1px solid var(--fd-border);
    background: var(--fd-panel);
    padding: 12px 18px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ?? Open button (trigger) ????????????????????????????????? */
#openFilterBtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ced4da;
    background: #fff;
    color: #212529;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    transition: background .15s, border-color .15s;
}
#openFilterBtn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}
#openFilterBtn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
#openFilterBtn .fd-chev {
    width: 14px;
    height: 14px;
    display: inline-block;
    transition: transform .18s ease;
}
#openFilterBtn[aria-expanded="true"] .fd-chev {
    transform: rotate(180deg);
}

/* ?? Form ?????????????????????????????????????????????????? */
#filterDrawer form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#filterDrawer fieldset {
    border: 1px solid var(--fd-border);
    background: var(--fd-bg);
    border-radius: 12px;
    padding: 14px;
}

#filterDrawer legend {
    padding: 0 6px;
    color: var(--fd-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ?? Inputs ???????????????????????????????????????????????? */
#filterDrawer input[type="text"],
#filterDrawer input[type="number"],
#filterDrawer select,
#filterDrawer .fd-select {
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--fd-border);
    background: var(--fd-panel2);
    color: var(--fd-text);
    outline: none;
    font-size: 14px;
    transition: border-color .15s;
}
#filterDrawer input:focus,
#filterDrawer select:focus,
#filterDrawer .fd-select:focus {
    border-color: var(--fd-accent2);
    background: #fff;
}
#filterDrawer .fd-select:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ?? Grid helpers ?????????????????????????????????????????? */
#filterDrawer .grid {
    display: grid;
    gap: 8px;
}
#filterDrawer .grid.cols-2 {
    grid-template-columns: 1fr 1fr;
}
#filterDrawer .range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: end;
}
#filterDrawer .field .muted {
    margin-top: 5px;
}
#filterDrawer .muted {
    color: var(--fd-muted);
    font-size: 13px;
}

/* ?? Checkbox / radio labely ??????????????????????????????? */
#filterDrawer .opt {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid var(--fd-border);
    border-radius: 10px;
    background: var(--fd-bg);
    cursor: pointer;
    font-size: 14px;
    transition: background .12s, border-color .12s;
}
#filterDrawer .opt input[type="checkbox"],
#filterDrawer .opt input[type="radio"] {
    accent-color: var(--fd-accent2);
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}
#filterDrawer .opt:hover {
    background: var(--fd-hover);
    border-color: #c8ced6;
}
#filterDrawer .opt:has(input:checked) {
    background: #eef2ff;
    border-color: var(--fd-accent2);
    color: var(--fd-accent2);
    font-weight: 600;
}

/* ?? Colour picker ????????????????????????????????????????? */
#filterDrawer .colors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
#filterDrawer .color-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border: 1px solid var(--fd-border);
    border-radius: 10px;
    background: var(--fd-bg);
    cursor: pointer;
    font-size: 14px;
    transition: background .12s, border-color .12s;
}
#filterDrawer .color-opt input[type="checkbox"] {
    accent-color: var(--fd-accent2);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
#filterDrawer .color-opt:hover {
    background: var(--fd-hover);
    border-color: #c8ced6;
}
#filterDrawer .color-opt:has(input:checked) {
    background: #eef2ff;
    border-color: var(--fd-accent2);
}

#filterDrawer .swatch {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, .12);
    flex-shrink: 0;
}
#filterDrawer .swatch.beige   { background: #d6c3a4; }
#filterDrawer .swatch.blue    { background: #2f6fed; }
#filterDrawer .swatch.brown   { background: #6b4a2b; }
#filterDrawer .swatch.yellow  { background: #f5c400; }
#filterDrawer .swatch.gold    { background: #c8a64b; }
#filterDrawer .swatch.grey   { background: #80889a; }  /* grey = britský pravopis dle DB */
#filterDrawer .swatch.green   { background: #2ea44f; }
#filterDrawer .swatch.orange  { background: #ff8a00; }
#filterDrawer .swatch.red     { background: #ff3b30; }
#filterDrawer .swatch.black   { background: #1b1f2a; border-color: rgba(0, 0, 0, .3); }
#filterDrawer .swatch.silver  { background: #bfc7d5; }
#filterDrawer .swatch.purple  { background: #8b5cf6; }
#filterDrawer .swatch.white   { background: #ffffff; border-color: #ced4da; }

/* ?? Pill (validační varování) ????????????????????????????? */
#filterDrawer .pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff3f3;
    color: #c0392b;
    font-size: 12px;
    border: 1px solid #f5c6cb;
    margin-top: 8px;
}

/* ?? Tlačítka footer ??????????????????????????????????????? */
#filterDrawer .btn-fd-primary {
    flex: 1;
    border: none;
    background: var(--fd-accent);
    color: #fff;
    padding: 11px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    transition: background .15s;
}
#filterDrawer .btn-fd-primary:hover {
    background: #c0392b;
}
#filterDrawer .btn-fd-reset {
    border: 1px solid var(--fd-border);
    background: var(--fd-bg);
    color: var(--fd-muted);
    padding: 11px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    transition: background .15s, color .15s;
}
#filterDrawer .btn-fd-reset:hover {
    background: var(--fd-hover);
    color: var(--fd-text);
}

/* ?? Responsive ???????????????????????????????????????????? */
@media (max-width: 520px) {
    #filterDrawer .grid.cols-2,
    #filterDrawer .range {
        grid-template-columns: 1fr;
    }
}

/* ?? Result toolbar (filtr + řazení na jednom řádku) ??????? */
.result-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.result-toolbar__left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ?? Aktivní filtry – řádek štítků ???????????????????????? */
.result-active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.result-active-filters__tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 12px;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #4338ca;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background .13s, border-color .13s;
    white-space: nowrap;
}
.result-active-filters__tag:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #312e81;
}
.result-active-filters__remove {
    font-size: 15px;
    line-height: 1;
    color: #818cf8;
    font-weight: 700;
}
.result-active-filters__clear {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid #dee2e6;
    color: #6c757d;
    font-size: 13px;
    text-decoration: none;
    transition: background .13s;
    white-space: nowrap;
}
.result-active-filters__clear:hover {
    background: #f8f9fa;
    color: #343a40;
}
