/* ============================================================
   VDPrint - Mobile responsive fixes (GLOBAL)
   v2 - vincoli stretti per evitare overflow orizzontale
   ============================================================ */

/* ---------- ANTI-OVERFLOW GLOBALE (sempre) ---------- */
html, body { max-width: 100% !important; overflow-x: hidden !important; }
img, video, iframe, table, svg { max-width: 100% !important; height: auto; }

/* CSS Grid: forza i track a non espandersi oltre il contenitore */
.product-grid, .product-grid > * { min-width: 0 !important; }
.product-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; }
@media (max-width: 992px) {
    .product-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 20px !important; }
}

/* ============================================================
   MOBILE <=768px
   ============================================================ */
@media (max-width: 768px) {

    /* ---------- BARRA PROMO (sopra navbar) ---------- */
    #promoBar { padding: 6px 0 !important; }
    #promoBar .promo-bar-inner { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; padding: 0 8px !important; justify-content: space-between !important; }
    #promoBar .promo-row1 { flex: 1 1 auto; min-width: 0; justify-content: flex-start !important; gap: 6px !important; }
    #promoBar .promo-row1 > span:first-child { font-size: 10px !important; letter-spacing: 0 !important; }
    #promoBar #promoCountdown { padding: 2px 8px !important; gap: 4px !important; }
    #promoBar #promoCountdown > span:first-child { display: none !important; }
    #promoBar .cd-num { font-size: 11px !important; min-width: 18px !important; padding: 1px 3px !important; }
    #promoBar .cd-block { min-width: 18px !important; }
    #promoBar .cd-label { font-size: 7px !important; }
    #promoBar .cd-sep { font-size: 11px !important; margin-top: -6px !important; }
    #promoBar .promo-row2 { flex: 0 0 auto; }
    #promoBar .promo-bar-link { padding: 3px 10px !important; font-size: 11px !important; white-space: nowrap; }
    #promoBar .promo-bar-link > span:first-child { font-size: 13px !important; }

    /* ---------- WRAPPER PAGINE OFFERTA ---------- */
    .product-wrapper { padding: 10px !important; max-width: 100% !important; box-sizing: border-box; overflow-x: hidden; }
    .product-wrapper * { max-width: 100%; box-sizing: border-box; word-wrap: break-word; overflow-wrap: break-word; }

    /* ---------- BANNER OFFERTA ROSSO ---------- */
    .offer-banner { padding: 10px 14px !important; margin-bottom: 14px !important; }
    .offer-banner h3 { font-size: 0.95rem !important; line-height: 1.25 !important; word-break: break-word; }
    .offer-banner p { font-size: 0.78rem !important; line-height: 1.3 !important; }

    /* ---------- IMMAGINE PRODOTTO ---------- */
    .product-left { width: 100% !important; min-width: 0 !important; }
    .product-right { width: 100% !important; min-width: 0 !important; }
    .main-image-container { padding: 10px !important; max-width: 100% !important; width: 100%; overflow: hidden !important; box-sizing: border-box; }
    .main-image { display: block !important; width: 100% !important; height: auto !important; max-width: 100% !important; max-height: none !important; object-fit: contain; }

    /* Badge OFFERTA: max 40% larghezza, sempre dentro */
    .offer-badge { top: 8px !important; right: 8px !important; padding: 4px 10px !important; font-size: 0.7rem !important; max-width: 40% !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }

    /* Nasconde la seconda immagine duplicata sotto il countdown */
    .product-left > .promo-img,
    .product-left img.promo-img { display: none !important; }

    /* ---------- TITOLI ---------- */
    .product-title { font-size: 1.2rem !important; line-height: 1.2 !important; margin-bottom: 4px !important; }
    .product-code  { font-size: 0.78rem !important; }
    .section-heading { font-size: 0.78rem !important; margin: 16px 0 8px !important; line-height: 1.3; }
    .section-heading span { display: block; font-size: 0.65rem !important; margin-top: 2px; }

    /* ---------- SPECS ---------- */
    .product-specs { padding: 10px !important; margin-bottom: 12px !important; }
    .product-specs p { font-size: 0.78rem !important; margin: 3px 0 !important; line-height: 1.35; }

    /* ---------- MIGLIOR PREZZO ---------- */
    .best-price-box { padding: 12px !important; flex-direction: column !important; gap: 6px !important; text-align: center !important; }
    .best-price-box > div { width: 100%; text-align: center !important; }
    .best-price-value { font-size: 1.4rem !important; }
    .best-price-label, .min-order-label { font-size: 0.78rem !important; }

    /* ---------- COUNTDOWN ---------- */
    .countdown-box { padding: 12px 8px !important; margin-bottom: 12px !important; }
    .countdown-label { font-size: 0.68rem !important; letter-spacing: 1px !important; }
    .countdown-grid { gap: 5px !important; flex-wrap: wrap; }
    .countdown-item { min-width: 48px !important; padding: 6px 6px !important; flex: 1 1 auto; }
    .countdown-number { font-size: 1.2rem !important; }
    .countdown-unit { font-size: 0.6rem !important; }

    /* ---------- HIGHLIGHT STAMPA + SPEDIZIONE ---------- */
    .print-highlight, .shipping-highlight { padding: 10px !important; }
    .print-title { font-size: 0.85rem !important; line-height: 1.2; word-break: break-word; }
    .print-detail, .ship-sub { font-size: 0.72rem !important; line-height: 1.3; }
    .ship-text { font-size: 0.85rem !important; }
    .print-badge { font-size: 0.65rem !important; padding: 3px 8px !important; }
    .print-highlight > div, .shipping-highlight > div { flex-wrap: wrap; }

    /* ---------- TABELLA PREZZI: scroll orizzontale interno ---------- */
    .price-table-container { overflow-x: auto !important; -webkit-overflow-scrolling: touch; border-radius: 8px; max-width: 100%; }
    .price-table { font-size: 0.78rem !important; min-width: 500px; }
    .price-table th, .price-table td { padding: 6px 5px !important; }
    .price-cell-sub { font-size: 0.62rem !important; }

    /* ---------- COLORI ---------- */
    .color-picker, .color-grid { gap: 6px !important; flex-wrap: wrap; }
    .color-swatch, .color-item { width: 44px !important; height: 44px !important; flex: 0 0 auto; }

    /* ---------- UPLOAD ---------- */
    .image-upload-grid { gap: 10px !important; grid-template-columns: 1fr !important; }
    .img-upload-box { padding: 12px !important; min-height: 90px !important; }
    .img-upload-box .upload-icon { font-size: 1.4rem !important; margin-bottom: 4px !important; }
    .img-upload-box .upload-label { font-size: 0.8rem !important; }
    .img-upload-box .upload-text { font-size: 0.72rem !important; }
    .img-upload-box img.preview-img { max-height: 100px !important; }

    /* ---------- CARRELLO (in offer page) ---------- */
    .cart-section { padding: 12px !important; margin-top: 12px !important; }
    .cart-summary { gap: 6px !important; flex-wrap: wrap; }
    .cart-summary > * { min-width: 0; }
    .cart-total-value { font-size: 1.15rem !important; }
    .cart-total-label, .cart-unit-price { font-size: 0.8rem !important; }
    .btn-cart { padding: 12px 8px !important; font-size: 0.95rem !important; width: 100% !important; max-width: 100% !important; box-sizing: border-box; white-space: normal; word-break: break-word; }

    /* ---------- DESCRIZIONE ---------- */
    .product-desc { padding: 12px !important; margin-top: 20px !important; }
    .product-desc h3 { font-size: 1rem !important; }
    .product-desc p, .product-desc li { font-size: 0.82rem !important; line-height: 1.4; }
    .product-desc ul { padding-left: 20px !important; }

    /* ---------- BREADCRUMB ---------- */
    .breadcrumb { font-size: 0.72rem !important; margin-bottom: 12px !important; padding: 6px 10px !important; flex-wrap: wrap; }

    /* ---------- INSEGNE: configuratore ---------- */
    .insegne-config-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 16px !important; }
    .insegne-config-grid .config-sidebar { position: static !important; }
    .ral-color-tile { width: 44px !important; height: 44px !important; }

    /* ---------- CARRELLO PAGINA ---------- */
    .cart-item-header .col-md-4.text-md-end { text-align: left !important; margin-top: 8px; }
    .total-section { padding: 12px !important; }
    .shipping-method-card { padding: 10px !important; }
    .shipping-method-card .form-check-label { font-size: 0.85rem; }

    /* ---------- CHECKOUT ---------- */
    .checkout-container { padding: 12px !important; }
    .checkout-container .form-floating { margin-bottom: 10px; }
    .checkout-container .form-control,
    .checkout-container .form-select { font-size: 16px !important; }  /* iOS no-zoom */

    /* ---------- BOOTSTRAP CONTAINER PADDING ---------- */
    .container, .container-fluid { padding-left: 12px !important; padding-right: 12px !important; max-width: 100% !important; }
    .row { margin-left: 0 !important; margin-right: 0 !important; }

    /* ---------- FOOTER ---------- */
    footer { padding-left: 12px !important; padding-right: 12px !important; }
    footer .container, footer .container-fluid { padding: 0 !important; }
    footer ul, footer .nav { flex-wrap: wrap !important; justify-content: center !important; gap: 4px 12px !important; padding-left: 0 !important; }
    footer li { white-space: nowrap; }
    footer a { font-size: 0.85rem; }
}

@media (max-width: 380px) {
    #promoBar .promo-row1 > span:first-child { display: none; }
    .offer-banner h3 { font-size: 0.85rem !important; }
    .product-title { font-size: 1.05rem !important; }
    .btn-cart { font-size: 0.85rem !important; }
}
