/* ===================================
   Akram Nutrition — couche de finition
   Chargée APRÈS main.css. Ne change ni la palette ni les polices :
   orange #FF8A00, onyx #0A0A0C, Outfit + Inter restent la signature.
   Elle traite ce qui manquait : accessibilité, états de chargement,
   états vides, retours visuels, confort tactile et impression.
   =================================== */

/* ─────────────────────────────────────────────
   0. Attribut hidden — à garder en tête de fichier
   ───────────────────────────────────────────── */

/* `hidden` ne masque un élément que via la feuille de style du navigateur.
   La moindre règle d'auteur posant un `display` la remporte : `.tbchat-fenetre`
   avait `display: flex`, et la fenêtre de discussion restait donc visible même
   après un clic sur la croix. Cette règle rend l'attribut fiable partout. */
[hidden] { display: none !important; }

/* ─────────────────────────────────────────────
   0 bis. Sélecteur de langue et sens de lecture
   ───────────────────────────────────────────── */

.tblang { position: relative; }

.tblang__bouton {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.7rem;
    min-height: 40px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: transparent;
    color: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.tblang__bouton:hover { border-color: var(--primary-color); color: var(--primary-color); }
.tblang__code { letter-spacing: 0.04em; }

.tblang__menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: 170px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    z-index: 1000;
    list-style: none;
    margin: 0;
}
.tblang__menu button {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: start;
    background: transparent;
}
.tblang__menu button:hover { background: var(--bg-surface); }
.tblang--actif { background: var(--primary-soft) !important; color: var(--primary-dark); }

/* ── Arabe : miroir de la mise en page ──
   Les blocs suivent `dir=rtl` tout seuls, mais les décalages écrits en
   `left`/`right` et les alignements figés doivent être repris un par un. */

[dir="rtl"] body { text-align: right; }

/* Les nombres, prix et codes restent en lecture latine même en RTL. */
[dir="rtl"] .current-price,
[dir="rtl"] .old-price,
[dir="rtl"] .total-amount,
[dir="rtl"] .order-number,
[dir="rtl"] .stat-value,
[dir="rtl"] .coach-stat__value,
[dir="rtl"] .gerance-stat__value,
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] code {
    direction: ltr;
    unicode-bidi: embed;
}

[dir="rtl"] .breadcrumb,
[dir="rtl"] .cart-item,
[dir="rtl"] .coach-meal__head,
[dir="rtl"] .tbchat-produit { flex-direction: row-reverse; }

[dir="rtl"] .coach-session { border-left: none; border-right: 3px solid var(--primary-color); }
[dir="rtl"] .coach-resume  { border-left: none; border-right: 3px solid var(--primary-color);
                             padding-left: 0; padding-right: 0.9rem; }
[dir="rtl"] .gerance-stat  { border-left: none !important;
                             border-right: 4px solid var(--primary-color); }

/* La bulle de discussion passe à gauche, et les bulles s'inversent. */
[dir="rtl"] #tbChat { right: auto; left: 1.25rem; }
[dir="rtl"] .tbchat-fenetre { right: auto; left: 0; }
[dir="rtl"] .tbchat-msg--client { align-self: flex-start; align-items: flex-start; }
[dir="rtl"] .tbchat-msg--bot    { align-self: flex-end; }
[dir="rtl"] .tbchat-meal__kcal,
[dir="rtl"] .tbchat-produit__prix s { margin-left: 0; margin-right: 5px; }

[dir="rtl"] .skip-link { left: auto; right: 1rem; }
[dir="rtl"] .tb-notif  { right: auto !important; left: 20px !important;
                         border-left: none !important;
                         border-right: 4px solid var(--primary-color) !important; }

/* La barre latérale de l'administration bascule de l'autre côté. */
[dir="rtl"] .admin-sidebar { left: auto; right: 0; }
[dir="rtl"] .admin-main    { margin-left: 0; margin-right: var(--sidebar-width, 260px); }

@media (max-width: 480px) {
    [dir="rtl"] #tbChat { left: 1rem; }
}

/* ─────────────────────────────────────────────
   1. Accessibilité
   ───────────────────────────────────────────── */

