/* 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-lg);
    padding: var(--spacing-16);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: visible; /* Permitir etiquetas flotantes */
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* 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: center;
}

.rebit-spc-dual-price .price-new {
    color: var(--color-primary);
    font-weight: 800;
}

.rebit-spc-dual-price .price-recond {
    color: #4a4a4a; /* Gris para recondicionado */
    font-weight: 700;
}

/* 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;
}

.rebit-shared-product-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
}

/* 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 0.5s ease;
}

.rebit-shared-product-card:hover .rebit-spc-image-wrapper img {
    transform: scale(1.05);
}

/* 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 0.2s;
    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);
}

.rebit-spc-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: var(--spacing-16);
}

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

.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-sale ins {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.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: all 0.2s 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;
}

.rebit-spc-btn.buy-now:hover {
    background-color: var(--color-primary-hover);
}

.rebit-spc-btn.add-cart {
    width: 40px;
    flex: 0 0 40px;
    background-color: var(--color-surface-alt);
    color: var(--color-primary);
    border: 1px solid var(--color-outline);
    padding: 0; /* Override woocommerce button padding */
}

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

.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-title {
        font-size: 13px;
        margin-bottom: 5px;
    }
    .rebit-spc-price .price-sale {
        font-size: 15px;
    }
    .rebit-spc-price .price-sale del {
        font-size: 11px;
    }
    .rebit-spc-price .price-sale ins {
        font-size: 15px;
    }
    .rebit-spc-price .price-regular del {
        font-size: 11px;
    }
    .rebit-spc-dual-price {
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    .rebit-spc-dual-price .price-new,
    .rebit-spc-dual-price .price-recond {
        font-size: 14px;
    }
    .rebit-spc-btn.buy-now {
        font-size: 12px;
        padding: 0 5px;
        height: 36px;
    }
    .rebit-spc-btn.add-cart {
        width: 36px;
        flex: 0 0 36px;
        height: 36px;
    }
}
