/*
 * Pages de rubans : ce que leur sélecteur ajoute au panneau commun (finder.css), puis la liste.
 *
 * Deux familles de classes. Les « brb- » sont propres aux rubans. Les « blf- » sont celles du panneau commun, et
 * celles que le thème nomme lui-même dans productlist.tpl et product-label-row.tpl : c'est sa convention pour une liste
 * comparable, que ce module alimente pour les étiquettes comme pour les rubans. Les deux listes ne se rencontrent
 * jamais sur une même page : chacune a sa feuille.
 */

.products-labels,
.brb-product-face {
    --brb-ink: #061F29;
    --brb-muted: #5A6E75;
    --brb-rule: #DCE3E5;
    --brb-ground: #F3F6F7;
    --brb-liner: #E5ECEE;
    --brb-label-edge: #B6C5C9;
    --brb-amber: #FCA715;
    --brb-amber-soft: #FFF2D9;
    --brb-amber-ink: #8A5300;
    --brb-ok: #22804F;
    --brb-ok-soft: #E1F3E9;
    --brb-warn: #8F5400;
    --brb-warn-soft: #FFF0D2;
    --brb-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- Sélecteur : la référence, sous les étapes du panneau commun ---------- */

/* Le raccourci de qui connaît déjà sa référence : une ligne, hors du parcours guidé */
.brb-ref {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0;
    padding: .7rem 1.5rem .8rem;
    border-top: 1px solid var(--blf-rule);
}

.brb-ref label {
    margin: 0;
    font-size: .8125rem;
    color: var(--blf-muted);
}

.brb-ref input {
    width: 10rem;
    font-family: var(--blf-mono);
}

.brb-ref-result {
    font-size: .8125rem;
    color: var(--blf-ok);
}

.brb-ref-result.is-miss {
    color: var(--blf-muted);
}

@media (max-width: 575.98px) {
    .brb-ref {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .brb-ref input {
        width: 100%;
    }
}

/* ---------- Liste comparable : classes nommées par le thème ---------- */

.products-labels a:focus-visible,
.products-labels button:focus-visible {
    outline: 3px solid var(--brb-amber);
    outline-offset: 2px;
}

/* ---------- Liste comparable ---------- */

#product-list.products-labels,
.products-labels {
    display: block !important;
    background: #fff;
    border: 1px solid var(--brb-rule);
    border-radius: 1rem;
    padding: 0 1.25rem;
    color: var(--brb-ink);
}

.blf-list-notice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin: 1rem 0 .25rem;
    padding: .65rem .9rem;
    background: var(--brb-amber-soft);
    border-radius: .6rem;
    font-size: .9375rem;
}

.blf-list-notice-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.blf-list-notice a {
    color: var(--brb-amber-ink);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blf-row {
    display: grid;
    grid-template-columns: 138px minmax(150px, 1.3fr) minmax(120px, .9fr) minmax(150px, 1.2fr) 110px 100px 150px;
    gap: .9rem;
    align-items: center;
    padding: .8rem 0;
    border-top: 1px solid var(--brb-rule);
}

.blf-group {
    margin: 0;
    padding: 1.1rem 0 .35rem;
    border-top: 1px solid var(--brb-rule);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brb-muted);
}

.blf-group + .blf-row {
    border-top: 0;
}

.blf-row--head {
    border-top: 0;
    padding: .9rem 0 .5rem;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brb-muted);
}

.blf-row--no {
    opacity: .6;
}

.blf-mono {
    font-family: var(--brb-mono);
    font-variant-numeric: tabular-nums;
}

.blf-row-format {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.blf-row-format .blf-mono {
    font-size: .8125rem;
    line-height: 1.25;
    white-space: nowrap;
}

.blf-row-format small {
    display: block;
    color: var(--brb-muted);
    font-family: inherit;
    font-size: .6875rem;
}

.blf-thumb {
    flex: 0 0 36px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blf-thumb i {
    display: block;
    background: #fff;
    border: 1px solid var(--brb-label-edge);
    border-radius: 2px;
}

/* Rubans : la photo remplace le dessin à l'échelle */
.blf-photo {
    display: block;
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border: 1px solid var(--brb-rule);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.blf-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.blf-row-product {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.blf-row-name {
    color: var(--brb-ink);
    font-weight: 700;
    text-decoration: none;
}

.blf-row-name:hover {
    text-decoration: underline;
}

.blf-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .2rem;
}

.blf-grade {
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .03em;
    padding: .05rem .45rem;
    border: 1px solid var(--brb-rule);
    border-radius: 99px;
}

.blf-grade--alt {
    background: var(--brb-amber-soft);
    border-color: transparent;
    color: var(--brb-amber-ink);
}

.blf-row-ref {
    font-family: var(--brb-mono);
    font-size: .75rem;
    color: var(--brb-muted);
}

.blf-history {
    margin-top: .25rem;
    font-size: .75rem;
    color: var(--brb-ok);
}

.blf-row-roll {
    font-size: .875rem;
    line-height: 1.35;
}

.blf-row-roll small,
.blf-row-compat small,
.blf-row-price small,
.blf-row-thousand small {
    display: block;
    color: var(--brb-muted);
    font-size: .75rem;
    line-height: 1.35;
}

.blf-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    font-weight: 700;
    padding: .1rem .55rem;
    border-radius: 99px;
    white-space: nowrap;
}

.blf-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.blf-pill--ok { background: var(--brb-ok-soft); color: var(--brb-ok); }
.blf-pill--ext { background: var(--brb-warn-soft); color: var(--brb-warn); }
.blf-pill--no { background: var(--brb-liner); color: var(--brb-muted); }
.blf-pill--unknown { background: var(--brb-liner); color: var(--brb-muted); }

.blf-row-compat small {
    margin-top: .2rem;
}

.blf-row-price,
.blf-row-thousand {
    text-align: right;
    line-height: 1.25;
}

/* Le prix payé prime ; le prix à la face (ou au mille) sert à comparer */
.blf-price {
    font-size: 1.0625rem;
    font-weight: 700;
    white-space: nowrap;
}

.blf-thousand {
    font-size: .875rem;
    font-weight: 500;
    color: var(--brb-muted);
    white-space: nowrap;
}

/* Disponibilité : une étiquette colorée se repère en parcourant la liste */
.blf-stock-tag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-top: .25rem;
    padding: .1rem .55rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}

.blf-stock-tag::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.blf-stock-tag--in {
    background: var(--brb-ok-soft);
    color: var(--brb-ok);
}

.blf-stock-tag--out {
    background: var(--brb-warn-soft);
    color: var(--brb-warn);
}

.blf-cart-form {
    display: flex;
    gap: .35rem;
    justify-content: flex-end;
    margin: 0;
}

.blf-qty {
    width: 3.6rem;
    text-align: center;
}

.blf-add {
    white-space: nowrap;
}

.blf-row-cart {
    display: flex;
    justify-content: flex-end;
}

/* ---------- Fiche produit et compte client ---------- */

.brb-product-face {
    margin: .35rem 0 0;
    font-size: .9375rem;
    color: var(--brb-ink);
}

.brb-product-face span {
    display: block;
    font-size: .8125rem;
    color: var(--brb-muted);
}

@media (max-width: 575.98px) {
    #product-list.products-labels,
    .products-labels {
        padding: 0 .85rem;
    }
    .blf-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "product thousand"
            "format price"
            "roll roll"
            "compat compat"
            "cart cart";
    }
    .blf-row-format { flex-direction: row; align-items: center; }
    .blf-row-cart { justify-content: stretch; }
    .blf-cart-form { width: 100%; }
    .blf-add { flex: 1; }
}