/* ==========================================================================
   PAGE MARQUES (vue/fournisseurs.php)
   S'appuie sur les variables et composants de css/chavigny.css
   ========================================================================== */

.mq {
    background: var(--ch-white);
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.mq-head {
    padding: 22px 0 30px;
    border-bottom: 1px solid var(--ch-border);
    background: var(--ch-grey-light);
}

.mq-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    font-size: .85rem;
}

.mq-breadcrumb li {
    display: inline-flex;
    align-items: center;
    color: var(--ch-grey-dark);
}

.mq-breadcrumb li + li::before {
    content: "";
    width: 6px;
    height: 6px;
    margin: 0 12px;
    border-top: 1.5px solid var(--ch-grey);
    border-right: 1.5px solid var(--ch-grey);
    transform: rotate(45deg);
}

.mq-breadcrumb a {
    color: var(--ch-grey-dark);
    text-decoration: none;
}

.mq-breadcrumb a:hover {
    color: var(--ch-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mq-breadcrumb [aria-current] {
    color: var(--ch-text);
    font-weight: 700;
}

.mq-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 32px;
}

.mq-kicker {
    margin: 0 0 4px;
    color: var(--ch-red);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.mq-title {
    margin: 0;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    font-weight: 700;
    line-height: 1.15;
}

.mq-subtitle {
    max-width: 620px;
    margin: 10px 0 0;
    color: var(--ch-grey-dark);
    font-size: 1rem;
    line-height: 1.55;
}

.mq-stats {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mq-stats li {
    padding: 8px 16px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-grey-dark);
    font-size: .92rem;
}

.mq-stats strong {
    color: var(--ch-red);
}

.mq-body {
    padding-top: 32px;
    padding-bottom: 72px;
}

/* --------------------------------------------------------------------------
   Marques les plus représentées
   -------------------------------------------------------------------------- */
.mq-section-title {
    margin: 0 0 16px;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: 1.1rem;
    font-weight: 700;
}

.mq-top {
    margin-bottom: 36px;
}

.mq-top-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mq-top-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 20px 16px 16px;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    background: var(--ch-white);
    text-decoration: none;
    transition: border-color .2s var(--ch-ease), box-shadow .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.mq-top-card:hover,
.mq-top-card:focus-visible {
    border-color: transparent;
    box-shadow: var(--ch-shadow-lg);
    transform: translateY(-3px);
}

.mq-top-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 70px;
}

.mq-top-logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.mq-top-count {
    padding: 3px 10px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-red-soft);
    color: var(--ch-red);
    font-size: .78rem;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Barre d'outils (reste visible au défilement)
   -------------------------------------------------------------------------- */
.mq-toolbar {
    position: sticky;
    top: calc(var(--ch-header-main-h) + var(--ch-header-nav-h));
    z-index: 5;
    margin: 0 calc(var(--ch-gutter) * -1) 8px;
    padding: 14px var(--ch-gutter) 10px;
    border-bottom: 1px solid var(--ch-grey-light);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(6px);
}

.mq-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.mq-search {
    position: relative;
    flex: 1 1 280px;
    max-width: 420px;
}

.mq-search > i {
    position: absolute;
    top: 50%;
    left: 18px;
    color: var(--ch-grey);
    transform: translateY(-50%);
    pointer-events: none;
}

.mq-search-input {
    width: 100%;
    height: 46px;
    padding: 0 18px 0 46px;
    border: 1.5px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: .95rem;
    transition: border-color .2s var(--ch-ease), box-shadow .2s var(--ch-ease);
}

.mq-search-input::placeholder {
    color: var(--ch-grey);
}

.mq-search-input:focus {
    outline: none;
    border-color: var(--ch-red);
    box-shadow: 0 0 0 4px rgba(208, 52, 58, .12);
}

.mq-sort {
    display: inline-flex;
    padding: 4px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-grey-light);
}

.mq-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--ch-radius-pill);
    background: transparent;
    color: var(--ch-grey-dark);
    font-family: var(--ch-font);
    font-size: .88rem;
    cursor: pointer;
    transition: background-color .15s var(--ch-ease), color .15s var(--ch-ease), box-shadow .15s var(--ch-ease);
}

.mq-sort-btn:hover {
    color: var(--ch-red);
}

.mq-sort-btn.is-active {
    background: var(--ch-white);
    color: var(--ch-text);
    font-weight: 700;
    box-shadow: var(--ch-shadow);
}

.mq-results {
    margin: 0 0 0 auto;
    color: var(--ch-grey-dark);
    font-size: .92rem;
}

.mq-results strong {
    color: var(--ch-text);
}

/* Index alphabétique */
.mq-alpha {
    margin-top: 10px;
}

