
.supermarket-layout {
    display: flex; 
    align-items: flex-start;
    gap: 110px; 
    
    max-width: 1400px;    
    margin: 50px auto; 
    padding: 0 25px;    
    margin-top: 120px;  
    margin-bottom: 80px; 
    min-height: 80vh;
}

.sidebar-filters {
    width: 220px; 
    flex-shrink: 0;
    background: var(--white); 
    border-radius: var(--radius); 
    padding: 25px; 
    box-shadow: var(--shadow-card); 
    border: 1px solid rgba(0,0,0,0.03);
    margin-top: 75px; 
    position: relative; 
    top: 0;    
    height: fit-content;
    z-index: 1; 
}

.filter-group { margin-bottom: 25px; }
.filter-group h4 {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    width: 100%;
    margin-bottom: 25px; 
    font-size: 1rem;
    color: var(--brand-text); 
    font-weight: 700;
}

#precio-valor {
    font-size: 1rem;
    font-weight: 600;
    color: var(--brand-text); 
    background: transparent;
    padding: 0;
    font-family: 'Inter', sans-serif;
}
#precio-valor::before { content: ""; }

.sidebar-search {
    display: flex; background: #f4f6f8; border-radius: 12px; padding: 5px;
    border: 1px solid transparent; transition: 0.2s;
}
.sidebar-search:focus-within { 
    background: white; border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(216, 125, 74, 0.1); 
}
.sidebar-search input { border: none; background: transparent; padding: 8px; width: 100%; font-size: 0.9rem; color: var(--brand-text); }
.sidebar-search button { background: none; border: none; color: #888; cursor: pointer; padding: 0 10px; }

.category-list { list-style: none; padding: 0; }
.category-list li {
    padding: 10px 15px; cursor: pointer; color: #666; transition: 0.2s;
    border-radius: 8px; font-size: 0.9rem; margin-bottom: 4px; font-weight: 500;
}
.category-list li:hover { background: #fff8f3; color: var(--primary); transform: translateX(5px); }
.category-list li.active {
    background: var(--primary); color: white; font-weight: 600;
    box-shadow: 0 4px 10px rgba(216, 125, 74, 0.3); transform: translateX(5px);
}

.slider { width: 100%; -webkit-appearance: none; background: #eee; height: 5px; border-radius: 5px; margin-top: 10px; }
.slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px; background: var(--primary);
    border-radius: 50%; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); cursor: pointer;
}
.price-labels {
    display: flex;
    justify-content: space-between; 
    width: 100%; 
    
    font-size: 0.9rem; 
    color: #777; 
    font-weight: 600; 
    
    margin-top: 10px; 
    padding: 0;
}
.catalog-main { flex: 1; width: 100%; }

.catalog-top-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;            
    flex-wrap: wrap;               
    margin-bottom: 30px; 
    border-bottom: 1px solid var(--border-light); 
    padding-bottom: 15px; 
    gap: 15px;
}

.catalog-top-bar h1 { 
    color: var(--brand-text); 
    font-size: 1.8rem; 
    font-weight: 800; 
    line-height: 1; 
    margin: 0;
}

.catalog-top-bar span { 
    display: block;
    margin-top: 5px;
    color: #888; 
    font-size: 0.9rem; 
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px; 
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--brand-text);
    background-color: var(--white);
    cursor: pointer;
    outline: none;
    min-width: 180px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.sort-select:hover {
    border-color: var(--primary);
}

.sort-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(216, 125, 74, 0.1);
}
.catalog-main .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 20px;
    width: 100%;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 15px; 
    border: none;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative; 
    display: flex; flex-direction: column;
    
    height: auto;
    min-height: 300px; 
}

.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

