/* ============================================================
   CitySelect - Dropdown ville avec barre de recherche
   PrestaShop 8.2 - Compatible tous thèmes
   ============================================================ */

/* Masquer le select natif */
.cityselect-hidden {
    display: none !important;
}

/* Conteneur principal */
.cityselect-wrapper {
    position: relative;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

/* Bouton déclencheur */
.cityselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    min-height: 38px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    color: #495057;
}

.cityselect-trigger:hover {
    border-color: #adb5bd;
}

.cityselect-trigger.open {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.cityselect-trigger .cityselect-placeholder {
    color: #6c757d;
    flex: 1;
}

.cityselect-trigger .cityselect-selected-text {
    flex: 1;
    color: #495057;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Flèche */
.cityselect-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #6c757d;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.cityselect-trigger.open .cityselect-arrow {
    transform: rotate(180deg);
}

/* Dropdown panel */
.cityselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #80bdff;
    border-top: none;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    max-height: 360px;
    overflow: hidden;
}

.cityselect-dropdown.open {
    display: flex;
}

/* Zone de recherche */
.cityselect-search-box {
    padding: 8px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

.cityselect-search-input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 8px center;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
    color: #495057;
}

.cityselect-search-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.2);
}

.cityselect-search-input::placeholder {
    color: #adb5bd;
}

/* Liste des villes */
.cityselect-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    max-height: 280px;
    flex: 1;
}

.cityselect-list::-webkit-scrollbar {
    width: 6px;
}

.cityselect-list::-webkit-scrollbar-track {
    background: #f1f3f5;
}

.cityselect-list::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}

/* Items de la liste */
.cityselect-option {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #495057;
    transition: background 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cityselect-option:hover {
    background: #e8f4fd;
    color: #004085;
}

.cityselect-option.selected {
    background: #007bff;
    color: #fff;
    font-weight: 600;
}

.cityselect-option.selected:hover {
    background: #0069d9;
}

/* Option "--" désactivée */
.cityselect-option[data-value="0"] {
    color: #adb5bd;
    font-style: italic;
}

/* Aucun résultat */
.cityselect-no-results {
    padding: 12px 14px;
    color: #6c757d;
    font-size: 13px;
    text-align: center;
    font-style: italic;
}

/* Highlight de la recherche */
.cityselect-option mark {
    background: #fff3cd;
    color: #856404;
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 700;
}

/* Adaptation pour supercheckout et thèmes */
.supercheckout-large-field + .cityselect-wrapper,
.form-control + .cityselect-wrapper {
    display: block;
}

/* Responsive mobile */
@media (max-width: 576px) {
    .cityselect-dropdown {
        max-height: 280px;
    }

    .cityselect-list {
        max-height: 200px;
    }

    .cityselect-trigger {
        font-size: 15px;
        min-height: 42px;
    }
}

/* Animation d'ouverture */
@keyframes cityselect-fadein {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cityselect-dropdown.open {
    animation: cityselect-fadein 0.15s ease forwards;
}
