/**
 * Cart Page — Lienzo en Blanco
 * Archivo: assets/wc/css/cart-page.css
 */

/* ==========================================================================
   1. LAYOUT PRINCIPAL
   ========================================================================== */

.hybinet-cart-page {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 380px;
    align-items: start;
    gap: 32px;
    padding: 32px 1.5rem 64px;
    max-width: 1200px;
    margin: 0 auto;
}

.hybinet-cart-page__main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.hybinet-cart-notices {
    grid-column: 1 / -1;
    width: 100%;
}

/* ==========================================================================
   2. ESTADO VACÍO
   ========================================================================== */

.hybinet-cart-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
    gap: 24px;
    background-color: var(--hybinet-color-bg-card);
    border-radius: var(--hybinet-card-radius);
    border: 1px solid var(--hybinet-color-border-default);
}

.hybinet-cart-empty__icon {
    color: var(--hybinet-color-border-default);
    line-height: 0;
}

.hybinet-cart-empty__body p {
    font-size: 1.1rem;
    color: var(--hybinet-color-text-secondary);
    margin: 0 0 16px;
}

.hybinet-cart-empty__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background-color: var(--hybinet-color-brand-accent);
    color: var(--hybinet-palette-black);
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.15s;
}

.hybinet-cart-empty__cta:hover {
    background-color: var(--hybinet-color-link-default);
    color: var(--hybinet-palette-white);
    transform: translateY(-1px);
}

/* ==========================================================================
   3. ITEMS DEL CARRITO
   ========================================================================== */

.hybinet-cart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hybinet-cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 100px 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background-color: var(--hybinet-color-bg-card);
    border-radius: var(--hybinet-card-radius);
    border: 1px solid var(--hybinet-color-border-default);
    transition: border-color 0.2s ease;
}

.hybinet-cart-item:hover {
    border-color: var(--hybinet-color-text-meta);
}

/* Imagen */
.hybinet-cart-item__image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--hybinet-color-bg-image);
    flex-shrink: 0;
}

.hybinet-cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Detalles */
.hybinet-cart-item__details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.hybinet-cart-item__name {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.hybinet-cart-item__name a {
    color: var(--hybinet-color-text-primary);
    text-decoration: none;
    transition: color 0.15s;
}

.hybinet-cart-item__name a:hover {
    color: var(--hybinet-color-link-hover);
}

.hybinet-cart-item__price {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.hybinet-price-current {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--hybinet-color-text-primary);
    text-decoration: none;
}

.hybinet-price-old {
    color: var(--hybinet-color-text-meta);
    font-size: 0.9rem;
    text-decoration: line-through;
}

.hybinet-price-save {
    background-color: color-mix(in srgb, var(--hybinet-color-status-danger) 10%, var(--hybinet-color-bg-primary, white));
    color: var(--hybinet-color-status-danger);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}

.hybinet-price-save--total {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.85rem;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

/* Acciones (Subtotal y Cantidad) */
.hybinet-cart-item__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.hybinet-cart-item__subtotal {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--hybinet-color-text-primary);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.hybinet-cart-item__controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Controles de cantidad */
.hybinet-qty {
    display: flex;
    align-items: center;
    border: 1px solid var(--hybinet-color-border-default);
    border-radius: 8px;
    background-color: var(--hybinet-color-bg-primary);
    overflow: hidden;
    width: fit-content;
}

.hybinet-qty__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--hybinet-color-text-secondary);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.hybinet-qty__btn:hover {
    background-color: var(--hybinet-color-bg-tertiary);
    color: var(--hybinet-color-text-primary);
}

/* Neutralizamos el :focus agresivo de GeneratePress */
.hybinet-qty__btn:focus {
    background-color: transparent;
    color: var(--hybinet-color-text-secondary);
    outline: none;
}

/* Si tiene focus Y hover al mismo tiempo (como al hacer click), mantenemos el gris del hover */
.hybinet-qty__btn:focus:hover {
    background-color: var(--hybinet-color-bg-tertiary);
    color: var(--hybinet-color-text-primary);
}

.hybinet-qty__btn svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
    overflow: visible;
}

.hybinet-qty__btn svg path {
    fill: var(--hybinet-color-text-secondary);
    transition: fill 0.15s;
}

.hybinet-qty__btn:hover svg path {
    fill: var(--hybinet-color-text-primary);
}

.hybinet-qty input[type="number"],
.hybinet-qty input.qty {
    width: 40px;
    height: 36px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--hybinet-color-border-default);
    border-right: 1px solid var(--hybinet-color-border-default);
    background: transparent;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--hybinet-color-text-primary);
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0;
}

.hybinet-qty input[type="number"]::-webkit-inner-spin-button,
.hybinet-qty input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Eliminar */
.hybinet-cart-item__remove {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hybinet-btn-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--hybinet-color-text-meta);
    background: var(--hybinet-color-bg-secondary);
    transition: background-color 0.2s, color 0.2s;
}

.hybinet-btn-remove:hover {
    background-color: color-mix(in srgb, var(--hybinet-color-status-danger) 8%, var(--hybinet-color-bg-primary, white));
    color: var(--hybinet-color-status-danger);
}

/* ==========================================================================
   4. ACCIONES DEL CARRITO
   ========================================================================== */

.hybinet-cart-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    background-color: var(--hybinet-color-bg-card);
    border-radius: var(--hybinet-card-radius);
    border: 1px solid var(--hybinet-color-border-default);
    margin-top: 24px;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.hybinet-cart-coupon {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 400px;
}

