/* ========================================================== */
/* == 🎨 ESTILOS EXCLUSIVOS PARA EL MODAL DE PRODUCTO 🎨 == */
/* ========================================================== */

/* --- VARIABLES DE COLORES (Necesarias para el modal) --- */
:root {
  /* TEMA CLARO (POR DEFECTO) */
  --color-texto: #212529;
  --color-texto-secundario: #6c757d;
  --color-tarjeta-fondo: #FFFFFF;
  --color-borde: #dee2e6;
  --color-borde-claro: #eee;
  --color-sutil: rgba(0, 0, 0, 0.04);
  --color-sombra: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
  /* TEMA OSCURO */
  --color-texto: #E0E0E0;
  --color-texto-secundario: #adb5bd;
  --color-tarjeta-fondo: #1E1E1E;
  --color-borde: #444444;
  --color-borde-claro: #333333;
  --color-sutil: rgba(255, 255, 255, 0.05);
}

/* --- TARJETAS DE PRODUCTO (Usadas en "Relacionados") --- */
.producto-card { 
    background-color: var(--color-tarjeta-fondo);
    border: 1px solid var(--color-borde-claro); 
    transition: all 0.3s ease-in-out; 
    border-radius: 8px; 
    overflow: hidden; 
    cursor: pointer; 
    min-height: 370px; 
    display: flex; 
    flex-direction: column;
}
.producto-card:hover { 
    border-color: var(--color-borde); 
    box-shadow: 0 4px 12px var(--color-sombra); 
}
.producto-card .image-container {
    height: 200px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    background-color: var(--color-sutil); 
}
.producto-card .image-container img { max-height: 100%; max-width: 100%; object-fit: contain; padding: 10px; }
.producto-card .button-wrapper { min-height: 50px; display: flex; align-items: center; justify-content: center; cursor: default; }
.producto-card .quantity-controls-wrapper { display: flex; flex-direction: column; align-items: flex-start; width: 100%; }
.producto-card .in-cart-text { font-size: 0.75rem; color: var(--color-texto-secundario); margin-bottom: 2px; }
.producto-card .controls-row { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.producto-card .button-group { display: flex; align-items: center; gap: 8px; }
.producto-card .btn-quantity { background-color: #F7C044; color: #725007; border-radius: 50%; width: 32px; height: 32px; border: none; font-size: 1.2rem; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.producto-card .quantity-display { font-weight: bold; font-size: 1.25rem; color: #B37B18; }

/* --- ESTRUCTURA PRINCIPAL DEL MODAL --- */
.modal-product-detail .modal-content { 
    background-color: var(--color-tarjeta-fondo);
    border: 1px solid var(--color-borde);
    border-radius: 12px; 
    overflow: hidden; 
}
.modal-product-detail .modal-body { padding: 0; }
.modal-navigation-header { padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--color-borde-claro); }
.modal-navigation-header .breadcrumb { margin-bottom: 0; padding-left: 0; background-color: transparent; }
.modal-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn-share { background-color: #e6f7ed; color: #28a745; border: none; border-radius: 20px; padding: 0.4rem 1rem; font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }

/* --- GALERÍA DE IMÁGENES Y ZOOM --- */
.image-gallery-wrapper { 
    background-color: var(--color-sutil); 
    padding: 2rem; 
    display: flex; 
    gap: 1rem; 
    align-items: flex-start; 
    height: 500px;
    position: relative; 
    overflow: hidden;   
}
.modal-thumbnails-vertical { 
    display: flex; 
    flex-direction: column; 
    gap: 0.75rem; 
    flex-shrink: 0; 
    padding-top: 0.5rem; 
    max-height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    position: relative; 
    z-index: 2;         
}
.modal-thumbnails-vertical img { width: 80px; height: 80px; object-fit: contain; border: 1px solid var(--color-borde-claro); border-radius: 8px; cursor: pointer; background-color: var(--color-tarjeta-fondo); transition: transform 0.2s ease-in-out; }
.modal-thumbnails-vertical img:hover { border-color: var(--color-borde); transform: scale(1.08); }
.modal-thumbnails-vertical img.active { border-color: var(--color-borde); transform: scale(1.1); }

.main-image-container-modal { 
    position: relative;
    overflow: hidden;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
#modalMainImage {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease, object-fit 0.1s step-end;
    transform-origin: center center;
}
.main-image-container-modal.zoomed #modalMainImage {
    transform: scale(4);
}
.image-gallery-wrapper.gallery-zoomed .main-image-container-modal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
}

