/* ================================
   Pop-Select (Custom Dropdown)
   Adapté Theme Fidelis
   ================================ */

.pop-select-hidden {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* --- Trigger (Bouton) --- */
.pop-select-trigger {
    position: relative;
    width: 100%;
    min-width: 120px;
    /* Une largeur minimale pour l'élégance */
    min-height: 44px;
    padding: 0.5rem 1rem;

    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);

    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    cursor: pointer;
    transition: all 0.2s ease;
}

/* État Hover */
.pop-select-trigger:hover {
    background: var(--surface-light);
    border-color: var(--text-tertiary);
}

/* État Ouvert / Focus */
.pop-select-trigger.pop-select--open,
.pop-select-trigger:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
    z-index: 10;
    /* Passe au-dessus des éléments adjacents si besoin */
}

/* Flèche */
.pop-select-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.pop-select-trigger:hover .pop-select-arrow {
    color: var(--text-secondary);
}

.pop-select-trigger.pop-select--open .pop-select-arrow {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

/* Texte (tronqué si trop long) */
.pop-select-trigger__value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* --- Variantes --- */

/* Variante "Full Width" (utile pour les formulaires verticaux) */
.pop-select--full .pop-select-trigger {
    width: 100%;
}

/* Variante "Compact" (encore plus petit pour les tableaux denses) */
.pop-select--compact .pop-select-trigger {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* --- Dropdown (Liste déroulante) --- */
.pop-select-dropdown {
    position: fixed;
    z-index: 10000;
    /* Toujours au-dessus */

    /* Largeur dynamique : au moins celle du trigger, mais peut s'agrandir */
    width: max-content;
    max-width: 90vw;
    max-height: 250px;
    overflow-y: auto;

    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* Ombre plus marquée */

    list-style: none;
    margin: 0;
    padding: 6px;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.pop-select-dropdown.pop-select--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Scrollbar */
.pop-select-dropdown::-webkit-scrollbar {
    width: 4px;
}

.pop-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.pop-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* Options */
.pop-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;

    background: transparent;
    border: none;
    border-radius: 6px;

    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;

    cursor: pointer;
    transition: all 0.15s ease;
}

.pop-select-option:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.pop-select-option.pop-select--selected {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    font-weight: 600;
}

.pop-select-option.pop-select--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    font-style: italic;
}


.pop-select-trigger {
    background-image: none !important;
    /* Retire la flèche du thème par défaut */
    padding-right: 1rem;
    /* Ajustement pour éviter un espace vide trop grand */
}