/**
 * Cocimundo — Cart page.
 *
 * Loaded only on the cart screen (see cocimundo_enqueue_cart_assets).
 * Everything that lives inside an AJAX-replaced node is styled here rather
 * than with Tailwind utilities, so re-rendered markup paints correctly on the
 * first frame instead of waiting for the CDN's JIT pass.
 */

:root {
    --cocimundo-header-h: 88px;
}

.cocimundo-cart {
    --cc-ink: #111827;
    --cc-ink-soft: #4b5563;
    --cc-muted: #6b7280;
    --cc-line: #e9eaec;
    --cc-line-strong: #d3d6db;
    --cc-surface: #ffffff;
    --cc-canvas: #f7f7f8;
    --cc-accent: #f5b301;
    --cc-accent-dark: #d99a00;
    --cc-accent-soft: #fff8e6;
    --cc-success: #15803d;
    --cc-danger: #b91c1c;
    --cc-radius: 16px;
    --cc-radius-sm: 10px;
    --cc-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);

    background: var(--cc-canvas);
    color: var(--cc-ink);
}

.cocimundo-cart-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1rem 3.5rem;
}

@media (min-width: 1024px) {
    .cocimundo-cart-shell {
        padding: 3rem 2rem 5rem;
    }
}

/* --------------------------------------------------------------------------
 * Header
 * ----------------------------------------------------------------------- */

.cocimundo-cart-header {
    margin-bottom: 1.75rem;
}

.cocimundo-cart-title {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--cc-ink);
}

@media (min-width: 768px) {
    .cocimundo-cart-title {
        font-size: 2.125rem;
    }
}

.cocimundo-cart-subtitle {
    margin: .375rem 0 0;
    font-size: .9375rem;
    color: var(--cc-muted);
}

/* --------------------------------------------------------------------------
 * Layout
 * ----------------------------------------------------------------------- */

.cocimundo-cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .cocimundo-cart-layout:not(.is-empty) {
        grid-template-columns: minmax(0, 1fr) 380px;
        gap: 2rem;
    }
}

.cocimundo-cart-main {
    min-width: 0;
}

/* --------------------------------------------------------------------------
 * Item list
 * ----------------------------------------------------------------------- */

.cocimundo-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--cc-surface);
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    overflow: hidden;
}

.cocimundo-cart-head {
    display: none;
}

@media (min-width: 1024px) {
    .cocimundo-cart-head {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr) 110px 132px 110px 44px;
        gap: 1rem;
        align-items: center;
        padding: .875rem 1.25rem;
        background: #fbfbfc;
        border-bottom: 1px solid var(--cc-line);
        font-size: .75rem;
        font-weight: 600;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--cc-muted);
    }

    .cocimundo-cart-head__info {
        grid-column: 1 / span 2;
    }

    .cocimundo-cart-head__price,
    .cocimundo-cart-head__qty,
    .cocimundo-cart-head__subtotal {
        text-align: center;
    }

    .cocimundo-cart-head__subtotal {
        text-align: right;
    }
}

.cocimundo-cart-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    grid-template-areas:
        "media info     remove"
        "media price    price"
        "media qty      subtotal";
    gap: .5rem 1rem;
    align-items: center;
    padding: 1.125rem 1rem;
    border-bottom: 1px solid var(--cc-line);
    transition: opacity .18s ease, transform .18s ease;
}

.cocimundo-cart-row:last-child {
    border-bottom: 0;
}

@media (min-width: 1024px) {
    .cocimundo-cart-row {
        grid-template-columns: 96px minmax(0, 1fr) 110px 132px 110px 44px;
        grid-template-areas: "media info price qty subtotal remove";
        gap: 1rem;
        padding: 1.25rem;
    }
}

/* Busy + leaving states */
.cocimundo-cart-row[aria-busy="true"] {
    opacity: .45;
    pointer-events: none;
}

