/* ROSE Print 1.3.0 — feuille d'impression : fiche produit (une seule page A4) et listes d'articles
 *
 * La feuille #roseprint-sheet est construite par roseprint.js au moment de l'impression,
 * mesurée hors écran, mise à l'échelle, puis supprimée après l'impression.
 * Géométrie : A4 (210 x 297 mm) - marges de 12 mm = 186 x 273 mm utiles ; la feuille fait
 * 186 x 268 mm (5 mm de sécurité) et ne peut pas déborder (overflow: hidden).
 *
 * Tout est préfixé par l'identifiant #roseprint-sheet et verrouillé par !important : la mise en page ne doit
 * dépendre ni de la largeur d'écran ni des règles « mobile » du thème, sinon la mesure faite
 * à l'écran ne correspondrait pas au rendu imprimé.
 */

/* ---------- La feuille (hors écran tant qu'on n'imprime pas) ---------- */
#roseprint-sheet {
    position: absolute !important;
    left: -10000px !important;
    top: 0 !important;
    width: 186mm !important;
    height: 268mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: #fff !important;
    color: #161616 !important;
    font: 400 12px/1.4 Roboto, Arial, Helvetica, sans-serif !important;
    text-align: left !important;
    letter-spacing: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

#roseprint-sheet *,
#roseprint-sheet *::before,
#roseprint-sheet *::after {
    box-sizing: border-box !important;
    font-family: Roboto, Arial, Helvetica, sans-serif !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
    box-shadow: none !important;
    animation: none !important;
    transition: none !important;
}

#roseprint-sheet .rp-inner {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    transform-origin: 0 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#roseprint-sheet .rp-foot {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 3mm 0 0 !important;
    background: #fff !important;
}

/* ---------- En-tête ---------- */
#roseprint-sheet .rp-head {
    margin: 0 0 5mm !important;
    padding: 0 0 2mm !important;
    border-bottom: 2px solid #263f5e !important;
    text-align: center !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: 1px !important;
    color: #263f5e !important;
}

/* ---------- Haut de fiche ---------- */
#roseprint-sheet .rp-top {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 6mm !important;
    margin: 0 0 5mm !important;
    padding: 0 !important;
}

#roseprint-sheet .rp-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

#roseprint-sheet .rp-img {
    flex: 0 0 48mm !important;
    width: 48mm !important;
    height: 48mm !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#roseprint-sheet .rp-img img {
    display: block !important;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

#roseprint-sheet .rp-title {
    margin: 0 0 3mm !important;
    padding: 0 !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: #161616 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

#roseprint-sheet .rp-ids,
#roseprint-sheet .rp-ids * {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    font-size: 11.5px !important;
    line-height: 1.6 !important;
    color: #444 !important;
    float: none !important;
    position: static !important;
}

#roseprint-sheet .rp-ids {
    display: block !important;
    margin: 0 0 4mm !important;
}

#roseprint-sheet .rp-ids span {
    margin-right: 5mm !important;
    white-space: nowrap !important;
}

#roseprint-sheet .rp-ids b,
#roseprint-sheet .rp-ids strong {
    font-weight: 700 !important;
    color: #161616 !important;
}

#roseprint-sheet .rp-price,
#roseprint-sheet .rp-price * {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    float: none !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    font-size: 11.5px !important;
    line-height: 1.5 !important;
    color: #444 !important;
    text-align: left !important;
}

#roseprint-sheet .rp-price .current-price,
#roseprint-sheet .rp-price .product-price {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    gap: 2mm !important;
}

#roseprint-sheet .rp-price .price,
#roseprint-sheet .rp-price .current-price > span:first-child {
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #161616 !important;
}

#roseprint-sheet .rp-price .regular-price {
    text-decoration: line-through !important;
}

/* ---------- Sections ---------- */
#roseprint-sheet .rp-sec {
    margin: 0 0 4mm !important;
    padding: 0 !important;
}

