/* ================================
   Pop-Select (Custom Dropdown "flottant")
   Basé sur history.css .custom-dropdown
   ================================ */

/* Cache le <select> original tout en le gardant accessible */
.pop-select-hidden {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Le bouton qui remplace le select */
.pop-select-trigger {
    /* Styles de .pop .select (monitoring.css) */
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    width: 100%;
    
    /* Styles de .custom-dropdown-trigger (history.css) */
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-align: left;
}

/* MODIFIÉ : J'ai adapté les styles de .select de popup.css */
.cond-row__type .pop-select-trigger {
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid rgba(148, 163, 184, .4);
    background: #ffffff;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.cond-row__type .pop-select-trigger:hover {
    border-color: rgba(37, 99, 235, .3);
    box-shadow: 0 1px 3px rgba(37, 99, 235, .08);
}

.cond-row__type .pop-select-trigger:focus,
.cond-row__type .pop-select-trigger.pop-select--open {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 
        0 0 0 3px rgba(37, 99, 235, .12),
        0 1px 2px rgba(15, 23, 42, .05);
}


.pop-select-arrow {
    /* Styles de .custom-dropdown-arrow (history.css) */
    transition: transform 0.2s ease;
    color: var(--muted);
    width: 12px;
    height: 12px;
}

.pop-select-trigger.pop-select--open .pop-select-arrow {
    transform: rotate(180deg);
}

/* Le conteneur du dropdown (positionné dans le body) */
.pop-select-dropdown {
    /* Styles de .custom-dropdown-list (history.css) */
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 6px;
    
    /* STYLES "FLOTTANTS" */
    position: fixed; /* Clé pour "flotter" */
    
    /* MODIFIÉ : Augmentation du z-index pour passer au-dessus du popup (120000) */
    z-index: 130000; 
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 250px;
    overflow-y: auto;
}

.pop-select-dropdown.pop-select--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pop-select-option {
    /* Styles de .custom-dropdown-item (history.css) */
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    border-radius: 8px; /* Ajout pour un meilleur hover */
}

.pop-select-option:hover {
    background: var(--hist-hover);
    color: var(--primary);
}

.pop-select-option.pop-select--selected {
    /* Imitation du style .selected de history.js */
    background: var(--hist-hover);
    color: var(--primary);
    font-weight: 700;
}

.pop-select-indicator {
    /* Styles de .custom-dropdown-indicator (history.css) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
}

.pop-select-indicator.earn { background: rgba(16, 185, 129, 0.1); color: var(--hist-success); }
.pop-select-indicator.spend { background: rgba(239, 68, 68, 0.1); color: var(--hist-danger); }
.pop-select-indicator.all { background: rgba(100, 116, 139, 0.1); color: var(--muted); }

/* Options désactivées */
.pop-select-option.pop-select--disabled {
    opacity: 0.5;           /* Rendu grisé */
    cursor: not-allowed;    /* Curseur interdit */
    pointer-events: none;   /* Empêche tout clic (sécurité supplémentaire) */
    background-color: transparent; /* Pas de hover background */
    font-style: italic;     /* Comme demandé précédemment */
    color: var(--muted, #94a3b8);
}

/* S'assurer que le hover ne change rien sur un disabled */
.pop-select-option.pop-select--disabled:hover {
    background: none;
    color: var(--muted, #94a3b8);
}