/* Estilos para Layout Masonry del Menú de TV */

/* Contenedor principal del layout masonry */
.masonry-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    height: 100%;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

/* Secciones individuales */
.masonry-section {
    background: white;
    box-shadow: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.masonry-section:hover {
    box-shadow: none;
    transform: none;
}

/* Header de sección */
.section-header {
    background: var(--header-bg-color, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    color: var(--title-text-color, white);
    padding: 10px 15px;
    position: relative;
    z-index: 2;
}

.section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.section-title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    font-size: 1rem;
    color: #f39c12;
}

/* Contenido de sección */
.section-content {
    flex: 1;
    padding: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Vista de producto único - Diseño optimizado */
.producto-unico-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 0;
    background: white;
}

.producto-unico-container .product-card {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    grid-template-rows: 1fr;
    background: white;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    position: relative;
}

/* Vista de listado de productos */
.listado-productos-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    overflow-y: auto;
    padding: 5px;
    scroll-behavior: smooth;
    /* Optimizaciones para scroll suave */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Ocultar scrollbar en WebKit browsers */
.listado-productos-container::-webkit-scrollbar {
    display: none;
}

/* Contenedor para scroll infinito */
.listado-productos-container.infinite-scroll {
    animation: infiniteScroll 60s linear infinite;
}

@keyframes infiniteScroll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

.listado-productos-container::-webkit-scrollbar {
    width: 4px;
}

.listado-productos-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.listado-productos-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
}

/* Vista de tabla de productos */
.tabla-productos-container {
    height: 100%;
    overflow: auto;
}

.productos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.productos-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.productos-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    background: white;
}

.productos-table tr:hover td {
    background: #f8f9fa;
}

.productos-table tr:nth-child(even) td {
    background: #f8f9fa;
}

/* Tarjetas de producto (versión compacta para masonry) */
.masonry-section .product-card {
    background: white;
    border: none;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 120px;
}

/* Items de lista para listado de productos */
.listado-productos-container .product-card {
    flex-direction: row;
    min-height: 60px;
    height: auto;
    border-radius: 0;
    padding: 8px;
    align-items: center;
    gap: 12px;
}

/* Reordenar elementos para que la imagen esté a la izquierda */
.listado-productos-container .product-card .product-image {
    order: 1;
}

.listado-productos-container .product-card .product-info {
    order: 2;
}

.masonry-section .product-card:hover {
    transform: none;
    box-shadow: none;
}

.masonry-section .product-card.featured {
    border: 2px solid #f39c12;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.masonry-section .product-card.featured::before {
    content: '⭐ Destacado';
    position: absolute;
    top: 5px;
    right: 5px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 2px 6px;
    font-size: 0.6rem;
    font-weight: 600;
    z-index: 2;
}

.masonry-section .product-image {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, #ddd, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Imagen para items de lista */
.listado-productos-container .product-card .product-image {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 0;
}

/* Imagen para producto único - Lado izquierdo */
.producto-unico-container .product-card .product-image {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.producto-unico-container .product-card .product-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    z-index: 1;
}

.producto-unico-container .product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    position: relative;
}

.producto-unico-container .product-card .product-image .placeholder {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.8);
    z-index: 2;
    position: relative;
}

.masonry-section .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.masonry-section .product-card:hover .product-image img {
    transform: scale(1.1);
}

.masonry-section .product-image .placeholder {
    font-size: 1.5rem;
    color: #bdc3c7;
}

.masonry-section .product-info {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Información para items de lista */
.listado-productos-container .product-card .product-info {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Información para producto único - Lado derecho */
.producto-unico-container .product-card .product-info {
    grid-column: 2;
    grid-row: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    background: white;
    position: relative;
}

/* Estilos específicos para texto en producto único */
.producto-unico-container .product-card .product-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.1;
    margin: 0;
}

.producto-unico-container .product-card .product-description {
    font-size: 0.9rem;
    color: #7f8c8d;
    line-height: 1.3;
    margin: 0;
    font-weight: 400;
}

.producto-unico-container .product-card .product-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: #e74c3c;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.producto-unico-container .product-card .product-price::before {
    content: '$';
    font-size: 1.5rem;
    color: #e74c3c;
}

.producto-unico-container .product-card .product-category {
    font-size: 0.8rem;
    color: #667eea;
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 0;
    align-self: flex-start;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: none;
    transition: all 0.3s ease;
}

.producto-unico-container .product-card .product-category:hover {
    transform: none;
    box-shadow: none;
}

/* Efectos adicionales para el nuevo diseño */
.producto-unico-container .product-card {
    transition: all 0.3s ease;
}

.producto-unico-container .product-card:hover {
    transform: none;
    box-shadow: none;
}

.producto-unico-container .product-card .product-image img {
    transition: transform 0.3s ease;
}