/* Un anneau de focus visible au clavier — mais jamais à la souris.
   Sans lui, la navigation au Tab était invisible sur tout le site. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
:where(a, button, input, select, textarea):focus:not(:focus-visible) {
    outline: none;
}

/* Lien d'évitement : premier élément tabulable de chaque page. */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 10000;
    padding: 0.85rem 1.5rem;
    background: var(--dark-base);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    transition: top var(--transition-base);
}
.skip-link:focus { top: 0; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Respect du réglage système « réduire les animations ». */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ─────────────────────────────────────────────
   2. Chargement — squelettes plutôt qu'écran vide
   ───────────────────────────────────────────── */

@keyframes tb-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-surface) 25%,
        #ECECEE 50%,
        var(--bg-surface) 75%);
    background-size: 600px 100%;
    animation: tb-shimmer 1.4s linear infinite;
    border-radius: var(--radius-md);
    pointer-events: none;
}

.skeleton-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-white);
}
.skeleton-card .skeleton-image  { aspect-ratio: 1 / 1; border-radius: 0; }
.skeleton-card .skeleton-body   { padding: 1.25rem; display: grid; gap: 0.7rem; }
.skeleton-card .skeleton-line   { height: 0.85rem; }
.skeleton-card .skeleton-line.w-40 { width: 40%; }
.skeleton-card .skeleton-line.w-70 { width: 70%; }
.skeleton-card .skeleton-line.w-55 { width: 55%; }
.skeleton-card .skeleton-btn    { height: 2.75rem; margin-top: 0.35rem; }

/* Bouton en cours de traitement : largeur figée, plus de saut de mise en page. */
.btn[disabled], .btn.is-loading {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─────────────────────────────────────────────
   3. États vides
   ───────────────────────────────────────────── */

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
    padding: clamp(2.5rem, 8vw, 5rem) 1.5rem;
}

.empty-state__icon {
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 2.1rem;
    margin-bottom: 0.35rem;
}

.empty-state__title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.empty-state__text {
    color: var(--text-secondary);
    max-width: 46ch;
    line-height: 1.65;
}

.empty-state .btn { margin-top: 0.85rem; }

/* ─────────────────────────────────────────────
   4. Cartes produit
   ───────────────────────────────────────────── */

.product-card {
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.product-card:hover { transform: translateY(-4px); }
.product-card .product-info { flex: 1; display: flex; flex-direction: column; }

/* Rapport d'image constant : une fiche mal cadrée ne déforme plus la grille. */
.product-image-wrapper { aspect-ratio: 1 / 1; overflow: hidden; }
.product-image-wrapper .product-image {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}
.product-card:hover .product-image { transform: scale(1.05); }

/* Le titre occupe deux lignes maximum : les boutons restent alignés. */
.product-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

/* Le bouton se colle en bas quelle que soit la longueur du titre. */
.btn-add-cart { margin-top: auto; }

.badge-out { background: var(--text-muted) !important; }

/* ─────────────────────────────────────────────
   5. Formulaires
   ───────────────────────────────────────────── */

.form-control {
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-soft);
    outline: none;
}
.form-control:disabled {
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Champ signalé invalide par le script, jamais par :invalid seul —
   sinon tout le formulaire s'affiche en rouge avant la première saisie. */
.form-control.is-invalid {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px var(--error-soft);
}

.field-error {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--error-color);
}

.form-group label .required { color: var(--primary-color); }

/* Le mode livraison en bureau, désactivé quand la commune n'a pas de relais. */
.delivery-option:has(input:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}
.delivery-option:has(input:checked) {
    border-color: var(--primary-color);
    background: var(--primary-soft);
}

/* ─────────────────────────────────────────────
   6. Confort tactile et mobile
   ───────────────────────────────────────────── */

@media (max-width: 768px) {
    /* Cible tactile minimale recommandée : 44 px. */
    .btn, .qty-btn, .cart-item-remove, .quick-action-btn,
    .mobile-menu-toggle, .size-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Encoches et barres système des téléphones récents. */
    body { padding-bottom: env(safe-area-inset-bottom); }
    .container { padding-inline: 1.15rem; }

    /* Empêche le zoom automatique d'iOS à la mise au point d'un champ. */
    input, select, textarea { font-size: 16px; }
}

