/* Layout Principal */
.ufc-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: space-between;
    align-items: center;
}

.ufc-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ufc-filter-btn {
    background: #f0f0f1;
    border: 1px solid #ccc;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.ufc-filter-btn.active, .ufc-filter-btn:hover {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.ufc-search-box {
    flex-grow: 1;
    max-width: 300px;
}

.ufc-search-input {
    width: 100%;
    padding: 8px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
}
.ufc-search-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Grid de Productos - DEFINICIÓN BASE (Escritorio / Laptop Grande) */
.ufc-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(4, 1fr); /* Default por si no se especifica clase */
}
/* Forzamos las columnas especificas con !important para asegurar que el shortcode mande */
.ufc-grid.cols-1 { grid-template-columns: repeat(1, 1fr) !important; }
.ufc-grid.cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.ufc-grid.cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.ufc-grid.cols-4 { grid-template-columns: repeat(4, 1fr) !important; }
.ufc-grid.cols-5 { grid-template-columns: repeat(5, 1fr) !important; }
.ufc-grid.cols-6 { grid-template-columns: repeat(6, 1fr) !important; }

/* MEDIA QUERIES REPARADAS */

/* Tablets (iPad Portrait, Tablets pequeñas) - Solo afecta abajo de 900px */
@media (max-width: 900px) { 
    .ufc-grid[class*="cols-"] { 
        grid-template-columns: repeat(3, 1fr) !important; 
    } 
}

/* Móviles grandes (Landscape) */
@media (max-width: 600px) { 
    .ufc-grid[class*="cols-"] { 
        grid-template-columns: repeat(2, 1fr) !important; 
    } 
}

/* Móviles pequeños (Portrait) */
@media (max-width: 480px) { 
    .ufc-grid[class*="cols-"] { 
        grid-template-columns: 1fr !important; 
    } 
}

.ufc-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.ufc-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.ufc-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ufc-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.ufc-item:hover .ufc-img-wrap img {
    transform: scale(1.05);
}

.ufc-item h3 {
    margin: 0;
    padding: 15px;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
    color: #333;
}

/* Modal */
.ufc-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
}

.ufc-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 900px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: row;
    max-height: 90vh;
}

@media (max-width: 768px) {
    .ufc-modal-content { flex-direction: column; overflow-y: auto; }
    #ufc-modal-img { width: 100%; height: auto; max-height: 300px; }
}

.ufc-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
}

.ufc-close:hover,
.ufc-close:focus {
    color: black;
    text-decoration: none;
}

.ufc-modal-body {
    display: flex;
    width: 100%;
}

@media (max-width: 768px) { .ufc-modal-body { flex-direction: column; } }

#ufc-modal-img {
    width: 50%;
    object-fit: cover;
    background: #000;
}
@media (max-width: 768px) { #ufc-modal-img { width: 100%; } }

.ufc-info {
    padding: 30px;
    width: 50%;
    overflow-y: auto;
}
@media (max-width: 768px) { .ufc-info { width: 100%; } }

#ufc-modal-title {
    margin-top: 0;
    font-size: 24px;
    color: #222;
}

#ufc-modal-desc {
    color: #555;
    line-height: 1.6;
    margin-top: 15px;
}
