/* Componente: Product Card (V2 Compartido) */
@import 'product-card-bestseller.css';

/* Estructura Base de Tarjeta */
.rebit-shared-product-card {
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--spacing-16);
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: visible;
    /* Permitir etiquetas flotantes */
    transition: box-shadow 250ms var(--ease-out), transform 250ms var(--ease-out);
}

/* Modal de Variaciones */
.rebit-var-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: none;
    /* Oculto por defecto */
    justify-content: center;
    align-items: center;
}

.rebit-var-modal.active {
    display: flex;
}

.rebit-var-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.rebit-var-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-outline);
    cursor: pointer;
}

.rebit-var-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dual Price Display */
.rebit-spc-dual-price {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.rebit-spc-dual-price .price-new-container,
.rebit-spc-dual-price .price-recond-container {
    display: flex;
    flex-direction: column;
}

/* Forzar color azul (primary) para TODO dentro de price-new */
.rebit-spc-dual-price .price-new,
.rebit-spc-dual-price .price-new .woocommerce-Price-amount,
.rebit-spc-dual-price .price-new bdi,
.rebit-spc-dual-price .price-new ins {
    color: var(--color-primary) !important;
    font-weight: 800 !important;
    text-decoration: none;
    line-height: 1;
}

/* Forzar color gris (#4a4a4a) para TODO dentro de price-recond */
.rebit-spc-dual-price .price-recond,
.rebit-spc-dual-price .price-recond .woocommerce-Price-amount,
.rebit-spc-dual-price .price-recond bdi,
.rebit-spc-dual-price .price-recond ins {
    color: #4a4a4a !important;
    font-weight: 700 !important;
    text-decoration: none;
    line-height: 1;
}

/* Si hay descuento, poner el precio original tachado encima */
.rebit-spc-dual-price .price-new,
.rebit-spc-dual-price .price-recond {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.rebit-spc-dual-price del,
.rebit-spc-dual-price del .woocommerce-Price-amount,
.rebit-spc-dual-price del bdi {
    color: var(--color-text-muted) !important;
    font-weight: 400 !important;
    font-size: 13px !important;
    text-decoration: line-through !important;
}

/* Fix woo price markup inside modal buttons */
.rebit-var-btn del {
    font-size: 0.8em;
    opacity: 0.8;
    margin-right: 5px;
}

.rebit-var-btn ins {
    text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
    .rebit-shared-product-card:hover {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
        transform: translateY(-3px);
    }
}

/* Image Wrapper */
.rebit-spc-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--color-surface-alt);
    overflow: hidden;
}

.rebit-spc-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.rebit-spc-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 350ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .rebit-shared-product-card:hover .rebit-spc-image-wrapper img {
        transform: scale(1.03);
    }
}

/* Badges */
.rebit-spc-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 2;
    pointer-events: none;
}

