/* Offer detail + native chat modal — see templates/website/modals/redirect_modal.html.
   Two-column grid on >=992px: offer detail | chat. Stacks on mobile. */

/* Selectors here intentionally double-up `.offer-modal.modal-modern`
   because modern-theme.css ships a `.modal-modern .modal-dialog.modal-xl
   { width: 1100px; max-width: calc(100vw - 2rem); }` rule with the same
   specificity as `.offer-modal .modal-xl` — without the extra class our
   width/max-width get overridden. Using `.offer-modal.modal-modern`
   bumps specificity by one class so we always win. */

.offer-modal.modal-modern .modal-dialog.modal-xl,
.offer-modal.modal-modern .modal-dialog.modal-xl.modal-dialog-centered {
    /* Fill ~90% of the viewport in the wide (AI-available) layout — gives
       both the detail card and the AI chat plenty of room to breathe.
       The 2rem subtraction leaves a visible gap around the modal edges. */
    width: calc(90vw - 2rem);
    max-width: calc(90vw - 2rem);
}

/* Wide dialog (default; AI detail+chat visible): force the inner content
   to fill 90vh so the detail/chat columns become tall scrollable surfaces
   instead of just hugging whatever the content needs. The compact dialog
   below intentionally opts out of this. */
.offer-modal.modal-modern .modal-dialog.modal-xl:not(.offer-modal-compact) {
    height: calc(90vh - 2rem);
    margin: 1rem auto;
}
.offer-modal .modal-dialog:not(.offer-modal-compact) .modal-content {
    height: 100%;
}
.offer-modal .modal-dialog:not(.offer-modal-compact) .offer-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;       /* outer scroll-lock; inner columns scroll */
    min-height: 0;
}
.offer-modal .modal-dialog:not(.offer-modal-compact) .offer-modal-grid {
    flex: 1;
    min-height: 0;
    /* Single-row grid: force the row track to fill the available height
       (default `auto` was sizing the row to content, letting the chat
       column grow past the viewport). */
    grid-template-rows: minmax(0, 1fr);
}
/* Grid items must opt out of their implicit `min-height: auto` so the
   inner `.offer-chat-messages` (flex:1; overflow:auto) actually
   constrains. Without this the chat panel grows indefinitely. */
.offer-modal .modal-dialog:not(.offer-modal-compact) .offer-modal-detail,
.offer-modal .modal-dialog:not(.offer-modal-compact) .offer-modal-chat {
    min-height: 0;
    max-height: 100%;
}
/* The detail-body sets its own max-height; in fill-mode it should flex
   instead so it consumes whatever vertical room the column has. The
   wrapping #offerDetailContent (.offer-detail-content) must be a flex
   container for that to take effect. */
.offer-modal .modal-dialog:not(.offer-modal-compact) .offer-detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.offer-modal .modal-dialog:not(.offer-modal-compact) .offer-detail-content .detail-body {
    max-height: none;
    flex: 1;
    min-height: 0;
}
/* In fill-mode the modal is tall enough that capping each tab panel at
   420px wastes vertical space. Let the panel grow and rely on the
   detail-body's overflow:auto for the (rare) very-long tab. */
.offer-modal .modal-dialog:not(.offer-modal-compact) .offer-detail-content .detail-tab-panel {
    max-height: none;
}

/* Compact dialog — used when the offer has no AI mapping (no detail card,
   no chat). Substantial enough to feel like a real modal: 2×2 CTA grid
   (Salva | Ritorna · Richiedi Info | Visualizza Offerta) gives the
   banner enough vertical presence so it doesn't look like a thin strip.
   The .offer-modal.modal-modern specificity bump prevents the
   modern-theme `width: 1100px` rule from overriding us. */