/* Les tableaux de l'admin défilent au lieu de déborder de l'écran. */
.data-table { min-width: 640px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─────────────────────────────────────────────
   6 bis. État des clés de services externes
   ───────────────────────────────────────────── */

.secret-status {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    line-height: 1.5;
    min-height: 1.2rem;
}
.secret-status code {
    background: var(--bg-surface);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}

/* ─────────────────────────────────────────────
   7. Indicateur de tarif de livraison
   ───────────────────────────────────────────── */

.price-source {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.price-source--live     { background: var(--success-soft); color: #15803D; }
.price-source--fallback { background: rgba(245, 158, 11, 0.12); color: #B45309; }

/* ─────────────────────────────────────────────
   7 bis. Images choisies dans l'administration
   ───────────────────────────────────────────── */

/* Bandeau d'accueil — l'image et l'opacité du voile arrivent en variables
   posées par app.js, jamais en CSS écrit à la volée. */
.hero-section.has-image {
    background-image:
        linear-gradient(
            rgba(10, 10, 12, var(--hero-overlay, 0.55)),
            rgba(10, 10, 12, var(--hero-overlay, 0.55))
        ),
        var(--hero-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Sur mobile, `fixed` casse le défilement sur iOS : on ne l'active qu'au-delà
   du tactile, et jamais si l'utilisateur limite les animations. */
@media (min-width: 1025px) and (prefers-reduced-motion: no-preference) {
    .hero-section.has-image { background-attachment: fixed; }
}

/* Vignettes de catégories avec photo */
.category-card {
    position: relative;
    display: block;
    overflow: hidden;
    isolation: isolate;
}

.category-card.has-image::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: var(--card-image);
    background-size: cover;
    background-position: center;
    transition: transform var(--transition-slow);
}
.category-card.has-image:hover::before { transform: scale(1.06); }

/* Voile dégradé : le titre blanc reste lisible sur n'importe quelle photo. */
.category-card.has-image::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        180deg,
        rgba(10, 10, 12, 0.15) 0%,
        rgba(10, 10, 12, 0.55) 55%,
        rgba(10, 10, 12, 0.88) 100%);
}

.category-card.has-image .category-content h3,
.category-card.has-image .category-content p,
.category-card.has-image .category-link {
    color: #FFFFFF;
    position: relative;
}
.category-card.has-image .category-content p { opacity: 0.9; }

/* Aperçu d'image dans les formulaires d'administration */
.image-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-surface) center / cover no-repeat;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    overflow: hidden;
}
.image-preview.square { aspect-ratio: 1 / 1; }

/* ─────────────────────────────────────────────
   7 ter. Coach — formulaire et programme
   ───────────────────────────────────────────── */

.coach-form { max-width: 860px; margin: 0 auto; }

.coach-block {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--bg-white);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
}
.coach-block legend {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.05rem;
    text-transform: uppercase;
    padding: 0 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.coach-step {
    display: grid;
    place-items: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.82rem;
}

.coach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.1rem;
}

.coach-choices { display: flex; gap: 0.75rem; }
.coach-choices--wrap { flex-wrap: wrap; }

/* Le bouton radio est masqué mais reste focusable : la navigation clavier
   fonctionne, et l'état sélectionné se lit sur l'étiquette. */
.coach-choice { flex: 1; min-width: 150px; cursor: pointer; }
.coach-choice input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
}
.coach-choice span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    min-height: 48px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-weight: 700;
    text-align: center;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.coach-choice input:checked + span {
    border-color: var(--primary-color);
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.coach-choice input:focus-visible + span {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}
.coach-choice--card span { flex-direction: column; gap: 0.4rem; padding: 1.1rem 0.75rem; }
.coach-choice--card i { font-size: 1.4rem; color: var(--primary-color); }

.coach-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
    margin-top: 0.85rem;
}

/* ── Résultat ── */