#roseprint-sheet .rp-sec-title {
    margin: 0 0 2mm !important;
    padding: 0 0 1mm !important;
    border-bottom: 1px solid #c8c8c8 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: .5px !important;
    text-transform: uppercase !important;
    color: #263f5e !important;
}

#roseprint-sheet .rp-body {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    color: #2b2b2b !important;
}

/* Verrou typographique : rien de ce qui est recopié ne garde ses tailles d'origine */
#roseprint-sheet .rp-body * {
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: 0 !important;
    color: inherit !important;
    float: none !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    transform: none !important;
    overflow: visible !important;
    text-indent: 0 !important;
    columns: auto !important;
}

/* le bloc recopié peut être un onglet replié ou masqué à l'écran : sur la feuille il est toujours visible */
#roseprint-sheet .rp-body > * {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#roseprint-sheet .rp-body p,
#roseprint-sheet .rp-body ul,
#roseprint-sheet .rp-body ol,
#roseprint-sheet .rp-body dl,
#roseprint-sheet .rp-body blockquote,
#roseprint-sheet .rp-body table {
    margin: 0 0 1.5mm !important;
}

#roseprint-sheet .rp-body ul,
#roseprint-sheet .rp-body ol {
    padding-left: 5mm !important;
}

#roseprint-sheet .rp-body ul { list-style: disc outside !important; }
#roseprint-sheet .rp-body ol { list-style: decimal outside !important; }
#roseprint-sheet .rp-body li { display: list-item !important; }

#roseprint-sheet .rp-body h1,
#roseprint-sheet .rp-body h2,
#roseprint-sheet .rp-body h3,
#roseprint-sheet .rp-body h4,
#roseprint-sheet .rp-body h5,
#roseprint-sheet .rp-body h6 {
    margin: 1mm 0 1.5mm !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    color: #161616 !important;
}

#roseprint-sheet .rp-body b,
#roseprint-sheet .rp-body strong,
#roseprint-sheet .rp-body th {
    font-weight: 700 !important;
}

#roseprint-sheet .rp-body a {
    text-decoration: none !important;
}

#roseprint-sheet abbr[title]::after,
#roseprint-sheet a[href]::after {
    content: none !important;
}

#roseprint-sheet .rp-body img {
    display: inline-block !important;
    max-width: 45% !important;
    max-height: 30mm !important;
    vertical-align: middle !important;
}

/* Tableaux (caractéristiques, tableaux de la description) */
#roseprint-sheet .rp-body table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
}

#roseprint-sheet .rp-body tr { display: table-row !important; }

#roseprint-sheet .rp-body th,
#roseprint-sheet .rp-body td {
    display: table-cell !important;
    padding: 1mm 2mm !important;
    border-bottom: 1px solid #e3e6e8 !important;
    text-align: left !important;
    vertical-align: top !important;
    word-break: break-word !important;
}

#roseprint-sheet .rp-body th {
    width: 42% !important;
    color: #55646e !important;
}

#roseprint-sheet .rp-body tr:nth-child(odd) > th,
#roseprint-sheet .rp-body tr:nth-child(odd) > td {
    background: #f5f7f8 !important;
}

/* Bloc caractéristiques de la fiche : deux colonnes, quelle que soit la largeur d'écran */
#roseprint-sheet .rp-body .rose-details {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 3mm 8mm !important;
    align-items: start !important;
}

#roseprint-sheet .rp-body .rose-details > * {
    min-width: 0 !important;
}

#roseprint-sheet .rp-body .rose-details img {
    max-height: 9mm !important;
    max-width: 30mm !important;
}

#roseprint-sheet .rp-body .rose-details h3 {
    margin: 0 0 1mm !important;
    font-size: 10px !important;
    letter-spacing: .5px !important;
    text-transform: uppercase !important;
    color: #7a8891 !important;
}

/* Description abrégée */
#roseprint-sheet .rp-body.rp-cut {
    position: relative !important;
    overflow: hidden !important;
}

#roseprint-sheet .rp-body.rp-cut::after {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 7mm !important;
    background: linear-gradient(rgba(255, 255, 255, 0), #fff) !important;
}