.mq-alpha ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mq-alpha-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: var(--ch-radius-sm);
    color: var(--ch-text);
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .15s var(--ch-ease), color .15s var(--ch-ease);
}

a.mq-alpha-link:hover,
a.mq-alpha-link:focus-visible,
a.mq-alpha-link.is-current {
    background: var(--ch-red);
    color: var(--ch-white);
}

.mq-alpha-link.is-empty {
    color: var(--ch-border);
    font-weight: 400;
    cursor: default;
}

.mq.is-sorted-count .mq-alpha,
.mq.is-filtering .mq-alpha {
    opacity: .4;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Groupes par lettre et grille
   -------------------------------------------------------------------------- */
.mq-group {
    padding-top: 24px;
    scroll-margin-top: calc(var(--ch-header-main-h) + var(--ch-header-nav-h) + 140px);
}

.mq-group[hidden],
.mq-item[hidden],
.mq-groups[hidden],
.mq-flat[hidden] {
    display: none;
}

.mq-letter {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 16px;
    color: var(--ch-red);
    font-family: var(--ch-font);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.mq-letter::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--ch-border);
}

.mq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mq-flat {
    padding-top: 24px;
}

.mq-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    background: var(--ch-white);
    color: var(--ch-text);
    text-decoration: none;
    overflow: hidden;
    transition: border-color .2s var(--ch-ease), box-shadow .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.mq-card:hover,
.mq-card:focus-visible {
    border-color: transparent;
    box-shadow: var(--ch-shadow-lg);
    transform: translateY(-3px);
}

.mq-card-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 110px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--ch-grey-light);
    background: var(--ch-white);
}

.mq-card-logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(.2);
    transition: filter .2s var(--ch-ease), transform .3s var(--ch-ease);
}

.mq-card:hover .mq-card-logo img {
    filter: none;
    transform: scale(1.05);
}

.mq-card-logo.is-text {
    background: var(--ch-grey-light);
}

.mq-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--ch-white);
    color: var(--ch-grey-dark);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: .04em;
    box-shadow: var(--ch-shadow);
}

.mq-card-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 44px 14px 16px;
}

.mq-card-name {
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
    transition: color .2s var(--ch-ease);
}

.mq-card:hover .mq-card-name {
    color: var(--ch-red);
}

.mq-card-count {
    color: var(--ch-grey-dark);
    font-size: .8rem;
}

.mq-card-arrow {
    position: absolute;
    right: 16px;
    bottom: 18px;
    color: var(--ch-grey);
    transition: color .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.mq-card:hover .mq-card-arrow {
    color: var(--ch-red);
    transform: translateX(4px);
}

.mq mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(208, 52, 58, .16);
    color: inherit;
}

/* --------------------------------------------------------------------------
   États vides
   -------------------------------------------------------------------------- */
.mq-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    padding: 56px 24px;
    border: 1.5px dashed var(--ch-border);
    border-radius: var(--ch-radius-lg);
    color: var(--ch-grey-dark);
    text-align: center;
}

.mq-empty[hidden] {
    display: none;
}

.mq-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--ch-grey-light);
    color: var(--ch-grey);
    font-size: 1.8rem;
}

.mq-empty p {
    max-width: 520px;
    margin: 0;
}

.mq-empty-title {
    color: var(--ch-text);
    font-size: 1.1rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.mq-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.mq-empty > .ch-btn {
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .mq-top-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    /* Header mobile : hauteur variable, la barre d'outils se colle sous la recherche */
    .mq-toolbar {
        top: 0;
        position: relative;
    }

    .mq-group {
        scroll-margin-top: 150px;
    }
}

@media (max-width: 640px) {
    .mq-head {
        padding: 16px 0 22px;
    }

    .mq-body {
        padding-top: 22px;
        padding-bottom: 48px;
    }

    .mq-top-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mq-search {
        flex-basis: 100%;
        max-width: none;
    }

    .mq-search-input {
        font-size: 16px; /* évite le zoom automatique iOS */
    }

    .mq-sort {
        flex: 1 1 auto;
    }

    .mq-sort-btn {
        flex: 1 1 0;
        justify-content: center;
        padding: 0 10px;
        font-size: .82rem;
    }

    .mq-results {
        margin-left: 0;
    }

    /* Index sur une ligne défilante */
    .mq-alpha ul {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .mq-alpha ul::-webkit-scrollbar {
        display: none;
    }

    .mq-alpha li {
        flex: 0 0 auto;
    }

    .mq-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mq-card-logo {
        height: 86px;
        padding: 12px 14px;
    }

    .mq-card-body {
        padding: 10px 12px 12px;
    }

    .mq-card-arrow {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mq-card,
    .mq-top-card,
    .mq-card-logo img {
        transition: none;
    }
}
