/* =========================================================
   HLAVNÍ FILTR SEKCE (kompaktní vzhled)
   ========================================================= */
.filters {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.4rem 0.7rem 0.7rem;
    margin-bottom: 1rem;
    background: #fafafa;
    transition: all 0.2s ease;
}

/* ------------------- Legend s šipkou ------------------- */
.filters > legend {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 0.2rem;
    color: #333;
    cursor: pointer;

    display: flex;
    align-items: center;
    gap: 6px;
}

/* Šipka */
.filters .toggle-arrow {
    width: 13px;
    height: 13px;
    display: inline-block;
    transition: transform 0.2s ease;
    background-size: contain;
    background-repeat: no-repeat;
    background-image: url("data:image/svg+xml;utf8,<svg width='14' height='14' xmlns='http://www.w3.org/2000/svg'><polyline points='2,5 7,10 12,5' stroke='%23666' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
}

.filters.is-opened .toggle-arrow {
    transform: rotate(180deg);
}

/* Skrytí / zobrazení formuláře */
.filters form {
    display: none;
    margin-top: 0.55rem;
}

.filters.is-opened form {
    display: block;
}

/* =========================================================
   FIELDSETY – KOMPAKTNÍ, PŘEHLEDNÉ
   ========================================================= */
.filters form fieldset {
    border: 1px solid #e4e4e4;
    padding: 0.6rem 0.7rem;
    border-radius: 4px;
    background: #fff;
    margin-bottom: 0.6rem;
}

.filters form fieldset > legend {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0 3px;
    color: #555;
}

/* =========================================================
   TABULKA → přepínáme na flex layout PRO ŘÁDKY VEDLE SEBE
   ========================================================= */
.filters table {
    width: 100%;
    border-collapse: collapse;
    display: block; /* Zrušíme table display */
}

/* TBODY jako flex kontejner pro řádky vedle sebe */
.filters tbody {
    display: flex ! important;
    flex-wrap: wrap; /* Umožní zalamování na nový řádek při nedostatku místa */
    gap: 1rem 2rem; /* mezera mezi řádky: 1rem vertikálně, 2rem horizontálně */
    align-items: flex-start;
}

/* Každý řádek (TR) bude flex item s vnitřním layoutem */
.filters tr {
    display: flex !important;
    align-items: center;
    gap: 0.4rem; /* mezera mezi label a inputem */
    flex: 0 1 auto; /* umožní flexibilní šířku, ale nezabrání zalamování */
    min-width: fit-content; /* zajistí minimální šířku podle obsahu */
}

/* THEAD pokud je potřeba (většinou se skrývá u filtrů) */
.filters thead {
    display: none; /* U filtrů obvykle nepotřebujeme hlavičku */
}

/* label (TH) */
.filters th {
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    color: #444;
    white-space: nowrap;
    font-weight: 600;
}

/* input/select buňky (TD) */
.filters td {
    padding: 0;
}

/* =========================================================
   SELECTY — malé, decentní
   ========================================================= */
.filters select {
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 120px; /* zmenšená min-width pro lepší fit */
    max-width: 200px; /* přidána max-width */
    background: #fff;
}

.filters select:focus {
    border-color: #999;
    outline: none;
}

/* =========================================================
   INPUT TEXTOVÉ POLE
   ========================================================= */
.filters input[type="text"],
.filters input[type="number"],
.filters input[type="date"] {
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 100px;
    max-width: 150px;
}

/* =========================================================
   TLAČÍTKO ODESLAT — malé, decentní
   ========================================================= */
.filters input[type="submit"],
.filters button[type="submit"],
.filters input[type="button"],
.filters button[type="button"] {
    min-width: 100px;
    width: max-content;
    max-width: 200px;
    border-radius: 3px;
    line-height: 25px !important;
    background: var(--action-button-color) !important;
    color: white;
}

.filters input[type="submit"]:hover,
.filters button[type="submit"]:hover,
.filters input[type="button"]:hover,
.filters button[type="button"]:hover {
    border-radius: 3px;
    border: 1px solid var(--action-button-color-hover);
    background: var(--action-button-color-hover) !important;
    line-height: 25px !important;

}

/* =========================================================
   SELECT2 - select2 ve filtrech
   ========================================================= */

/* Základní box */
.filters .select2-container {
    width: 220px !important;     /* pevná šířka */
    font-size: 14px;
}

/* Vnitřní select */
.filters .select2-container .select2-selection--single {
    height: 32px;                 /* menší výška */
    padding: 4px 8px;
    background-color: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all 0.15s ease-in-out;
}

/* Text uvnitř */
.filters .select2-container .select2-selection--single .select2-selection__rendered {
    color: #333;
    line-height: 22px;
    font-weight: 500;
    padding-left: 2px;
}

/* Placeholder */
.filters .select2-container .select2-selection--single .select2-selection__placeholder {
    color: #999;
}

/* Šipka */
.filters .select2-container .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 8px;
}

/* Hover efekt – decentní */
.filters .select2-container .select2-selection--single:hover {
    border-color: #a0a0a0;
}

/* Focus efekt – profesionální */
.filters .select2-container.select2-container--open .select2-selection--single,
.filters .select2-container .select2-selection--single:focus {
    border-color: #4b8fe2;
    box-shadow: 0 0 0 3px rgba(75, 143, 226, 0.2);
}

/* Dropdown menu */
.select2-container .select2-dropdown {
    border-radius: 6px;
    border-color: #ccc;
}

/* Položky v dropdownu */
.select2-results__option {
    padding: 6px 10px;
    font-size: 14px;
}

/* Hover položek */
.select2-results__option--highlighted {
    background-color: #4b8fe2 !important;
    color: white !important;
}

/* Vybraný item */
.select2-results__option[aria-selected="true"] {
    background-color: #e8f1fc;
    color: #333;
}



/* =========================================================
   RESPONSIVITA - na malých obrazovkách jeden prvek na řádek
   ========================================================= */
@media (max-width: 768px) {
    .filters tbody {
        flex-direction: column;
        gap: 0.8rem;
    }

    .filters tr {
        width: 100%;
        justify-content: space-between;
    }

    .filters select,
    .filters input[type="text"],
    .filters input[type="number"],
    .filters input[type="date"] {
        max-width: none;
        flex: 1;
        margin-left: 0.5rem;
    }
}