/* Cascina Bonfiglio — Pagina ringraziamento ordine (Figma 201:4247 / 201:4709).
   Override del template WC checkout/thankyou.php — replica il popup
   "Ordine confermato!" con banner punti fedeltà. Il pannello viene
   mostrato come modal overlay all'arrivo sulla thankyou page.
*/

/* ===== Modal overlay (Figma 201:4709) ===== */
.cb-thankyou-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
.cb-thankyou-modal.is-open { display: flex; }
.cb-thankyou-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(35, 22, 10, .55);
    backdrop-filter: blur(2px);
    animation: cb-thankyou-fade .25s ease both;
}
.cb-thankyou-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 693px;
    animation: cb-thankyou-pop .35s cubic-bezier(.34,1.56,.64,1) both;
}
.cb-thankyou-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    background: rgba(0,0,0,.04);
    color: #23160a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background .2s ease, transform .2s ease;
}
.cb-thankyou-modal__close:hover { background: rgba(0,0,0,.12); transform: scale(1.06); }
.cb-thankyou-modal__close:focus-visible { outline: 2px solid var(--cb-green); outline-offset: 2px; }

.cb-thankyou__panel--modal {
    box-shadow: 0 30px 80px rgba(0,0,0,.25);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

@keyframes cb-thankyou-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cb-thankyou-pop {
    from { opacity: 0; transform: translateY(20px) scale(.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .cb-thankyou-modal__backdrop,
    .cb-thankyou-modal__dialog { animation: none; }
}

/* Lock body scroll when modal open. */
body.cb-thankyou-modal-open { overflow: hidden; }

.cb-thankyou {
    padding: 80px 0 100px;
    background: #fff;
    color: var(--cb-brown);
    font-family: var(--cb-font-body);
}
.cb-thankyou__inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

.cb-thankyou__panel {
    background: #fff;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.12);
    padding: 50px 60px 40px;
    text-align: center;
    max-width: 693px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 23px;
}
.cb-thankyou__panel--failed { border-color: #f0c5c5; background: #fff7f7; }

.cb-thankyou__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 77px; height: 75px;
    margin: 0;
}
.cb-thankyou__icon img { width: 100%; height: auto; display: block; }

.cb-thankyou__title {
    margin: 0;
    font-family: var(--cb-font-heading);
    font-size: 38px; font-weight: 800;
    color: var(--cb-brown);
    line-height: 1.1;
}
/* Variante Figma 201:4709: titolo in font script (Caveat). */
.cb-thankyou__title--script {
    font-family: var(--cb-font-accent); font-style: italic;
    font-weight: 700;
    font-size: 58px;
    line-height: 47px;
    letter-spacing: 1.1743px;
    color: #000;
}

.cb-thankyou__lead {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 18px;
    line-height: 1.5;
    color: #000;
}

.cb-thankyou__num {
    margin: 0;
    font-size: 13px;
    color: #6f7268;
}

.cb-thankyou__cta-row {
    margin: 0;
    display: flex; flex-wrap: wrap; gap: 15px; justify-content: center;
}
.cb-thankyou__cta {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 22px;
    background: var(--cb-green);
    color: #fff;
    font-family: var(--cb-font-body);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.6px;
    border: 0;
    border-radius: 86px;
    text-decoration: none;
    transition: background .2s ease;
    min-width: 179px;
    justify-content: center;
    cursor: pointer;
}
/* Lista errori validazione nel modal "Pagamento non riuscito" — bullet leggibili. */
.cb-thankyou__lead--errors {
    margin-bottom: 8px !important;
    font-weight: 600;
}
.cb-thankyou__errors {
    list-style: none;
    margin: 0 0 18px;
    padding: 14px 18px;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-family: var(--cb-font-body);
    font-size: 14px;
    line-height: 1.5;
    color: #2C1A0E;
    text-align: center;
}
.cb-thankyou__errors li {
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
}
.cb-thankyou__errors li:last-child { margin-bottom: 0; }
.cb-thankyou__lead--errors { text-align: center !important; }

/* Header statico "Ordine effettuato!" — sopra il riepilogo. */
.cb-thankyou__success-header {
    text-align: center;
    padding: 40px 20px 24px;
    max-width: 720px;
    margin: 0 auto;
}
.cb-thankyou__success-icon {
    display: inline-block;
    margin: 0 auto 16px;
}
.cb-thankyou__success-title {
    margin: 0 0 12px;
    font-family: var(--cb-font-display, var(--cb-font-body));
    font-size: 32px;
    font-weight: 800;
    color: var(--cb-text, #2C1A0E);
    line-height: 1.15;
}
.cb-thankyou__success-lead {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 16px;
    color: #555;
    line-height: 1.5;
}
@media (max-width: 640px) {
    .cb-thankyou__success-header { padding: 28px 16px 18px; }
    .cb-thankyou__success-title { font-size: 24px; }
    .cb-thankyou__success-lead { font-size: 14px; }
}
.cb-thankyou__cta:hover { background: #6a8a4f; }
.cb-thankyou__cta--ghost {
    background: #fae7cc;
    color: #000;
    border: 0;
    min-width: 81px;
}
.cb-thankyou__cta--ghost:hover { background: #f5dcb5; }

/* Banner punti fedeltà (Figma 201:4689). bg #fae7cc, radius 10, jar 60, badge green pill. */
.cb-thankyou__loyalty {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fae7cc;
    border-radius: 10px;
    padding: 8px 20px;
    margin: 0;
    text-align: left;
    width: 273px;
    box-sizing: border-box;
    height: 76px;
}
.cb-thankyou__loyalty-jar { display: inline-flex; flex-shrink: 0; }
.cb-thankyou__loyalty-jar img { width: 60px; height: 60px; display: block; }
.cb-thankyou__loyalty-text {
    font-size: 8.5px;
    line-height: 10px;
    color: #000;
    flex: 1;
    min-width: 0;
}
.cb-thankyou__loyalty-text p { margin: 3px 0 0; }
.cb-thankyou__loyalty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cb-green);
    color: #fff;
    font-weight: 700;
    font-size: 9.6px;
    letter-spacing: 0.42px;
    padding: 4px 10px;
    border-radius: 60px;
    height: 18px;
    box-sizing: border-box;
}
.cb-thankyou__loyalty-total { font-size: 8.5px; margin-top: 4px; }
.cb-thankyou__loyalty-total strong { color: #000; font-weight: 700; }

/* Dettagli ordine sotto al pannello principale */
.cb-thankyou__details {
    margin-top: 32px;
    background: #fbfaf6;
    border-radius: 12px;
    padding: 24px 28px;
    text-align: left;
}
.cb-thankyou__meta {
    list-style: none;
    margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px;
}
.cb-thankyou__meta li {
    display: flex; flex-direction: column; gap: 2px;
}
.cb-thankyou__meta span { font-size: 12px; color: #6f7268; text-transform: uppercase; letter-spacing: .04em; }
.cb-thankyou__meta strong { font-size: 15px; color: var(--cb-brown); font-weight: 700; }

.cb-thankyou__note {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #efe9e2;
}
.cb-thankyou__note h2 { margin: 0 0 6px; font-size: 14px; font-weight: 700; }

@media (max-width: 1024px) {
    .cb-thankyou { padding: 60px 0 80px; }
    .cb-thankyou__inner { padding: 0 20px; }
    .cb-thankyou__panel { padding: 40px 32px 32px; }
}

@media (max-width: 640px) {
    .cb-thankyou { padding: 36px 0 60px; }
    .cb-thankyou__inner { padding: 0 16px; }
    .cb-thankyou__panel { padding: 32px 20px 24px; gap: 18px; border-radius: 16px; }
    .cb-thankyou-modal { padding: 16px; }
    .cb-thankyou-modal__close { top: 10px; right: 10px; width: 30px; height: 30px; }
    .cb-thankyou__panel--modal { padding-top: 40px; }
    .cb-thankyou__icon { width: 56px; height: 54px; }
    .cb-thankyou__title { font-size: 26px; }
    .cb-thankyou__title--script { font-size: 38px; line-height: 1.05; }
    .cb-thankyou__lead { font-size: 14px; line-height: 1.5; }
    .cb-thankyou__num { font-size: 12px; }
    .cb-thankyou__cta-row { flex-direction: column; gap: 10px; width: 100%; }
    .cb-thankyou__cta { width: 100%; justify-content: center; padding: 11px 18px; font-size: 13px; }
    .cb-thankyou__note h2 { font-size: 13px; }
}
