﻿/*_ProductCard.css*/
/* ========== GRID DE PRODUCTOS ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 16px;
    }
}

/* ========== TARJETA DE PRODUCTO ========== */
.product-card {
    width: 100%;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    position: relative;
    flex-direction: column;
    height: 100%;
}

    .product-card:hover {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

/* ========== IMAGEN DEL PRODUCTO ========== */
.product-image {
    height: 240px;
    overflow: hidden;
    background-color: #f5f5f5;
    position: relative;
}

    .product-image img,
    .no-image-placeholder {
        width: 100%;
        height: 100%;
        object-fit: scale-down;
        transition: transform 0.5s;
    }

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.no-image-placeholder {
    font-size: 48px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== INFORMACIÓN DEL PRODUCTO ========== */
.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}

/* Envío gratis */
.product-shipping {
    font-size: .8333rem;
    font-weight: 300;
    margin-bottom: 0;
    width: fit-content;
    display: flex;
    color: var(--colorNeutralForegroundInverted);
    background: var(--colorGreen1);
    align-items: center;
    gap: 5px;
    padding: 2px 5px;
}

/* Título del producto */
.product-title {
    font-size: 14px;
    color: #666;
    margin: 4px 0 0 0;
    line-height: 1.4;
    min-height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-decoration: none;
}

    .product-title a {
        color: inherit;
        text-decoration: none;
    }

        .product-title a:hover {
            color: #3483fa;
        }

        .product-title a::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 1;
        }
/* Marca */
.product-brand {
    font-size: 13px;
    color: #333;
    margin: 2px 0;
}

.brand-name {
    font-weight: 500;
    color: #0078d4;
}

/* Calificación */
.product-rating-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
}

.rating-stars-display {
    display: flex;
    gap: 1px;
    color: #ffc107;
}

.rating-values {
    display: flex;
    gap: 4px;
    font-size: 13px;
    color: #666;
}

.rating-number {
    font-weight: 600;
}

.no-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #999;
}