.offer-modal.modal-modern .modal-dialog.modal-xl.offer-modal-compact {
    width: min(720px, 92vw);
    max-width: min(720px, 92vw);
    margin: 3rem auto;
    transition: width 0.2s ease, max-width 0.2s ease;
}
.offer-modal .modal-dialog.offer-modal-compact .offer-modal-body {
    padding: 2rem;
}
.offer-modal .modal-dialog.offer-modal-compact .offer-modal-banner {
    padding: 2rem 2rem 1.75rem;
}
.offer-modal .modal-dialog.offer-modal-compact .offer-modal-banner .banner-message {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 0.5rem;
}
/* CTA row → 2-column grid; the 4 buttons (Salva, Ritorna, Richiedi Info,
   Visualizza Offerta) stack as 2 rows of 2, which gives the modal a
   nice square-ish footprint and lets every button breathe. The Tariffe
   link is `display: none` outside discount-code mode, so it doesn't
   skew the grid. */
.offer-modal .modal-dialog.offer-modal-compact .banner-cta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 0.85rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    width: 100%;
}
.offer-modal .modal-dialog.offer-modal-compact .banner-cta-row > .modal-btn {
    justify-content: center;
    width: 100%;
    padding: 0.85rem 1rem;
}
/* Drop to a single column on phone-width so each button is comfortably
   tappable on a touch device. */
@media (max-width: 540px) {
    .offer-modal .modal-dialog.offer-modal-compact .banner-cta-row {
        grid-template-columns: 1fr;
    }
}

.offer-modal .modal-content {
    border-radius: 16px;
    overflow: hidden;
    border: none;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.18);
}

.offer-modal-body {
    padding: 1.75rem 1.75rem 1.5rem;
    background: #fafbfd;
}

.offer-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e5e7eb;
    color: #6b7280;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.offer-modal-close:hover {
    background: #fff;
    color: #111827;
    border-color: #d1d5db;
}

/* ---- Banner ---- */
/* Two stacked rows inside the colored block: message row + CTAs row.
   The display:flex on the banner itself is gone; .banner-message is
   the flex container now, and .banner-cta-row sits below it. */
.offer-modal-banner {
    padding: 0.85rem 1.1rem 0.9rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.98rem;
    line-height: 1.4;
}
.offer-modal-banner .banner-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.offer-modal-banner.online {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
    border: 1px solid #34d399;
}

.offer-modal-banner.non-online {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.offer-modal-banner.not-logged {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #92400e;
    border: 1px solid #fbbf24;
}

.offer-modal-banner.discount-code {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #3730a3;
    border: 1px solid #818cf8;
    flex-wrap: wrap;
}

.offer-modal-banner.worldexplorer {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #075985;
    border: 1px solid #38bdf8;
}

.offer-modal-banner .banner-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.offer-modal-banner .banner-text {
    flex: 1;
    min-width: 0;
}

.offer-modal-banner .banner-text strong {
    display: block;
    font-weight: 700;
    margin-bottom: 0.15rem;
    font-size: 1.05rem;
}

.offer-modal-banner .banner-discount {
    background: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-weight: 700;
    color: #0b2c56;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.offer-modal-banner .banner-code {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px dashed #818cf8;
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-family: ui-monospace, "SF Mono", monospace;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e1b4b;
}

.offer-modal-banner .banner-copy-btn {
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.offer-modal-banner .banner-copy-btn:hover {
    background: #4338ca;
}

.offer-modal-banner .banner-copy-btn.copied {
    background: #16a34a;
}

.offer-modal-banner .banner-login-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.offer-modal-banner .banner-login-actions a {
    background: #fff;
    color: #92400e;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.offer-modal-banner .banner-login-actions a:hover {
    background: #fef3c7;
}

/* ---- Grid layout ---- */
.offer-modal-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.95fr;
    gap: 1.25rem;
    align-items: stretch;
}

@media (max-width: 991px) {
    .offer-modal-grid {
        grid-template-columns: 1fr;
    }
    .offer-modal-body {
        padding: 1.25rem 1rem 1rem;
    }
}

/* ---- Detail column ---- */
.offer-modal-detail {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    height: 100%;
}

.offer-detail-loading,
.offer-detail-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
    text-align: center;
}

.offer-detail-error i {
    font-size: 1.5rem;
    color: #f59e0b;
    margin-bottom: 0.5rem;
}

.offer-detail-content .detail-body {
    padding: 1.15rem 1.15rem 1.15rem;
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
}

