/* ╔══════════════════════════════════════════════════════════╗
   ║  LibExplorer — CSS Recherche avancée (Phase 4)           ║
   ║  Hero, barre, autocomplete, sidebar, grille, pagination  ║
   ╚══════════════════════════════════════════════════════════╝ */

/* ── Hero recherche ─────────────────────────────────────────────────────────── */
.search-hero {
    padding: calc(var(--nav-height) + 2.5rem) 0 2.5rem;
    background: radial-gradient(ellipse 70% 80% at 50% 0%, rgba(255,45,107,.1) 0%, transparent 70%);
    border-bottom: 1px solid var(--color-border);
}

.search-hero__title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    font-weight: 900;
    color: white;
    text-align: center;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.search-hero__title span { color: var(--color-primary); }

/* ── Barre de recherche ─────────────────────────────────────────────────────── */
.search-bar-wrap {
    display: flex;
    gap: .75rem;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
}

.search-bar {
    flex: 1;
    position: relative;
}

.search-bar__input {
    width: 100%;
    height: 52px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius-full);
    padding: 0 3rem 0 3rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: white;
    outline: none;
    transition: all .2s;
}

.search-bar__input::placeholder { color: var(--color-text-muted); }

.search-bar__input:focus {
    border-color: rgba(255,45,107,.5);
    background: rgba(255,255,255,.09);
    box-shadow: 0 0 0 4px rgba(255,45,107,.12);
}

.search-bar__icon {
    position: absolute;
    left: 1rem; top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: .9rem;
    pointer-events: none;
}

.search-bar__clear {
    position: absolute;
    right: .875rem; top: 50%;
    transform: translateY(-50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    border: none; color: white;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: .75rem;
    transition: background .15s;
}
.search-bar__clear:hover { background: rgba(255,255,255,.2); }

/* ── Autocomplétion ─────────────────────────────────────────────────────────── */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + .5rem);
    left: 0; right: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    overflow: hidden;
    animation: fadeDown .15s ease;
}

.autocomplete-section-title {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--color-text-subtle);
    padding: .75rem 1rem .35rem;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .625rem 1rem;
    cursor: pointer;
    transition: background .12s;
    text-decoration: none;
    color: inherit;
}

.autocomplete-item:hover,
.autocomplete-item[aria-selected="true"] {
    background: var(--color-bg-elevated);
}

.autocomplete-item__icon {
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-elevated);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
}

.autocomplete-item__name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: white;
}

.autocomplete-item__sub {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    display: flex; align-items: center; gap: .35rem;
}

.autocomplete-item mark {
    background: none;
    color: var(--color-primary);
    font-weight: 700;
}

.autocomplete-city .autocomplete-item__icon {
    color: var(--color-secondary);
}

/* ── Tags filtres actifs ────────────────────────────────────────────────────── */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
    margin-top: 1rem;
    min-height: 28px;
}

.filter-tag {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .3rem .75rem;
    background: rgba(255,45,107,.12);
    border: 1px solid rgba(255,45,107,.3);
    border-radius: var(--radius-full);
    font-size: .75rem; font-weight: 600;
    color: var(--color-secondary);
    cursor: pointer;
    transition: all .15s;
}
.filter-tag:hover { background: rgba(255,45,107,.2); }
.filter-tag--clear { background: rgba(255,255,255,.06); border-color: var(--color-border); color: var(--color-text-muted); }
.filter-tag--clear:hover { background: rgba(255,255,255,.1); color: white; }

/* ── Layout grille + sidebar ────────────────────────────────────────────────── */
.search-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    padding-top: 2rem;
    padding-bottom: 4rem;
    align-items: start;
    position: relative;
}