.rebit-spc-badge {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.rebit-spc-badge.sale {
    background-color: var(--color-error, #ba1a1a);
    /* Rojo oscuro / Rebaja */
}

.rebit-spc-badge.condition {
    background-color: #4a4a4a;
    /* Gris oscuro para reacondicionado */
}

/* Info */
.rebit-spc-info {
    padding: var(--spacing-16);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.rebit-spc-title {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: var(--spacing-8);
    flex: 1;
    /* Empuja los precios y botones hacia abajo */
}

.rebit-spc-title a {
    color: var(--color-text);
    text-decoration: none;
    transition: color 160ms ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Límite de 2 líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rebit-spc-title a:hover {
    color: var(--color-primary);
}

/* ===== FIX: Price Color — cubre todos los markups que genera WooCommerce ===== */
/* Layout base del precio */
.rebit-spc-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: var(--spacing-16);
    width: 100%;
}

.rebit-spc-price .price-sale {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

/* Precio activo (producto sin descuento o precio nuevo en oferta) */

.rebit-spc-price .woocommerce-Price-amount,
.rebit-spc-price .amount,
.rebit-spc-price bdi {
    color: var(--color-price);
    font-weight: 700;
}

/* Precio tachado (precio anterior en oferta) */
.rebit-spc-price del .woocommerce-Price-amount,
.rebit-spc-price del .amount,
.rebit-spc-price del bdi {
    color: var(--color-text-muted);
    font-weight: 400;
}

/* ins wrapper que WooCommerce usa para el precio nuevo */
.rebit-spc-price .price-sale ins {
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.rebit-spc-price .price-sale del {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 400;
    text-decoration: line-through;
}

.rebit-spc-price .price-regular del {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Actions */
.rebit-spc-actions {
    display: flex;
    gap: 8px;
}

.rebit-spc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 120ms ease;
    cursor: pointer;
    border: none;
    height: 40px;
}

.rebit-spc-btn.buy-now {
    flex: 1;
    /* Toma todo el ancho posible */
    background-color: var(--color-primary);
    color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
    .rebit-spc-btn.buy-now:hover {
        background-color: var(--color-primary-hover);
    }

    .rebit-spc-btn.add-cart:hover {
        background-color: var(--color-outline);
    }
}

.rebit-spc-btn:active {
    transform: scale(0.96);
}

.rebit-spc-btn.add-cart {
    width: 40px !important;
    flex: 0 0 40px !important;
    background-color: var(--color-surface-alt) !important;
    color: var(--color-primary) !important;
    border: 1px solid var(--color-outline) !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.rebit-spc-btn.add-cart::after {
    display: none !important;
}

.rebit-spc-btn.add-cart svg {
    width: 18px;
    height: 18px;
}

/* === RESPONSIVO === */
@media (max-width: 768px) {
    .rebit-shared-product-card {
        padding: 10px;
    }

    .rebit-spc-info {
        padding: 10px 0 0 0;
    }

    .rebit-spc-badge {
        font-size: 9px;
        padding: 2px 5px;
    }

    .rebit-spc-title {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .rebit-spc-price .price-sale {
        font-size: 12px;
    }

    .rebit-spc-price .price-sale del,
    .rebit-spc-price .price-sale del .woocommerce-Price-amount,
    .rebit-spc-price .price-sale del bdi {
        font-size: 10px !important;
    }

    .rebit-spc-price .price-sale ins,
    .rebit-spc-price .price-sale ins .woocommerce-Price-amount,
    .rebit-spc-price .price-sale ins bdi {
        font-size: 12px !important;
    }

    .rebit-spc-price .price-regular del {
        font-size: 10px;
    }

    .rebit-spc-dual-price {
        gap: 6px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        width: 100%;
    }

    .rebit-spc-dual-price .price-new,
    .rebit-spc-dual-price .price-recond,
    .rebit-spc-dual-price .price-new .woocommerce-Price-amount,
    .rebit-spc-dual-price .price-recond .woocommerce-Price-amount,
    .rebit-spc-dual-price .price-new ins,
    .rebit-spc-dual-price .price-recond ins,
    .rebit-spc-dual-price .price-new bdi,
    .rebit-spc-dual-price .price-recond bdi {
        font-size: 11px !important;
    }

    .rebit-spc-dual-price del,
    .rebit-spc-dual-price del .woocommerce-Price-amount,
    .rebit-spc-dual-price del bdi {
        font-size: 9px !important;
    }

    .rebit-spc-btn.buy-now {
        font-size: 11px;
        padding: 0 4px;
        height: 32px;
    }

    .rebit-spc-btn.add-cart {
        width: 32px;
        flex: 0 0 32px;
        height: 32px;
    }

    .rebit-spc-btn.add-cart svg {
        width: 14px;
        height: 14px;
    }
}

/* Hover Overlay for Default Cards */
.rebit-shared-product-card:not(.best-seller) .rebit-spc-image-wrapper {
    position: relative;
    overflow: hidden;
    /* Ensure overlay doesn't overflow container */
}

.rebit-spc-hover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55%;
    background: linear-gradient(to top, rgba(0, 102, 255, 0.8) 0%, rgba(0, 110, 255, 0.4) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    pointer-events: none;
}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
    .rebit-spc-hover-overlay {
        background: rgba(0, 17, 49, 0.4);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        mask-image: linear-gradient(to top, black 0%, black 50%, transparent 100%);
        -webkit-mask-image: linear-gradient(to top, black 0%, black 50%, transparent 100%);
    }
}

.rebit-shared-product-card:not(.best-seller):hover .rebit-spc-hover-overlay {
    transform: translateY(0);
}

.rebit-spc-hover-desc {
    color: #ffffff;
    font-size: 13px;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.rebit-spc-hover-specs {
    list-style: none;
    margin: 0;
    padding: 0;
    color: #ffffff;
    font-size: 12px;
    line-height: 1.6;
}

.rebit-spc-hover-specs li {
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.rebit-spc-hover-specs strong {
    color: #ffffff;
    font-weight: 800;
}