/* --- CURSOR PERSONALIZADO PARA ZOOM --- */
.custom-cursor {
    position: absolute;
    width: 80px; height: 80px;
    background-image: url('https://api.iconify.design/mdi/magnify-plus-outline.svg');
    background-size: contain; background-repeat: no-repeat;
    pointer-events: none; 
    display: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
}
.main-image-container-modal.zoomed .custom-cursor {
    background-image: url('https://api.iconify.design/mdi/magnify-minus-outline.svg');
}

/* --- Lógica para mostrar cursor SOLO en dispositivos SIN tacto (con mouse) --- */
.no-touch-device .main-image-container-modal {
    cursor: none; /* Oculta el cursor del sistema */
}
.no-touch-device .main-image-container-modal:hover .custom-cursor {
    display: block; /* Muestra nuestra lupa personalizada */
}

/* --- COLUMNA DE INFORMACIÓN DEL PRODUCTO --- */
.product-info-column { padding: 2rem; }

/* ===================== INICIO DE CAMBIOS ===================== */
/* --- Estilos específicos para el icono de Reseña en el modal --- */
.review-icon {
    font-size: 1.6rem; /* Reducido de 1.75rem */
    cursor: pointer;
    color: var(--color-texto-secundario); /* Color gris por defecto */
    transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
    position: static;
    box-shadow: none;
    background-color: transparent;
}

/* Al pasar el mouse sobre la estrella, se pinta de amarillo */
.review-icon:hover {
    color: #ffc107; 
    transform: scale(1.1);
}

/* Si el producto ya fue calificado (clase .reviewed añadida por JS) */
.review-icon.reviewed i::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900; /* fas (sólido) */
    content: "\f005"; /* Código de la estrella sólida */
    color: #ffc107; /* Se muestra amarilla por defecto */
}
/* ====================== FIN DE CAMBIOS ====================== */

#modalProductName { 
    font-size: 1.3rem; /* Reducido de 1.5rem */
    font-weight: 600; 
    margin-bottom: 0.5rem; 
}
#modalProductDetails { 
    font-size: 0.9rem; /* Reducido de 0.95rem */
    color: var(--color-texto-secundario); 
    margin-bottom: 1.5rem; 
}

/* ESTILOS PARA EL PRECIO (CORREGIDO) */
#modalPriceContainer {
    font-weight: 700; 
    text-align: left;
}
#modalPriceContainer #modalOriginalPrice {
    font-size: 1.1rem; /* Reducido de 1.25rem */
    font-weight: 400;
}
#modalPriceContainer #modalCurrentPrice {
    font-size: 1.5rem; /* Reducido de 1.75rem */
    font-weight: 700;
}


#modal-button-container { border-top: 1px solid var(--color-sutil); border-bottom: 1px solid var(--color-sutil); padding: 1.5rem 0; margin: 1.5rem 0; }

/* ========================================================== */
/* == 🛒 BOTÓN AÑADIR AL CARRO (CORREGIDO) 🛒 == */
/* ========================================================== */
.btn-add-to-cart-modal { 
    background-color: #F7C044; 
    color: #333; 
    border: none; 
    border-radius: 25px; 
    font-size: 1rem; 
    font-weight: 600; 
    padding: 12px 15px; 
    width: 100%;
    transition: all 0.3s ease;
}

.btn-add-to-cart-modal:hover {
    background-color: rgba(247, 192, 68, 0.85);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(247, 192, 68, 0.3);
}