.img-circle {
    width: 100%; 
    height: 150px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    margin-bottom: 15px;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.img-circle img {
    height: 100%; 
    width: auto; 
    max-width: 100%;
    object-fit: contain;
    border-radius: 20px;
    background-color: #ffffff; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.product-card:hover .img-circle img {
    transform: scale(1.05);
}
.product-card h3 {
    font-size: 0.95rem; color: #444; font-weight: 600; margin-bottom: 5px;
    line-height: 1.3; height: 2.6em; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.product-card p {
    font-size: 1.4rem !important; color: var(--brand-text) !important;
    font-weight: 800; margin-top: auto;
}

.btn-add {
    position: absolute; bottom: 15px; right: 15px;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary); color: white; border: none;
    font-size: 0; display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 10px rgba(216, 125, 74, 0.3);
    transition: 0.2s; z-index: 2;
}
.btn-add::after { content: "+"; font-size: 1.6rem; margin-top: -2px; }
.btn-add:hover { background: var(--brand-text); transform: scale(1.1); }
.btn-add:active { transform: scale(0.95); }

.text-center-link { text-align: center; margin-top: 50px; }
.btn-more-products {
    background: transparent; color: var(--brand-text); padding: 12px 30px; border: 2px solid var(--brand-text);
    border-radius: 30px; text-decoration: none; font-weight: 700; transition: 0.3s; display: inline-flex; align-items: center; gap: 10px;
}
.btn-more-products:hover { background: var(--brand-text); color: white; }



@media (max-width: 900px) {
    .supermarket-layout { 
        flex-direction: column; 
        gap: 30px; 
        margin-top: 90px; 
        margin-bottom: 60px; 
        padding: 0 15px;
    }

    .sidebar-filters { 
        width: 100%; 
        position: relative; 
        top: 0; 
        margin-top: 0; 
        margin-bottom: 20px; 
        z-index: 1;
    }
    
    .category-list { 
        display: flex; 
        flex-wrap: wrap; 
        gap: 8px; 
    }
    .category-list li { 
        background: #f4f4f4; 
        border: 1px solid #eee; 
        margin: 0; 
        font-size: 0.85rem; 
        padding: 8px 15px; 
        border-radius: 50px; 
    }
    
    .catalog-main .product-grid { 
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
        gap: 15px; 
    }
}

@media (max-width: 480px) {
    .catalog-main .product-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px; 
    }

    .product-card {
        padding: 10px; 
        min-height: 260px; 
    }

    .img-circle {
        height: 120px;
    }
    
    .product-card p { font-size: 1.2rem !important; }
    .product-card h3 { font-size: 0.85rem; }
}

.mobile-menu-btn { 
    display: none; 
    background: transparent; 
    border: none; 
    font-size: 1.5rem; 
    color: var(--brand-text); 
    cursor: pointer; 
    padding: 5px; 
}

@media (max-width: 900px) {
    .main-nav { gap: 15px; }
    .mobile-menu-btn { display: block; order: -1; }

    .nav-links {
        display: none; 
        position: absolute; 
        top: 100%; 
        left: 0; 
        width: 100%;
        background-color: var(--white); 
        flex-direction: column; 
        align-items: center;
        padding: 20px 0; 
        box-shadow: 0 15px 30px rgba(0,0,0,0.1);
        border-top: 1px solid var(--border-light); 
        z-index: 998;
    }
    .nav-links.active { display: flex; animation: fadeInDown 0.3s ease; }
    .nav-link { width: 100%; text-align: center; padding: 15px; font-size: 1.2rem; border-bottom: 1px solid rgba(0,0,0,0.05); }
}

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


.product-grid .empty-state, 
.product-grid .loader {
    grid-column: 1 / -1; 
    width: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 60px 0; text-align: center; color: #888;
}

.empty-state i { font-size: 4rem; color: #ddd; margin-bottom: 15px; }
.empty-state h3 { font-size: 1.2rem; color: var(--brand-text); margin-bottom: 5px; }
.empty-state p { font-size: 0.95rem; color: #999; }

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    margin-bottom: 20px;
    width: 100%;
}

.page-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background-color: var(--white);
    color: var(--brand-text);
    border-radius: 8px; 
    cursor: pointer;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    background-color: #f4f6f8;
    border-color: #ccc;
    transform: translateY(-2px);
}

.page-btn.active {
    background-color: var(--primary); /* Naranja */
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(216, 125, 74, 0.3);
}

#modal-detalle-producto {
    display: none; 
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    
    background-color: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(5px);
    z-index: 10000; 
    justify-content: center !important;
    align-items: center !important;
    
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#modal-detalle-producto.active {
    display: flex !important; 
    opacity: 1;
}

