/* ======================================================================
   Barre de recherche Hero – Design final avec expansion fluide
   ====================================================================== */

/* --- Conteneur principal --- */
.tv-search {
    max-width: 600px;
    margin: 0 auto 2rem;
    font-family: 'Inter Tight', sans-serif;
    position: relative;
    z-index: 10;
}

/* --- Barre blanche (fermée ou ouverte) --- */
.tv-search__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 60px;                     /* très arrondi par défaut */
    padding: 8px 12px;
    transition: border-radius 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
    z-index: 2;
}

/* Barre quand le panneau de suggestions est actif : les coins du bas deviennent droits */
.tv-search--active .tv-search__bar {
    border-radius: 24px 24px 0 0;
    box-shadow: none;                        /* on enlève l'ombre pour laisser celle du panneau */
}

/* --- Zone de saisie (gris clair) --- */
.tv-search__input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
    border-radius: 50px;
    padding: 0 16px;
    height: 44px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tv-search__input-wrapper:focus-within {
    border-color: #d2d2d2;
    box-shadow: 0 0 0 2px rgba(217, 122, 53, 0.15);
}

/* Icône loupe */
.tv-search__icon-loupe {
    color: #bbb;
    flex-shrink: 0;
}

/* Champ de saisie */
.tv-search__input {
    width: 100%;
    border: none !important;
    background: transparent !important;
    font-size: 1rem !important;
    color: #555 !important;
    padding: 8px 0 !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    font-family: 'Inter Tight', sans-serif;
}

.tv-search__input::placeholder {
    color: #777 !important;
    font-size: 1rem !important;
    opacity: 1;
}

/* --- Bouton micro (gris discret) --- */
.tv-search__voice {
    color: #bbb !important;
    background: none !important;
    border: none !important;
    padding: 6px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem !important;
    border-radius: 50% !important;
    height: 44px;
    width: 44px;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.tv-search__voice:hover {
    background-color: #f5f5f5 !important;
    color: #D97A35 !important;
}

/* --- Pilule filtre "Tous" --- */
.tv-search__filter-btn {
    background: #ffffff !important;
    border: 1px solid #e8e8e8 !important;
    font-size: 0.9rem !important;
    color: #888 !important;
    font-weight: 400 !important;
    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px;
    height: 44px;
    box-sizing: border-box;
    border-radius: 50px !important;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.tv-search__filter-btn:hover {
    background: #fafafa !important;
}

/* Icône caret dans le filtre */
.tv-search__filter-btn i {
    font-size: 0.9rem;
    color: #888;
    vertical-align: middle;
}

/* --- Bouton Rechercher (orange) --- */
.tv-search__submit-btn {
    background: #D97A35 !important;
    color: #fff !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    padding: 0 20px !important;
    border-radius: 50px !important;
    border: none !important;
    height: 44px;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-search__submit-btn:hover {
    background: #c0682e !important;
}

/* --- Tags des catégories sélectionnées --- */
.tv-search__tags {
    margin: 0;                  /* plus de marge intempestive quand vide */
    padding: 0 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Espace uniquement quand des tags sont présents */
.tv-search__tags:not(:empty) {
    margin-top: 10px;
}

.tv-search__tag {
    background: #D97A35;
    color: #fff;
    border-radius: 50px;
    padding: 4px 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tv-search__tag-remove {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

.tv-search__tag-remove:hover {
    opacity: 0.8;
}

/* --- Dropdown de filtre (catégories) --- */
.tv-search__filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-top: none;
    border-radius: 0 0 16px 16px;
    padding: 16px;
    margin-top: 0 !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    display: none;
    z-index: 3;
}

.tv-search__filter-dropdown.is-open {
    display: block;
}

.tv-search__filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.tv-search__filter-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.tv-search__filter-actions {
    display: flex;
    justify-content: space-between;
}

.tv-search__filter-clear-all,
.tv-search__filter-apply {
    background: none;
    border: 1px solid #e0dcd5;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tv-search__filter-clear-all:hover {
    background: #f5f5f5;
}

.tv-search__filter-apply {
    background: #D97A35;
    color: #fff;
    border-color: #D97A35;
}

.tv-search__filter-apply:hover {
    background: #c0682e;
}

/* --- Panneau de suggestions (collé à la barre) --- */
.tv-search__suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-top: none;
    border-radius: 0 0 24px 24px;           /* même arrondi que le bas de la barre ouverte */
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    display: none;
    z-index: 3;
    flex-direction: column;
    max-height: 420px;
    overflow: hidden;
    margin-top: 0 !important;
}

/* Affichage du panneau quand actif */
.tv-search--active .tv-search__suggestions {
    display: flex;
}

/* Liste des résultats scrollable */
.tv-search__results {
    overflow-y: auto;
    padding: 8px 0;
    flex: 1;
}

/* Item de suggestion */
.tv-search__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    text-decoration: none;
    color: #332822;
    transition: background 0.2s;
}

.tv-search__item:hover,
.tv-search__item[aria-selected="true"] {
    background: #f9f7f4;
}

.tv-search__item-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f0f0;
}

.tv-search__item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv-search__item-content {
    flex: 1;
    overflow: hidden;
}

.tv-search__item-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.tv-search__item-title mark {
    background: rgba(217,122,53,0.2);
    color: #D97A35;
    font-weight: 700;
    border-radius: 2px;
    padding: 0 2px;
}

.tv-search__item-excerpt {
    font-size: 0.78rem;
    color: #8A7B72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-top: 2px;
}

/* Cache l'image pour les pages (optionnel) */
.tv-search__item--page .tv-search__item-img {
    display: none;
}

/* --- Footer du panneau --- */
.tv-search__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    border-top: 1px solid rgba(0,0,0,0.05);
    font-size: 0.8rem;
}

.tv-search__count {
    color: #8A7B72;
}

.tv-search__view-all {
    color: #D97A35;
    font-weight: 600;
    text-decoration: none;
}

.tv-search__view-all:hover {
    text-decoration: underline;
}

/* Message "Aucun résultat" */
.tv-search__empty {
    padding: 24px;
    text-align: center;
    color: #8A7B72;
    font-style: italic;
}

/* --- Responsive mobile --- */
@media (max-width: 640px) {
    .tv-search {
        max-width: 100%;
    }
    .tv-search__bar {
        flex-wrap: wrap;
        padding: 10px;
    }
    .tv-search__filter-btn {
        margin-left: 0;
        margin-top: 8px;
    }
    .tv-search__submit-btn {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        text-align: center;
    }
    .tv-search__voice {
        margin-right: 0;
    }
}