#roseprint-sheet .rp-cut-note {
    margin: 1mm 0 0 !important;
    font-size: 10.5px !important;
    font-style: italic !important;
    color: #55646e !important;
}

/* ---------- Bas de page : lien + QR code, pied ---------- */
#roseprint-sheet .rp-link {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 5mm !important;
    margin: 0 !important;
    padding: 2.5mm 4mm !important;
    border: 1px solid #c8c8c8 !important;
}

#roseprint-sheet .rp-link-txt {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

#roseprint-sheet .rp-link-txt strong,
#roseprint-sheet .rp-url,
#roseprint-sheet .rp-date {
    display: block !important;
    margin: 0 !important;
}

#roseprint-sheet .rp-link-txt strong {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #161616 !important;
}

#roseprint-sheet .rp-url {
    font-size: 10.5px !important;
    color: #263f5e !important;
    word-break: break-all !important;
}

#roseprint-sheet .rp-date {
    margin-top: 1.5mm !important;
    font-size: 9.5px !important;
    color: #777 !important;
}

#roseprint-sheet .rp-qr {
    flex: 0 0 24mm !important;
    width: 24mm !important;
    height: 24mm !important;
}

#roseprint-sheet .rp-qr svg {
    display: block !important;
    width: 24mm !important;
    height: 24mm !important;
}

#roseprint-sheet .rp-address {
    margin: 2.5mm 0 0 !important;
    text-align: center !important;
    font-size: 10.5px !important;
    font-style: italic !important;
    color: #161616 !important;
}

#roseprint-sheet .rp-bar {
    display: none !important;
}

/* ---------- Aperçu à l'écran (adresse de la fiche + #roseprint) ---------- */
@media screen {
    html.roseprint-preview #roseprint-sheet {
        left: 50% !important;
        top: 56px !important;
        margin: 0 0 40px -93mm !important;
        z-index: 2147483000 !important;
        border: 1px solid #9aa4ac !important;
    }

    /* le site passe en fond estompé derrière l'aperçu */
    html.roseprint-preview body > *:not(#roseprint-sheet) {
        opacity: .12 !important;
        pointer-events: none !important;
    }

    html.roseprint-preview #roseprint-sheet .rp-bar {
        display: flex !important;
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        z-index: 2147483001 !important;
        justify-content: center !important;
        gap: 6mm !important;
        padding: 10px 16px !important;
        background: #263f5e !important;
        color: #fff !important;
        font-size: 14px !important;
    }

    html.roseprint-preview #roseprint-sheet .rp-bar a {
        color: #fff !important;
        text-decoration: underline !important;
    }
}

/* ---------- Impression : la feuille, et rien d'autre ---------- */
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    html.roseprint-on,
    html.roseprint-on body {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    /* neutralise l'en-tête / pied de l'ancien articleprint.css */
    html.roseprint-on body::before,
    html.roseprint-on body::after {
        content: none !important;
        display: none !important;
    }

    html.roseprint-on body > *:not(#roseprint-sheet) {
        display: none !important;
    }

    html.roseprint-on #roseprint-sheet {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        margin: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
        z-index: auto !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}

/* =====================================================================
 *  LISTES D'ARTICLES : tableau, sur autant de pages que nécessaire
 * ===================================================================== */
#roseprint-sheet.rp-list {
    height: auto !important;
    overflow: visible !important;
}

#roseprint-sheet.rp-list .rp-inner,
#roseprint-sheet.rp-list .rp-foot {
    position: static !important;
    width: auto !important;
    transform: none !important;
}

#roseprint-sheet.rp-list .rp-foot {
    margin-top: 5mm !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

#roseprint-sheet.rp-list .rp-title {
    margin: 0 0 1mm !important;
    font-size: 17px !important;
}

#roseprint-sheet .rp-count {
    margin: 0 0 4mm !important;
    font-size: 10.5px !important;
    color: #55646e !important;
}

