/* ========================================================== */
/* == 🎨 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: 2rem; /* Tamaño del icono */
    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.75rem; font-weight: 600; margin-bottom: 0.5rem; }
#modalProductDetails { font-size: 1rem; color: var(--color-texto-secundario); margin-bottom: 1.5rem; }
#modalProductPrice { font-size: 2rem; font-weight: 700; text-align: left; }
#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; }
.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%; }


/* ========================================================== */
/* == 🎨 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: 2.25rem; /* Más grande */
    font-weight: 700;   /* Más grueso */
    color: #8B572A;     /* Color café oscuro del diseño */
    line-height: 1;
}
#modalQuantityControls .button-group {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Espacio entre los botones */
}
#modalQuantityControls .btn-quantity {
    width: 44px;
    height: 44px;
    border-radius: 50%; /* Circulares */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    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.4rem;
    }
    #modalCurrentPrice {
        font-size: 1.8rem;
    }
}