.hybinet-cart-coupon input.input-text {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--hybinet-color-border-default);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: var(--hybinet-color-bg-primary);
    transition: border-color 0.2s;
}

/* ==========================================================================
   FLOATING ACTION TOAST (Actualizar Carrito)
   ========================================================================== */

.update-cart-btn {
    height: 44px;
    padding: 0 24px;
    border-radius: 8px;
    border: 1px solid var(--hybinet-color-border-default);
    background-color: var(--hybinet-color-bg-primary);
    color: var(--hybinet-color-text-primary);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.update-cart-btn:not(:disabled) {
    background-color: var(--hybinet-color-brand-accent);
    color: var(--hybinet-palette-black);
    border-color: var(--hybinet-color-brand-accent);
}

.update-cart-btn:not(:disabled):hover {
    filter: brightness(0.92);
}

.update-cart-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ==========================================================================
   5. SIDEBAR / TOTALES
   ========================================================================== */

.hybinet-cart-page__sidebar {
    position: sticky;
    top: 120px; /* Debajo del header */
}

.hybinet-cart-totals {
    background-color: var(--hybinet-color-bg-card);
    border-radius: var(--hybinet-card-radius);
    border: 1px solid var(--hybinet-color-border-default);
    overflow: hidden;
}

.hybinet-cart-totals__title {
    margin: 0;
    padding: 24px;
    font-size: 1.1rem;
    font-weight: 800;
    border-bottom: 1px solid var(--hybinet-color-border-default);
}

.hybinet-cart-totals__lines {
    padding: 12px 24px;
}

.hybinet-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--hybinet-color-bg-secondary);
}

.hybinet-totals-row:last-child,
.hybinet-totals-row--total {
    border-bottom: none;
}

.hybinet-totals-row__label {
    font-size: 0.95rem;
    color: var(--hybinet-color-text-secondary);
    font-weight: 500;
}

.hybinet-totals-row__value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--hybinet-color-text-primary);
}

.hybinet-totals-row__value--discount {
    color: var(--hybinet-color-status-danger);
}

/* Shipping block styles (Dynamic UI) */
.woocommerce-shipping-totals {
    display: flex;
    flex-direction: column;
}

.hybinet-shipping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}


.hybinet-shipping-selected-name {
    width: 100%;
    font-size: 0.85rem;
    color: var(--hybinet-color-text-meta);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 4px;
}


.hybinet-shipping-toggle-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--hybinet-color-text-meta);
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 1px 5px;
    border: 1px solid var(--hybinet-color-border-default);
    border-radius: 6px;
    font-size: 0.85rem;
    background-color: transparent;
}

.hybinet-shipping-toggle-btn:hover {
    color: var(--hybinet-color-text-primary);
    border-color: var(--hybinet-color-border);
}

.hybinet-shipping-toggle-btn svg {
    margin-top: 2px;
}

.hybinet-shipping-selected-price {
    font-size: 1rem;
    color: var(--hybinet-color-text-primary);
    text-align: right;
}

.hybinet-shipping-methods-wrapper {
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--hybinet-color-border);
}

.woocommerce-shipping-methods {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.woocommerce-shipping-methods li {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.woocommerce-shipping-methods input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.woocommerce-shipping-methods label {
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--hybinet-color-text-primary);
    margin: 0;
}

.woocommerce-shipping-destination {
    font-size: 0.85rem;
    color: var(--hybinet-color-text-meta);
    margin: 0 0 8px 0;
    text-align: right;
}

.woocommerce-shipping-calculator {
    width: 100%;
}

.shipping-calculator-button {
    font-size: 0.85rem;
    color: var(--hybinet-color-brand-primary);
    text-decoration: underline;
}

.hybinet-totals-row__value--strikethrough {
    text-decoration: line-through;
    color: var(--hybinet-color-text-meta);
}

.hybinet-shipping-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 4px;
    color: var(--hybinet-color-text-meta);
    font-size: 0.82rem;
}

.hybinet-shipping-notice svg {
    flex-shrink: 0;
    stroke: var(--hybinet-color-text-meta);
}

.hybinet-totals-row--total {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 2px solid var(--hybinet-color-border-default);
}

.hybinet-totals-row--total .hybinet-totals-row__label {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--hybinet-color-text-primary);
}

.hybinet-totals-row__value--grand {
    font-size: 1.5rem;
    font-weight: 800;
}

.hybinet-cart-totals .wc-proceed-to-checkout {
    padding: 0 24px 24px;
}

.checkout-button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 16px;
    background-color: var(--hybinet-color-brand-accent);
    color: var(--hybinet-palette-black);
    font-weight: 800;
    font-size: 1rem;
    border-radius: 10px;
    text-decoration: none;
    transition: transform 0.15s, filter 0.2s;
}

.checkout-button:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
    color: var(--hybinet-palette-black);
}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */

@media (max-width: 991px) {
    .hybinet-cart-page {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .hybinet-cart-page__sidebar {
        position: static;
    }
}

@media (max-width: 767px) {
    .hybinet-cart-item {
        grid-template-columns: 80px 1fr;
        gap: 16px;
        padding: 16px;
    }

    .hybinet-cart-item__image {
        width: 80px;
        height: 80px;
    }

    .hybinet-cart-item__actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid var(--hybinet-color-bg-secondary);
        padding-top: 16px;
        margin-top: 8px;
    }

    .hybinet-cart-item__subtotal {
        align-items: flex-start;
    }

    .hybinet-cart-coupon {
        max-width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
}