.offer-detail-content .detail-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.offer-detail-content .detail-id-label {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    color: #4b5563;
    font-family: ui-monospace, "SF Mono", monospace;
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.offer-detail-content .detail-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bfg-main, #0b2c56);
    margin: 0;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.offer-detail-content .detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    font-size: 0.85rem;
}

.offer-detail-content .detail-meta .pill {
    background: #f3f4f6;
    color: #374151;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
}

.offer-detail-content .detail-meta .pill.price {
    background: #ecfdf5;
    color: #065f46;
    font-weight: 600;
}

.offer-detail-content .detail-summary {
    color: #374151;
    line-height: 1.55;
    margin-bottom: 1rem;
}

/* Labelled sections (inclusioni/esclusioni/etc) — slightly bigger type
   than before, with a thin top border so the stack reads as discrete
   items rather than a wall of text. */
.offer-detail-content .detail-section {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.55;
    padding-top: 0.7rem;
    margin-top: 0.7rem;
    border-top: 1px solid #f1f5f9;
}
.offer-detail-content .detail-section.detail-summary {
    /* summary sits between the meta pills and the first labelled
       section — no top border, slightly bigger type. */
    font-size: 1rem;
    color: #374151;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}
/* First labelled section after the summary has no top border (the
   summary already sits before it with no decoration). */
.offer-detail-content .detail-summary + .detail-section,
.offer-detail-content .detail-meta + .detail-section {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.offer-detail-content .detail-section-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.offer-detail-content .detail-section-title i {
    color: #2563eb;
    font-size: 0.95rem;
}

/* Inline "Vedi di più": the wrap is the positioning context, the text
   is line-clamped via --clamp-lines (set per-block in JS), and the
   toggle button is absolutely positioned at the bottom-right of the
   collapsed text — sharing the same line as the last visible row.
   A fade gradient on the toggle hides the truncation behind it so it
   reads as a natural "…" replacement. */
.offer-detail-content .detail-section-text-wrap {
    position: relative;
}
.offer-detail-content .detail-section-text {
    white-space: pre-line;
}
.offer-detail-content .detail-section[data-collapsed="1"] .detail-section-text {
    display: -webkit-box;
    -webkit-line-clamp: var(--clamp-lines, 2);
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.offer-detail-content .detail-section-toggle {
    background: none;
    border: none;
    color: #6b7280;          /* muted gray — was blue, was too loud */
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    line-height: inherit;
}
.offer-detail-content .detail-section-toggle:hover {
    color: #374151;
    text-decoration: underline;
}

/* JS sets .toggle-fits when the text doesn't actually need clamping —
   we hide the toggle in that case so users only see "Vedi di più"
   when there's something to expand. */
.offer-detail-content .detail-section-toggle.toggle-fits {
    display: none;
}

/* Collapsed: glue the toggle to the bottom-right of the clamped text. */
.offer-detail-content .detail-section[data-collapsed="1"] .detail-section-toggle {
    position: absolute;
    right: 0;
    bottom: 0;
    padding-left: 2.25rem;
    /* Fade gradient blends the toggle into the truncation point — color
       must match the modal body background (#fafbfd via .offer-modal-body
       on the parent .offer-modal-detail card which has #fff background). */
    background: linear-gradient(to right, rgba(255,255,255,0) 0, #fff 1.5rem);
}

/* Expanded: toggle drops to its own line below the (now-full) text. */
.offer-detail-content .detail-section[data-collapsed="0"] .detail-section-toggle {
    position: static;
    background: none;
    padding-left: 0;
    margin-top: 0.35rem;
}

/* ---- Detail tabs (descrizione / inclusioni / esclusioni / pasti / spese / note) ---- */
.offer-detail-content .detail-tabs {
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.75rem;
}

/* `detail-tabs-top` is the layout where tabs sit immediately under the
   meta pills (no preceding summary block) — drop the divider so tabs feel
   like the primary content surface. */
.offer-detail-content .detail-tabs.detail-tabs-top {
    margin-top: 0.85rem;
    border-top: none;
    padding-top: 0;
}

.offer-detail-content .detail-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.65rem;
}

/* Per-tab categorical color: each tab gets a CSS variable for its
   accent color. Inactive tabs use the color on the left border + icon
   so the category reads at a glance even before clicking. Active tab
   takes over with a solid filled background in the same color. */
.offer-detail-content .detail-tab {
    --tab-color: #6b7280;
    background: #f9fafb;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-left: 3px solid var(--tab-color);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s ease;
}
.offer-detail-content .detail-tab i { font-size: 0.85rem; color: var(--tab-color); }

.offer-detail-content .detail-tab:hover {
    background: #fff;
    color: #1f2937;
    border-color: var(--tab-color);
    border-left-color: var(--tab-color);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.offer-detail-content .detail-tab.active {
    background: var(--tab-color);
    color: #fff;
    border-color: var(--tab-color);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}
.offer-detail-content .detail-tab.active i { color: #fff; }

/* Category color palette — picked so the eye reads inclusioni=positive
   (green), esclusioni=negative (red), pasti=warm (orange), etc. */
.offer-detail-content .detail-tab[data-tab="descrizione"] { --tab-color: #2563eb; }   /* blue */
.offer-detail-content .detail-tab[data-tab="inclusioni"]  { --tab-color: #16a34a; }   /* green */
.offer-detail-content .detail-tab[data-tab="esclusioni"]  { --tab-color: #dc2626; }   /* red */
.offer-detail-content .detail-tab[data-tab="pasti"]       { --tab-color: #ea580c; }   /* orange */
.offer-detail-content .detail-tab[data-tab="note_spese"]  { --tab-color: #7c3aed; }   /* purple */
.offer-detail-content .detail-tab[data-tab="note"]        { --tab-color: #4b5563; }   /* slate */

.offer-detail-content .detail-tab-panel {
    display: none;
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.55;
    white-space: pre-line;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.5rem 0.25rem 0.25rem;
}
.offer-detail-content .detail-tab-panel.active {
    display: block;
}

/* ---- Chat column ---- */
/* Stretches to match the detail column's height (grid is align-items:
   stretch by default). No max-height cap → if the detail card is long,
   the chat grows with it. The .offer-chat-messages scroll-container
   inside flexes (flex: 1) to absorb the extra space. */
.offer-modal-chat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    height: 100%;
}

.offer-chat-header {
    background: linear-gradient(135deg, #f8d775, #e0a64b);
    color: #6e3c00;
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-weight: 700;
    border-radius: 14px 14px 0 0;
}
.offer-chat-header img { flex-shrink: 0; margin-top: 2px; }
.offer-chat-header-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.offer-chat-header-title { font-weight: 700; font-size: 0.95rem; }
.offer-chat-header-sub {
    font-weight: 400;
    font-size: 0.78rem;
    color: #7c2d12;
    opacity: 0.85;
}

/* Empty-state hero panel — Gemini-style centered title + form + chips.
   Hidden in active state via the [data-state="active"] override below. */
.offer-chat-welcome {
    text-align: center;
    padding: 2rem 1.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.offer-chat-welcome-icon {
    width: 48px; height: 48px;
    margin-bottom: 0.25rem;
    opacity: 0.95;
}
.offer-chat-welcome-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
}
.offer-chat-welcome-sub {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* === EMPTY STATE ============================================== */
/* Centered layout: hide active-only chrome, push form + chips into
   the middle of the panel. */
.offer-modal-chat[data-state="empty"] {
    justify-content: center;
}
.offer-modal-chat[data-state="empty"] .offer-chat-header,
.offer-modal-chat[data-state="empty"] #offerChatMessages,
.offer-modal-chat[data-state="empty"] #offerChatTyping,
.offer-modal-chat[data-state="empty"] #offerChatRateInfo {
    display: none;
}
.offer-modal-chat[data-state="empty"] .offer-chat-form {
    border-top: none;
    background: transparent;
    border-radius: 0;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    max-width: 460px;
    width: 100%;
}
.offer-modal-chat[data-state="empty"] .offer-chat-form input {
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    background: #fff;
}
.offer-modal-chat[data-state="empty"] .offer-chat-suggestions-empty {
    margin: 1rem auto 0;
    max-width: 520px;
    padding: 0 1rem;
    width: 100%;
}
.offer-modal-chat[data-state="empty"] .offer-chat-suggestions-empty .offer-chat-suggestions {
    justify-content: center;
    align-self: center;
    margin: 0;
    padding: 0;
}

/* === ACTIVE STATE ============================================= */
/* Once the user sends their first message: hide the welcome panel
   and the empty-state chips host. The header + messages + bottom-
   anchored form take over (default flex column flow). */
.offer-modal-chat[data-state="active"] .offer-chat-welcome,
.offer-modal-chat[data-state="active"] .offer-chat-suggestions-empty {
    display: none;
}

.offer-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #fafbfd;
}

.offer-chat-empty {
    color: #9ca3af;
    font-size: 0.92rem;
    font-style: italic;
    text-align: center;
    margin: auto 0;
    padding: 1rem 0.5rem;
}

.offer-chat-message {
    max-width: 85%;
    padding: 0.55rem 0.85rem;
    border-radius: 14px;
    font-size: 0.93rem;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.offer-chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.offer-chat-message.model {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.offer-chat-message.system {
    align-self: center;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-size: 0.85rem;
    font-style: italic;
}

.offer-chat-message strong {
    font-weight: 700;
}

.offer-chat-message a {
    color: inherit;
    text-decoration: underline;
}

.offer-chat-typing {
    padding: 0.4rem 1rem 0.6rem;
    display: flex;
    gap: 4px;
    background: #fafbfd;
}

.offer-chat-typing .dot {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    animation: chatDot 1.2s infinite ease-in-out;
}

.offer-chat-typing .dot:nth-child(2) { animation-delay: 0.15s; }
.offer-chat-typing .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.offer-chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 0 0 14px 14px;
}

.offer-chat-form input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.offer-chat-form input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.offer-chat-send {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.offer-chat-send:hover { transform: translateY(-1px); }
.offer-chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.offer-chat-rate-info {
    padding: 0 1rem 0.45rem;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: right;
    min-height: 1rem;
}

/* Quick-question chips rendered under the last model message. Pinned by
   appending to the end of .offer-chat-messages — so whenever a new turn
   arrives, the old strip is removed and the new one ends up under the
   latest reply. */
.offer-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.35rem 0 0.15rem;
    padding-left: 0.15rem;
    align-self: flex-start;
    max-width: 100%;
}

.offer-chat-suggest-btn {
    background: #fff;
    color: #2563eb;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 0.32rem 0.78rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    line-height: 1.2;
}

.offer-chat-suggest-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.offer-chat-suggest-btn:active {
    transform: translateY(0);
}

.offer-chat-suggest-btn.preventivo {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border-color: #fcd34d;
    font-weight: 600;
}

.offer-chat-suggest-btn.preventivo:hover {
    background: linear-gradient(135deg, #fde68a, #fcd34d);
    border-color: #f59e0b;
}

/* CTA row INSIDE the banner — sits below the message row, sharing the
   banner's colored background. Right-aligned action cluster on wide
   viewports; stacks full-width on mobile. */
.banner-cta-row {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.55rem;
}
.banner-cta-row .offer-modal-tariffe-link {
    margin-right: auto;
    font-size: 0.88rem;
}

/* Secondary-action cluster: Salva + Ritorna + Richiedi Info read as
   one group. Tighter gap inside the cluster than the gap between the
   cluster and the primary "Visualizza Offerta" CTA on its right. */
.banner-cta-row .banner-cta-secondary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.banner-cta-row .offer-modal-primary {
    margin-left: 0.75rem;
}
@media (max-width: 575px) {
    .banner-cta-row .banner-cta-secondary {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .banner-cta-row .offer-modal-primary { margin-left: 0; width: 100%; }
}

/* CTAs inherit the banner's colored background — make their borders/
   surfaces consistent against any of the 5 mode colors. */
.banner-cta-row .offer-modal-request {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.92);
    color: #1f2937;
}
.banner-cta-row .offer-modal-request:hover {
    background: #fff;
    border-color: #fff;
    color: #111827;
}

/* "Ritorna alla ricerca" — sits next to Richiedi Info. Dark text on a
   translucent white surface so it stays readable on every banner mode
   (online/non-online/not-logged/discount-code/worldexplorer). The prior
   white-on-transparent variant disappeared on the lighter banner colors. */
.banner-cta-row .offer-modal-back {
    background: rgba(255, 255, 255, 0.82);
    border: 1.5px solid rgba(255, 255, 255, 0.92);
    color: #1f2937;
    border-radius: 10px;
    padding: 0.6rem 1.1rem;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.banner-cta-row .offer-modal-back:hover {
    background: #fff;
    border-color: #fff;
    color: #111827;
    transform: translateY(-1px);
}

/* Salva button — heart toggle, mirrors viewedOffers state. Two visual
   modes: outline (red border, red heart, white fill) when not yet saved,
   solid (red fill, white heart) when saved. Clicking toggles state. */
.banner-cta-row .offer-modal-save {
    background: #fff;
    border: 1.5px solid #ef4444;
    color: #ef4444;
    border-radius: 10px;
    padding: 0.6rem 0.95rem;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.banner-cta-row .offer-modal-save:hover {
    background: #fef2f2;
    transform: translateY(-1px);
}
.banner-cta-row .offer-modal-save.saved {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
.banner-cta-row .offer-modal-save.saved:hover {
    background: #dc2626;
    border-color: #dc2626;
}
.banner-cta-row .offer-modal-save i { font-size: 0.95rem; }

@media (max-width: 575px) {
    .banner-cta-row {
        flex-direction: column;
        align-items: stretch;
    }
    .banner-cta-row .offer-modal-back,
    .banner-cta-row .offer-modal-save,
    .banner-cta-row .offer-modal-request,
    .banner-cta-row .offer-modal-primary {
        width: 100%;
        justify-content: center;
    }
    .banner-cta-row .offer-modal-tariffe-link {
        margin-right: 0;
        text-align: center;
    }
}

.offer-modal-tariffe-link {
    color: #2563eb;
    font-size: 0.92rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.offer-modal-tariffe-link:hover {
    text-decoration: underline;
}

.offer-modal-request {
    background: #fff;
    color: #2563eb;
    border: 1.5px solid #2563eb;
    border-radius: 10px;
    padding: 0.65rem 1.2rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.15s ease;
    margin-left: auto;
}

.offer-modal-request:hover {
    background: #eef2ff;
    border-color: #1d4ed8;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.offer-modal-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    font-size: 0.98rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    transition: all 0.15s ease;
}

.offer-modal-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.offer-modal-primary.success {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.offer-modal-primary.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

/* Booking-submitted confirmation card replaces the chat scroll body. */
.offer-chat-booked {
    margin: auto 0;
    text-align: center;
    padding: 1.25rem;
    background: #ecfdf5;
    border: 1px solid #34d399;
    border-radius: 12px;
    color: #065f46;
}

.offer-chat-booked i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #10b981;
}

.offer-chat-booked h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.offer-chat-booked p {
    font-size: 0.9rem;
    margin: 0;
}

/* =====================================================================
   Affiliated Aziende modal — card grid listing partner aziende.
   See templates/website/modals/affiliated_aziende_modal.html.
   ===================================================================== */
.affiliated-aziende-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.25rem 0.1rem 0.25rem 0;
}

.affiliated-aziende-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.affiliated-aziende-card:hover {
    border-color: var(--bfg-main, #2563eb);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.affiliated-aziende-card .aff-card-name {
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--bfg-main, #0b2c56);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.affiliated-aziende-card .aff-card-row {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: #4b5563;
    line-height: 1.4;
    margin-top: 0.25rem;
}
.affiliated-aziende-card .aff-card-row i {
    color: #9ca3af;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 0.2rem;
}
.affiliated-aziende-card .aff-card-piva {
    font-family: ui-monospace, "SF Mono", monospace;
    font-size: 0.8rem;
    color: #6b7280;
}
