/* Order summary ticket (theme visual wave 1, T10; boards Cart-B and CartMobile-B).
   Markup: inc/order-summary.php (fotomania_order_summary_html). Loaded on the cart, the checkout,
   the order-received page and the account (functions.php, fotomania-order-summary). The cart's CEP
   calculator fields and the checkout button keep their rules in cart.css. */

.fm-summary {
    --fm-summary-pad: 24px;
    --fm-summary-dash: oklch(0.20 0.02 45 / 0.22);
    --fm-summary-dash-strong: oklch(0.20 0.02 45 / 0.30);
    --fm-summary-shadow: 0 2px 8px oklch(0.22 0.03 45 / 0.05);
    --fm-summary-stamp: oklch(0.48 0.20 25 / 0.45);
    --fm-summary-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    position: relative;
    box-sizing: border-box;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 14px;
    box-shadow: var(--fm-summary-shadow);
    color: var(--ink);
}

/* Header strip: "PEDIDO · CARRINHO" and the line count. */
.fm-summary__head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 16px var(--fm-summary-pad);
    border-bottom: 1px dashed var(--fm-summary-dash);
    font-family: var(--fm-summary-mono);
    font-size: 11px;
    line-height: 16px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.fm-summary__intro { padding: 20px var(--fm-summary-pad) 0; }
.fm-summary__title {
    margin: 0;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 400;
    font-size: 22px;
    line-height: 28px;
    letter-spacing: 0;
    color: var(--ink);
}

/* Free-shipping bar (inc/copy-tokens.php decides the text and the percentage). */
.fm-summary .ship-progress { margin-top: 16px; }
.fm-summary .ship-progress__text {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
}
.fm-summary .ship-progress__bar {
    margin-top: 10px;
    height: 6px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}
.fm-summary .ship-progress__bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--red);
    transition: width var(--standard, 400ms) var(--ease-out, ease);
}
@media (prefers-reduced-motion: reduce) {
    .fm-summary .ship-progress__bar span { transition: none; }
}

/* Ledger: mono labels and amounts in two strict columns, dashed hairlines between rows. */
.fm-summary__ledger { margin: 20px var(--fm-summary-pad) 0; padding: 0; }
.fm-summary__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    align-items: baseline;
    padding: 14px 0;
    border-top: 1px dashed var(--fm-summary-dash);
}
.fm-summary__ledger > .fm-summary__row:last-child { padding-bottom: 16px; }
.fm-summary__label {
    margin: 0;
    font-family: var(--fm-summary-mono);
    font-size: 12px;
    line-height: 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.fm-summary__value {
    margin: 0;
    font-family: var(--fm-summary-mono);
    font-size: 15px;
    line-height: 20px;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
    color: var(--ink);
}
.fm-summary__value .amount { font-family: inherit; }
.fm-summary__row > dd { margin: 0; }
.fm-summary__row > dd:not(.fm-summary__value) { grid-column: 1 / -1; }

/* Coupons keep WooCommerce's amount and remove link. */
.fm-summary .cart-discount .fm-summary__value { color: var(--red-600); white-space: normal; }
.fm-summary .cart-discount .woocommerce-remove-coupon {
    margin-left: 8px;
    font-family: "Geist", system-ui, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.fm-summary .cart-discount .woocommerce-remove-coupon:hover { color: var(--red-600); }

/* Shipping: "Correios Sedex · 1 a 3 dias úteis", then "para 93800-000 · mudar". */
.fm-summary__row > .fm-summary__ship-method {
    margin-top: 6px;
    font-size: 14px;
    line-height: 20px;
    color: var(--ink);
}
.fm-summary__row > .fm-summary__ship-dest,
.fm-summary__row > .fm-summary__ship-notice,
.fm-summary__row > .fm-summary__ship-details {
    margin-top: 2px;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
}
.fm-summary__row > .fm-summary__ship-notice { margin-top: 6px; }
.fm-summary__change {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 500;
    color: var(--red-600);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    cursor: pointer;
}
.fm-summary__change:hover { color: var(--red); }
.fm-summary__change:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 2px; }
.fm-summary__row > .fm-summary__ship-calc { margin-top: 8px; }
/* WooCommerce wraps the calculator fields in a <section>: drop the page-section padding style.css gives
   it. Its submit takes the board's outline pill (the coupon "aplicar" pattern of Cart-B). The fields
   stay stacked: WooCommerce and the shipping plugin toggle the section's display inline. */
.fm-summary .shipping-calculator-form { padding: 0; }
.fm-summary .shipping-calculator-form > p { margin: 0 0 8px; }
.fm-summary .shipping-calculator-form label {
    display: block;
    margin-bottom: 8px;
    font-family: var(--fm-summary-mono);
    font-size: 12px;
    line-height: 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.fm-summary .shipping-calculator-form input.input-text { height: 44px; box-sizing: border-box; border-radius: 10px; }
.fm-summary .shipping-calculator-form button[name="calc_shipping"] {
    height: 44px;
    padding: 0 20px;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font-family: "Geist", system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--fast, 200ms) ease, color var(--fast, 200ms) ease;
}
.fm-summary .shipping-calculator-form button[name="calc_shipping"]:hover { background: var(--ink); color: var(--paper); }
.fm-summary .shipping-calculator-form button[name="calc_shipping"]:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.fm-summary__ship--calc > .fm-summary__ship-calc { margin-top: 4px; }

/* More than one rate: compact one-line options in the ledger's own style (the board shows only the
   chosen-rate state). The radios are WooCommerce's: cart.js posts the checked one. */
.fm-summary__row > .fm-summary__ship-options { margin-top: 6px; }
.fm-summary__rates { list-style: none; margin: 0; padding: 0; }
.fm-summary__rates li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.fm-summary__rates li + li { border-top: 1px dashed var(--fm-summary-dash); }
.fm-summary__rates input[type="radio"] {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--red);
}
.fm-summary__rates label { flex: 1 1 auto; min-width: 0; cursor: pointer; }
.fm-shipping-option--cart {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 14px;
    line-height: 20px;
}
.fm-shipping-option--cart .fm-shipping-option__line { min-width: 0; color: var(--ink); }
.fm-shipping-option--cart .fm-shipping-option__price {
    flex: none;
    font-family: var(--fm-summary-mono);
    font-weight: 500;
    white-space: nowrap;
}

