/*
 * Fiche produit mobile V2 — proposition A validée le 2026-11-23
 * (canvas « Fiche produit mobile web · V2 », planches PropA1, PropA2, PropA3, PropABarres).
 * Chargée uniquement sur la fiche produit, après les styles de details.blade.php.
 * Tout ce qui change la mise en page est limité à < 768 px ; la tablette et le desktop gardent leur fiche.
 */

/* ---------- Puces partagées (mobile et desktop) ---------- */
.gm-pdm-chip--out { background: #FEF2F2; color: #B91C1C; font-weight: 600; }
.gm-pdm-chip--origin { gap: 5px; }
.gm-pdm-num { font-variant-numeric: tabular-nums; }
[theme="dark"] .gm-pdm-chip--out { background: #3B1418; color: #FCA5A5; }

/* Lien devis à côté de « Me prévenir » dans la barre desktop */
.gm-sticky-rfq {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 38px; padding: 0 14px; border-radius: 9999px;
    background: #000080; color: #FFFFFF; font: 600 13px 'Inter', system-ui, sans-serif;
    text-decoration: none; white-space: nowrap;
}
.gm-sticky-rfq:hover { background: #0376EA; color: #FFFFFF; }
.product-details-sticky .product-restock-request-section[style*="display: block"] { display: flex !important; gap: 8px; align-items: center; }

/* Éléments ajoutés pour le mobile : jamais visibles à partir de 768 px */
@media (min-width: 768px) {
    .gm-pdm-acc-toggle, .gm-pdm-more, .gm-sticky-hint, .gm-sticky-oos, .gm-sticky-options { display: none !important; }
}

@media (max-width: 767.98px) {

    /* ---------- Ordre des blocs : photo et achat → caractéristiques → détails repliables → livraison, boutique, devis ---------- */
    html .gm-details-card { order: 2 !important; }
    html .gm-buybox-col { order: 3 !important; display: flex !important; flex-direction: column; gap: 12px; margin-bottom: 16px; }
    html .gm-buybox-col > .gm-pdm-delivery { order: 1; }
    html .gm-buybox-col > .gm-sticky-buy-box { order: 2; }
    html .gm-buybox-col > .gm-pdm-rfq { order: 3; }

    /* ---------- Faux, doublons et blocs qui allongent la page ---------- */
    html .gm-gallery-sticky > .gm-trade-assurance-card,
    html .gm-sticky-buy-box .gm-trade-assurance-card,
    html .gm-buybox-pinned-header,
    html .gm-pd-qty-block,
    html .gm-sticky-buy-box .product-add-and-buy-section-parent,
    html .gm-sticky-buy-box .product-restock-request-section,
    html .gm-quick-specs-card,
    html .gm-pdm-chip--delay,
    html .fbt-bundle-container,
    html .gm-pdm-store-products,
    html .gm-pdm-similar-products .badge,
    html .gm-pf {
        display: none !important;
    }
    html .gm-sticky-buy-box {
        padding: 0 !important; margin: 0 !important;
        background: transparent !important; box-shadow: none !important; border: 0 !important;
    }
    html .gm-sticky-buy-box::before { display: none !important; }
    html .gm-sticky-buy-box .gm-Anaizan-company-card { margin-top: 0 !important; border-radius: 12px !important; }

    /* Un seul carrousel en bas, 6 produits au plus */
    html .gm-pdm-similar-products .swiper-slide:nth-child(n+7) { display: none !important; }

    /* ---------- Premier écran ---------- */
    html .gm-pdm-meta .gm-pdm-chip--muted { height: auto; padding: 0; background: transparent; font-size: 12px; color: #475569; }
    html .gm-pdm-chips { gap: 6px; margin: 8px 0 0; }
    html .gm-pdm-chips .gm-pdm-chip { height: 26px; }

    html .gm-pdm-strip {
        display: flex; align-items: center; gap: 12px;
        min-height: 64px; box-sizing: border-box; margin: 14px 0 4px; padding: 10px 12px;
        border: 1px solid #E2E8F0; border-radius: 12px; background: #FFFFFF;
        color: #0F172A; text-decoration: none;
    }
    html .gm-pdm-strip:hover, html .gm-pdm-strip:focus { color: #0F172A; border-color: #CBD5E1; }
    html .gm-pdm-strip-icon {
        width: 36px; height: 36px; flex-shrink: 0; border-radius: 8px;
        background: #EAF2FF; color: #000080; display: flex; align-items: center; justify-content: center;
    }
    html .gm-pdm-strip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
    html .gm-pdm-strip-title { font: 600 14px/1.35 'Inter', system-ui, sans-serif; }
    html .gm-pdm-strip-sub { font-size: 12px; line-height: 1.35; color: #475569; }
    html .gm-pdm-strip-chevron { flex-shrink: 0; color: #64748B; }

    /* ---------- Cartes ---------- */
    html .gm-pdm-card {
        box-sizing: border-box; margin-top: 12px; padding: 16px;
        background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 12px; color: #0F172A;
    }
    html .gm-buybox-col > .gm-pdm-card { margin-top: 0; }
    html .gm-pdm-card-title { margin: 0 0 12px; font: 700 16px/1.3 'Plus Jakarta Sans', sans-serif; color: #0F172A; }

    html .gm-pdm-specs-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
    html .gm-pdm-spec { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    html .gm-pdm-spec dt { font-size: 12px; font-weight: 400; color: #64748B; }
    html .gm-pdm-spec dd { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
    html .gm-pdm-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px !important; }
    html .gm-pdm-tone-ok { color: #15803D; }
    html .gm-pdm-tone-out { color: #B91C1C; }

    html .gm-pdm-rows { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
    html .gm-pdm-row { display: flex; justify-content: space-between; gap: 12px; }
    html .gm-pdm-row dt { font-weight: 400; color: #475569; }
    html .gm-pdm-row dd { margin: 0; text-align: right; }
    html .gm-pdm-row strong { font-weight: 600; }
    html .gm-pdm-note {
        display: flex; align-items: center; gap: 10px; margin: 12px 0 0; padding: 10px 12px;
        border-radius: 8px; background: #F8FAFC; font-size: 13px; line-height: 1.4; color: #334155;
    }
    html .gm-pdm-note svg { flex-shrink: 0; color: #000080; }

    html .gm-pdm-rfq {
        display: flex; flex-direction: column; gap: 10px; padding: 16px;
        border-radius: 12px; background: #EAF2FF;
    }
    html .gm-pdm-rfq-title { margin: 0; font: 700 16px/1.3 'Plus Jakarta Sans', sans-serif; color: #000080; }
    html .gm-pdm-rfq p { margin: 0; font-size: 14px; line-height: 1.5; color: #1E293B; }
    html .gm-pdm-rfq-btn {
        display: flex; align-items: center; justify-content: center; height: 48px;
        border-radius: 8px; background: #000080; color: #FFFFFF; font: 600 15px 'Inter', system-ui, sans-serif; text-decoration: none;
    }
    html .gm-pdm-rfq-btn:hover, html .gm-pdm-rfq-btn:focus { background: #0376EA; color: #FFFFFF; }

    /* ---------- Description, fiche technique, avis : blocs repliables ---------- */
    html .gm-details-card {
        border: 1px solid #E2E8F0 !important; border-radius: 12px !important; box-shadow: none !important;
        flex: 0 0 auto !important; width: calc(100% - var(--bs-gutter-x)) !important; max-width: none !important;
        margin: 12px calc(var(--bs-gutter-x) * .5) 0 !important;
    }
    html .gm-details-card .card-body { padding: 0 !important; }
    html .gm-details-card nav:has(#nav-tab) { display: none !important; }
    html #nav-tab { display: none !important; }
    html #nav-tabContent > .tab-pane { display: block !important; opacity: 1 !important; }
    html #nav-tabContent > .tab-pane.gm-pdm-acc-collapsed { display: none !important; }
    html .gm-pdm-acc-panel { padding: 0 16px 16px; }
    html .gm-pdm-acc-panel .p-2, html .gm-pdm-acc-panel .p-md-3 { padding: 0 !important; }
    html .gm-pdm-acc-panel h4 { display: none; }
    html .gm-pdm-acc-toggle {
        width: 100%; min-height: 56px; box-sizing: border-box; padding: 0 16px;
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        border: 0; border-top: 1px solid #E2E8F0; background: transparent;
        font: 600 15px 'Inter', system-ui, sans-serif; color: #0F172A; text-align: left;
    }
    html .gm-pdm-acc-toggle:first-child { border-top: 0; }
    html .gm-pdm-acc-toggle[aria-expanded="true"] { font: 700 16px 'Plus Jakarta Sans', sans-serif; }
    html .gm-pdm-acc-toggle svg { flex-shrink: 0; color: #475569; transition: transform .2s cubic-bezier(.4, 0, .2, 1); }
    html .gm-pdm-acc-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
    html .gm-pdm-clamp { max-height: 104px; overflow: hidden; }
    html .gm-pdm-more {
        min-height: 44px; padding: 0; border: 0; background: transparent;
        font: 600 14px 'Inter', system-ui, sans-serif; color: #0366CF !important;
    }

    /* ---------- Barre d'achat ---------- */
    html .product-details-sticky > .product-details-sticky-collapse-btn { display: none !important; }
    html .gm-sticky-info .product-generated-variation-text { display: none !important; }
    html .product-details-sticky-bottom .gm-sticky-buttons { order: 4 !important; }

    html .gm-sticky-calc { font-size: 12px; color: #475569; font-variant-numeric: tabular-nums; white-space: nowrap; }
    html .gm-sticky-subtotal .product-details-chosen-price-amount { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 19px !important; font-variant-numeric: tabular-nums; }

    html .product-details-sticky .quantity__minus[disabled],
    html .product-details-sticky .quantity__plus[disabled] { color: #CBD5E1 !important; pointer-events: none; }

    html .gm-sticky-options {
        order: 0; flex: 1 1 100%; box-sizing: border-box;
        width: auto !important; height: auto !important; min-height: 44px; padding: 0 12px;
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        border: 1px solid #CBD5E1 !important; border-radius: 8px !important; background: #F8FAFC !important;
        font: 400 14px 'Inter', system-ui, sans-serif; color: #0F172A !important;
    }
    html .gm-sticky-options-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    html .gm-sticky-options-edit { flex-shrink: 0; font-weight: 600; color: #0366CF; }
    html .gm-sticky-options-edit .bi { display: inline-block; transition: transform .2s ease; }
    html .gm-sticky-options.rotate-180 { transform: none !important; rotate: none !important; }
    html .gm-sticky-options.rotate-180 .gm-sticky-options-edit .bi { rotate: 180deg; }
    html .product-details-sticky-top { max-height: 50vh; }

    html .gm-sticky-hint { order: 3; flex: 1 1 100%; font-size: 12px; font-weight: 600; line-height: 1.4; }
    html .gm-sticky-hint[hidden] { display: none !important; }
    html .gm-sticky-hint[data-tone="warning"] { color: #B45309; }
    html .gm-sticky-hint a { color: #0366CF; text-decoration: none; }
    html .gm-sticky-hint-action { padding: 2px 0; border: 0; background: transparent; font: inherit; color: inherit; text-decoration: underline; }
    html .gm-pdm-under-moq .quantity { border-color: #F59E0B !important; box-shadow: 0 0 0 1px #F59E0B; }
    html .gm-sticky-buttons .btn:disabled {
        background: #E2E8F0 !important; border-color: #E2E8F0 !important; color: #64748B !important; opacity: 1 !important;
    }

    /* Rupture : statut et prix à la place de la quantité, « Me prévenir » et « Demander un devis » */
    html .gm-sticky-oos { display: none; }
    html .gm-pdm-oos .gm-sticky-oos {
        order: 1; flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    }
    html .gm-pdm-oos .quantity,
    html .gm-pdm-oos .gm-sticky-info,
    html .gm-pdm-oos .gm-sticky-hint { display: none !important; }
    html .gm-sticky-oos-badge {
        display: inline-flex; align-items: center; height: 26px; padding: 0 8px; border-radius: 4px;
        background: #FEF2F2; color: #B91C1C; font: 600 12px 'Inter', system-ui, sans-serif;
    }
    html .gm-sticky-oos-price { font-size: 13px; color: #475569; }
    html .gm-sticky-oos-price strong { font: 700 19px 'Plus Jakarta Sans', sans-serif; color: #0F172A; font-variant-numeric: tabular-nums; }
    html .product-details-sticky .gm-sticky-buttons { width: 100%; }
    html .product-details-sticky .product-restock-request-section[style*="display: block"] {
        display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%;
    }
    html .product-details-sticky .request-restock-btn,
    html .product-details-sticky .gm-sticky-rfq {
        height: 48px; min-height: 48px; border-radius: 8px !important; font: 600 15px 'Inter', system-ui, sans-serif !important;
        display: flex; align-items: center; justify-content: center; padding: 0 8px !important; text-transform: none !important;
    }
    html .product-details-sticky .request-restock-btn {
        background: #FFFFFF !important; border: 1.5px solid #000080 !important; color: #000080 !important;
    }

    /* ---------- Mode sombre ---------- */
    html [theme="dark"] .gm-pdm-strip,
    html [theme="dark"] .gm-pdm-card { background: #1E293B; border-color: #334155; color: #F1F5F9; }
    html [theme="dark"] .gm-pdm-card-title,
    html [theme="dark"] .gm-pdm-strip:hover { color: #F8FAFC; }
    html [theme="dark"] .gm-pdm-strip-sub,
    html [theme="dark"] .gm-pdm-spec dt,
    html [theme="dark"] .gm-pdm-row dt { color: #94A3B8; }
    html [theme="dark"] .gm-pdm-strip-icon { background: #17204A; color: #93A5FF; }
    html [theme="dark"] .gm-pdm-note { background: #0F172A; color: #CBD5E1; }
    html [theme="dark"] .gm-pdm-note svg { color: #93A5FF; }
    html [theme="dark"] .gm-pdm-rfq { background: #17204A; }
    html [theme="dark"] .gm-pdm-rfq-title { color: #93A5FF; }
    html [theme="dark"] .gm-pdm-rfq p { color: #E2E8F0; }
    html [theme="dark"] .gm-pdm-acc-toggle { color: #F1F5F9; border-color: #334155; }
    html [theme="dark"] .gm-details-card { border-color: #334155 !important; }
}
