/* ── Reset ───────────────────────────────────────────────────────── */

body.appify-checkout-active .woocommerce-checkout {
    max-width: 100%;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--ap-bg);
}

body.appify-checkout-active .woocommerce-checkout h3,
body.appify-checkout-active .woocommerce-checkout h2,
body.appify-checkout-active .woocommerce-checkout .woocommerce-checkout-coupon,
body.appify-checkout-active .woocommerce-checkout .woocommerce-checkout-login,
body.appify-checkout-active .woocommerce-info {
    display: none !important;
}

/* ── Root container ──────────────────────────────────────────────── */

.appify-co-root {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--ap-bar-h) + var(--ap-safe));
    overflow: hidden;
    background: var(--ap-bg);
    z-index: 40;
}

.admin-bar .appify-co-root { top: 32px; }

@media screen and (max-width: 782px) {
    .admin-bar .appify-co-root { top: 46px; }
}

/* ── Schermate ───────────────────────────────────────────────────── */

.appify-co-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--ap-bg);
    transform: translateX(100%);
    transition: transform .28s var(--ap-ease);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.appify-co-screen.is-active { transform: translateX(0); }

.appify-co-screen--main {
    transform: none;
    transition: none;
}

.appify-co-screen--main.is-active { transform: none; }

/* ── Header principale (Secure Checkout) ─────────────────────────── */

.appify-co-main-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 14px;
    background: var(--ap-accent);
    flex-shrink: 0;
}

.appify-co-main-header svg {
    width: 18px;
    height: 18px;
    stroke: rgba(255,255,255,.85);
    flex-shrink: 0;
}

.appify-co-main-header span {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
}

/* ── Header schermata figlia ─────────────────────────────────────── */

.appify-co-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--ap-accent);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.appify-co-back-btn {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: transform .08s ease-out;
}

.appify-co-back-btn:active { transform: scale(.88); }

.appify-co-back-btn svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
}

.appify-co-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

/* ── Lista voci ──────────────────────────────────────────────────── */

.appify-co-list {
    margin-top: 0;
}

.appify-co-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 16px;
    background: #ffffff;
    border: none;
    border-bottom: 1px solid var(--ap-separator);
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}

.appify-co-item:first-child {
    border-top: 1px solid var(--ap-separator);
}

.appify-co-item.is-pressing,
.appify-co-item:active {
    background: var(--ap-separator);
}

.appify-co-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: rgba(var(--ap-accent-rgb), .10);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.appify-co-item-icon svg {
    width: 15px;
    height: 15px;
    stroke: var(--ap-accent);
    stroke-width: 2;
}

.appify-co-item-label {
    flex: 1;
    font-size: 15px;
    font-weight: 400;
    color: var(--ap-text);
}

.appify-co-item-chevron {
    width: 13px;
    height: 13px;
    stroke: #999999;
    display: block;
    flex-shrink: 0;
}

/* ── Titolo sezione riepilogo ────────────────────────────────────── */

.appify-co-section-title {
    font-size: 12px;
    color: var(--ap-muted);
    padding: 12px 16px 4px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* ── Body schermata figlia ───────────────────────────────────────── */

.appify-co-body {
    flex: 1;
    padding-bottom: 24px;
}

/* ── Campi nelle schermate figlie ────────────────────────────────── */

.appify-co-fields p.form-row {
    margin: 0 !important;
    padding: 5px 16px !important;
    float: none !important;
    width: 100% !important;
    border-bottom: 1px solid var(--ap-separator);
    box-sizing: border-box;
    background: #ffffff;
}

.appify-co-fields p.form-row:last-child { border-bottom: none; }

.appify-co-fields .form-row-first,
.appify-co-fields .form-row-last {
    float: none !important;
    width: 100% !important;
}

.appify-co-fields label {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--ap-muted);
    margin: 0 0 2px !important;
    padding: 0 !important;
    text-transform: none;
    letter-spacing: 0;
}