.btn-add-to-cart-modal:active {
    transform: translateY(0);
    background-color: rgba(247, 192, 68, 0.95);
}

/* ========================================================== */
/* == 📄 BOTONES DE INFORMACIÓN ADICIONAL (DISEÑO CORRECTO) 📄 == */
/* ========================================================== */
.product-secondary-info-buttons {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    border-top: 1px solid var(--color-borde-claro);
    padding-top: 1.5rem;
}

.product-secondary-info-buttons .btn {
    flex: 1;
    background-color: #ffffff;
    border: 1.5px solid #dee2e6;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.product-secondary-info-buttons .btn:hover {
    background-color: #f1f3f5;
    border-color: #adb5bd;
    color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.product-secondary-info-buttons .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.product-secondary-info-buttons .btn i {
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.product-secondary-info-buttons .btn:hover i {
    color: #007bff;
}

/* Responsive para botones en móvil */
@media (max-width: 575.98px) {
    .product-secondary-info-buttons {
        flex-direction: column;
        gap: 0.4rem;
    }
    
    .product-secondary-info-buttons .btn {
        width: 100%;
        padding: 0.5rem 0.65rem;
        font-size: 0.75rem;
    }
    
    .product-secondary-info-buttons .btn i {
        font-size: 0.85rem;
    }
}

/* ========================================================== */
/* == ⭐ NUEVO: ESTILOS PARA RATING DE ESTRELLAS EN EL MODAL ⭐ == */
/* ========================================================== */
#modalProductRating {
    padding: 0;
    margin: 0;
}

#modalProductRating .star-rating-display {
    letter-spacing: -1px;
    font-size: 0.9rem;
}

/* Estrellas llenas (con valoración) - Amarillas */
#modalProductRating .star-rating-display .fas.fa-star {
    color: #ffc107;
}

/* Estrellas vacías (sin valoración o restantes) - Grises/Plomo */
#modalProductRating .star-rating-display .far.fa-star {
    color: #dee2e6;
}

#modalProductRating .rating-count {
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

/* ========================================================== */
/* == 🎨 AJUSTE DE DISEÑO PARA CONTROLES DE CANTIDAD (MODAL) 🎨 == */
/* ========================================================== */
#modalQuantityControls .controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
#modalQuantityControls .in-cart-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-texto-secundario);
    margin-bottom: 4px;
}
#modalQuantityControls .quantity-display {
    font-size: 1.6rem;   /* Reducido de 1.75rem */
    font-weight: 700;   
    color: #8B572A;     
    line-height: 1;
}
#modalQuantityControls .button-group {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Espacio entre los botones */
}
#modalQuantityControls .btn-quantity {
    width: 40px; 
    height: 40px;
    border-radius: 50%; /* Circulares */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem; /* Reducido de 1.3rem */
    font-weight: bold;
    transition: all 0.2s ease;
    border: none; /* Asegura que no haya borde por defecto */
}
#modalQuantityControls #modalIncrementButton {
    background-color: #F7C044; /* Relleno amarillo */
    color: #333; /* Ícono oscuro */
}
#modalQuantityControls #modalIncrementButton:hover {
    opacity: 0.9;
}
#modalQuantityControls #modalDecrementButton {
    background-color: transparent;
    color: #8B572A; /* Ícono café oscuro */
    border: 1.5px solid #F7C044; /* Borde amarillo */
}
#modalQuantityControls #modalDecrementButton:hover {
    background-color: rgba(247, 192, 68, 0.1); /* Un leve fondo al pasar el mouse */
}

