/* ============================================================
   EGOMNIA STORE — Checkout Modal
   Swiss-inspired · Light · Generous whitespace
   ============================================================ */

/* --- Overlay --- */
.checkout-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(26, 26, 24, .45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    opacity: 0; pointer-events: none;
    transition: opacity .3s ease;
}
.checkout-overlay.active {
    opacity: 1; pointer-events: auto;
}

/* --- Modal --- */
.checkout-modal {
    position: relative;
    width: 100%; max-width: 620px; max-height: 90vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(26, 26, 24, .12);
    display: flex; flex-direction: column;
    animation: checkoutSlideIn .35s ease;
}
@keyframes checkoutSlideIn {
    from { opacity:0; transform: translateY(24px) scale(.985); }
    to   { opacity:1; transform: translateY(0) scale(1); }
}

.checkout-scroll {
    overflow-y: auto;
    padding: 2.5rem;
}
.checkout-scroll::-webkit-scrollbar { width: 4px; }
.checkout-scroll::-webkit-scrollbar-track { background: transparent; }
.checkout-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* --- Close --- */
.checkout-close {
    position: absolute; top: 1rem; right: 1rem; z-index: 10;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border); border-radius: 50%;
    font-size: 1.2rem; color: var(--fg-dim); cursor: pointer;
    transition: all .15s;
    line-height: 1;
}
.checkout-close:hover {
    background: var(--fg); color: var(--bg); border-color: var(--fg);
}

/* --- Header --- */
.checkout-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.checkout-header__tag {
    display: block;
    font-family: var(--font-sans);
    font-size: .675rem; font-weight: 560; letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .75rem;
}
.checkout-header__title {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--fg);
    margin-bottom: .5rem;
}
.checkout-header__dataset {
    font-family: var(--font-sans);
    font-size: .85rem;
    color: var(--fg-muted);
    margin-bottom: .25rem;
}
.checkout-header__price {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--fg);
}

/* --- Sections --- */
.checkout-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}
.checkout-section:last-of-type { border-bottom: none; }

/* Invoice fields toggle */
#invoiceFields {
    display: none;
    opacity: 0;
    transition: opacity .25s ease;
}
#invoiceFields.visible {
    display: block;
    opacity: 1;
}