.producto-unico-container .product-card:hover .product-image img {
    transform: scale(1.02);
}

.masonry-section .product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.masonry-section .product-description {
    font-size: 0.7rem;
    color: #7f8c8d;
    margin-bottom: 6px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.masonry-section .product-price {
    font-size: 1rem;
    font-weight: 700;
    color: #e74c3c;
    margin-bottom: 4px;
}

.masonry-section .product-category {
    font-size: 0.6rem;
    color: #95a5a6;
    background: #ecf0f1;
    padding: 2px 6px;
    border-radius: 0;
    align-self: flex-start;
}

/* Mensaje cuando no hay productos */
.no-products {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Responsive para diferentes tamaños de sección */
.masonry-section[style*="width: 100%"] .listado-productos-container {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.masonry-section[style*="width: 50%"] .listado-productos-container {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.masonry-section[style*="width: 33.33%"] .listado-productos-container {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

/* Responsive para TV */
@media (min-width: 1920px) {
    .masonry-section .product-name {
        font-size: 1rem;
    }
    
    .masonry-section .product-description {
        font-size: 0.8rem;
    }
    
    .masonry-section .product-price {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .productos-table {
        font-size: 1rem;
    }
    
    /* Producto único responsivo */
    .producto-unico-container .product-card .product-name {
        font-size: 2.2rem;
    }
    
    .producto-unico-container .product-card .product-description {
        font-size: 1rem;
    }
    
    .producto-unico-container .product-card .product-price {
        font-size: 3rem;
    }
    
    .producto-unico-container .product-card .product-price::before {
        font-size: 1.8rem;
    }
    
    .producto-unico-container .product-card .product-category {
        font-size: 0.9rem;
        padding: 8px 16px;
    }
}

@media (min-width: 2560px) {
    .masonry-section .product-name {
        font-size: 1.1rem;
    }
    
    .masonry-section .product-description {
        font-size: 0.9rem;
    }
    
    .masonry-section .product-price {
        font-size: 1.2rem;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .productos-table {
        font-size: 1.1rem;
    }
    
    /* Producto único responsivo 2K */
    .producto-unico-container .product-card .product-name {
        font-size: 2.5rem;
    }
    
    .producto-unico-container .product-card .product-description {
        font-size: 1.2rem;
    }
    
    .producto-unico-container .product-card .product-price {
        font-size: 3.5rem;
    }
    
    .producto-unico-container .product-card .product-price::before {
        font-size: 2rem;
    }
    
    .producto-unico-container .product-card .product-category {
        font-size: 1rem;
        padding: 10px 20px;
    }
    
    .producto-unico-container .product-card .product-description {
        font-size: 1.4rem;
    }
    
    .producto-unico-container .product-card .product-price {
        font-size: 3rem;
    }
}

@media (min-width: 3840px) {
    .masonry-section .product-name {
        font-size: 1.2rem;
    }
    
    .masonry-section .product-description {
        font-size: 1rem;
    }
    
    .masonry-section .product-price {
        font-size: 1.3rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .productos-table {
        font-size: 1.2rem;
    }
    
    /* Producto único responsivo 4K */
    .producto-unico-container .product-card .product-name {
        font-size: 3rem;
    }
    
    .producto-unico-container .product-card .product-description {
        font-size: 1.5rem;
    }
    
    .producto-unico-container .product-card .product-price {
        font-size: 4rem;
    }
    
    .producto-unico-container .product-card .product-price::before {
        font-size: 2.5rem;
    }
    
    .producto-unico-container .product-card .product-category {
        font-size: 1.2rem;
        padding: 12px 24px;
    }
}

/* Animaciones para las secciones */
.masonry-section {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.masonry-section:nth-child(1) { animation-delay: 0.1s; }
.masonry-section:nth-child(2) { animation-delay: 0.2s; }
.masonry-section:nth-child(3) { animation-delay: 0.3s; }
.masonry-section:nth-child(4) { animation-delay: 0.4s; }
.masonry-section:nth-child(5) { animation-delay: 0.5s; }
.masonry-section:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Optimizaciones específicas para TV */
.masonry-container {
    /* Asegurar que no haya scroll */
    overflow: hidden !important;
}

.masonry-section {
    /* Asegurar que las secciones se ajusten perfectamente */
    box-sizing: border-box;
}

/* Scrollbar personalizado para contenedores internos */
.listado-productos-container::-webkit-scrollbar,
.tabla-productos-container::-webkit-scrollbar {
    width: 6px;
}

.listado-productos-container::-webkit-scrollbar-track,
.tabla-productos-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.listado-productos-container::-webkit-scrollbar-thumb,
.tabla-productos-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.listado-productos-container::-webkit-scrollbar-thumb:hover,
.tabla-productos-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
}