/* Once a CEP is known the calculator folds away behind "mudar" (these outrank the shipping
   plugin's forced-open rule); "mudar" adds .is-open (script in cart-totals.php). */
.fm-summary__ship--has-cep:not(.is-open) .woocommerce-shipping-calculator { display: none !important; }
.fm-summary__ship--has-cep .shipping-calculator-button { display: none !important; }
.fm-summary__ship--has-cep.is-open .shipping-calculator-form { display: block !important; visibility: visible !important; }

/* Total behind the notched tear line. */
.fm-summary__total {
    position: relative;
    margin: 0 var(--fm-summary-pad);
    border-top: 1px dashed var(--fm-summary-dash-strong);
}
.fm-summary__notch {
    position: absolute;
    top: -9px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--paper);
}
.fm-summary__notch--start { left: calc(-1 * (var(--fm-summary-pad) + 10px)); border-right: 1px solid var(--hairline); }
.fm-summary__notch--end { right: calc(-1 * (var(--fm-summary-pad) + 10px)); border-left: 1px solid var(--hairline); }
.fm-summary__total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding-top: 18px;
}
.fm-summary__total-label {
    font-family: var(--fm-summary-mono);
    font-size: 13px;
    line-height: 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
}
.fm-summary__total-value {
    font-family: var(--fm-summary-mono);
    font-size: 24px;
    line-height: 30px;
    font-weight: 600;
    text-align: right;
}
.fm-summary__total-value strong { font-weight: inherit; }
.fm-summary__total-value .amount { font-family: inherit; }
.fm-summary__total-value small { display: block; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--muted); }

/* Footer: the lab dispatch stamp, then the surface's own action (the cart's proceed button). */
.fm-summary__foot { padding: 18px var(--fm-summary-pad) var(--fm-summary-pad); }
.fm-summary .fm-lab-exit {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid var(--fm-summary-stamp);
    border-radius: 8px;
    font-family: var(--fm-summary-mono);
    font-size: 12px;
    line-height: 18px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--red-600);
}
.fm-summary .fm-lab-exit svg { flex: none; }
.fm-summary .fm-lab-exit__text { min-width: 0; }
.fm-summary .fm-lab-exit__date { white-space: nowrap; }
.fm-summary .wc-proceed-to-checkout { margin-top: 18px; padding: 0; }
.fm-summary__foot > :first-child { margin-top: 0; }

/* Order context (board VO-A): the payment row, and any row the totals list places after the total,
   sit under the total in a quiet second ledger; the ticket closes on its own padding (no footer). */
.fm-summary--order .fm-summary__ledger--after { margin-top: 10px; }
.fm-summary--order .fm-summary__ledger--after .fm-summary__row { padding: 4px 0; border-top: 0; }
.fm-summary--order .fm-summary__ledger--after .fm-summary__value {
    font-family: "Geist", system-ui, sans-serif;
    font-size: 13px;
    font-weight: 400;
    white-space: normal;
    color: var(--muted);
}
.fm-summary--order > :last-child { margin-bottom: var(--fm-summary-pad); }

@media (max-width: 480px) {
    .fm-summary { --fm-summary-pad: 20px; }
}