/* --- CARRUSEL DE PRODUCTOS RELACIONADOS (DENTRO DEL MODAL) --- */
.related-products-carousel-outer-wrapper { background-color: #f8f9fa; padding: 20px; border-radius: 8px; }
.related-products-carousel-container { position: relative; }
.carousel-track-wrapper { overflow: hidden; }
.carousel-track { display: flex; flex-wrap: nowrap; gap: 1rem; transition: transform 0.4s ease-in-out; }
.carousel-track > .col { flex: 0 0 calc(20% - 0.8rem); width: calc(20% - 0.8rem); padding: 0; }
.carousel-control { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; cursor: pointer; display: flex; align-items: center; justify-content: center; background-color: #ffffff; border-radius: 50%; width: 40px; height: 40px; border: 1px solid #dee2e6; box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: all 0.2s ease; }
.carousel-control.prev { left: -20px; }
.carousel-control.next { right: -20px; }
.carousel-control:hover { background-color: #e9ecef; }
.carousel-control:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- SCROLLBAR DE MINIATURAS --- */
.modal-thumbnails-vertical::-webkit-scrollbar { width: 6px; }
.modal-thumbnails-vertical::-webkit-scrollbar-track { background: transparent; }
.modal-thumbnails-vertical::-webkit-scrollbar-thumb { background-color: var(--color-borde); border-radius: 10px; }

/* ========================================================== */
/* == 🪄 ESTILOS PARA APILAR MODALES (STACKING MODALS) 🪄 == */
/* ========================================================== */
#reviewsProductModal.modal-stack {
  z-index: 1060; 
}
.modal-backdrop.show:nth-of-type(2) {
    z-index: 1059;
}

/* ========================================================== */
/* == ⭐ ESTILOS PARA LAS ESTRELLAS DE CALIFICACIÓN (CORREGIDO) ⭐ == */
/* ========================================================== */
.rating-stars {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: center;
}
.rating-stars input[type="radio"] {
    display: none;
}
.rating-stars label {
    font-size: 2.5rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s;
}
/* CORRECCIÓN: Se pintan solo las estrellas correctas al pasar el mouse */
.rating-stars label:hover,
.rating-stars label:hover ~ label {
    color: #ffc107;
}
.rating-stars input[type="radio"]:checked ~ label {
    color: #ffc107;
}

/* ========================================================== */
/* ✅ MODIFICACIONES RESPONSIVE PARA EL MODAL EN MÓVILES ✅ */
/* ========================================================== */
@media (max-width: 575.98px) {
    /* -- Títulos -- */
    .modal .related-products h4 {
        font-size: 1.2rem;
    }
    
    /* -- Tarjetas de relacionados (móvil) -- */
    .related-products .producto-card {
        min-height: 240px;
    }
    .related-products .producto-card .image-container {
        height: 100px;
    }
    .related-products .producto-card .card-body {
        padding: 0.6rem;
    }
    .related-products .producto-card .card-title {
        font-size: 0.75rem;
    }
    .related-products .producto-card .current-price {
        font-size: 0.9rem;
    }

    /* -- Carrusel de Relacionados (móvil) -- */
    .related-products-carousel-outer-wrapper {
        padding: 1rem 0;
    }
    .carousel-track > .col {
        flex: 0 0 calc(45%); 
        width: calc(45%);
    }
    .carousel-control {
        width: 35px;
        height: 35px;
    }
    .carousel-control.prev { left: 5px; }
    .carousel-control.next { right: 5px; }

    /* -- Header del Modal (móvil) -- */
    .modal-navigation-header {
        padding: 0.75rem 1rem;
        align-items: center; 
    }
    .modal-navigation-header .breadcrumb {
        font-size: 0.8rem; 
    }
    .btn-share {
        font-size: 0.9rem;
        padding: 0;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .btn-share .share-text {
        display: none;
    }

    /* -- Galería de Imágenes (móvil) -- */
    .image-gallery-wrapper {
        height: 350px;
        padding: 1rem;
    }
    .modal-thumbnails-vertical img {
        width: 55px;
        height: 55px;
    }

    /* -- Columna de Información del Producto (móvil) -- */
    .product-info-column {
        padding: 1.5rem;
    }
    #modalProductName {
        font-size: 1.15rem; /* Reducido de 1.25rem */
    }

    /* ESTE ES EL SELECTOR QUE USA TU HTML, NO #modalProductPrice */
    #modalPriceContainer #modalCurrentPrice {
        font-size: 1.3rem; /* Reducido de 1.5rem */
    }
    
    /* ⭐ BLOQUE AÑADIDO PARA MÓVIL ⭐ */
    .review-icon {
        font-size: 1.4rem; /* Reducido de 1.5rem */
    }
    #modalQuantityControls .quantity-display {
        font-size: 1.4rem; /* Reducido de 1.6rem */
    }
    #modalQuantityControls .btn-quantity {
        font-size: 1.1rem; /* Reducido de 1.2rem */
        width: 36px;
        height: 36px;
    }
    /* ⭐ FIN BLOQUE AÑADIDO ⭐ */

    /* ⭐ NUEVO: Rating responsive en móvil ⭐ */
    #modalProductRating .star-rating-display {
        font-size: 0.75rem;
        letter-spacing: -1px;
    }
    
    #modalProductRating .star-rating-display .fas.fa-star {
        color: #ffc107;
    }
    
    #modalProductRating .star-rating-display .far.fa-star {
        color: #dee2e6;
    }
    
    #modalProductRating .rating-count {
        font-size: 0.75rem;
    }
}