/* Precio */
.product-price {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.current-price {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}


.original-price del {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.product-discount-badge {
    background-color: #FFE6E6;
    color: #741F1C;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Cuotas */
.product-installments {
    font-size: 14px;
    color: var(--colorGreen1);
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0;
}

/* Productos vendidos */
.product-total-sales {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0;
}

/* ========== TAGS/ETIQUETAS ========== */
.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.product-tag {
    background-color: #f5f5f5;
    color: #666;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
}

    /* Estilos específicos para cada tipo de tag */
    .product-tag.shipping-tag {
        background-color: #e6f7ee;
        color: #00a650;
    }

    .product-tag.discount-tag {
        background-color: #ffe6e6;
        color: #ff4444;
    }

    .product-tag.warranty-tag {
        background-color: #e6f0ff;
        color: #3483fa;
    }

    .product-tag.condition-tag {
        background-color: #fff8e6;
        color: #ff9900;
    }

    .product-tag.stock-tag.in-stock {
        background-color: #e6f7ee;
        color: #00a650;
    }

    .product-tag.stock-tag.out-of-stock {
        background-color: #ffe6e6;
        color: #ff4444;
    }

/* ========== BOTONES DE ACCIÓN (si se usan) ========== */
.product-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.btn-view-details {
    flex: 1;
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

    .btn-view-details:hover {
        background-color: #e9ecef;
        color: #333;
    }

.btn-add-to-cart {
    flex: 1;
    background-color: #3483fa;
    color: white;
    border: 1px solid #3483fa;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

    .btn-add-to-cart:hover {
        background-color: #2968c8;
        border-color: #2968c8;
    }

    .btn-add-to-cart:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* ========== DISEÑO RESPONSIVE MÓVIL ========== */
@media (max-width: 1024px) {
    /* Diseño horizontal en móvil */
    .product-card {
        flex-direction: row;
        height: auto;
        min-height: 140px;
        align-items: center;
    }

    /* Imagen a la izquierda - tamaño fijo */
    .product-image {
        width: 180px;
        min-width: 180px;
        height: 180px;
        flex-shrink: 0;
    }

        .product-image img,
        .no-image-placeholder {
            object-fit: contain;
        }

    .no-image-placeholder {
        font-size: 32px;
    }

    /* Información del producto a la derecha */
    .product-info {
        flex: 1;
        padding: 1rem;
    }

    /* Ajustes de texto para móvil horizontal */
    .product-title {
        font-size: calc(1rem + 1px);
        min-height: auto;
        -webkit-line-clamp: 2;
    }

    .current-price {
        font-size: 18px;
    }

    .product-discount-badge {
        font-size: 11px;
        padding: 2px 5px;
    }

    .product-installments {
        font-size: 12px;
    }

    .product-rating-container {
        font-size: 12px;
    }

    .product-total-sales {
        font-size: 11px;
    }

    .product-brand {
        font-size: 12px;
    }

    /* Tags más compactos en móvil */
    .product-tags {
        margin-top: 0;
        gap: 4px;
    }

    .product-tag {
        font-size: 10px;
        padding: 2px 5px;
    }

    /* Botones de acción en móvil */
    .product-actions {
        flex-direction: column;
        margin-top: 8px;
    }

    .btn-view-details,
    .btn-add-to-cart {
        width: 100%;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Eliminar efecto hover en dispositivos táctiles */
    @media (hover: none) {
        .product-card:hover {
            transform: none;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

            .product-card:hover .product-image img {
                transform: none;
            }
    }
}

@media (max-width: 480px) {
    .product-image {
        width: 140px;
        min-width: 140px;
        height: 140px;
    }

    .current-price {
        font-size: 16px;
    }

    .product-title {
        font-size: 0.95rem;
    }
}

/* ========== EFECTOS DE ACCESIBILIDAD ========== */
.product-card:focus-within {
    outline: 2px solid #3483fa;
    outline-offset: 2px;
}

.product-card *:focus {
    outline: none;
}

/* ========== ANIMACIONES ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.3s ease-out;
}


    /* ========== MEJORAS ACCESIBILIDAD PRODUCT CARD ========== */

    /* Título más oscuro */
    .product-card .product-title {
        color: #1f2937; /* Antes #666 (muy claro) */
        font-weight: 500;
    }

        .product-card .product-title a:hover {
            color: var(--color-blue, #2563eb);
            text-decoration: underline; /* Ayuda visual extra */
        }

    /* Precio Original (tachado) - El gris #999 falla AA, usamos #566479 */
    .product-card .original-price del {
        color: #566479;
        font-weight: 500; /* Letra un poco más gruesa ayuda con el tachado */
    }

    /* Precio Actual - Oscuro para máximo contraste */
    .product-card .current-price {
        color: #0f172a;
    }

    /* Etiquetas (Tags) - Fondo claro, texto oscuro */
    .product-card .product-tag {
        background-color: #f3f4f6;
        color: #374151; /* Antes #666 */
        border: 1px solid #e5e7eb; /* Borde sutil para definir el área */
    }

    /* Estado sin valoraciones */
    .product-card .no-rating {
        color: #566479; /* Antes #999 */
    }

    /* Focus Visible en la tarjeta completa */
    .product-card:focus-within {
        outline: 3px solid var(--color-blue, #2563eb);
        outline-offset: 4px;
        border-radius: 4px;
    }

    /* Botón Añadir al carrito */
    .product-card .btn-add-to-cart {
        background-color: var(--color-blue, #2563eb);
        border-color: var(--color-blue, #2563eb);
    }

        .product-card .btn-add-to-cart:hover {
            background-color: #1d4ed8;
        }

        .product-card .btn-add-to-cart:focus-visible,
        .product-card .btn-view-details:focus-visible {
            outline: 3px solid #fbbf24; /* Amarillo para contraste sobre azul o blanco */
            outline-offset: 2px;
            z-index: 10;
        }

/* ========== MODO ALTO CONTRASTE (AAA) - CARD ========== */

body.high-contrast-mode .product-card {
    border: 2px solid #000000;
    box-shadow: none !important;
}

    body.high-contrast-mode .product-card .product-title,
    body.high-contrast-mode .product-card .product-title a {
        color: var(--color-blue-contrast) !important;
        text-decoration: underline;
    }

    body.high-contrast-mode .product-card .current-price {
        color: #000000 !important;
        font-weight: 800;
        font-size: 1.2em;
    }

    body.high-contrast-mode .product-card .original-price del {
        color: #000000 !important;
        text-decoration: line-through;
        opacity: 0.8;
    }

    body.high-contrast-mode .product-card .product-tag {
        background-color: #ffffff !important;
        color: #000000 !important;
        border: 1px solid #000000 !important;
        font-weight: 700;
    }

    body.high-contrast-mode .product-card .btn-add-to-cart {
        background-color: #000000 !important;
        color: #ffffff !important;
        border: 2px solid #000000 !important;
        font-weight: 700;
    }

    body.high-contrast-mode .product-card .btn-view-details {
        background-color: #ffffff !important;
        color: #000000 !important;
        border: 2px solid #000000 !important;
        font-weight: 700;
    }

/* Badges en modo contraste */
body.high-contrast-mode .product-discount-badge,
body.high-contrast-mode .product-tag.discount-tag {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #ffffff;
}
