/* ==========================================================================
   Accueil « place de marché » (views/home/index.php) — complète home.css.
   Structure : menu des catégories | bannière | carte d'accueil, puis puces
   de recherches populaires, catégories, produits, boutiques, appel aux
   vendeurs. Les couleurs viennent des variables --home-* posées par la vue.
   ========================================================================== */

.home-hub {
    background: var(--bg-secondary, #f6f7f9);
    padding-bottom: 1.5rem;
}

/* --- Hero en trois colonnes --------------------------------------------------- */
.hub-hero {
    padding: 1.25rem 0 0.5rem;
}

.hub-hero-grid {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 290px;
    gap: 1rem;
    align-items: stretch;
}

.hub-hero-grid--nosidebar {
    grid-template-columns: minmax(0, 1fr) 290px;
}

/* Menu des catégories */
.hub-sidebar {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
}

.hub-sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.85rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    background: var(--home-primary, #0B1B34);
    border-radius: 13px 13px 0 0;
}

.hub-side-list {
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
    flex: 1;
}

.hub-side-item {
    position: static;
}

.hub-side-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
}

.hub-side-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.hub-side-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hub-side-arrow {
    color: var(--home-muted, #888);
    font-size: 1.1rem;
}

.hub-side-item:hover > .hub-side-link,
.hub-side-item:focus-within > .hub-side-link {
    background: color-mix(in srgb, var(--home-secondary, #C9A24B) 16%, transparent);
    color: var(--home-primary, #0B1B34);
}

/* Volet des catégories d'un domaine : s'ouvre sur la bannière (survol ou clavier) */
.hub-flyout {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    z-index: 20;
    width: min(460px, 70vw);
    min-height: 100%;
    margin-left: 4px;
    padding: 1rem 1.25rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.hub-side-item:hover > .hub-flyout,
.hub-side-item:focus-within > .hub-flyout {
    display: block;
}

.hub-flyout-title {
    margin: 0 0 0.6rem;
    font-weight: 700;
    color: var(--home-primary, #0B1B34);
}

.hub-flyout ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-flyout a {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0;
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
}

.hub-flyout a:hover {
    color: var(--home-secondary, #C9A24B);
}

.hub-flyout small {
    color: var(--home-muted, #888);
}

.hub-sidebar-all {
    display: block;
    padding: 0.7rem 1rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--home-primary, #0B1B34);
    text-decoration: none;
}

/* Bannière centrale */
.hub-banner {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 420px;
    overflow: hidden;
    border-radius: 14px;
    background-color: var(--home-primary, #0B1B34);
    background-position: center;
    background-size: cover;
    color: #fff;
}

.hub-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.68) 100%);
}

.hub-banner-content {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 2rem clamp(1.25rem, 3vw, 2.25rem);
}

.hub-banner-badge {
    display: block;
    width: clamp(96px, 11vw, 150px);
    height: clamp(96px, 11vw, 150px);
    margin-bottom: 0.75rem;
    object-fit: contain;
}

.hub-banner-title {
    max-width: 24ch;
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 2.6vw, 2.3rem);
    font-weight: 800;
    line-height: 1.15;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.hub-banner-subtitle {
    max-width: 44ch;
    margin: 0 0 1.25rem;
    font-size: 1rem;
    opacity: 0.95;
}

.hub-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Carte d'accueil */
.hub-welcome {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.25rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
}

.hub-welcome-title {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--home-primary, #0B1B34);
}

.hub-welcome-btn {
    display: block;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--home-primary, #0B1B34);
    border-radius: 999px;
    background: transparent;
    color: var(--home-primary, #0B1B34);
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hub-welcome-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.hub-welcome-btn--primary {
    background: var(--home-secondary, #C9A24B);
    border-color: var(--home-secondary, #C9A24B);
    color: #0B1B34;
}

.hub-quick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 0.5rem 0 0;
    padding: 0.85rem 0 0;
    list-style: none;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.hub-quick a {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.6rem;
    border-radius: 10px;
    background: var(--bg-secondary, #f6f7f9);
    color: inherit;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.hub-quick a:hover {
    background: color-mix(in srgb, var(--home-secondary, #C9A24B) 22%, transparent);
}

/* --- Recherches populaires ----------------------------------------------------- */
.hub-chips {
    padding: 0.75rem 0;
}

.hub-chips-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.hub-chips-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--home-muted, #888);
    margin-right: 0.25rem;
}

.hub-chip {
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 999px;
    background: var(--card-bg, #fff);
    color: inherit;
    font-size: 0.85rem;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.hub-chip:hover {
    border-color: var(--home-secondary, #C9A24B);
    color: var(--home-secondary, #C9A24B);
}

/* --- Sections en blocs blancs ---------------------------------------------------- */
.home-hub .home-section > .home-container {
    padding: 1.25rem 1.5rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
}

.home-hub .home-section {
    padding: 0.75rem 0;
}

/* Pleine largeur du site : plus de plafond sur le contenu de l'accueil, seulement une marge latérale. */
.home-hub .home-container {
    max-width: none;
    padding-left: clamp(0.75rem, 1.6vw, 1.5rem);
    padding-right: clamp(0.75rem, 1.6vw, 1.5rem);
}

/* Grille de produits : 4 colonnes sur grand écran (8 produits sur deux rangées) */
.hub-products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hub-product-store {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: var(--home-muted, #888);
}

/* --- Boutiques -------------------------------------------------------------------- */
.hub-stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 0.9rem;
}

.hub-store-card {
    display: flex;
    gap: 0.85rem;
    padding: 0.9rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.hub-store-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.1);
}

.hub-store-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--home-primary, #0B1B34);
    color: #fff;
    font-weight: 700;
    font-size: 1.3rem;
    overflow: hidden;
}

.hub-store-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hub-store-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.hub-store-desc {
    font-size: 0.85rem;
    color: var(--home-muted, #888);
}

.hub-store-meta {
    font-size: 0.78rem;
    color: var(--home-muted, #888);
}

.hub-verified {
    color: #2f6b3f;
    font-weight: 700;
}

/* --- Appel aux vendeurs -------------------------------------------------------------- */
.hub-sell {
    padding: 0.75rem 0;
}

.hub-sell-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.75rem clamp(1.25rem, 3vw, 2.5rem);
    border-radius: 14px;
    background: linear-gradient(135deg, var(--home-primary, #0B1B34), #14305c);
    color: #fff;
}

.hub-sell-text h2 {
    margin: 0 0 0.5rem;
    color: #fff;
    font-size: clamp(1.3rem, 2.4vw, 1.8rem);
}

.hub-sell-text p {
    margin: 0 0 0.75rem;
    max-width: 56ch;
    opacity: 0.92;
}

.hub-sell-perks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-sell-perks li {
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(226, 194, 117, 0.55);
    border-radius: 999px;
    font-size: 0.82rem;
    color: #f3e7c3;
}

.hub-sell-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.hub-sell-link {
    color: #e7ddbf;
    font-size: 0.88rem;
}

/* --- Responsive ----------------------------------------------------------------------- */
@media (max-width: 1180px) {
    .hub-hero-grid {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .hub-hero-grid--nosidebar {
        grid-template-columns: minmax(0, 1fr);
    }

    .hub-welcome {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .hub-welcome-title {
        flex-basis: 100%;
    }

    .hub-welcome-btn {
        flex: 1 1 180px;
    }

    .hub-quick {
        flex-basis: 100%;
        grid-template-columns: repeat(4, 1fr);
    }

    .hub-products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .hub-hero-grid,
    .hub-hero-grid--nosidebar {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Mobile : le bloc des catégories est masqué (les catégories restent accessibles par les puces
       « Recherches populaires », la grille « Catégories pour vous » et le menu du site). */
    .hub-sidebar {
        display: none;
    }

    .hub-banner {
        order: -1;
        min-height: 360px;
    }

    .hub-quick {
        grid-template-columns: 1fr 1fr;
    }

    .hub-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .hub-banner {
        min-height: 380px;
        align-items: center;
        text-align: center;
    }

    .hub-banner-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hub-banner-actions {
        width: 100%;
        max-width: 400px;
        flex-wrap: nowrap;
        gap: 0.6rem;
    }

    .hub-banner-actions .home-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 48px;
        padding: 0.6rem 0.5rem;
        line-height: 1.2;
        text-align: center;
    }

    .home-hub .home-section > .home-container {
        padding: 1rem;
    }

    .hub-sell-inner {
        text-align: center;
        justify-content: center;
    }

    .hub-sell-perks {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hub-welcome-btn,
    .hub-store-card,
    .hub-chip {
        transition: none;
    }
}

/* ==========================================================================
   Disposition : rangée 1 = menu des catégories | colonnes de produits ;
   rangée 2 = bannière | carte d'accueil ; puis la suite de la liste (50 produits).
   ========================================================================== */
.hub-top {
    padding: 1.25rem 0 0.5rem;
}

.hub-top-grid {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.hub-top-grid--nosidebar {
    grid-template-columns: minmax(0, 1fr);
}

.hub-top-products {
    padding: 1rem 1.25rem 1.25rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    min-width: 0;
}

.hub-top-products .home-section-header {
    margin-bottom: 0.75rem;
}

/* Colonnes de produits à droite du menu : 5 colonnes sur ordinateur */
.hub-top-grid-products,
.hub-list-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.hub-list-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.hub-list-more {
    margin: 1.25rem 0 0;
    text-align: center;
}

.hub-list-more-btn {
    background: var(--home-primary, #0B1B34);
    color: #fff;
}

/* La rangée de la bannière réutilise .hub-hero-grid : bannière + carte d'accueil, sans colonne de menu */
.hub-hero-grid {
    grid-template-columns: minmax(0, 1fr) 290px;
}

.hub-hero-grid .hub-banner {
    min-height: 360px;
}

@media (max-width: 1180px) {
    .hub-top-grid {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .hub-top-grid-products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hub-list-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .hub-hero-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 860px) {
    .hub-top-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hub-top-grid-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hub-list-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Rangée de la bannière : plus de réordonnancement, elle suit simplement la rangée 1 */
    .hub-hero-grid .hub-banner {
        order: 0;
        min-height: 340px;
    }
}

@media (max-width: 640px) {
    .hub-list-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .hub-top-products {
        padding: 0.85rem;
    }
}

/* ==========================================================================
   Barre de recherche de la page d'accueil + synchronisation avec celle du header
   ========================================================================== */
.hub-search {
    padding: 1.1rem 0 0;
}

.hub-search-form {
    max-width: 760px;
    margin: 0 auto;
}

/* Pas d'overflow:hidden ici : le menu de suggestions (search-autocomplete.js) s'ouvre sous la barre */
.hub-search-box {
    position: relative;
    display: flex;
    align-items: stretch;
    background: var(--card-bg, #fff);
    border: 2px solid var(--home-secondary, #C9A24B);
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.hub-search-box input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 0.8rem 1.25rem;
    border: none;
    outline: none;
    background: transparent;
    border-radius: 999px 0 0 999px;
    font: inherit;
    font-size: 1rem;
    color: inherit;
}

.hub-search-box:focus-within {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--home-secondary, #C9A24B) 28%, transparent), 0 6px 18px rgba(0, 0, 0, 0.1);
}

.hub-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 3px;
    padding: 0 1.4rem;
    border: none;
    border-radius: 999px;
    background: var(--home-secondary, #C9A24B);
    color: #0B1B34;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.hub-search-btn:hover {
    filter: brightness(1.06);
}

@media (max-width: 480px) {
    .hub-search-btn-label {
        display: none;
    }

    .hub-search-btn {
        padding: 0 1rem;
    }
}

/* Header : sa barre de recherche disparaît (sans décaler la mise en page) tant que celle de l'accueil est à l'écran */
.site-header .navbar-search {
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.site-header.hub-search-in-view .navbar-search {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .site-header .navbar-search {
        transition: none;
    }
}

/* Onglets Produits / Vendeurs au-dessus de la barre de recherche (comme Alibaba) */
.hub-search-tabs {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.hub-search-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.2rem;
    border: 1.5px solid transparent;
    border-radius: 999px;
    background: var(--card-bg, #fff);
    border-color: var(--border-color, #e5e7eb);
    color: var(--home-primary, #0B1B34);
    text-decoration: none;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hub-search-tab:hover {
    border-color: var(--home-secondary, #C9A24B);
    background: color-mix(in srgb, var(--home-secondary, #C9A24B) 16%, var(--card-bg, #fff));
}


.hub-search-tab:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--home-secondary, #C9A24B) 55%, transparent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .hub-search-tab {
        transition: none;
    }
}

/* « Devenir un vendeur » : bouton d'appel, doré, parmi les raccourcis au-dessus de la recherche */
.hub-search-tab--cta {
    background: var(--home-secondary, #C9A24B);
    border-color: var(--home-secondary, #C9A24B);
    color: #0B1B34;
}

.hub-search-tab--cta:hover {
    background: color-mix(in srgb, var(--home-secondary, #C9A24B) 86%, #000);
    border-color: color-mix(in srgb, var(--home-secondary, #C9A24B) 86%, #000);
}

@media (max-width: 480px) {
    .hub-search-tabs {
        flex-wrap: wrap;
    }

    .hub-search-tab {
        padding: 0.4rem 0.9rem;
        font-size: 0.88rem;
    }
}