.coach-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    max-width: 860px;
    margin-inline: auto;
}
.coach-card--split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.coach-title {
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.coach-title i { color: var(--primary-color); }
.coach-subtitle {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 0.7rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.coach-subtitle i { color: var(--primary-color); }

.coach-resume {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.25rem;
    padding-left: 0.9rem;
    border-left: 3px solid var(--primary-color);
}

.coach-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.85rem;
}
.coach-stat {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 0.75rem;
    text-align: center;
}
.coach-stat--main {
    background: var(--dark-base);
    border-color: var(--dark-base);
}
.coach-stat--main .coach-stat__value { color: var(--primary-color); font-size: 2rem; }
.coach-stat--main .coach-stat__label { color: rgba(255, 255, 255, 0.75); }

.coach-stat__value {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1.1;
}
.coach-stat__label {
    display: block;
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.3rem;
}

.coach-meta { color: var(--text-secondary); font-size: 0.9rem; margin-top: 1rem; }
.coach-warning {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid #FDE68A;
    border-radius: var(--radius-md);
    color: #92400E;
    font-size: 0.88rem;
}

.coach-macro { margin-bottom: 1.1rem; }
.coach-macro__head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.coach-macro__head span span { color: var(--text-muted); font-weight: 400; }
.coach-macro__bar {
    height: 10px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.coach-macro__bar div { height: 100%; border-radius: var(--radius-full); }

.coach-meals { display: grid; gap: 0.85rem; }
.coach-meal {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    background: var(--bg-light);
}
.coach-meal__head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.coach-meal__time {
    background: var(--dark-base);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
}
.coach-meal__kcal {
    margin-left: auto;
    color: var(--primary-color);
    font-weight: 800;
    font-size: 0.86rem;
}
.coach-meal ul, .coach-session ul, .coach-list {
    margin: 0 0 0 1.1rem;
    list-style: disc;
    line-height: 1.75;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.coach-sessions { display: grid; gap: 0.85rem; }
.coach-session {
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
}
.coach-session__head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.coach-session__head span { color: var(--text-muted); font-size: 0.84rem; }

.coach-products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.85rem;
}
.coach-product {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.coach-product:hover { border-color: var(--primary-color); transform: translateY(-3px); }
.coach-product img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.coach-product div { padding: 0.75rem; display: grid; gap: 0.25rem; }
.coach-product strong { font-size: 0.86rem; line-height: 1.35; }
.coach-product span { color: var(--primary-color); font-weight: 800; font-size: 0.9rem; }

.coach-disclaimer {
    max-width: 860px;
    margin: 0 auto 1.25rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.6;
    text-align: center;
}

.coach-actions {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

@media print {
    .coach-form, .coach-actions, .breadcrumb-section { display: none !important; }
    .coach-card { break-inside: avoid; border-color: #ccc !important; }
}

/* ─────────────────────────────────────────────
   7 quater. Gérance — chiffres réservés au gérant
   ───────────────────────────────────────────── */

.role-badge {
    font-weight: 700;
    font-size: 0.86rem;
    padding: 4px 12px;
    border-radius: var(--radius-full);
}
.role-badge--manager { background: var(--primary-soft); color: var(--primary-dark); }
.role-badge--staff   { background: var(--bg-surface);   color: var(--text-secondary); }

.gerance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.gerance-stat {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: grid;
    gap: 0.25rem;
}
.gerance-stat__label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 700;
}
.gerance-stat__value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1.15;
}
.gerance-stat__note { font-size: 0.76rem; color: var(--text-muted); }

.gerance-note {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.gerance-alertes { display: grid; gap: 0.7rem; margin-top: 1.25rem; }
.gerance-alerte {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid #FDE68A;
    color: #92400E;
}
.gerance-alerte--rupture {
    background: var(--error-soft);
    border-color: #FECACA;
    color: #B91C1C;
}
.gerance-alerte__liste {
    margin-top: 0.4rem;
    font-size: 0.82rem;
    opacity: 0.85;
    font-weight: 400;
}

.gerance-bloc {
    margin-top: 1.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.gerance-bloc h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    /* Le formulaire de charge passe en colonne : cinq champs côte à côte
       deviennent illisibles sur un téléphone. */
    #gerance form { grid-template-columns: 1fr !important; }
}

/* ─────────────────────────────────────────────
   7 quinquies. Assistant de vente (bulle flottante)
   ───────────────────────────────────────────── */

#tbChat {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 9998;
    font-family: var(--font-body);
}

.tbchat-bulle {
    width: 58px; height: 58px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    color: #fff;
    font-size: 1.4rem;
    box-shadow: var(--shadow-orange);
    display: grid;
    place-items: center;
    position: relative;
    transition: transform var(--transition-base), background var(--transition-base);
}
.tbchat-bulle:hover { transform: scale(1.07); }
.tbchat-bulle--actif { background: var(--dark-base); box-shadow: var(--shadow-lg); }

.tbchat-bulle__pastille {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 20px; height: 20px;
    border-radius: var(--radius-full);
    background: var(--error-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
}

.tbchat-fenetre {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(380px, calc(100vw - 2.5rem));
    height: min(560px, calc(100vh - 8rem));
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: tbchat-apparait 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tbchat-apparait {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tbchat-fenetre { animation: none; }
}

.tbchat-entete {
    background: var(--dark-base);
    color: #fff;
    padding: 1rem 1.15rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.tbchat-entete strong { display: block; font-family: var(--font-heading); font-size: 1rem; }
.tbchat-entete span   { font-size: 0.76rem; color: rgba(255, 255, 255, 0.7); }
.tbchat-fermer { color: #fff; font-size: 1.15rem; opacity: 0.8; }
.tbchat-fermer:hover { opacity: 1; }

.tbchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: var(--bg-light);
    overscroll-behavior: contain;
}

.tbchat-msg { display: flex; flex-direction: column; max-width: 88%; }
.tbchat-msg--client { align-self: flex-end; align-items: flex-end; }
.tbchat-msg--bot    { align-self: flex-start; }

.tbchat-msg__texte {
    padding: 0.7rem 0.95rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.tbchat-msg--bot .tbchat-msg__texte {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: var(--radius-sm);
}
.tbchat-msg--client .tbchat-msg__texte {
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: var(--radius-sm);
}

/* Points d'attente */
.tbchat-attente .tbchat-msg__texte { display: flex; gap: 4px; padding: 0.85rem 1rem; }
.tbchat-attente span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: tbchat-pulse 1.2s infinite;
}
.tbchat-attente span:nth-child(2) { animation-delay: 0.15s; }
.tbchat-attente span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tbchat-pulse {
    0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
    30%           { opacity: 1;    transform: translateY(-3px); }
}

.tbchat-produits { display: grid; gap: 0.5rem; margin-top: 0.55rem; }
.tbchat-produit {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.55rem;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.tbchat-produit:hover { border-color: var(--primary-color); transform: translateX(2px); }
.tbchat-produit img {
    width: 46px; height: 46px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}
.tbchat-produit strong {
    display: block;
    font-size: 0.82rem;
    line-height: 1.3;
    margin-bottom: 2px;
}
.tbchat-produit__prix { color: var(--primary-color); font-weight: 800; font-size: 0.84rem; }
.tbchat-produit__prix s { color: var(--text-muted); font-weight: 400; margin-left: 5px; }
.tbchat-produit__rupture {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--error-color);
    font-weight: 700;
}

.tbchat-relances {
    display: flex;
    gap: 0.4rem;
    padding: 0 0.85rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.tbchat-relances::-webkit-scrollbar { display: none; }
.tbchat-relances:not(:empty) { padding-block: 0.7rem; }
.tbchat-relance {
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    background: var(--bg-white);
    color: var(--text-secondary);
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.tbchat-relance:hover { border-color: var(--primary-color); color: var(--primary-color); }

.tbchat-saisie {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
}
.tbchat-saisie input {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
}
.tbchat-saisie input:focus { border-color: var(--primary-color); }
.tbchat-saisie button {
    width: 42px; height: 42px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    color: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.tbchat-saisie button:disabled { opacity: 0.5; }

@media (max-width: 480px) {
    /* Plein écran sur téléphone : une fenêtre flottante y serait trop étroite. */
    #tbChat { right: 1rem; bottom: 1rem; }
    .tbchat-fenetre {
        position: fixed;
        inset: 0;
        width: 100%; height: 100%;
        border-radius: 0;
        border: none;
    }
}

@media print { #tbChat { display: none !important; } }

/* ─────────────────────────────────────────────
   8. Impression du reçu
   ───────────────────────────────────────────── */

@media print {
    .main-header, .main-footer, .breadcrumb-section,
    .mobile-nav-close, .tb-notif,
    .success-container > div:last-child,
    #osenTrackingLink, .btn {
        display: none !important;
    }

    body { background: #fff; color: #000; font-size: 12pt; }
    .container { max-width: 100%; padding: 0; }

    .success-container, .order-info-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }

    /* Un reçu ne doit pas se couper au milieu d'une ligne d'article. */
    .cart-item, .order-info-card { break-inside: avoid; }

    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}

/* ===== Éditeur du menu de navigation (administration) ===== */
/* Les boutons ronds de 42px du site sont trop hauts une fois empilés : dans
   cet éditeur, chaque ligne doit rester lisible d'un coup d'œil. */
#menuEditor .btn-icon {
    width: 28px;
    height: 24px;
    font-size: 0.75rem;
    border: 1px solid var(--border-light);
    background: #FFFFFF;
    cursor: pointer;
}

#menuEditor .btn-icon:hover:not(:disabled) {
    background: var(--primary-color);
    color: #FFFFFF;
    transform: none;
}

#menuEditor .btn-icon:disabled {
    opacity: 0.3;
    cursor: default;
}

#menuEditor .btn-icon.danger:hover { background: var(--error-color); }

#menuEditor .form-control { margin: 0; }

/* Sur mobile la grille à cinq colonnes devient illisible : on empile. */
@media (max-width: 900px) {
    #menuEditor > div > div {
        grid-template-columns: auto 1fr !important;
    }
    #menuEditor .form-control { grid-column: 1 / -1; }
}

/* ===== Mise en avant (accueil) =====
   Un seul bloc large a la place des quatre cartes figees : il porte
   l'annonce du moment — evenement, nouvelle marque, grosse promotion. */
.spotlight-section {
    padding: 3.5rem 0;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
}

.spotlight {
    position: relative;
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: center;
    gap: 2.5rem;
    min-height: 260px;
    padding: 2.5rem;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--dark-base);
    color: #FFFFFF;
    text-decoration: none;
    transition: var(--transition-base);
}

.spotlight:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

/* La photo vit dans un pseudo-element : le zoom au survol ne doit pas
   entrainer le texte avec lui. */
.spotlight.has-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--spotlight-image);
    background-size: cover;
    background-position: center;
    transition: transform 0.6s ease;
    z-index: 0;
}

.spotlight.has-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(10, 10, 12, calc(var(--spotlight-overlay, 0.45) + 0.35)) 0%,
        rgba(10, 10, 12, var(--spotlight-overlay, 0.45)) 100%);
    z-index: 0;
}

