/**
 * Cart - Fungiverse Crecienta
 * Layout premium con 2 columnas bien proporcionadas.
 *
 * @package Fungiverse
 */

/* ─── CONTENEDOR PRINCIPAL ───────────────────── */
.fv-cart {
    width: min(100% - (var(--fv-gutter, 1.5rem) * 2), var(--fv-container-wide, 1280px));
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) 0;
    display: grid;
    gap: 2rem;
}

/* Forzar que el main no desborde la grilla */
.fv-cart__main {
    min-width: 0;
    overflow: hidden;
}

/* La tabla puede scrollear horizontalmente si falta espacio */
.fv-cart__form {
    overflow-x: auto;
    min-width: 0;
}

/* ─── HEADER ─────────────────────────────────── */
.fv-cart__header {
    margin-bottom: 0.5rem;
}

.fv-cart__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fv-red, #e84d44);
    font-weight: 600;
}

.fv-cart__title {
    margin: 0;
    font-family: var(--fv-font-heading);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    color: var(--fv-text, #111);
}

/* ─── TABLA DE PRODUCTOS ─────────────────────── */
.fv-cart__table,
.fv-cart__summary-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.fv-cart__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    table-layout: auto;
}

.fv-cart__table thead th {
    padding: 0.6rem 0.75rem;
    background: #fafafa;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: rgba(0,0,0,0.45);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.fv-cart__table td {
    padding: 0.85rem 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    vertical-align: middle;
    font-size: 0.85rem;
    color: var(--fv-text, #111);
}

/* Columnas compactas */
.fv-cart__table .product-remove {
    width: 32px;
    padding-right: 0;
}

.fv-cart__table .product-thumbnail {
    width: 64px;
    padding-right: 0;
}

.fv-cart__table img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
}

/* Ocultar columna subtotal en desktop — redundante con el sidebar */
@media (min-width: 1024px) {
    .fv-cart__table .product-subtotal {
        display: none;
    }
}

.fv-cart__table .product-name {
    font-weight: 500;
    line-height: 1.4;
}