.cocimundo-cart-row.is-leaving {
    opacity: 0;
    transform: translateX(-12px);
}

.cocimundo-cart-row__media {
    grid-area: media;
    align-self: start;
    width: 88px;
    height: 88px;
    border-radius: var(--cc-radius-sm);
    overflow: hidden;
    background: #f3f4f6;
}

@media (min-width: 1024px) {
    .cocimundo-cart-row__media {
        width: 96px;
        height: 96px;
        align-self: center;
    }
}

.cocimundo-cart-row__media a,
.cocimundo-cart-row__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cocimundo-cart-row__info {
    grid-area: info;
    min-width: 0;
    align-self: center;
}

.cocimundo-cart-row__name {
    display: block;
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--cc-ink);
    text-decoration: none;
}

.cocimundo-cart-row__name:hover {
    color: var(--cc-accent-dark);
}

.cocimundo-cart-row__meta,
.cocimundo-cart-row__sku {
    margin: .25rem 0 0;
    font-size: .75rem;
    line-height: 1.4;
    color: var(--cc-muted);
}

.cocimundo-cart-row__meta p {
    margin: 0;
}

.cocimundo-cart-row__backorder {
    margin: .375rem 0 0;
    font-size: .75rem;
    color: var(--cc-accent-dark);
}

.cocimundo-cart-row__price {
    grid-area: price;
}

.cocimundo-cart-row__qty {
    grid-area: qty;
}

.cocimundo-cart-row__subtotal {
    grid-area: subtotal;
    justify-self: end;
    text-align: right;
}

.cocimundo-cart-row__price,
.cocimundo-cart-row__subtotal {
    font-size: .9375rem;
    color: var(--cc-ink-soft);
}

.cocimundo-cart-row__subtotal [data-cart-subtotal] {
    font-weight: 700;
    color: var(--cc-ink);
}

@media (min-width: 1024px) {
    .cocimundo-cart-row__price {
        text-align: center;
    }

    .cocimundo-cart-row__qty {
        justify-self: center;
    }
}

/* Inline labels — the column headers only exist on desktop */
.cocimundo-cart-row__label {
    display: block;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cc-muted);
    margin-bottom: .125rem;
}

@media (min-width: 1024px) {
    .cocimundo-cart-row__label {
        display: none;
    }
}

/* Quantity stepper */
.cocimundo-cart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--cc-line-strong);
    border-radius: 999px;
    background: var(--cc-surface);
    overflow: hidden;
}

.cocimundo-cart-qty--fixed {
    padding: .375rem .875rem;
    font-weight: 600;
    color: var(--cc-ink);
}

.cocimundo-cart-qty__btn {
    appearance: none;
    border: 0;
    background: transparent;
    width: 34px;
    height: 34px;
    font-size: 1rem;
    line-height: 1;
    font-weight: 600;
    color: var(--cc-ink);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.cocimundo-cart-qty__btn:hover:not(:disabled) {
    background: var(--cc-accent-soft);
    color: var(--cc-accent-dark);
}

.cocimundo-cart-qty__btn:disabled {
    color: #c3c7cd;
    cursor: not-allowed;
}

.cocimundo-cart-qty__input {
    width: 44px;
    height: 34px;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--cc-line);
    border-right: 1px solid var(--cc-line);
    text-align: center;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--cc-ink);
    background: transparent;
    -moz-appearance: textfield;
}

.cocimundo-cart-qty__input:focus {
    outline: 2px solid var(--cc-accent);
    outline-offset: -2px;
}

.cocimundo-cart-qty__input::-webkit-outer-spin-button,
.cocimundo-cart-qty__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove */
.cocimundo-cart-row__remove {
    grid-area: remove;
    justify-self: end;
    align-self: start;
}

@media (min-width: 1024px) {
    .cocimundo-cart-row__remove {
        align-self: center;
    }
}

.cocimundo-cart-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: #9aa0a8;
    transition: background .15s ease, color .15s ease;
}