.spotlight.has-image:hover::before { transform: scale(1.04); }

.spotlight__media,
.spotlight__body { position: relative; z-index: 1; }

.spotlight__media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.spotlight__logo {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    /* Beaucoup de logos de marques arrivent sur fond blanc : la pastille
       claire evite le carre blanc decoupe sur la photo sombre. */
    background: rgba(255, 255, 255, 0.94);
    padding: 1rem;
    border-radius: var(--radius-md);
}

/* Sans logo, le texte prend toute la largeur au lieu de laisser un trou. */
.spotlight:not(:has(.spotlight__logo:not([hidden]))) {
    grid-template-columns: 1fr;
}

.spotlight__badge {
    display: inline-block;
    margin-bottom: 0.85rem;
    padding: 0.35rem 0.9rem;
    background: var(--primary-color);
    color: #FFFFFF;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.spotlight__title {
    font-size: clamp(1.5rem, 3.2vw, 2.4rem);
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 0.75rem;
    color: #FFFFFF;
    text-transform: uppercase;
}

.spotlight__text {
    max-width: 60ch;
    margin: 0 0 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1.6;
}

.spotlight__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.6rem;
    background: var(--primary-color);
    color: #FFFFFF;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: var(--transition-base);
}

.spotlight:hover .spotlight__cta { gap: 1rem; }