@media (max-width: 1024px) {
    .search-layout { grid-template-columns: 1fr; }
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.search-sidebar {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    position: sticky;
    top: calc(var(--nav-height) + 1rem);
    max-height: calc(100vh - var(--nav-height) - 2rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

@media (max-width: 1024px) {
    .search-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: min(320px, 90vw);
        border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.16,1,.3,1);
        z-index: 500;
        max-height: 100dvh;
    }
    .search-sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 499;
    }
    .sidebar-overlay.active { display: block; }
}

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.25rem 0;
    font-size: var(--text-sm); font-weight: 700; color: white;
    position: sticky; top: 0;
    background: var(--color-bg-card);
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    z-index: 1;
}

/* ── Section filtre ─────────────────────────────────────────────────────────── */
.filter-section {
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.25rem;
}

.filter-section:last-child { border-bottom: none; }

.filter-section__title {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--color-text-muted);
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: .875rem;
}

.filter-section__toggle {
    margin-left: auto;
    background: none; border: none;
    color: var(--color-text-subtle);
    cursor: pointer; font-size: .7rem;
    transition: transform .2s;
}
.filter-section__toggle.rotated { transform: rotate(180deg); }

.filter-section__body.collapsed { display: none; }

.filter-section__body { display: flex; flex-direction: column; gap: .35rem; }

/* ── Radio / checkbox filtres ────────────────────────────────────────────────── */
.filter-radio,
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: .625rem;
    cursor: pointer;
    padding: .35rem .5rem;
    border-radius: var(--radius-sm);
    transition: background .12s;
}
.filter-radio:hover,
.filter-checkbox:hover { background: rgba(255,255,255,.04); }

.filter-radio input,
.filter-checkbox input { accent-color: var(--color-primary); cursor: pointer; flex-shrink: 0; }

.filter-radio__label,
.filter-checkbox__label {
    flex: 1;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    display: flex; align-items: center; gap: .4rem;
    transition: color .12s;
}
.filter-radio input:checked ~ .filter-radio__label,
.filter-checkbox input:checked ~ .filter-checkbox__label { color: white; font-weight: 600; }

.filter-radio__count {
    font-size: .65rem;
    color: var(--color-text-subtle);
    min-width: 20px; text-align: right;
}

.eq-group-title {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--color-text-subtle);
    margin: .75rem 0 .25rem;
    padding-left: .25rem;
}

/* Prix pills */
.price-pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.price-pill {
    padding: .3rem .75rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: .8rem; font-weight: 700; color: var(--color-text-muted);
    cursor: pointer; transition: all .15s;
}
.price-pill.active,
.price-pill:hover { background: var(--color-primary); border-color: var(--color-primary); color: white; }

/* Bouton mobile filtres */
#filtersToggleBtn {
    display: none;
    position: relative;
}
@media (max-width: 1024px) { #filtersToggleBtn { display: flex; } }

.filters-badge {
    position: absolute;
    top: -6px; right: -6px;
    width: 18px; height: 18px;
    background: var(--color-primary);
    border-radius: 50%;
    font-size: .65rem; font-weight: 800;
    color: white;
    display: flex; align-items: center; justify-content: center;
}

/* ── Barre outils résultats ──────────────────────────────────────────────────── */
.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: .75rem;
    flex-wrap: wrap;
}

.results-toolbar__info {
    display: flex; align-items: center; gap: .6rem;
    font-size: var(--text-sm); color: var(--color-text-muted);
}

.results-toolbar__right {
    display: flex; align-items: center; gap: .75rem;
}