.cocimundo-cart-remove:hover {
    background: #fef2f2;
    color: var(--cc-danger);
}

.cocimundo-cart-remove svg {
    width: 18px;
    height: 18px;
}

/* --------------------------------------------------------------------------
 * Tools row (coupon + no-JS update)
 * ----------------------------------------------------------------------- */

.cocimundo-cart-tools {
    margin-top: 1.25rem;
}

.cocimundo-cart-nojs {
    display: none;
    margin-top: 1rem;
}

.cocimundo-cart-coupon {
    background: var(--cc-surface);
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    padding: 1.25rem;
}

.cocimundo-cart-coupon__label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--cc-ink);
    margin-bottom: .75rem;
}

.cocimundo-cart-coupon__field {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.cocimundo-cart-coupon__input {
    flex: 1 1 200px;
    min-width: 0;
    height: 44px;
    padding: 0 .875rem;
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--cc-radius-sm);
    font-size: .9375rem;
    color: var(--cc-ink);
    background: var(--cc-surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cocimundo-cart-coupon__input::placeholder {
    color: #9aa0a8;
}

.cocimundo-cart-coupon__input:focus {
    outline: none;
    border-color: var(--cc-accent);
    box-shadow: 0 0 0 3px rgba(245, 179, 1, .18);
}

.cocimundo-cart-coupon__chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0 0 .75rem;
    padding: 0;
}

.cocimundo-cart-chip {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .3125rem .5rem .3125rem .75rem;
    border-radius: 999px;
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: .8125rem;
    font-weight: 600;
}

.cocimundo-cart-chip__remove {
    appearance: none;
    border: 0;
    background: transparent;
    color: #166534;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .125rem;
    opacity: .65;
}

.cocimundo-cart-chip__remove:hover {
    opacity: 1;
}

/* --------------------------------------------------------------------------
 * Summary
 * ----------------------------------------------------------------------- */

.cocimundo-cart-summary {
    min-width: 0;
}

@media (min-width: 1024px) {
    .cocimundo-cart-summary {
        position: sticky;
        top: calc(var(--cocimundo-header-h) + 1.5rem);
        align-self: start;
    }
}

.cocimundo-cart-summary__card {
    background: var(--cc-surface);
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    padding: 1.5rem;
    transition: opacity .15s ease;
}

.cocimundo-cart-summary.is-loading .cocimundo-cart-summary__card {
    opacity: .5;
    pointer-events: none;
}

.cocimundo-cart-summary__title {
    margin: 0 0 1.125rem;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--cc-ink);
}

.cocimundo-cart-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .4375rem 0;
    font-size: .9375rem;
    color: var(--cc-ink-soft);
}

.cocimundo-cart-line > span:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--cc-ink);
}

.cocimundo-cart-line--discount,
.cocimundo-cart-line--discount > span:last-child {
    color: var(--cc-success);
}

/* WooCommerce renders the shipping block as a <ul>/<p> soup; tame it. */
.cocimundo-cart-line--shipping {
    display: block;
}

.cocimundo-cart-line--shipping ul,
.cocimundo-cart-line--shipping li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cocimundo-cart-line--shipping li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .125rem 0;
}

.cocimundo-cart-line--shipping label {
    font-size: .9375rem;
    color: var(--cc-ink-soft);
}

.cocimundo-cart-line--shipping .woocommerce-shipping-destination,
.cocimundo-cart-line--shipping .woocommerce-shipping-calculator {
    margin-top: .5rem;
    font-size: .8125rem;
    color: var(--cc-muted);
}

.cocimundo-cart-total-row {
    margin-top: .875rem;
    padding-top: .875rem;
    border-top: 1px solid var(--cc-line);
}

.cocimundo-cart-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.cocimundo-cart-total__label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cc-ink);
}

.cocimundo-cart-total__value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--cc-ink);
}