/* ========================================================== */
/* == 📑 PESTAÑAS DE INFO. ADICIONAL DEL PRODUCTO (MODAL) == */
/* ========================================================== */

.product-details-tabs-container .nav-tabs .nav-link {
    font-size: 0.9rem;
    color: var(--color-texto-secundario);
    padding: 0.75rem 0.5rem;
    font-weight: 500;
}

.product-details-tabs-container .nav-tabs .nav-link.active {
    color: var(--color-texto);
    font-weight: 600;
    border-color: var(--color-borde) var(--color-borde) var(--color-tarjeta-fondo);
}

.product-details-tabs-container .tab-content {
    background-color: var(--color-sutil);
    min-height: 150px;
    font-size: 0.95rem;
    color: var(--color-texto-secundario);
}

#desc-larga-pane {
    color: var(--color-texto); /* Texto principal para la descripción */
    white-space: pre-wrap; /* Respeta los saltos de línea del vendedor */
}

/* --- Grid de Certificaciones (Modal) --- */
.certificaciones-grid {
    display: grid;
    /* 3 columnas, con un mínimo de 80px */
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1.5rem;
    padding-top: 1rem;
}

.certificacion-item-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.certificacion-item-modal .cert-img-link img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid var(--color-borde-claro);
    border-radius: 4px;
    background-color: var(--color-tarjeta-fondo);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.certificacion-item-modal .cert-img-link:hover img {
    transform: scale(1.05);
    box-shadow: var(--color-sombra);
}

.certificacion-item-modal .cert-titulo-link {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    color: var(--color-texto-secundario);
}
.certificacion-item-modal .cert-titulo-link:hover {
    color: var(--color-texto);
}



/* ============================================
   ESTILOS PARA ENLACE DE DIRECCIÓN
   ============================================ */

#modalProductOriginLink {
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

#modalProductOriginLink:hover {
    background-color: rgba(13, 110, 253, 0.1);
    transform: translateX(3px);
}

#modalProductOriginLink:hover .fa-map-marker-alt {
    animation: bounce 0.6s ease-in-out infinite;
    color: #0d6efd;
}

#modalProductOriginLink:hover .fa-external-link-alt {
    opacity: 1 !important;
    transform: translateX(2px);
}

#modalProductOriginLink:active {
    transform: translateX(1px);
}

/* Animación de rebote para el ícono */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Responsivo */
@media (max-width: 768px) {
    #modalProductOriginLink {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }
    
    #modalProductOriginLink .fa-map-marker-alt {
        font-size: 1rem;
    }
    
    #modalProductOriginLink .fa-external-link-alt {
        font-size: 0.7rem;
    }
}

/* Estado de focus para accesibilidad */
#modalProductOriginLink:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}