.checkout-section__title {
    font-family: var(--font-sans);
    font-size: .75rem; font-weight: 580; letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fg-dim);
    margin-bottom: .5rem;
}
.checkout-section__desc {
    font-size: .85rem;
    color: var(--fg-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* --- Terms Box --- */
.checkout-terms-box {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    max-height: 160px;
    overflow-y: auto;
}
.checkout-terms-box p {
    font-size: .73rem; line-height: 1.7; color: var(--fg-muted);
}
.checkout-terms-box p + p { margin-top: .65rem; }
.checkout-terms-box strong { color: var(--fg); font-weight: 520; }

/* --- Checkbox --- */
.checkout-checkbox {
    display: flex; align-items: flex-start; gap: .65rem;
    cursor: pointer;
    user-select: none;
}
.checkout-checkbox input {
    position: absolute; opacity: 0; width: 0; height: 0;
}
.checkout-checkbox__mark {
    flex-shrink: 0;
    width: 18px; height: 18px;
    border: 1.5px solid var(--border-hov);
    border-radius: 3px;
    margin-top: 1px;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
    background: var(--surface);
}
.checkout-checkbox input:checked + .checkout-checkbox__mark {
    background: var(--accent);
    border-color: var(--accent);
}
.checkout-checkbox input:checked + .checkout-checkbox__mark::after {
    content: '';
    display: block;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg) translateY(-1px);
}
.checkout-checkbox:hover .checkout-checkbox__mark { border-color: var(--fg-dim); }
.checkout-checkbox__text {
    font-size: .78rem;
    color: var(--fg-body);
    line-height: 1.55;
}
.checkout-checkbox__text a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.checkout-checkbox__text a:hover { color: var(--accent-hov); }

/* --- Radio Cards --- */
.checkout-radio-group {
    display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
}
.checkout-radio-card {
    position: relative;
    display: flex; align-items: flex-start; gap: .75rem;
    padding: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .18s;
    background: var(--surface);
}
.checkout-radio-card:hover { border-color: var(--border-hov); background: #fcfcf9; }
.checkout-radio-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.checkout-radio-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkout-radio-card__indicator {
    flex-shrink: 0;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border-hov);
    margin-top: 2px;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.checkout-radio-card:has(input:checked) .checkout-radio-card__indicator {
    border-color: var(--accent);
}
.checkout-radio-card:has(input:checked) .checkout-radio-card__indicator::after {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.checkout-radio-card__content { display: flex; flex-direction: column; }
.checkout-radio-card__title {
    font-family: var(--font-sans);
    font-size: .85rem; font-weight: 520;
    color: var(--fg);
    margin-bottom: .15rem;
}
.checkout-radio-card__desc {
    font-size: .73rem; color: var(--fg-muted); line-height: 1.5;
}

/* --- Form Fields --- */
.checkout-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.checkout-field {
    display: flex; flex-direction: column; gap: .35rem;
}
.checkout-field__label {
    font-family: var(--font-sans);
    font-size: .7rem; font-weight: 520; letter-spacing: .03em;
    color: var(--fg-body);
}
.checkout-field__required { color: var(--accent-alt); }
.checkout-field__input {
    font-family: var(--font-sans);
    font-size: .85rem;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem .75rem;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.checkout-field__input::placeholder { color: var(--fg-dim); }
.checkout-field__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13,148,136,.08);
}
.checkout-field__input.input-error {
    border-color: var(--accent-alt);
    box-shadow: 0 0 0 3px rgba(183,97,14,.06);
}
.checkout-field__error {
    font-size: .68rem; color: var(--accent-alt);
    min-height: 0; opacity: 0; transition: opacity .15s;
}
.checkout-field__error.visible { opacity: 1; }

/* --- Summary --- */
.checkout-summary {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.checkout-summary__row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .85rem; color: var(--fg-muted);
    padding: .35rem 0;
}
.checkout-summary__row + .checkout-summary__row {
    border-top: 1px solid var(--border);
}
.checkout-summary__row--total {
    font-family: var(--font-serif);
    font-size: 1.1rem; font-weight: 500;
    color: var(--fg);
    margin-top: .25rem;
    padding-top: .65rem;
}

/* --- Submit --- */
.checkout-submit {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    width: 100%;
    padding: .85rem 1.5rem;
    margin-top: 1rem;
    border: none; border-radius: var(--radius);
    background: var(--fg);
    color: var(--bg);
    font-family: var(--font-sans);
    font-size: .9rem; font-weight: 500;
    letter-spacing: .01em;
    cursor: pointer;
    transition: all .18s;
}
.checkout-submit:hover:not(:disabled) {
    background: var(--accent);
}
.checkout-submit:disabled {
    opacity: .4; cursor: not-allowed;
}
.checkout-submit__icon { height: 20px; width: auto; }

/* --- Errore a livello di form (acquisti chiusi, PayPal, rete) --- */
.checkout-form-error {
    margin: 0 0 .85rem;
    padding: .7rem .85rem;
    border: 1px solid var(--accent-alt);
    border-radius: var(--radius);
    background: rgba(183,97,14,.06);
    color: var(--accent-alt);
    font-size: .8rem; line-height: 1.45;
}

/* --- Note --- */
.checkout-note {
    text-align: center;
    font-size: .7rem; color: var(--fg-dim);
    margin-top: .85rem; line-height: 1.5;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .checkout-overlay { padding: .75rem; align-items: flex-end; }
    .checkout-modal { max-width: 100%; max-height: 95vh; border-radius: 12px 12px 0 0; }
    .checkout-scroll { padding: 1.75rem 1.25rem; }
    .checkout-radio-group { grid-template-columns: 1fr; }
    .checkout-form-grid { grid-template-columns: 1fr; }
}
