/* ========================================
   CUSTOM SELECT - Hezká roletka
   Nahrazuje nativní <select> vlastním dropdownem
   Dropdown je position:fixed v <body> - nebude oříznutý overflow
   BEM, MOBILE FIRST
   ======================================== */

/* ---- Wrapper ---- */
.custom-select {
    position: relative;
    width: 100%;
}

/* ---- Trigger tlacitko ---- */
.custom-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    padding-right: 36px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    color: #374151;
    background-color: #fff;
    border: 2px solid transparent;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    min-height: 46px;
    box-sizing: border-box;
}

.custom-select__trigger::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    transition: transform 0.2s;
}

.custom-select--open .custom-select__trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select__trigger:hover {
    border-color: #f97316;
    box-shadow: 0 2px 12px rgba(249, 115, 22, 0.15);
}

.custom-select--open .custom-select__trigger {
    border-color: #f97316;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Placeholder stav */
.custom-select__trigger--placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Disabled stav */
.custom-select--disabled .custom-select__trigger {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.custom-select--disabled .custom-select__trigger:hover {
    border-color: transparent;
    box-shadow: none;
}

/* ---- Dropdown (position:fixed v body) ---- */
.custom-select__dropdown {
    display: none;
    position: fixed;
    z-index: 9999;
    border: 2px solid #f97316;
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 260px;
    overflow: hidden;
    flex-direction: column;
    box-sizing: border-box;
}

/* ---- Vyhledavani ---- */
.custom-select__search-wrap {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.custom-select__search {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #374151;
    background: #f9fafb;
    box-sizing: border-box;
}

.custom-select__search:focus {
    outline: none;
    border-color: #f97316;
    background: #fff;
}

.custom-select__search::placeholder {
    color: #9ca3af;
}

/* ---- Seznam polozek ---- */
.custom-select__list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    flex: 1;
}

.custom-select__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 14px;
    color: #374151;
}

.custom-select__option:hover {
    background: #fff7ed;
}

.custom-select__option--active {
    background: #fff7ed;
    color: #ea580c;
    font-weight: 600;
}

.custom-select__option--placeholder {
    color: #9ca3af;
    font-style: italic;
    border-bottom: 1px solid #f3f4f6;
}

.custom-select__option--disabled {
    color: #9ca3af;
    cursor: default;
    font-style: italic;
}

.custom-select__option--disabled:hover {
    background: transparent;
}

.custom-select__option--hidden {
    display: none;
}

/* ---- Mobilní overlay ---- */
.custom-select__mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.4);
}

.custom-select__mobile-overlay--visible {
    display: block;
}

/* ---- Skupina (optgroup label) ---- */
.custom-select__group {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
    user-select: none;
}

.custom-select__group:not(:first-child) {
    margin-top: 4px;
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
}

/* ---- Oddělovač (divider) ---- */
.custom-select__divider {
    padding: 10px 14px 6px;
    font-size: 11px;
    font-weight: 700;
    color: #f97316;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
    user-select: none;
    margin-top: 4px;
    border-top: 2px solid #fed7aa;
    background: #fffbeb;
}

/* Varianta uvnitr modalu - aby trigger pasoval k ostatnim polem */
.health-entry-modal .custom-select__trigger {
    border: 1px solid #d1d5db;
    box-shadow: none;
    padding: 10px 14px;
    padding-right: 36px;
    min-height: 42px;
}

.health-entry-modal .custom-select__trigger:hover {
    border-color: #f97316;
    box-shadow: none;
}

.health-entry-modal .custom-select--open .custom-select__trigger {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* ========================================
   TABLET (768px+)
   ======================================== */
@media (min-width: 768px) {
    .health__toolbar .custom-select,
    .shows__toolbar .custom-select,
    .trials__toolbar .custom-select {
        width: auto;
        min-width: 180px;
    }
}

@media (min-width: 1024px) {
    .health__toolbar .custom-select,
    .shows__toolbar .custom-select,
    .trials__toolbar .custom-select {
        min-width: 220px;
    }
}

/* Varianta uvnitr trials-modal */
.trials-modal .custom-select__trigger {
    border: 1px solid #d1d5db;
    box-shadow: none;
    padding: 10px 14px;
    padding-right: 36px;
    min-height: 42px;
}

.trials-modal .custom-select__trigger:hover {
    border-color: #f97316;
    box-shadow: none;
}

.trials-modal .custom-select--open .custom-select__trigger {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* Varianta uvnitr show-entry-modal */
.show-entry-modal .custom-select__trigger {
    border: 1px solid #d1d5db;
    box-shadow: none;
    padding: 10px 14px;
    padding-right: 36px;
    min-height: 42px;
}

.show-entry-modal .custom-select__trigger:hover {
    border-color: #f97316;
    box-shadow: none;
}

.show-entry-modal .custom-select--open .custom-select__trigger {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}