.appify-co-fields label .required { color: #c62828; }

.appify-co-fields input.input-text,
.appify-co-fields select,
.appify-co-fields textarea {
    width: 100% !important;
    height: 26px !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 15px !important;
    color: var(--ap-text) !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    outline: none !important;
    font-family: inherit !important;
    line-height: 26px !important;
}

.appify-co-fields textarea {
    height: auto !important;
    min-height: 48px !important;
    resize: none;
    line-height: 1.4 !important;
}

.appify-co-fields .woocommerce-input-wrapper { display: block; width: 100%; }

/* Nasconde note aggiuntive spurie dentro billing */
.appify-co-fields .woocommerce-additional-fields { display: none !important; }

/* Nasconde titoli h2/h3 dentro schermate figlie */
.appify-co-body h2,
.appify-co-body h3 { display: none !important; }

/* ── Riepilogo ordine ────────────────────────────────────────────── */

body.appify-checkout-active table.shop_table {
    border: none;
    border-collapse: collapse;
    width: 100%;
    background: #ffffff;
    border-top: 1px solid var(--ap-separator);
    border-bottom: 1px solid var(--ap-separator);
}

body.appify-checkout-active table.shop_table th,
body.appify-checkout-active table.shop_table td {
    padding: 10px 16px;
    border: none;
    border-bottom: 1px solid var(--ap-separator);
    font-size: 14px;
    color: var(--ap-text);
    background: transparent;
    font-weight: 400;
    vertical-align: middle;
}

body.appify-checkout-active table.shop_table tfoot tr:last-child th,
body.appify-checkout-active table.shop_table tfoot tr:last-child td {
    font-size: 15px;
    font-weight: 700;
    border-bottom: none;
}

/* Thumbnail prodotto */
body.appify-checkout-active .appify-order-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--ap-radius-sm);
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

body.appify-checkout-active table.shop_table .product-thumbnail { display: none !important; }

/* ── Pagamento ───────────────────────────────────────────────────── */

body.appify-checkout-active #payment {
    background: #ffffff;
    border-top: 1px solid var(--ap-separator);
    border-bottom: 1px solid var(--ap-separator);
    padding: 0 16px 16px;
    border-radius: 0;
    margin-top: 12px;
}

body.appify-checkout-active #payment ul.payment_methods {
    border: none; padding: 0; margin: 0;
}

body.appify-checkout-active #payment ul.payment_methods li {
    border-bottom: 1px solid var(--ap-separator);
    margin: 0; padding: 13px 0; background: transparent;
}

body.appify-checkout-active #payment ul.payment_methods li:last-child { border-bottom: none; }

body.appify-checkout-active #payment ul.payment_methods li label {
    font-size: 15px; font-weight: 400; color: var(--ap-text);
    cursor: pointer; margin: 0; text-transform: none; font-family: inherit;
}

body.appify-checkout-active #payment .payment_box {
    background: transparent; padding: 8px 0 0; margin: 0;
    font-size: 13px; color: var(--ap-muted);
}

body.appify-checkout-active #payment .payment_box::before { display: none; }

/* ── Bottone ─────────────────────────────────────────────────────── */

body.appify-checkout-active #place_order {
    display: block; width: 100%; height: 46px;
    background: var(--ap-accent); color: #fff;
    border: none; border-radius: var(--ap-radius);
    font-size: 15px; font-weight: 600; cursor: pointer;
    -webkit-appearance: none; margin-top: 14px; font-family: inherit;
    transition: transform .08s var(--ap-ease), opacity .12s;
}

body.appify-checkout-active #place_order:active { transform: scale(.98); opacity: .85; }

/* ── Termini ─────────────────────────────────────────────────────── */

body.appify-checkout-active .woocommerce-terms-and-conditions-wrapper {
    font-size: 13px; color: var(--ap-muted); margin-top: 10px;
}

body.appify-checkout-active .woocommerce-terms-and-conditions-wrapper a { color: var(--ap-accent); }

/* ── Messaggi ────────────────────────────────────────────────────── */

body.appify-checkout-active .woocommerce-error {
    margin: 0 0 12px; border-left: none; padding: 10px 14px;
    font-size: 14px; background: #fff2f2; border: 1px solid #ffcdd2;
    color: #c62828; list-style: none; border-radius: var(--ap-radius-sm);
}

body.appify-checkout-active .woocommerce-message {
    margin: 0 0 12px; border-left: none; padding: 10px 14px;
    font-size: 14px; background: #fff8e1; border: 1px solid #ffe082;
    color: var(--ap-text); border-radius: var(--ap-radius-sm);
}

/* ── Dark mode ───────────────────────────────────────────────────── */

body.appify-dark .appify-co-screen { background: #111111; }
body.appify-dark .appify-co-item { background: #1c1c1e; }
body.appify-dark .appify-co-item.is-pressing { background: #2c2c2e; }
body.appify-dark #payment { background: #1c1c1e; }
body.appify-dark .appify-co-fields p.form-row { background: #1c1c1e; }