#roseprint-sheet .rp-table {
    display: table !important;
    width: 100% !important;
    margin: 0 !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
    font-size: 10.5px !important;
    line-height: 1.3 !important;
}

#roseprint-sheet .rp-table thead { display: table-header-group !important; }
#roseprint-sheet .rp-table tbody { display: table-row-group !important; }

#roseprint-sheet .rp-table tr {
    display: table-row !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

#roseprint-sheet .rp-table th,
#roseprint-sheet .rp-table td {
    display: table-cell !important;
    margin: 0 !important;
    padding: 1.2mm 1.4mm !important;
    border: 0 !important;
    border-bottom: 1px solid #dfe3e6 !important;
    background: none !important;
    font-size: 10.5px !important;
    line-height: 1.3 !important;
    color: #1d1d1d !important;
    text-align: left !important;
    vertical-align: middle !important;
    white-space: normal !important;
}

#roseprint-sheet .rp-table th {
    border-bottom: 1.5px solid #263f5e !important;
    font-size: 9.5px !important;
    font-weight: 700 !important;
    letter-spacing: .3px !important;
    text-transform: uppercase !important;
    color: #263f5e !important;
    white-space: nowrap !important;
}

#roseprint-sheet .rp-table tbody tr:nth-child(even) > td {
    background: #f6f8f9 !important;
}

#roseprint-sheet .rp-table .rp-c-img {
    width: 13mm !important;
    padding: .8mm 1mm !important;
}

#roseprint-sheet .rp-table .rp-c-img img {
    display: block !important;
    width: 11mm !important;
    height: 11mm !important;
    max-width: none !important;
    object-fit: contain !important;
}

/* en-tête « Réf. fabricant » sur deux lignes : la colonne se cale sur les références */
#roseprint-sheet .rp-table th.rp-c-mref {
    white-space: normal !important;
    line-height: 1.15 !important;
}

/* la désignation prend toute la largeur laissée libre par les autres colonnes */
#roseprint-sheet .rp-table th.rp-c-name,
#roseprint-sheet .rp-table td.rp-c-name {
    width: 100% !important;
}

#roseprint-sheet .rp-table .rp-n,
#roseprint-sheet .rp-table .rp-b {
    display: block !important;
}

#roseprint-sheet .rp-table .rp-n {
    font-weight: 500 !important;
}

#roseprint-sheet .rp-table .rp-b {
    font-size: 9.5px !important;
    color: #6b7780 !important;
}

#roseprint-sheet .rp-table td.rp-c-mref,
#roseprint-sheet .rp-table td.rp-c-ref,
#roseprint-sheet .rp-table td.rp-c-ean,
#roseprint-sheet .rp-table td.rp-c-loc {
    white-space: nowrap !important;
}

#roseprint-sheet .rp-table td.rp-c-loc {
    font-weight: 700 !important;
}

#roseprint-sheet .rp-table .rp-c-ht,
#roseprint-sheet .rp-table .rp-c-ttc,
#roseprint-sheet .rp-table .rp-c-price,
#roseprint-sheet .rp-table .rp-c-stock {
    text-align: right !important;
    white-space: nowrap !important;
}

#roseprint-sheet .rp-table td.rp-c-ttc,
#roseprint-sheet .rp-table td.rp-c-price {
    font-weight: 700 !important;
}

@media print {
    html.roseprint-on #roseprint-sheet.rp-list {
        overflow: visible !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }
}

/* =====================================================================
 *  BOUTONS D'IMPRESSION (affichés selon le réglage du module)
 * ===================================================================== */
#roseprint-btn {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 900;
    display: flex;
    gap: 6px;
}

#roseprint-btn button {
    padding: 8px 12px;
    border: 1px solid #263f5e;
    border-radius: 6px;
    background: #fff;
    color: #263f5e;
    font: 500 13px/1.2 Roboto, Arial, sans-serif;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}

#roseprint-btn button:hover,
#roseprint-btn button:focus-visible {
    background: #263f5e;
    color: #fff;
}

@media print {
    #roseprint-btn {
        display: none !important;
    }
}