/* En arabe la fleche doit pointer vers la gauche. */
[dir="rtl"] .spotlight__cta i { transform: scaleX(-1); }

[dir="rtl"] .spotlight.has-image::after {
    background: linear-gradient(
        270deg,
        rgba(10, 10, 12, calc(var(--spotlight-overlay, 0.45) + 0.35)) 0%,
        rgba(10, 10, 12, var(--spotlight-overlay, 0.45)) 100%);
}

@media (max-width: 768px) {
    .spotlight-section { padding: 2.25rem 0; }
    .spotlight {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.75rem 1.4rem;
        text-align: center;
    }
    .spotlight__logo { max-height: 96px; }
    .spotlight__text { margin-inline: auto; font-size: 0.92rem; }
    /* Le degrade lateral ne fonctionne plus une fois le bloc empile. */
    .spotlight.has-image::after {
        background: rgba(10, 10, 12, calc(var(--spotlight-overlay, 0.45) + 0.2));
    }
}

@media (prefers-reduced-motion: reduce) {
    .spotlight, .spotlight.has-image::before { transition: none; }
    .spotlight:hover { transform: none; }
    .spotlight.has-image:hover::before { transform: none; }
}

/* ===== Barre de navigation defilante =====
   Le menu porte autant d'entrees que le marchand cree de rayons. Au-dela de
   la largeur disponible, elles sortaient de l'ecran sans moyen de les
   atteindre : le conteneur defile et deux fleches encadrent la liste. */
