/* ============================================================
   TABLE TOOLBAR V2
   ============================================================ */

/* ============================================
   Layout
   ============================================ */
.toolbar-v2 {
    display: flex;
    align-items: center;
    background: #F7F3E8;
    border: 1px solid #EDE8D6;
    border-radius: 18px;
    padding: 6px;
    min-height: 46px;
    overflow: visible;
}

.toolbar-v2-inner {
    flex: 1;
    background: #FFFFFF;
    border-radius: 12px;
    padding: 6px 10px;
    position: relative;
    overflow: visible;
}

/* Concave curve on the right side */
/*.toolbar-v2-inner::after {
    content: '';
    position: absolute;
    right: -22px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: #F7F3E8;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}*/

.toolbar-v2-inner--no-actions::after {
    display: none;
}

.toolbar-v2-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.toolbar-v2-filters {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    flex-wrap: wrap;
}

/* ============================================
   Pill
   ============================================ */
.toolbar-v2-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 10px 0 12px;
    gap: 5px;
    background: #FFFFFF;
    border: 1px solid #E4E0D6;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    overflow: visible;
    transition: border-color .15s, background .15s;
}

.toolbar-v2-pill:hover {
    border-color: #C8C4B8;
    background: #FAFAF8;
}

.toolbar-v2-pill.is-open {
    border-color: #1A1A1A;
    z-index: 200;
}

.toolbar-v2-pill.toolbar-v2-pill-active {
    background: #F5F2E8;
    border-color: #2D2D2D;
}

.toolbar-v2-pill-label {
    font-size: 13px;
    font-weight: 500;
    color: #2D2D2D;
    pointer-events: none;
    flex-shrink: 0;
}

.toolbar-v2-pill.toolbar-v2-pill-active .toolbar-v2-pill-label {
    font-weight: 600;
}

/* Hidden by default, shown by JS when a value is selected */
.toolbar-v2-pill-value {
    display: none;
    font-size: 12.5px;
    color: #6B6665;
    pointer-events: none;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 6px;
    margin-left: 2px;
    border-left: 1px solid #DDD9CF;
}

.toolbar-v2-pill-chevron {
    font-size: 9px;
    color: #9A9693;
    pointer-events: none;
    flex-shrink: 0;
    transition: transform .18s;
}

.toolbar-v2-pill.is-open .toolbar-v2-pill-chevron {
    transform: rotate(180deg);
    color: #2D2D2D;
}

.toolbar-v2-pill.toolbar-v2-pill-active .toolbar-v2-pill-chevron {
    color: #2D2D2D;
}

/* Native elements — visually hidden */
.toolbar-v2-pill select,
.toolbar-v2-pill input[type="date"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    clip: rect(0, 0, 0, 0);
    overflow: hidden;
}

/* Selectize anchor — positions the dropdown below the pill */
.toolbar-v2-pill .selectize-control {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 0;
    overflow: visible;
    pointer-events: none;
}

.toolbar-v2-pill .selectize-input {
    visibility: hidden;
    height: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
}

/* ============================================
   Dropdown
   ============================================ */
.toolbar-v2-dropdown.selectize-dropdown {
    opacity: 1 !important;
    pointer-events: auto !important;
    position: absolute !important;
    top: 8px !important;
    left: 0 !important;
    min-width: 220px;
    background: #FFFFFF;
    border: 1px solid #E8E4DC;
    border-radius: 14px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .07), 0 12px 28px -4px rgba(0, 0, 0, .11);
    padding: 6px;
    z-index: 99999 !important;
    overflow: hidden;
}

.toolbar-v2-dropdown .selectize-input {
    visibility: visible !important;
    position: relative !important;
    display: flex !important;
    align-items: center;
    width: auto !important;
    height: auto !important;
    min-height: 34px !important;
    padding: 0 10px !important;
    margin: 0 0 5px 0 !important;
    background: #F7F5F1 !important;
    border: 1.5px solid transparent !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    cursor: text;
    overflow: visible !important;
    transition: border-color .15s, background .15s;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
}

.toolbar-v2-dropdown .selectize-input:focus-within {
    border-color: #1A1A1A !important;
    background: #FFFFFF !important;
}

.toolbar-v2-dropdown .selectize-input input {
    font-size: 13px !important;
    color: #2D2D2D !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    min-width: 100px;
}

.toolbar-v2-dropdown .selectize-input .item {
    font-size: 13px !important;
}

.toolbar-v2-dropdown .selectize-input input::placeholder {
    color: #C4C0BB !important;
}

/* Options */
.toolbar-v2-dropdown .selectize-dropdown-content {
    max-height: 220px;
    overflow-y: auto;
    padding: 0;
}

.toolbar-v2-dropdown .selectize-dropdown-content::-webkit-scrollbar {
    width: 3px;
}

.toolbar-v2-dropdown .selectize-dropdown-content::-webkit-scrollbar-thumb {
    background: #E0DDD3;
    border-radius: 4px;
}

.toolbar-v2-dropdown .option {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #2D2D2D;
    cursor: pointer;
    transition: background .1s;
}

.toolbar-v2-dropdown .option:hover,
.toolbar-v2-dropdown .option.active {
    background: #F5F2E8;
}

.toolbar-v2-dropdown .option.selected {
    background: #EDEAE0;
    font-weight: 600;
    color: #1A1A1A;
}

/* Hide the empty option (reset value) from the dropdown list */
.toolbar-v2-dropdown .option[data-value=""] {
    display: none;
}

/* ── Controls (Filtrer / Réinitialiser buttons) */
.toolbar-v2-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Action buttons (outside white zone) */
.toolbar-v2-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px 0 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

/* Responsive */
@media (max-width: 991px) {
    .toolbar-v2 {
        flex-wrap: wrap;
        gap: 4px;
    }

    .toolbar-v2-inner {
        width: 100%;
        border-radius: 12px;
        order: 1;
    }

    .toolbar-v2-inner::after {
        display: none;
    }

    .toolbar-v2-form {
        flex-wrap: wrap;
    }

    .toolbar-v2-filters {
        width: 100%;
    }

    .toolbar-v2-controls {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .toolbar-v2-actions {
        order: 2;
        width: 100%;
        padding: 0 2px 2px;
        justify-content: flex-end;
    }
}

@media (max-width: 576px) {
    .toolbar-v2-pill {
        flex: 1 1 calc(50% - 5px);
    }

    .toolbar-v2-controls .button-v2 {
        flex: 1;
    }
}