/**
 * Filtro de Productos AJAX - Estilos
 * Sistema de filtrado de productos con navegación por categorías
 * 
 * @package Madeco
 * @since 1.0.0
 */

/* ========================================
   Contenedor Principal
   ======================================== */
.madeco-filtro-productos-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   Barra de Navegación (Filtros)
   ======================================== */
.madeco-filtro-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
    align-items: center;
    border-bottom: 2px solid #cdcdcd !important;
    padding-bottom: 10px !important;
}

.madeco-filtro-item {
    margin: 0 !important;
    cursor: pointer;
    position: relative;
    padding-bottom: 5px;
}

.madeco-filtro-item:hover {
    color: #294A84 !important;
}

.madeco-filtro-item.active {
    color: #294A84 !important;
    font-weight: 700 !important;
}

.madeco-filtro-item.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    right: 0;
    height: 3px;
    background: #FEBD00;
}

.madeco-filtro-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   Wrapper del Grid (Para loading state)
   ======================================== */
.madeco-productos-grid-wrapper {
    position: relative;
    min-height: 400px;
    padding-top: 30px;
}

/* ========================================
   Grid de Productos
   ======================================== */
.madeco-productos-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* minmax(0, 1fr) evita que el contenido desborde y fuerce una sola columna */
.madeco-productos-grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.madeco-productos-grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.madeco-productos-grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.madeco-productos-grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.madeco-productos-grid-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.madeco-productos-grid-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* ========================================
   Tarjeta de Producto
   ======================================== */
.madeco-producto-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0; /* Permite que la tarjeta respete la columna del grid */
}

/* Imagen del Producto: ocupa solo su celda, mantiene proporción 1:1 */
.madeco-producto-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f8f8;
    flex-shrink: 0;
}

.madeco-producto-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.madeco-producto-img a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Contenido del Producto */
.madeco-producto-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.madeco-producto-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
    color: #333;
}

.madeco-producto-title a {
    color: inherit;
    text-decoration: none;
}

.madeco-producto-title a:hover {
    color: #294A84;
}

.madeco-producto-location {
    font-size: 14px;
    color: #666;
    margin: 0;
    display: flex;
    align-items: center;
}

.madeco-producto-location::before {
    content: "📍";
    margin-right: 5px;
}

/* Rating */
.madeco-producto-rating {
    display: flex;
    align-items: center;
    gap: 5px;
}

.madeco-producto-rating .star-rating {
    font-size: 14px;
}

/* ========================================
   Mensajes de Estado
   ======================================== */
.madeco-no-productos {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
    background: #f8f8f8;
    border-radius: 8px;
}

.madeco-error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #d32f2f;
    background: #ffebee;
    border-radius: 8px;
    border: 1px solid #ef9a9a;
}

/* ========================================
   Loading Spinner
   ======================================== */
.madeco-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.madeco-loading-spinner .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #294A84;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet - 2 columnas */
@media (max-width: 1199px) {
    .madeco-productos-grid,
    .madeco-productos-grid-cols-3,
    .madeco-productos-grid-cols-4,
    .madeco-productos-grid-cols-5,
    .madeco-productos-grid-cols-6 {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .madeco-filtro-nav {
        gap: 15px;
    }
    
    .madeco-filtro-item {
        font-size: 18px !important;
    }
}

/* Tablet pequeño */
@media (max-width: 768px) {
    
    .madeco-filtro-nav {
        gap: 15px;
        justify-content: flex-start;
    }
    
    .madeco-filtro-item {
        font-size: 16px !important;
    }
    
    .madeco-productos-grid {
        gap: 20px;
    }
}

/* Mobile - 1 columna */
@media (max-width: 640px) {
    .madeco-productos-grid,
    .madeco-productos-grid-cols-1,
    .madeco-productos-grid-cols-2,
    .madeco-productos-grid-cols-3,
    .madeco-productos-grid-cols-4,
    .madeco-productos-grid-cols-5,
    .madeco-productos-grid-cols-6 {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .madeco-producto-title {
        font-size: 16px;
    }
}