.nav-scroller {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    /* min-width:0 est indispensable : sans lui un enfant flex refuse de
       retrecir sous la largeur de son contenu, et rien ne defile jamais. */
    flex: 1 1 auto;
    min-width: 0;
}

.nav-scroller .nav-menu {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scroll-behavior: smooth;
    /* Les liens s'arretent net au bord au lieu d'etre coupes en deux mots. */
    scroll-snap-type: x proximity;
    /* Place pour le trait orange sous l'entree active et pour le contour de
       focus, que le defilement rognerait sinon. */
    padding-block: 2px 6px;
}

.nav-scroller .nav-menu > li {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.nav-scroller .nav-menu > li > a { white-space: nowrap; }

/* Barre de defilement fine et discrete : elle montre qu'il reste des entrees
   a decouvrir, ce que des fleches seules ne disent pas toujours. */
.nav-scroller .nav-menu { scrollbar-width: thin; scrollbar-color: var(--primary-color) transparent; }
.nav-scroller .nav-menu::-webkit-scrollbar { height: 4px; }
.nav-scroller .nav-menu::-webkit-scrollbar-track { background: transparent; }
.nav-scroller .nav-menu::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}
.nav-scroller:hover .nav-menu::-webkit-scrollbar-thumb { background: var(--primary-color); }

.nav-scroll-btn {
    display: none;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    background: #FFFFFF;
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-base);
}

/* Les fleches n'apparaissent que s'il y a reellement quelque chose a atteindre. */
.nav-scroller.is-scrollable .nav-scroll-btn { display: flex; }

.nav-scroll-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #FFFFFF;
}

/* Bout de course : la fleche reste en place pour ne pas faire sauter la
   largeur de la barre a chaque defilement. */
.nav-scroll-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

[dir="rtl"] .nav-scroll-btn i { transform: scaleX(-1); }

/* Les sous-menus passent en position fixe (calculee par script) pour sortir
   du cadre qui defile ; sans cela ils etaient rognes en hauteur. */
.nav-scroller .dropdown-menu { z-index: 1200; }

@media (max-width: 768px) {
    /* Le conteneur disparait de la mise en page : le menu redevient enfant
       direct de .nav-content et le tiroir mobile retrouve son comportement
       d'origine, sans qu'aucune regle existante n'ait a etre reecrite. */
    .nav-scroller { display: contents; }
    .nav-scroll-btn { display: none !important; }
    .nav-scroller .nav-menu { overflow: visible; padding-block: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .nav-scroller .nav-menu { scroll-behavior: auto; }
}

/* Les sous-menus ne s'ouvraient qu'au survol : inatteignables au clavier.
   Le script place deja le sous-menu au focus, il ne manquait que la
   revelation. */
.nav-menu .dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