.modal-producto-layout {
    background: var(--white, #ffffff);
    width: 100%;
    max-width: 600px;     
    max-height: 90vh;
    border-radius: 20px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    position: relative;
    
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#modal-detalle-producto.active .modal-producto-layout {
    transform: scale(1);
}

.close-btn-floating {
    position: absolute;
    top: 15px; right: 15px;
    background: #f4f4f4;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    z-index: 20;
    transition: 0.2s;
}
.close-btn-floating:hover { background: #ff4757; color: white; }

.producto-main-info {
    display: flex;
    gap: 20px;       
    padding: 25px;  
    align-items: flex-start; 
}

.detalle-img-container {
    flex: 0 0 40%;  
    background: #f8f8f8;
    border-radius: 15px;
    height: 200px;   
    display: flex; align-items: center; justify-content: center;
    padding: 10px;
}
.detalle-img-container img {
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain;
    mix-blend-mode: multiply;
}

.detalle-texto {
    flex: 1;
}

.badge-cat {
    background: var(--primary, #D87D4A);
    color: white; padding: 3px 10px; border-radius: 4px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    display: inline-block; margin-bottom: 8px;
}

.detalle-texto h2 {
    font-size: 1.4rem; 
    margin: 0 0 5px 0;
    color: var(--brand-text, #333);
    line-height: 1.2;
}

.detalle-texto h3 {
    font-size: 1.6rem; 
    color: var(--primary, #D87D4A);
    margin: 5px 0 12px 0;
    font-weight: 800;
}

.desc-texto {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.4;
    
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-modal-full {
    background: var(--primary, #D87D4A);
    color: white; border: none; width: 100%;
    padding: 10px; border-radius: 8px; font-weight: 600;
    cursor: pointer; transition: 0.2s;
    font-size: 0.9rem;
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-modal-full:hover { background: #c46c3b; transform: translateY(-2px); }

.producto-relacionados {
    background: #fafafa;
    padding: 15px 25px;
    border-top: 1px solid #eee;
}
.producto-relacionados h4 {
    font-size: 0.8rem; color: #999; margin: 0 0 10px 0; letter-spacing: 0.5px;
}

.grid-relacionados {
    display: flex; 
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}
.card-mini {
    min-width: 90px; max-width: 90px; /* Miniaturas reales */
    background: white; border: 1px solid #eee; border-radius: 10px;
    padding: 5px; cursor: pointer; text-align: center; transition: 0.2s;
}
.card-mini:hover { border-color: var(--primary); transform: translateY(-3px); }
.card-mini img { width: 100%; height: 50px; object-fit: contain; margin-bottom: 5px; }
.card-mini .mini-nombre { font-size: 0.7rem; color: #333; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-mini .mini-precio { font-size: 0.75rem; color: var(--primary); font-weight: 700; margin: 0; }


@media (max-width: 600px) {
    .modal-producto-layout {
        width: 90% !important; 
        border-radius: 15px;
    }

    .producto-main-info {
        flex-direction: column; 
        padding: 20px;
        gap: 15px;
        text-align: center;
    }
    
    .detalle-img-container {
        flex: unset; width: 100%; height: 160px; 
    }
    
    .detalle-texto { width: 100%; }
    
    .detalle-texto h2 { font-size: 1.2rem; }
    .detalle-texto h3 { font-size: 1.4rem; }
}

.relacionados-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.grid-relacionados {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 5px;
    width: 100%;
    
    justify-content: flex-start; 

    scrollbar-width: none;
}
.grid-relacionados::-webkit-scrollbar { display: none; }

.grid-relacionados.centered {
    justify-content: center;
}

.nav-arrow {
    background: white; border: 1px solid #eee; width: 35px; height: 35px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #555; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: 0.2s; z-index: 5; flex-shrink: 0;
    
    display: none; 
}
.nav-arrow:hover { background: var(--primary); color: white; border-color: var(--primary); }

.nav-arrow.prev { position: absolute; left: -15px; }
.nav-arrow.next { position: absolute; right: -15px; }

@media (max-width: 768px) {
    .nav-arrow { display: none !important; } 
}