/* ============================================================
   Offer Page (Annuncio) — Figma redesign
   Riferimento: figma.com/.../Secarepay-Motors node 64:519
   Namespace: .op__* — isolato, non interferisce col legacy
   Tutte le dimensioni in rem; design tokens (--color-pay, --color-border).
   ============================================================ */

.op {
    --op-text: #44403c;
    --op-text-light: #44403c;
    --op-success: #2a9250;
    --op-success-bg: #d9eddb;
    --op-card-radius: 1.5rem;
    --op-sidebar-width: 25rem;

    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.5rem;
    font-family: 'Roboto', sans-serif;
    color: var(--op-text);
    box-sizing: border-box;
}

.op *,
.op *::before,
.op *::after {
    box-sizing: border-box;
}

/* --- Topbar: back link + action buttons --- */
.op__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 0.75rem;
}

.op__back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 300;
    color: var(--op-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.op__back:hover {
    color: var(--color-pay);
}

.op__back-icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

.op__actions {
    display: flex;
    align-items: center;
    gap: 0;
    justify-content: space-between;
    width: var(--op-sidebar-width);
}

@media (max-width: 899px) {
    .op__topbar {
        gap: 1rem;
        margin-bottom: 0;
        padding-bottom: 0.875rem;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 1.5rem;
    }

    .op__back-label {
        display: none;
    }

    .op__back-icon {
        width: 1.15rem;
        height: 1.15rem;
    }

    .op__actions {
        width: auto;
        gap: 0.75rem;
    }

    .op__action-label {
        display: none;
    }

    .op__action-btn svg {
        width: 1.65rem;
        height: 1.65rem;
    }
}

.op__action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--mainBlue);
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: transform 0.12s ease;
}

.op__action-btn:active {
    transform: scale(0.95);
}

.op__action-btn svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: currentColor;
    flex-shrink: 0;
}

.op__action-label {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1;
}

/* --- Main area: gallery + sidebar --- */
.op__main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* op__left è flex column per permettere il reorder su mobile */
.op__left {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Desktop: specs tra heading e gallery */
.op__left > .op__specs {
    display: flex;
    order: 2;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-top: 0;
}
.op__left > .op__gallery { order: 3; }
.op__inline-ctas { display: none; }

@media (max-width: 899px) {
    .op__heading  { order: 2; }
    .op__left > .op__gallery { order: 1; margin-bottom: 1rem; }
    .op__left > .op__specs {
        order: 4;
        padding-top: 0;
        margin-top: 0.625rem;
    }
    .op__inline-ctas {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        order: 3;
        margin-top: 0.625rem;
        margin-bottom: 1rem;
    }
}

@media (min-width: 900px) {
    .op__main {
        grid-template-columns: 1fr var(--op-sidebar-width);
    }
}

/* --- Gallery (carousel singolo con frecce ai lati estremi) --- */
.op__gallery {
    position: relative;
    min-width: 0;
}

.op__gallery-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    border-radius: 1.25rem;
    /* overflow:hidden makes this a scroll container, so focusing a child (nav arrows,
       or a slide <a> when Fancybox restores focus on close) lets the browser scroll
       it to reveal the focused element — pushing the active slide off-screen and
       blanking the gallery. overflow:clip clips identically but is NOT scrollable, so
       focus can never shift the slides. hidden is kept as fallback for old browsers. */
    overflow: hidden;
    overflow: clip;
    background: #d9d9d9;
}

.op__gallery-carousel .swiper-wrapper {
    height: 100%;
}

.op__gallery-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: block;
}

.op__gallery-slide picture,
.op__gallery-slide img,
.op__gallery-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.op__gallery-arrow {
    position: absolute;
    top: auto;
    bottom: 1.625rem;
    transform: none;
    z-index: 3;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-pay);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.15s ease;
    padding: 0;
}

.op__gallery-arrow:hover {
    opacity: 0.85;
}