.fv-cart__table .product-name a {
    color: var(--fv-text, #111);
    text-decoration: none;
}

.fv-cart__table .product-price,
.fv-cart__table .product-subtotal {
    font-weight: 600;
    white-space: nowrap;
}

.fv-cart__table .product-remove a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: rgba(0,0,0,0.3);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.fv-cart__table .product-remove a:hover {
    background: rgba(232, 77, 68, 0.1);
    color: var(--fv-red, #e84d44);
}

/* Quantity input */
.fv-cart__table .quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 999px;
    overflow: hidden;
}

.fv-cart__table .quantity input[type="number"] {
    width: 48px;
    height: 40px;
    text-align: center;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fv-text, #111);
    background: transparent;
    -moz-appearance: textfield;
}

.fv-cart__table .quantity input::-webkit-inner-spin-button,
.fv-cart__table .quantity input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* ─── ACCIONES (cupón + actualizar) ──────────── */
.fv-cart__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.fv-cart__coupon {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.fv-cart__actions .input-text {
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.12);
    padding: 0 1rem;
    font-size: 0.85rem;
    background: #fff;
    color: var(--fv-text, #111);
    min-width: 180px;
}

.fv-cart__actions .button,
.woocommerce-cart .fv-cart__actions .button,
.woocommerce .fv-cart__actions .button {
    min-height: 44px;
    border-radius: 999px;
    padding: 0 1.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    background: #111;
    color: #fff;
    transition: all 0.25s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.fv-cart__actions .button:hover,
.woocommerce-cart .fv-cart__actions .button:hover,
.woocommerce .fv-cart__actions .button:hover {
    background: var(--fv-red, #e84d44) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232,77,68,0.3);
}

/* ─── SIDEBAR — RESUMEN DEL PEDIDO ───────────── */
.fv-cart__summary-card {
    padding: 1.75rem;
}

.fv-cart__summary-title {
    margin: 0 0 1.25rem;
    font-family: var(--fv-font-heading);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--fv-text, #111);
}

/* WC totals table inside summary */
.fv-cart__totals .shop_table {
    width: 100%;
    border-collapse: collapse;
}

.fv-cart__totals .shop_table th,
.fv-cart__totals .shop_table td {
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 0.9rem;
    vertical-align: top;
}

.fv-cart__totals .shop_table th {
    font-weight: 500;
    color: rgba(0,0,0,0.6);
    text-align: left;
}

.fv-cart__totals .shop_table td {
    text-align: right;
    font-weight: 600;
    color: var(--fv-text, #111);
}

/* Fee (descuento) row — highlight */
.fv-cart__totals .shop_table .fee td,
.fv-cart__totals .shop_table .fee th {
    color: #2e7d32;
    font-weight: 600;
}

/* Order total row */
.fv-cart__totals .shop_table .order-total th,
.fv-cart__totals .shop_table .order-total td {
    font-size: 1.1rem;
    font-weight: 700;
    padding-top: 1rem;
    border-bottom: none;
    color: var(--fv-text, #111);
}

/* Coupons */
.fv-cart__totals .woocommerce-shipping-totals td,
.fv-cart__totals .coupon-toggle td {
    font-size: 0.85rem;
}

/* Checkout CTA */
.wc-proceed-to-checkout {
    padding-top: 1.25rem;
}

.wc-proceed-to-checkout .checkout-button,
.woocommerce-cart .wc-proceed-to-checkout .checkout-button,
.woocommerce .wc-proceed-to-checkout a.checkout-button {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--fv-red, #e84d44) !important;
    color: #fff !important;
    border: none;
    border-radius: 999px;
    font-family: var(--fv-font-body, 'Inter', sans-serif);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(232,77,68,0.25);
}

.wc-proceed-to-checkout .checkout-button:hover,
.woocommerce-cart .wc-proceed-to-checkout .checkout-button:hover,
.woocommerce .wc-proceed-to-checkout a.checkout-button:hover {
    background: #d63e35 !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(232,77,68,0.35);
}

/* ─── NOTA DE TRANSFERENCIA ──────────────────── */
.fv-cart__transfer-note {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: #f8f8f8;
    border: 1px solid rgba(0,0,0,0.06);
    color: var(--fv-text, #111);
    font-size: 0.85rem;
    line-height: 1.5;
}

.fv-cart__transfer-note strong {
    color: #2e7d32;
}

.fv-cart__transfer-note p {
    margin: 0.35rem 0 0;
    color: rgba(0,0,0,0.5);
    font-size: 0.8rem;
}

/* ─── RESPONSIVE LAYOUT ──────────────────────── */
@media (min-width: 1024px) {
    .fv-cart {
        grid-template-columns: 1fr 340px;
        gap: 2rem;
        align-items: start;
    }

    .fv-cart__sticky {
        position: sticky;
        top: calc(2rem + 100px);
    }
}

/* Tablet */
@media (max-width: 1023px) {
    .fv-cart {
        grid-template-columns: 1fr;
    }

    .fv-cart__table thead th {
        font-size: 0.6rem;
        padding: 0.6rem 0.8rem;
    }

    .fv-cart__table td {
        padding: 0.8rem;
    }
}

/* Mobile: tabla responsive con data-title */
@media (max-width: 600px) {
    .fv-cart__table thead {
        display: none;
    }

    .fv-cart__table tr {
        display: grid;
        grid-template-columns: 72px 1fr;
        gap: 0.5rem 1rem;
        padding: 1rem;
        border-bottom: 1px solid rgba(0,0,0,0.06);
    }

    .fv-cart__table td {
        border: none;
        padding: 0;
    }

    .fv-cart__table .product-thumbnail {
        grid-row: 1 / 4;
        width: auto;
    }

    .fv-cart__table .product-remove {
        grid-column: 2;
        justify-self: end;
    }

    .fv-cart__table .product-remove a {
        width: 24px;
        height: 24px;
        font-size: 1rem;
    }

    .fv-cart__table .product-price,
    .fv-cart__table .product-quantity,
    .fv-cart__table .product-subtotal {
        grid-column: 1 / -1;
    }

    .fv-cart__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .fv-cart__coupon {
        flex-direction: column;
    }

    .fv-cart__actions .input-text {
        min-width: auto;
        width: 100%;
    }
}