.cocimundo-cart-total__value .woocommerce-Price-amount {
    font-weight: 800;
}

.cocimundo-cart-total__value small {
    display: block;
    font-size: .75rem;
    font-weight: 500;
    color: var(--cc-muted);
}

/* --------------------------------------------------------------------------
 * Buttons / CTA
 * ----------------------------------------------------------------------- */

.cocimundo-cart-actions {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .625rem;
}

.cocimundo-btn,
.cocimundo-cart .checkout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    height: 48px;
    padding: 0 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--cc-radius-sm);
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
}

.cocimundo-btn:active {
    transform: translateY(1px);
}

.cocimundo-btn svg {
    width: 16px;
    height: 16px;
}

.cocimundo-btn--primary,
.cocimundo-cart .checkout-button {
    width: 100%;
    background: var(--cc-accent);
    color: #1a1400;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 16px rgba(245, 179, 1, .28);
}

.cocimundo-btn--primary:hover,
.cocimundo-cart .checkout-button:hover {
    background: var(--cc-accent-dark);
    color: #1a1400;
}

.cocimundo-btn--ghost {
    width: 100%;
    background: transparent;
    border-color: var(--cc-line-strong);
    color: var(--cc-ink);
}

.cocimundo-btn--ghost:hover {
    background: #f3f4f6;
    color: var(--cc-ink);
}

.cocimundo-btn--dark {
    background: var(--cc-ink);
    color: #fff;
}

.cocimundo-btn--dark:hover {
    background: #000;
    color: #fff;
}

.cocimundo-btn[disabled],
.cocimundo-btn.is-busy {
    opacity: .6;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
 * Gate de WhatsApp
 * ----------------------------------------------------------------------- */

.cocimundo-wa-gate {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
    margin-bottom: .25rem;
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius-sm);
    background: #fafafb;
}

.cocimundo-wa-gate.is-unlocked {
    background: #f6fdf8;
    border-color: #bbf7d0;
}

.cocimundo-wa-gate__text {
    margin: 0;
    font-size: .8125rem;
    line-height: 1.5;
    color: var(--cc-ink-soft);
}

.cocimundo-wa-gate__done {
    display: flex;
    align-items: center;
    gap: .375rem;
    margin: 0;
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.4;
    color: #166534;
}

.cocimundo-wa-gate__done svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.cocimundo-wa-btn {
    width: 100%;
    background: #25d366;
    color: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 16px rgba(37, 211, 102, .26);
}

.cocimundo-wa-btn:hover {
    background: #1da851;
    color: #fff;
}

.cocimundo-wa-btn svg {
    width: 18px;
    height: 18px;
}

/* Ya desbloqueado: el enlace sigue disponible pero baja de jerarquía para no
   competir con el botón de pago. */
.cocimundo-wa-btn--soft {
    height: 40px;
    background: transparent;
    color: #15803d;
    border-color: #bbf7d0;
    box-shadow: none;
    font-size: .875rem;
}

.cocimundo-wa-btn--soft:hover {
    background: #ecfdf3;
    color: #166534;
}

/* aria-busy en vez de .is-busy: esa clase lleva pointer-events:none y se
   aplicaría sobre el mismo enlace cuyo clic acaba de abrir WhatsApp. */
.cocimundo-wa-btn[aria-busy="true"] {
    opacity: .65;
}

/* CTA de pago bloqueado. Es un <button aria-disabled>, no un <a>. */
.cocimundo-cart .checkout-button.is-locked {
    width: 100%;
    background: #eceef1;
    color: #9aa0a8;
    box-shadow: none;
    cursor: not-allowed;
}

.cocimundo-cart .checkout-button.is-locked:hover {
    background: #eceef1;
    color: #9aa0a8;
    transform: none;
}

.cocimundo-cart .checkout-button.is-locked:active {
    transform: none;
}

.cocimundo-cart .checkout-button.is-locked svg {
    width: 15px;
    height: 15px;
    opacity: .8;
}