.op__gallery-arrow svg {
    width: 0.75rem;
    height: 0.75rem;
    fill: #fff;
}

.op__gallery-arrow--prev { left: 0.75rem; }
.op__gallery-arrow--next { right: 0.75rem; }

.op__gallery-arrow.swiper-button-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.op__gallery-arrow.swiper-button-lock {
    display: none; /* nascondi se c'è una sola slide */
}

/* --- Wishlist — attivo nella topbar: cuore pieno blu (non bianco come sulle card lista) --- */
.op__wishlist--active .wl-icon__filled {
    fill: var(--mainBlue);
}

/* Sfondo scuro sottile dietro i thumb in overlay per leggibilità */
.op__gallery-carousel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.38), transparent);
    pointer-events: none;
    z-index: 1;
}

/* --- Gallery thumbs strip — overlay sul carousel --- */
.op__gallery-thumbs {
    position: absolute;
    bottom: 0.625rem;
    left: calc(0.75rem + 2.25rem + 0.5rem);
    right: calc(0.75rem + 2.25rem + 0.5rem);
    overflow: hidden;
    z-index: 2;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 0.4rem;
}

.op__gallery-thumbs .swiper-wrapper {
    display: flex;
    gap: 0;
    transition: transform 0.3s ease;
}

.op__gallery-thumb {
    flex: 0 0 calc(100% / 5);
    width: calc(100% / 5);
    height: 4.25rem;
    padding: 0;
    border: 0;
    border-right: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 0;
    background: #d9d9d9;
    cursor: pointer;
    overflow: hidden;
    transition: opacity 0.15s ease;
    opacity: 0.75;
}

.op__gallery-thumb:first-child {
    border-radius: 0.4rem 0 0 0.4rem;
}

.op__gallery-thumb:last-child,
.op__gallery-thumb:nth-child(5) {
    border-right: 0;
    border-radius: 0 0.4rem 0.4rem 0;
}

.op__gallery-thumb:hover {
    opacity: 1;
}

.op__gallery-thumb.op__gallery-thumb--active {
    opacity: 1;
    box-shadow: inset 0 0 0 2px #fff;
}

