/* Contenedor principal de la página */
.catalog-container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem 1.5rem;
}

.catalog-title { 
    margin: 1.5rem 0 1rem 0; 
    font-size: 1.8rem; 
    color: var(--primary); 
    font-weight: 700; 
}

/* Bloque 1: Contenedor exclusivo para los filtros */
/* Panel de Filtros Organizado */
.filter-form { 
    background: white; 
    padding: 1.5rem; 
    border-radius: 10px; 
    border: 1px solid #e2e8f0; 
    display: none; 
    flex-direction: column; 
    gap: 1rem; 
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03); 
}

.filter-form.active { 
    display: flex; 
}

.filter-form select, 
.filter-form input { 
    width: 100%;
    padding: 0.7rem; 
    border: 1px solid var(--border-color); 
    border-radius: 6px; 
    font-size: 0.95rem; 
    outline: none; 
    box-sizing: border-box;
    background: #fff;
}

.filter-form select:focus, 
.filter-form input:focus { 
    border-color: var(--accent); 
}

/* Fila para Categoría, Marca y Precio Máximo */
.filter-row-triple {
    display: grid;
    grid-template-columns: 1fr; /* En móvil se colocan en columnas individuales una debajo de otra */
    gap: 1rem;
    width: 100%;
}

/* En pantallas de escritorio o tabletas medianas, los ponemos en línea si hay espacio, o en bloque limpio */
@media (min-width: 769px) {
    .filter-row-triple {
        grid-template-columns: 1fr 1fr 1fr; /* Categoría | Marca | Precio en la misma línea en PC */
    }
}

/* Contenedor de botones inferiores */
.filter-actions {
    display: flex;
    gap: 0.8rem;
    width: 100%;
}

.filter-actions button, 
.filter-actions .btn-secondary {
    flex: 1;
    height: 44px;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    box-sizing: border-box;
    text-align: center;
}

.filter-actions button {
    background-color: var(--primary);
    color: white;
}

.filter-actions .btn-secondary {
    background-color: var(--text-muted);
    color: white;
}

/* Bloque 2: Contenedor independiente y fluido para las tarjetas de productos */
.products-section {
    width: 100%;
}

/* Grilla de productos responsiva que se expande de lado a lado */
.grid-catalogo { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
    gap: 1.8rem; 
    width: 100%;
}

.card { 
    background-color: var(--card-bg); 
    border: 1px solid #e2e8f0; 
    border-radius: 10px; 
    overflow: hidden; 
    cursor: pointer; 
    transition: transform 0.2s, box-shadow 0.2s; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.02); 
}

.card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 10px 20px -3px rgba(30, 64, 175, 0.1); 
    border-color: var(--accent); 
}

.card-img-container { 
    width: 100%; 
    height: 190px; 
    background-color: #ffffff; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 1rem; 
    border-bottom: 1px solid #f1f5f9;
}

.card img { 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
}

.card-body { 
    padding: 1.2rem; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
    justify-content: space-between; 
}

.card-title { 
    font-size: 1.1rem; 
    font-weight: 700; 
    color: var(--text-main); 
    margin-bottom: 0.4rem; 
    line-height: 1.3; 
}

.card-meta { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    margin-bottom: 1rem; 
    font-weight: 600; 
}

.card-footer-info { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: auto; 
}

.card-price { 
    color: var(--primary); 
    font-weight: 800; 
    font-size: 1.25rem; 
}

.badge-cat { 
    display: inline-block; 
    background-color: #eff6ff; 
    color: var(--primary); 
    font-size: 0.75rem; 
    padding: 0.2rem 0.6rem; 
    border-radius: 4px; 
    font-weight: 700; 
    margin-bottom: 0.5rem; 
}

.no-results { 
    grid-column: 1/-1; 
    text-align: center; 
    color: var(--text-muted); 
    padding: 3rem; 
    background: white; 
    border-radius: 8px; 
    border: 1px solid #e2e8f0; 
    display: none; 
}

.card.producto-oculto {
    display: none !important;
}

/* ==========================================
   ADAPTACIÓN MÓVIL: 2 PRODUCTOS POR FILA
   ========================================== */
@media (max-width: 768px) {
    .grid-catalogo {
        grid-template-columns: repeat(2, 1fr); /* 2 productos por fila en móvil */
        gap: 0.8rem; 
    }

    .catalog-container {
        padding: 0 0.8rem 2rem 0.8rem; 
    }

    .card-img-container {
        height: 120px; 
        padding: 0.5rem;
    }

    .card-title {
        font-size: 0.95rem; 
    }

    .card-body {
        padding: 0.8rem; 
    }

    .card-price {
        font-size: 1.05rem; 
    }

    /* AQUÍ CAMBIA: Solo en móvil el botón baja y ocupa todo el ancho */
    .card-footer-info {
        flex-direction: column;     /* Apilado vertical */
        gap: 0.5rem;                /* Espacio entre precio y botón */
        align-items: stretch;
    }

    .card-footer-info .btn {
        width: 100% !important;     /* Botón de ancho completo en móvil */
        padding: 0.4rem !important;
        font-size: 0.8rem !important;
    }
}