.cocimundo-cart-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    margin: .25rem 0 0;
    font-size: .75rem;
    color: var(--cc-muted);
}

.cocimundo-cart-secure svg {
    width: 13px;
    height: 13px;
}

/* --------------------------------------------------------------------------
 * Shipping calculator (rendered by includes/free-shipping)
 * ----------------------------------------------------------------------- */

.cfs-calc {
    margin-top: 1rem;
    padding: 1rem;
    background: #fafafb;
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius-sm);
}

.cfs-calc__label {
    display: block;
    margin: 0 0 .625rem;
    font-size: .8125rem;
    line-height: 1.45;
    color: var(--cc-ink-soft);
}

.cfs-calc__fields {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.cfs-calc__input {
    width: 100%;
    height: 42px;
    padding: 0 .75rem;
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--cc-radius-sm);
    font-size: .875rem;
    color: var(--cc-ink);
    background: var(--cc-surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cfs-calc__input:focus {
    outline: none;
    border-color: var(--cc-accent);
    box-shadow: 0 0 0 3px rgba(245, 179, 1, .18);
}

.cfs-calc__btn {
    height: 42px;
    border: 0;
    border-radius: var(--cc-radius-sm);
    background: var(--cc-ink);
    color: #fff;
    font-size: .875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}

.cfs-calc__btn:hover:not(:disabled) {
    background: #000;
}

.cfs-calc__btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.cfs-calc__result {
    margin-top: .75rem;
    font-size: .8125rem;
    line-height: 1.45;
}

.cfs-calc__result.is-success {
    color: var(--cc-success);
}

.cfs-calc__result.is-error {
    color: var(--cc-danger);
}

/* --------------------------------------------------------------------------
 * Notices
 * ----------------------------------------------------------------------- */

.cocimundo-cart-notices:empty {
    display: none;
}

.cocimundo-cart-notices {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.cocimundo-cart-notice {
    padding: .75rem 1rem;
    border-radius: var(--cc-radius-sm);
    border: 1px solid var(--cc-line);
    background: var(--cc-surface);
    font-size: .875rem;
    color: var(--cc-ink-soft);
}

.cocimundo-cart-notice a {
    color: inherit;
    text-decoration: underline;
}

.cocimundo-cart-notice--success {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

.cocimundo-cart-notice--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--cc-danger);
}

.cocimundo-cart-notice--notice {
    background: var(--cc-accent-soft);
    border-color: #fde68a;
    color: #8a6100;
}

/* --------------------------------------------------------------------------
 * Empty state
 * ----------------------------------------------------------------------- */

.cocimundo-cart-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: var(--cc-surface);
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
}

.cocimundo-cart-empty__icon {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--cc-accent-soft);
    color: var(--cc-accent-dark);
    margin-bottom: 1.25rem;
}

.cocimundo-cart-empty__icon svg {
    width: 32px;
    height: 32px;
}

.cocimundo-cart-empty__title {
    margin: 0 0 .5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cc-ink);
}

.cocimundo-cart-empty__text {
    margin: 0 0 1.5rem;
    max-width: 34ch;
    font-size: .9375rem;
    color: var(--cc-muted);
}

.cocimundo-cart-empty__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
    justify-content: center;
}

.cocimundo-cart-empty__actions .cocimundo-btn {
    width: auto;
    min-width: 180px;
}

/* --------------------------------------------------------------------------
 * Hide the parent theme's own cart chrome if it leaks through
 * ----------------------------------------------------------------------- */

.cocimundo-cart .woocommerce-message,
.cocimundo-cart .woocommerce-info,
.cocimundo-cart .woocommerce-error {
    margin-bottom: 1.25rem;
    padding: .75rem 1rem;
    border-radius: var(--cc-radius-sm);
    border: 1px solid var(--cc-line);
    background: var(--cc-surface);
    list-style: none;
    font-size: .875rem;
}
