.product-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.product-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease-in-out;
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #eee;
    transition: transform 0.3s ease-in-out;
}

.product-card-content {
    padding: 1rem;
    flex-grow: 1;
}


.product-card-content h2 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.product-card-content h2 a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease-in-out;
}
.product-card-content h2 a:hover {
    color: var(--primary-color);
}

.product-card-content .price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 1rem;
}

.product-card-actions {
    padding: 0 1rem 1rem 1rem;
    display: flex;
    justify-content: space-between;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

@media (min-width: 768px) {
    .product-card .product-card-actions {
        opacity: 0;
        transform: translateY(10px);
    }

    .product-card:hover {
        transform: translateY(-5px) scale(1.03);
        box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    }

    .product-card:hover img {
        transform: scale(1.05);
    }

    .product-card:hover .product-card-actions {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.category-btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 7px;
    text-decoration: none;
    color: #333;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
}

.category-btn:hover {
    background-color: #eee;
    border-color: #bbb;
}

.category-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

@media (min-width: 768px) {
    .category-filter {
        gap: 0.75rem;
    }
    .category-btn {
        padding: 0.5rem 1.25rem;
        font-size: 1.1rem;
    }
}

.btn {
    padding: 0.5rem 0.75rem; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 0.9rem; text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary { background-color: #007bff; color: white; }
.btn-primary:hover { background-color: #0056b3; }
.btn-secondary { background-color: #6c757d; color: white; }
.btn-secondary:hover { background-color: #5a6268; }


.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none; padding: 2rem; box-sizing: border-box;
    overflow-y: auto; z-index: 2000;
}
#cart-modal-overlay .modal-content {
    max-width: 400px;
    margin: 0 0 0 auto;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
}
#cart-modal-overlay.is-open .modal-content {
    transform: translateX(0);
}
#cart-modal-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    overflow: hidden;
}
#cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}
.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
    align-items: center;
}
.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.cart-item-info {
    flex-grow: 1;
    min-width: 0;
}
.cart-item-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-info .price {
    font-size: 0.9rem;
    color: #555;
    display: block;
}
.cart-item-actions.quantity-control {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.btn-qty {
    background-color: #eee;
    border: 1px solid #ccc;
    color: #333;
    width: 25px;
    height: 25px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    line-height: 23px;
    text-align: center;
}
.btn-qty:hover {
    background-color: #ddd;
}
.item-quantity {
    width: 40px;
    text-align: center;
    border: 1px solid #ccc;
    height: 25px;
    margin: 0 5px;
    border-radius: 4px;
    -moz-appearance: textfield;
}
.item-quantity::-webkit-outer-spin-button,
.item-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#cart-summary {
    padding: 1rem 0 0 0;
    border-top: 2px solid #333;
    margin-top: auto;
    background: #fff;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.modal-content {
    background-color: white; border-radius: 8px;
    width: 90%; max-width: 600px;
    position: relative; margin: auto;
    max-height: 90vh;
    display: flex; flex-direction: column;
}
.modal-header {
    padding: 1.5rem; border-bottom: 1px solid #dee2e6;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.5rem; }
.modal-close {
    font-size: 2rem; font-weight: bold; cursor: pointer;
    line-height: 1;
}
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}
.modal-product-layout {
    display: flex; flex-direction: column; gap: 1.5rem;
}
@media (min-width: 600px) {
    .modal-product-layout { flex-direction: row; }
    .modal-product-layout > div { flex: 1; }
}
.modal-product-layout img { width: 100%; border-radius: 8px; }
.modal-product-layout .price { font-size: 1.5rem; font-weight: bold; color: #007bff; margin: 0.5rem 0; }
.tab-nav {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-top: 1.5rem;
}
.tab-btn {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border: none; background: none;
    font-size: 1rem; font-weight: 500;
    color: #6c757d;
}
.tab-btn.active {
    color: #007bff;
    border-bottom: 2px solid #007bff;
}
.tab-content {
    display: none;
    padding: 1rem 0;
    line-height: 1.6;
    white-space: pre-wrap;
}
.tab-content.active {
    display: block;
}




/* --- ESTILOS DE LA GALERÍA --- */
    .product-gallery-wrapper {
        display: flex;
        gap: 15px;
        width: 100%;
        /* CAMBIO CLAVE: Usamos aspect-ratio en lugar de altura fija para evitar franjas negras */
        aspect-ratio: 16 / 9;
        max-height: 500px; /* Límite de seguridad */
        background: #fff;
        border-radius: 8px;
        overflow: hidden;
    }

    /* Columna Miniaturas */
    .gallery-thumbs { display: flex; flex-direction: column; gap: 10px; width: 80px; overflow-y: auto; padding: 10px 5px; }
    .gallery-thumbs::-webkit-scrollbar { width: 4px; }
    .thumb-item { width: 70px; height: 70px; border: 2px solid transparent; border-radius: 6px; cursor: pointer; opacity: 0.7; transition: all 0.2s; flex-shrink: 0; background: #f1f1f1; position: relative; }
    .thumb-item:hover, .thumb-item.active { border-color: var(--primary-color, #e69500); opacity: 1; }
    .thumb-item img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* CAMBIO: Rellena todo el cuadro (adios barras negras) */
        object-position: center;
        display: block;
    }
    .video-thumb .play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 1.5rem; text-shadow: 0 2px 4px rgba(0,0,0,0.8); pointer-events: none; }

    /* Visor Principal */
    .gallery-main-stage { flex-grow: 1; position: relative; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
    #main-product-image { width: 100%; height: 100%; object-fit: contain; background: #fff; }
    #main-product-video { width: 100%; height: 100%; display: none; }

/* REPRODUCTOR HACK (Modo Escala - Sin deformar) */
    .premium-player-wrapper { position: relative; width: 100%; height: 100%; overflow: hidden; }

    .video-zoom-container {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        pointer-events: none;
    }

    .video-zoom-container iframe {
        position: absolute;
        top: 50%; left: 50%;
        width: 100%;
        height: 180%; /* <--- EL SECRETO: 180% de altura para sacar las barras */
        transform: translate(-50%, -50%); /* Lo centra para cortar arriba y abajo */
        border: none;
        z-index: 0;
    }

    /* --- NUEVO: AJUSTE PARA PANTALLA COMPLETA --- */
    /* Cuando está en fullscreen, reducimos el zoom para que no se corte tanto */
    .premium-player-wrapper:fullscreen .video-zoom-container iframe {
        height: 130%; /* Ajuste suave para fullscreen */
    }

    /* Ajuste Responsive: En móviles, cambiamos la orientación */
    @media (max-width: 768px) {
        .product-gallery-wrapper {
            flex-direction: column-reverse;
            height: auto;
            aspect-ratio: auto; /* En móvil dejamos que la altura sea libre */
        }
        .gallery-thumbs {
            flex-direction: row;
            width: 100%;
            height: 80px;
            overflow-x: auto;
        }
        .gallery-main-stage {
            width: 100%;
            aspect-ratio: 16 / 9; /* Forzamos proporción de video en el visor */
            height: auto;
        }
    }



    /* Capas de Control */
    .premium-poster {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: contain; /* CAMBIO: Ajusta la imagen completa sin recortar/zoom */
        object-position: center;
        z-index: 10;
        transition: opacity 0.4s;
        background: #000; /* Rellena con negro los espacios sobrantes si los hay */
    }
    .premium-poster.is-hidden { opacity: 0; pointer-events: none; }
    .big-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80px; height: 80px; background: rgba(0,0,0,0.6); border-radius: 50%; color: white; display: flex; align-items: center; justify-content: center; font-size: 3rem; z-index: 20; cursor: pointer; border: 3px solid white; transition: transform 0.2s; pointer-events: none; }
    /* Estilo para ocultar el botón grande cuando se reproduce */
    .big-play-btn.hidden { opacity: 0; visibility: hidden; transition: opacity 0.3s; }
    .player-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 15; cursor: pointer; }

    /* Responsive */
    @media (max-width: 768px) {
        .product-gallery-wrapper { flex-direction: column-reverse; height: auto; }
        .gallery-thumbs { flex-direction: row; width: 100%; height: 90px; overflow-x: auto; }
        .gallery-main-stage { height: 350px; }
    }













    /* --- ESTILOS DE LA BARRA DE CONTROLES --- */
.custom-controls {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 45px;
    background: rgba(0,0,0,0.85); display: flex; align-items: center;
    padding: 0 10px; z-index: 30; opacity: 0; transition: opacity 0.3s;
}
/* Mostrar controles al pasar el mouse o si está pausado */
.premium-player-wrapper:hover .custom-controls,
.premium-player-wrapper.paused .custom-controls { opacity: 1; }

.ctrl-btn {
    background: none; border: none; color: #fff; width: 35px; height: 100%;
    cursor: pointer; font-size: 1rem; opacity: 0.8; transition: opacity 0.2s;
}
.ctrl-btn:hover { opacity: 1; color: var(--primary-color, #e69500); }

/* Barra de Progreso */
.progress-container {
    flex-grow: 1; height: 5px; background: #444; border-radius: 3px;
    margin: 0 15px; cursor: pointer; position: relative;
}
.progress-fill {
    height: 100%; width: 0%; background: var(--primary-color, #e69500);
    border-radius: 3px; position: relative;
}
/* Bolita del progreso */
.progress-fill::after {
    content: ''; position: absolute; right: -4px; top: -3px;
    width: 11px; height: 11px; background: #fff; border-radius: 50%;
    opacity: 0; transition: opacity 0.2s;
}
.progress-container:hover .progress-fill::after { opacity: 1; }

.time-text { color: #ccc; font-size: 0.75rem; margin-right: 10px; min-width: 70px; text-align: center;}

/* Volumen */
.volume-container { display: flex; align-items: center; width: 30px; overflow: hidden; transition: width 0.3s; }
.volume-container:hover { width: 100px; }
.volume-slider { width: 60px; height: 4px; margin-left: 5px; cursor: pointer; }










/* --- ESTILOS BREADCRUMBS Y DETALLE (Sin Cambios) --- */
        .breadcrumbs {
            margin-bottom: 1.5rem; font-size: 0.9rem; color: #555;
            display: flex; align-items: center;
        }
        .breadcrumbs span { color: #777; margin: 0 0.5rem; }
        .breadcrumbs a {
           display: inline-block; padding: 0.3rem 0.8rem;
           background-color: #f7a00f; border: 1px solid #e69500;
           border-radius: 5px; color: white; font-weight: bold;
           text-decoration: none; transition: filter 0.2s ease;
           margin-right: 0.5rem;
       }
       .breadcrumbs a:hover { filter: brightness(90%); text-decoration: none; }

        .product-detail-container {
            display: grid; grid-template-columns: 1fr; gap: 2rem;
            background-color: #fff; padding: 2rem; border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin-bottom: 3rem;
        }
        @media (min-width: 768px) {
            .product-detail-container { grid-template-columns: 1fr 1fr; }
        }
        .product-image img {
            width: 100%;
            max-width: 400px;
            display: block;
            margin: 0 auto;
            border-radius: 8px; aspect-ratio: 1/1; object-fit: cover;
        }
        .product-info h1 { font-size: 2rem; margin-top: 0; }
        .product-info .price { font-size: 1.5rem; font-weight: bold; color: var(--primary-color); margin: 1rem 0; }
        .product-info .section-content { font-size: 1rem; line-height: 1.6; color: #555; margin-bottom: 1.5rem; }
        .product-info h3 { font-size: 1.2rem; color: #333; margin-top: 1.5rem; margin-bottom: 0.5rem; border-bottom: 1px solid #eee; padding-bottom: 0.3rem; }
        .btn-add-cart-page { width: 100%; padding: 0.75rem 1.5rem; font-size: 1.1rem; font-weight: bold; margin-top: 1rem; }

        .related-products-section,
        .brands-section {
            margin-top: 3rem;
            padding-top: 2rem;
            border-top: 1px solid #eee;
        }
        .section-title {
            text-align: center;
            font-size: 1.5rem;
            color: #333;
            margin-bottom: 2rem;
        }
        .related-products-grid {
            display: grid;
            gap: 1.5rem;
            grid-template-columns: repeat(2, 1fr);
        }
        @media (min-width: 992px) {
            .related-products-grid {
                grid-template-columns: repeat(4, 1fr);
            }
        }
        .related-products-grid .product-card img {
             height: 150px;
        }

        .brands-logo-container {
           display: grid;
           grid-template-columns: repeat(2, 1fr);
           gap: 0.25rem;
           justify-items: center;
           align-items: center;
       }
       @media (min-width: 768px) {
           .brands-logo-container {
               grid-template-columns: repeat(4, 1fr);
                gap: 0.5rem;
           }
       }
        .brand-logo img {
            max-height: 110px;
            max-width: 220px;
            width: auto;
            opacity: 0.8;
            transition: opacity 0.2s ease, transform 0.2s ease;
        }
        .brand-logo img:hover {
            opacity: 1;
            transform: scale(1.05);
        }
    /* --- INICIO YOUTUBE FACADE STYLES --- */
    .video-facade-wrapper {
        position: relative;
        width: 100%;
        padding-bottom: 56.25%; /* Ratio 16:9 estricto */
        height: 0;
        overflow: hidden;
        background-color: #000;
        border-radius: 8px; /* Opcional: bordes redondeados */
    }

    /* La Imagen de Portada (Miniatura) */
    .video-facade-img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover; /* ESTO es la magia: rellena sin deformar */
        z-index: 20; /* Encima del video */
        cursor: pointer;
        transition: opacity 0.4s ease;
    }

    /* Botón de Play Encima de la imagen (Mejora UX) */
    .video-play-btn {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 68px;
        height: 48px;
        background-color: rgba(33, 33, 33, 0.8);
        border-radius: 10px;
        z-index: 21;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.2s;
    }
    .video-play-btn:hover { background-color: #f00; }
    .video-play-btn::before {
        content: '';
        border-style: solid;
        border-width: 10px 0 10px 20px;
        border-color: transparent transparent transparent #fff;
    }

    /* El contenedor del video real (Oculto al inicio) */
    .video-iframe-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
        /* Aquí mantenemos tu truco de zoom si lo deseas,
           pero al estar detrás de la imagen, no se ve lo feo al cargar */
    }

    /* Clase para ocultar la fachada al hacer clic */
    .video-active .video-facade-img,
    .video-active .video-play-btn {
        opacity: 0;
        pointer-events: none;
        display: none; /* Asegura que se quite del DOM visual */
    }
    /* --- FIN YOUTUBE FACADE STYLES --- */
