/**
 * Custom Select Styles pour AvisLab
 * Remplace les <select> natifs pour éviter les bugs Telegram WebApp
 */

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

.custom-select-button {
    width: 100%;
    padding: 14px 40px 14px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.custom-select-button:active {
    transform: scale(0.98);
}

.custom-select.open .custom-select-button {
    background: var(--glass-strong);
    border-color: var(--primary);
}

.custom-select-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-arrow {
    position: absolute;
    right: 16px;
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    pointer-events: none;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--dark-medium);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.custom-select.open .custom-select-dropdown {
    max-height: 300px;
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
}

/* Scrollbar custom pour le dropdown */
.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

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

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Options */
.custom-select-option {
    padding: 12px 16px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.custom-select-option:hover {
    background: var(--glass);
}

.custom-select-option:active {
    background: var(--glass-strong);
}

.custom-select-option.selected {
    background: var(--glass-strong);
    color: var(--primary);
    font-weight: 600;
}

.custom-select-option.selected::before {
    content: '✓';
    position: absolute;
    right: 16px;
    color: var(--primary);
    font-weight: bold;
}

/* Animation d'entrée */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select.open .custom-select-dropdown {
    animation: slideDown 0.2s ease;
}

/* Responsive mobile */
@media (max-width: 480px) {
    .custom-select-dropdown {
        max-height: 250px;
    }
}