.op__gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.op__gallery-thumb--video {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.op__gallery-thumb-play {
    width: 1.75rem;
    height: 1.75rem;
    fill: #fff;
}

/* --- Dots pagination (solo mobile) --- */
.op__gallery-dots {
    display: none;
}

.op__gallery-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #ccc;
    margin: 0 0.25rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.op__gallery-dot--active {
    background: var(--mainBlue);
    transform: scale(1.25);
}

/* --- Gallery: mobile — puntini sotto, frecce nascoste --- */
@media (max-width: 899px) {
    .op__gallery-thumbs {
        display: none;
    }

    .op__gallery-carousel::after {
        display: none;
    }

    .op__gallery-arrow {
        display: none;
    }

    .op__gallery-carousel {
        aspect-ratio: 4 / 3;
    }

    .op__gallery-dots {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0.375rem 0 0.25rem;
    }
}

/* --- Sidebar (resume + Paga Sicuro) --- */
.op__sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* --- Resume card --- */
.op__resume {
    position: relative;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--op-card-radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    overflow: hidden;
}

.op__pagasicuro::before {
    content: "";
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    width: 7.5rem;
    height: 7.5rem;
    background-image: url('/static/images/offer-card-pattern.png');
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.5;
    pointer-events: none;
    transform: scale(-1);
    filter: invert(47%) sepia(21%) saturate(1143%) hue-rotate(100deg) brightness(89%) contrast(93%);
}


.op__resume::before {
    content: "";
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 7.5rem;
    height: 7.5rem;
    background-image: url('/static/images/offer-card-pattern.png');
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.5;
    pointer-events: none;
}

/* Solo desktop: la sola card resume diventa fissa quando il top scrolla sopra l'header,
   mentre la card verde (op__pagasicuro) resta nel flusso normale.
   Gestito via classe .op__resume--fixed togglata da JS (scroll listener).
   Approccio fixed perché OfferInfo/OfferDetail sono plugin separati e non
   condividono un parent comune che permetterebbe `position: sticky`.
   IMPORTANTE: queste regole devono stare DOPO .op__resume per sovrascrivere
   position: relative quando la card è fissata (specificità identica → vince
   l'ordine sorgente). */
@media (min-width: 900px) {
    .op__sidebar {
        align-self: start;
    }

    .op__resume--fixed {
        position: fixed;
        top: 1rem;
        width: var(--op-sidebar-width);
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        z-index: 10;
    }

    /* placeholder che mantiene lo spazio della resume nel layout quando è fixed */
    .op__resume-placeholder {
        width: var(--op-sidebar-width);
    }
}

/* ── Colonna sinistra: heading + gallery impilati ── */
.op__left {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Heading inside la colonna gallery ── */
.op__heading {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 1.5rem;
    margin-bottom: 1rem;
    align-items: start;
}

@media (max-width: 899px) {
    .op__heading {
        grid-template-columns: 1fr;
    }
}

.op__heading-left {
    min-width: 0;
    margin-bottom: 1rem;
}

.op__heading-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

@media (max-width: 899px) {
    .op__heading-right {
        align-items: flex-start;
        text-align: left;
    }
}

/* Specs: striscia che spanna entrambe le colonne */
.op__heading .op__specs {
    display: flex;
    grid-column: 1 / -1;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

@media (max-width: 899px) {
    .op__heading .op__specs {
        flex-wrap: wrap;
        gap: 0.75rem 1.5rem;
    }
    .op__heading .op__specs .op__spec {
        flex: 0 0 calc(50% - 0.75rem);
    }
}

/* ── Header card: collassato di default, si apre con un'animazione di allungamento
   della card quando .op__resume--context-visible viene aggiunto via JS.
   max-height + margin animati sul header stesso (non sui figli) perché
   display:none rimuove le dimensioni e rompe l'animazione height. ── */
.op__resume-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                margin    0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity   0.3s ease 0.18s;
}

.op__resume--context-visible .op__resume-header {
    max-height: 12rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    opacity: 1;
}

.op__resume-header-left {
    flex: 1;
    min-width: 0;
}

.op__resume-header-right {
    display: flex;
    flex-shrink: 0;
    margin-left: auto;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.op__title {
    margin: 0;
    font-size: 2rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__resume .op__title {
    font-size: 1.125rem;
    line-height: 1.375rem;
}

.op__version {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 300;
    color: var(--op-text);
}

.op__price-stroked {
    display: inline-block;
    margin: 0;
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 300;
    color: var(--greyText);
    text-decoration: line-through;
}

.op__price {
    display: block;
    margin: 0.25rem 0 0;
    font-size: 40px;
    line-height: 2.25rem;
    font-weight: 300;
    color: var(--color-pay);
}

.op__resume .op__price {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.75rem;
}

.op__price-note {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    font-weight: 300;
    color: var(--greyText);
    text-align: right;
}

/* ── Specs: striscia orizzontale, inizialmente nascosta ──
   Diventa visibile (.op__resume--specs-visible) via IntersectionObserver
   quando il sentinel in cima a OfferDetail esce dal viewport. */
.op__specs {
    display: none;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0 1.5rem;
    margin-top: 1rem;
    padding-top: 4rem;
    overflow: hidden;
}

.op__resume--context-visible .op__specs {
    display: flex;
}

.op__spec {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex-shrink: 0;
    min-width: 0;
}

.op__spec-label {
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 300;
    color: var(--op-text);
}

.op__spec-value {
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: var(--op-text);
    word-break: break-word;
}

/* --- Divider (Figma Line 1) --- */
.op__divider {
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid var(--color-border);
}

/* --- Dealer card --- */
.op__dealer {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.op__dealer-avatar {
    flex: 0 0 auto;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: #d9d9d9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
}

.op__dealer-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1 1 auto;
}

.op__dealer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    width: fit-content;
    font-size: 0.875rem;
    line-height: 1rem;
    font-weight: 600;
    color: var(--color-pay);
}

.op__dealer-badge-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.op__dealer-name-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
    color: var(--op-text);
}

.op__dealer-name-link:hover .op__dealer-name {
    color: var(--color-pay);
}

.op__dealer-name {
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__dealer-link-icon {
    width: 0.625rem;
    height: 0.625rem;
    flex: 0 0 auto;
}

.op__dealer-location {
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 300;
    color: var(--op-text);
}

/* --- CTAs (Mostra numero solid + Scrivi/Whatsapp outline) --- */
.op__ctas {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2rem;
}

/* Riga con Scrivi + WhatsApp affiancati */
.op__ctas-row {
    display: flex;
    gap: 0.5rem;
}

.op__ctas-row .op__cta {
    flex: 1 1 0;
    min-width: 0;
}

.op__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 600;
    border-radius: var(--radius-control);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: 1px solid transparent;
    font-family: inherit;
}

.op__cta--primary {
    background: var(--color-pay);
    border-color: var(--color-pay);
    color: #fff;
}

.op__cta--primary:hover {
    background: var(--color-pay-700);
    border-color: var(--color-pay-700);
}

.op__cta--outline {
    background: #fff;
    border-color: var(--color-pay);
    color: var(--color-pay);
}

.op__cta--outline:hover {
    background: var(--color-pay-50);
}

.op__cta-icon {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
}

/* --- Paga Sicuro card (separato, verde) --- */
.op__pagasicuro {
    position: relative;
    background: var(--op-success-bg);
    border: 1px solid var(--op-success);
    border-radius: var(--op-card-radius);
    padding: 2rem 1.5rem;
}

/* Footer della card op__resume: bleed ai lati e in basso, niente border-radius */
.op__resume .op__pagasicuro {
    margin: 1.5rem -1.5rem -1.5rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-top: 1px solid var(--op-success);
}

.op__pagasicuro-icon-link {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: block;
    line-height: 0;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.op__pagasicuro-icon {
    width: 1.375rem;
    height: 1.375rem;
    pointer-events: none;
}

.op__pagasicuro-title {
    margin: 0 2rem 0.25rem 0;
    font-size: 1.25rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--op-success);
}

.op__pagasicuro-body {
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 300;
    color: var(--op-text);
}

.op__pagasicuro-btn {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    background: var(--op-success);
    color: #fff;
    font-size: 1rem;
    line-height: 1.25rem;
    font-weight: 600;
    border: 0;
    border-radius: var(--radius-control);
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.15s ease;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

.op__pagasicuro-btn:hover {
    background: #237a42;
}

.op__inline-wallet-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.op__inline-wallet-btn .op__cta-icon {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    flex-shrink: 0;
}

@media (max-width: 899px) {
    .op__inline-wallet-btn {
        display: flex;
    }
}

.op__pagasicuro--disabled {
    cursor: not-allowed;
}

.op__pagasicuro--disabled .op__pagasicuro-btn {
    pointer-events: none;
}

/* --- Modal: Pagamento Custodito info --- */
.op__pcustodito-modal {
    position: fixed;
    inset: 0;
    z-index: 100010;
}

.op__pcustodito-modal[hidden] {
    display: none;
}

.op__pcustodito-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.op__pcustodito-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(34rem, calc(100vw - 2rem));
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    animation: pcustodito-in 0.18s ease;
}

@keyframes pcustodito-in {
    from { opacity: 0; transform: translate(-50%, calc(-50% - 0.5rem)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.op__pcustodito-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
}

.op__pcustodito-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--mainBlue);
}

.op__pcustodito-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: none;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: #78716c;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.15s ease;
}

.op__pcustodito-close:hover {
    background: #f5f5f4;
}

.op__pcustodito-body {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.op__pcustodito-lead {
    margin: 0;
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.65;
    color: #44403c;
}

.op__pcustodito-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.op__pcustodito-steps li {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    font-size: 0.92rem;
    font-weight: 300;
    line-height: 1.6;
    color: #57534e;
}

.op__pcustodito-steps li > span {
    flex-shrink: 0;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mainBlue);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 50%;
    margin-top: 0.15rem;
}

.op__pcustodito-steps li strong {
    font-weight: 500;
}

.op__pcustodito-footer {
    padding: 0 1.75rem 1.75rem;
}

.op__pcustodito-cta {
    display: block;
    text-align: center;
    padding: 0.875rem 1rem;
    background: var(--mainBlue);
    color: #fff;
    font-weight: 400;
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: var(--radius-control, 0.75rem);
    transition: opacity 0.15s ease;
}

.op__pcustodito-cta:hover {
    opacity: 0.88;
    color: #fff;
}

/* --- Sezioni sotto (Descrizione/Veicolo/Motore/Stato/Accessori) ---
   Larghezza limitata alla colonna sinistra (quella del gallery) cosicché
   non finiscano sotto la sidebar fixed quando si scrolla. */
.op__sections-wrapper {
    --op-text: #44403c;
    --op-success: #2a9250;
    --op-sidebar-width: 25rem;

    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    font-family: 'Roboto', sans-serif;
    color: var(--op-text);
    box-sizing: border-box;
}

@media (min-width: 900px) {
    .op__sections-wrapper {
        padding-right: calc(var(--op-sidebar-width) + 3rem);
    }
}

.op__sections-wrapper *,
.op__sections-wrapper *::before,
.op__sections-wrapper *::after {
    box-sizing: border-box;
}

.op__sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Hairline divider tra tutte le sezioni dell'annuncio
   (Descrizione → Veicolo → Motore → Stato → Accessori → Garanzia → Punti di forza).
   Padding+margin simmetrici per centrare la linea nello spazio tra due sezioni. */
.op__sections > * + * {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

@media (max-width: 550px) {
    .op__sections-wrapper {
        padding: 0 1rem 2rem;
    }

    .op__sections > * + * {
        margin-top: 1.25rem;
        padding-top: 1.25rem;
    }
}

.op__section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.op__section-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--op-text);
}

