/* ==========================================================================
   HT-SELECT — Select premium mobile-first
   Single y multi-select con overlay bottom sheet.
   Requiere: ht-overlay.css
   ========================================================================== */

/* --- Trigger (reemplaza el <input> original) ----------------------------- */
.ht-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    padding: 12px var(--spacing-md);
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 46px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ht-select:hover {
    border-color: var(--color-border-strong);
}

.ht-select:focus-visible {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.ht-select--open {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

/* --- Texto mostrado ------------------------------------------------------ */
.ht-select__display {
    font-family: var(--font-family-body);
    font-size: var(--text-base);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-heading);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ht-select__display--placeholder {
    color: var(--color-text-muted);
}

/* --- Pills (multi-select) ------------------------------------------------ */
.ht-select__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.ht-select__pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-success-soft);
    color: var(--color-success-dark);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    padding: 3px 8px 3px 10px;
    max-width: 140px;
}

.ht-select__pill-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ht-select__pill-remove {
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- Icono chevron ------------------------------------------------------- */
.ht-select__arrow {
    font-size: 20px;
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ht-select--open .ht-select__arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   OVERLAY CONTENT — Lista de opciones
   ========================================================================== */

/* --- Search -------------------------------------------------------------- */
.ht-select__search-wrap {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--color-border-light);
    position: sticky;
    top: 0;
    background: var(--color-bg-card);
    z-index: 1;
}

.ht-select__search {
    width: 100%;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 9px var(--spacing-md) 9px 36px;
    font-family: var(--font-family-body);
    font-size: var(--text-sm);
    color: var(--color-text-heading);
    outline: none;
    transition: var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.ht-select__search:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

/* --- Lista de opciones --------------------------------------------------- */
.ht-select__list {
    list-style: none;
    margin: 0;
    padding: var(--spacing-xs) 0;
}

.ht-select__item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 14px var(--spacing-md);
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ht-select__item:active {
    background: var(--color-bg-subtle);
}

.ht-select__item--selected {
    background: var(--color-success-soft);
}

.ht-select__item--empty {
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    cursor: default;
}

/* --- Icono check --------------------------------------------------------- */
.ht-select__item-check {
    font-size: 20px;
    color: var(--color-success);
    opacity: 0;
    flex-shrink: 0;
    margin-left: auto;
    transition: opacity 0.15s ease;
}

.ht-select__item--selected .ht-select__item-check {
    opacity: 1;
}

/* --- Icono decorativo (emoji o SVG) ------------------------------------ */
.ht-select__item-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ht-select__item-icon svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Texto del item ------------------------------------------------------ */
.ht-select__item-text {
    font-family: var(--font-family-body);
    font-size: var(--text-base);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-heading);
    flex: 1;
}

.ht-select__item--selected .ht-select__item-text {
    font-weight: var(--font-weight-semibold);
    color: var(--color-success-dark);
}

/* --- Separador de grupo -------------------------------------------------- */
.ht-select__separator {
    height: 1px;
    background: var(--color-border-light);
    margin: var(--spacing-xs) var(--spacing-md);
}

/* --- Botón confirmar (multi-select) ------------------------------------- */
.ht-select__confirm {
    width: 100%;
    border: none;
    border-radius: var(--radius-button);
    padding: 14px var(--spacing-md);
    font-family: var(--font-family-heading);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--color-success);
    color: var(--color-success-text);
    box-shadow: 0 4px 12px var(--color-success-shadow);
}

.ht-select__confirm:hover {
    background: var(--color-success-hover);
}