/* Toggle vue grille / liste / carte */
.view-toggle {
    display: flex;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.view-toggle__btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; color: var(--color-text-muted);
    background: none; border: none; cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.view-toggle__btn:hover { color: white; background: rgba(255,255,255,.06); }
.view-toggle__btn.active { color: white; background: rgba(255,255,255,.1); }

/* Select tri */
.sort-select {
    height: 36px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    padding: 0 .875rem;
    cursor: pointer;
    outline: none;
    transition: border-color .15s;
}
.sort-select:focus { border-color: rgba(255,45,107,.4); }

/* ── Loading overlay ─────────────────────────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8,8,16,.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    z-index: 50;
    animation: fadeIn .15s ease;
}

.loading-overlay__spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,45,107,.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.search-results { position: relative; }

/* ── Vue liste ───────────────────────────────────────────────────────────────── */
.cards-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cards-grid.view-list .card {
    flex-direction: row;
    max-height: 160px;
}

.cards-grid.view-list .card__image {
    width: 200px;
    height: auto;
    flex-shrink: 0;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

.cards-grid.view-list .card__footer { display: none; }

@media (max-width: 600px) {
    .cards-grid.view-list .card { flex-direction: column; max-height: none; }
    .cards-grid.view-list .card__image { width: 100%; height: 160px; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
}

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm); font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all .15s;
    padding: 0 .5rem;
}
.page-btn:hover { background: var(--color-bg-elevated); color: white; }
.page-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.page-btn:disabled { opacity: .4; cursor: default; }

.page-ellipsis {
    color: var(--color-text-subtle);
    display: flex; align-items: center;
    font-size: var(--text-sm);
    padding: 0 .35rem;
}

/* Radius buttons */
.radius-btn {
    padding: .3rem .75rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 600;
    cursor: pointer; color: var(--color-text-muted);
    transition: all .15s;
}
.radius-btn.active,
.radius-btn:hover { background: var(--color-primary); border-color: var(--color-primary); color: white; }

/* ── Animations ──────────────────────────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity:0 } to { opacity:1 } }
@keyframes fadeDown { from { opacity:0; transform:translateY(-6px) } to { opacity:1; transform:translateY(0) } }
@keyframes spin     { to   { transform:rotate(360deg) } }

/* ── Cards transition lors du rafraîchissement AJAX ─────────────────────────── */
.card-enter {
    animation: cardIn .25s ease both;
}

@keyframes cardIn {
    from { opacity:0; transform: translateY(12px); }
    to   { opacity:1; transform: translateY(0); }
}

.search-layout{display:grid;grid-template-columns:280px 1fr;gap:1.5rem;max-width:1200px;margin:0 auto;padding:0 1.5rem}
.search-sidebar{width:280px;min-width:280px}
.search-results{flex:1;min-width:0}
.filter-section{background:#1A1A2E;border:1px solid #333;border-radius:12px;padding:1rem;margin-bottom:1rem}
.filter-section__title{font-size:.85rem;font-weight:700;color:white;margin:0 0 .75rem;text-transform:uppercase;letter-spacing:.05em}
.sidebar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}
@media(max-width:768px){.search-layout{grid-template-columns:1fr}.search-sidebar{width:100\n.search-layout{display:grid;grid-template-columns:280px 1fr;gap:1.5rem;align-items:start}
.search-sidebar{width:280px;min-width:280px;max-width:280px}
.search-results{flex:1;min-width:0;overflow:hidden}
.filter-section{background:#1A1A2E;border:1px solid #333;border-radius:12px;padding:1rem;margin-bottom:1rem}
.filter-section__title{font-size:.85rem;font-weight:700;color:white;margin:0 0 .75rem;text-transform:uppercase}
.sidebar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}
@media(max-width:768px){.search-layout{grid-template-columns:1fr}.search-sidebar{width:100%;max-width:100%}}
\n.container.search-layout,.search-layout{display:grid !important;grid-template-columns:280px 1fr !important;gap:1.5rem !important;align-items:start !important}
\n.container.search-layout,.search-layout{display:grid !important;grid-template-columns:280px 1fr !important;gap:1.5rem !important;align-items:start !important;justify-content:start !important}
\n.sidebar-overlay{position:fixed !important;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:100;display:none;pointer-events:none}
\n.sidebar-overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:100;display:none}\n\n.sidebar-overlay{position:fixed !important;grid-column:none !important;top:0;left:0;width:100% !important;height:100% !important;background:rgba(0,0,0,0.5);z-index:999;display:none !important;max-width:none !important}
\n#loadingOverlay{pointer-events:none !important}

#cardsGrid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important; gap: 1.5rem !important; }