/* --- Accordion (Veicolo/Motore/Stato/Accessori) --- */
.op__section--accordion .op__section-title {
    margin: 0;
}

.op__section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

/* Icona prima del titolo (a sinistra) — uso order per non toccare il markup */
.op__section-toggle > .op__section-icon {
    order: 1;
}

.op__section-toggle > span:not(.op__section-icon) {
    order: 2;
    font-size: 1.25rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__section-icon {
    position: relative;
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    display: inline-block;
}

.op__section-icon::before,
.op__section-icon::after {
    content: "";
    position: absolute;
    background-color: var(--op-text);
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.op__section-icon::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.op__section-icon::after {
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

/* X = barra orizzontale ruotata 45° + barra verticale ruotata 45°
   (mantengono lo stesso senso → formano croce diagonale). */
[data-accordion][data-expanded="true"] .op__section-icon::before {
    transform: translateY(-50%) rotate(45deg);
}

[data-accordion][data-expanded="true"] .op__section-icon::after {
    transform: translateX(-50%) rotate(45deg);
}

.op__section-body {
    overflow: hidden;
    transition: max-height 0.2s ease, opacity 0.15s ease;
}

[data-accordion][data-expanded="false"] .op__section-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

[data-accordion][data-expanded="true"] .op__section-body {
    max-height: none;
    opacity: 1;
}

.op__section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem 2rem;
}

@media (max-width: 899.9px) {
    .op__section-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem 1.5rem;
    }
}

@media (max-width: 550px) {
    .op__section-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
}

/* --- Descrizione --- */
.op__description {
    position: relative;
}

.op__description-text {
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 300;
    color: var(--op-text);
    max-height: 6rem;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.op__description[data-expanded="true"] .op__description-text {
    max-height: none;
}

.op__description-toggle {
    margin-top: 0.5rem;
    padding: 0;
    background: none;
    border: 0;
    color: var(--color-pay);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.op__description-toggle:hover {
    text-decoration: underline;
}

/* --- Accessori --- */
.op__accessories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.op__accessory-group-name {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__accessory-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem 2rem;
}

@media (max-width: 899.9px) {
    .op__accessory-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 550px) {
    .op__accessory-list {
        grid-template-columns: 1fr;
    }
}

.op__accessory-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 300;
    color: var(--op-text);
}

.op__accessory-check {
    flex: 0 0 auto;
    width: 0.875rem;
    height: 0.875rem;
    fill: var(--color-pay);
}

/* --- Estensione della Garanzia (Figma group 15) --- */
.op__warranty {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-md);
}

.op__warranty-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__warranty-body {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 300;
    color: var(--op-text);
}

.op__warranty-body strong {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__warranty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border: 1px solid var(--color-pay);
    border-radius: var(--radius-control);
    color: var(--color-pay);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.op__warranty-btn:hover {
    background: var(--color-pay-50);
}

/* --- Opteven promo (Estensione della Garanzia — sezione libera, senza card) --- */
.op__opteven-promo {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.op__opteven-promo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.op__opteven-promo-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__opteven-logo {
    height: 1.75rem;
    width: auto;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
}

.op__opteven-promo-price {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--op-text);
}

.op__opteven-promo-body {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 300;
    color: var(--op-text);
}

.op__opteven-promo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border: 1px solid var(--color-pay);
    border-radius: var(--radius-control);
    color: var(--color-pay);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.op__opteven-promo-btn:hover {
    background: var(--color-pay-50);
}

/* --- Responsive resume card --- */
@media (max-width: 550px) {
    .op {
        padding: 1rem;
    }

    .op__resume {
        padding: 1.25rem;
    }

    .op__title { font-size: 1.25rem; }
    .op__price { font-size: 1.75rem; line-height: 2rem; }
    .op__resume--context-visible .op__specs { gap: 0 1rem; }
}

@media (max-width: 899px) {
    /* I 3 bottoni contatto e l'header della card sono nella bar fissa in basso */
    .op__resume .op__ctas,
    .op__resume-header {
        display: none;
    }

    .op__opteven-promo-btn {
        align-self: stretch;
        text-align: center;
    }
}

/* --- Mobile sticky CTA bar --- */
.op__mobile-bar {
    display: none;
}

@media (max-width: 899px) {
    .op__mobile-bar {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        gap: 0.5rem;
        padding: 1rem 0.875rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid var(--color-border);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
        transform: translateY(110%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .op__mobile-bar--visible {
        transform: translateY(0);
    }

    .op__mobile-bar--hidden {
        transform: translateY(110%);
    }

    .op__mobile-bar-preview {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.625rem;
    }

    .op__mobile-bar-thumb {
        height: 3.75rem;
        width: auto;
        aspect-ratio: 5 / 4;
        object-fit: cover;
        border-radius: 0.5rem;
        display: block;
        flex-shrink: 0;
    }

    .op__mobile-bar-info {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        gap: 0.1rem;
    }

    .op__mobile-bar-brand {
        font-size: 0.875rem;
        font-weight: 700;
        color: #1a1a1a;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .op__mobile-bar-model {
        font-size: 0.75rem;
        font-weight: 400;
        color: #666;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .op__mobile-bar-price {
        font-size: 1.125rem;
        font-weight: 700;
        color: var(--color-pay);
        white-space: nowrap;
        letter-spacing: -0.02em;
        flex-shrink: 0;
        align-self: center;
    }

    .op__mobile-bar-ctas {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.375rem;
    }

    /* 3 bottoni: primary a destra (order:1), outline icona-only a sinistra */
    .op__mobile-bar-ctas .op__cta--primary {
        flex: 1;
        min-width: 0;
        font-size: 0.875rem;
        padding: 0.625rem 0.5rem;
        order: 1;
    }

    .op__mobile-bar-ctas .op__cta--outline {
        flex: 0 0 2.75rem;
        padding: 0.625rem 0;
        justify-content: center;
    }

    .op__mobile-bar-ctas .op__cta--outline span {
        display: none;
    }

    /* 1 bottone (outline unico = nessun telefono): diventa blu pieno a tutta larghezza */
    .op__mobile-bar-ctas .op__cta--outline:only-child {
        flex: 0 0 100%;
        order: 0;
        background: var(--color-pay);
        color: #fff;
        border-color: var(--color-pay);
        font-size: 0.9375rem;
        padding: 0.75rem 1rem;
    }

    .op__mobile-bar-ctas .op__cta--outline:only-child span {
        display: inline;
    }

    /* Spazio in fondo alla pagina per non far coprire i contenuti dalla bar */
    .op,
    .op__sections-wrapper {
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom));
    }

    /* Il pulsante preferenze Iubenda appare solo dopo che l'utente ha già scelto:
       su mobile è coperto dalla bar fissa, quindi lo nascondiamo */
    .iubenda-tp-btn {
        display: none !important;
    }
}

/* ============================================================
   Print styles
   ============================================================ */
@media print {
    /* ── Base reset ── */
    .op {
        max-width: none;
        padding: 0;
    }

    /* ── Hide non-printable elements ── */
    .op__topbar,
    .op__gallery-thumbs,
    .op__gallery-arrow,
    .op__gallery-carousel::after,
    .op__gallery-dots,
    .op__inline-ctas,
    .op__mobile-bar,
    .op__ctas,
    .op__inline-wallet-btn,
    .op__pagasicuro,
    .op__opteven-promo,
    .op__description-toggle,
    .offer-info-deal-popup-container,
    .op__pcustodito-modal {
        display: none !important;
    }

    /* ── Single-column layout ── */
    .op__main {
        display: block;
    }

    .op__sidebar {
        margin-top: 1.5rem;
    }

    /* ── Gallery: main image only, no carousel chrome ── */
    .op__gallery-carousel {
        aspect-ratio: unset;
        border-radius: 0.5rem;
        overflow: visible;
        break-inside: avoid;
    }

    .op__gallery-carousel .swiper-wrapper {
        display: block;
        transform: none !important;
    }

    .op__gallery-slide {
        display: none;
        width: 100%;
        height: auto;
    }

    .op__gallery-slide:first-child {
        display: block;
    }

    .op__gallery-slide:first-child picture,
    .op__gallery-slide:first-child img {
        width: 100%;
        height: auto;
        max-height: 22rem;
        object-fit: cover;
        display: block;
        border-radius: 0.5rem;
    }

    /* ── Resume card: flat, static, no shadow ── */
    .op__resume {
        position: static !important;
        box-shadow: none;
        border-color: #ccc;
        break-inside: avoid;
    }

    .op__resume--fixed {
        position: static !important;
        width: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* ── Sections wrapper: remove sidebar offset and add breathing room below resume card ── */
    .op__sections-wrapper {
        padding-right: 1.5rem !important;
        padding-top: 2.5rem;
        padding-bottom: 1rem;
        max-width: none;
    }

    /* ── Expand all accordions ── */
    [data-accordion] .op__section-body {
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible !important;
        pointer-events: auto;
    }

    /* ── Expand truncated description ── */
    .op__description-text {
        max-height: none !important;
        overflow: visible !important;
    }

    /* ── Avoid page breaks inside key blocks ── */
    .op__heading,
    .op__gallery,
    .op__resume,
    .op__section,
    .op__accessory-group {
        break-inside: avoid;
    }
}
