/* ===== ESTILOS PARA SISTEMA DE PRODUCTOS ===== */

/* Sección de productos */
.products-section {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Controles de filtro */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.filter-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.filter-controls select:focus {
    outline: 2px solid #5e35b1;
    outline-offset: 2px;
}

.products-count {
    margin-left: auto;
    font-size: 13px;
    color: #666;
    background: #e9ecef;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
}

/* Loading de productos */
.products-loading {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #5e35b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Grid de productos */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Tarjetas de producto */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Imagen del producto */
.product-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

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

/* Información del producto */
.product-info2 {
    padding: 15px;
}

.product-name {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Especificaciones del producto */
.product-specs {
    margin-bottom: 15px;
}

.spec-item {
    font-size: 11px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.spec-label {
    color: #666;
    font-weight: 500;
}

.spec-value {
    color: #333;
    margin-left: 4px;
}

/* Precio del producto */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: auto;
}

.price {
    font-size: 18px;
    font-weight: bold;
    color: #5e35b1;
}

.tax-info {
    font-size: 12px;
    color: #666;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 20px;
    padding: 10px 0;
    font-size: 14px;
}

.breadcrumbs a {
    color: #5e35b1;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    color: #666;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.pagination a:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.pagination a.active {
    background-color: #5e35b1;
    color: white;
    border-color: #5e35b1;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(94, 53, 177, 0.3);
}

.pagination .pagination-nav {
    font-weight: bold;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #495057;
    font-size: 18px;
}

.empty-state p {
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 14px;
}

/* Mejoras para el sidebar dinámico */
.category-item .category-name {
    font-size: 13px;
}

.category-item .dropdown-item {
    font-size: 12px;
    padding: 8px 15px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        margin-bottom: 20px;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    .products-section {
        padding: 15px;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .filter-controls select {
        width: 100%;
    }
    
    .products-count {
        margin-left: 0;
        text-align: center;
    }
    
    .product-name {
        font-size: 13px;
    }
    
    .price {
        font-size: 16px;
    }
    
    .pagination {
        gap: 2px;
    }
    
    .pagination a {
        padding: 6px 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
    }
    
    .product-info2 {
        padding: 12px;
    }
    
    .product-image {
        height: 160px;
    }
    
    .product-name {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .spec-item {
        font-size: 10px;
        margin-bottom: 3px;
    }
    
    .price {
        font-size: 15px;
    }
    
    .tax-info {
        font-size: 11px;
    }
    
    .filter-controls {
        padding: 12px;
    }
    
    .breadcrumbs {
        font-size: 12px;
        margin-bottom: 15px;
    }
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Estados de focus mejorados */
.product-link:focus {
    outline: 2px solid #5e35b1;
    outline-offset: 2px;
    border-radius: 12px;
}

.pagination a:focus {
    outline: 2px solid #5e35b1;
    outline-offset: 2px;
}

/* Mejoras adicionales para accesibilidad */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Hover states específicos */
.product-card:hover .product-name {
    color: #5e35b1;
}

.product-card:hover .price {
    color: #7c4dff;
}

/* Indicador de carga para imágenes */
.product-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #5e35b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-image img:not([src]) + ::before,
.product-image img[src=""] + ::before {
    opacity: 1;
}

/* Mejoras para categorías dinámicas */
.category-item[data-dynamic="true"] {
    border-left: 3px solid #5e35b1;
}

.category-item[data-dynamic="true"] .category-name {
    color: #5e35b1;
    font-weight: 500;
}

/* Filtros activos */
.filter-active {
    background: #5e35b1 !important;
    color: white !important;
}

/* Botón de limpiar filtros */
.clear-filters-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.clear-filters-btn:hover {
    background: #5a6268;
}

/* Mejoras para el diseño de especificaciones */
.product-specs {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    font-size: 11px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.spec-item:last-child {
    margin-bottom: 0;
}

.spec-label {
    font-weight: 600;
    color: #495057;
    flex-shrink: 0;
    margin-right: 8px;
}

.spec-value {
    color: #212529;
    text-align: right;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Indicador de productos en categorías */
.category-count {
    font-size: 11px;
    color: #666;
    font-weight: normal;
}

/* Estados de error */
.error-message {
    text-align: center;
    padding: 40px 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 20px 0;
}

/* Mejoras para el título de la página */
.page-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
    text-align: center;
    border-bottom: 2px solid #5e35b1;
    padding-bottom: 10px;
}