/* Assassina o dropdown nativo do PrestaShop para sempre */
.ui-autocomplete,
.search-widget .dropdown-menu,
#search_widget .dropdown-menu,
.quickview-dropdown,
.js-search-results {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Contentor principal da Pesquisa Instantânea */
#coolmatica-instant-search {
    padding: 30px 15px;
    background: #fff;
    min-height: 50vh;
    animation: fadeIn 0.3s ease-in-out;
}

.coolmatica-grid-header h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 25px;
    font-weight: 600;
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 10px;
}

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

/* =========================================
   NOVO LAYOUT: BARRA LATERAL + 4 COLUNAS
   ========================================= */

.os-search-layout { 
    display: flex; 
    flex-wrap: wrap; 
    margin: 0 -10px; 
    width: 100%; 
}

/* Coluna Esquerda: Filtros */
.os-sidebar { 
    width: 25%; 
    padding: 0 10px; 
}

.os-filter-block { 
    background: #fff; 
    padding: 20px; 
    border-radius: 5px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    margin-bottom: 20px; 
    border: 1px solid #eaeaea; 
}

.os-filter-block h4 { 
    font-size: 1.1rem; 
    font-weight: 600; 
    margin-bottom: 15px; 
    border-bottom: 2px solid #f1f1f1; 
    padding-bottom: 10px; 
}

/* Coluna Direita: Resultados */
.os-content { 
    width: 75%; 
    padding: 0 10px; 
}

/* Força a grelha de produtos a comportar-se de forma perfeita com 4 colunas */
.os-products-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; 
    margin: 0; 
    padding: 0; 
}

.os-products-grid .product-miniature { 
    width: 100% !important; 
    max-width: 100% !important; 
    margin: 0 !important; 
}

.os-products-grid .thumbnail-container { 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
}

.os-products-grid .product-thumbnail { 
    flex-grow: 0; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 10px; 
}

.os-products-grid .product-description { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
}

/* Responsividade: Ajustar colunas para ecrãs mais pequenos */
@media (max-width: 1199px) { 
    .os-products-grid { grid-template-columns: repeat(3, 1fr); } 
}
@media (max-width: 991px) { 
    .os-content { width: 100%; } 
    .os-products-grid { grid-template-columns: repeat(3, 1fr); } 
}
@media (max-width: 767px) { 
    .os-products-grid { grid-template-columns: repeat(2, 1fr); } 
}
@media (max-width: 480px) { 
    .os-products-grid { grid-template-columns: repeat(1, 1fr); } 
}

/* =========================================
   FILTROS MOBILE: PAINEL OFF-CANVAS (GAVETA)
   ========================================= */

/* Botão "Filtros" e botão de fechar dentro do painel:
   escondidos por defeito (só aparecem em mobile) */
.os-mobile-filter-toggle,
.os-sidebar-close-row {
    display: none;
}

/* Overlay escurecido atrás da gaveta */
.os-filters-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}
.os-filters-overlay.show {
    display: block;
    opacity: 1;
}

@media (max-width: 991px) {
    .os-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        height: 100dvh;
        margin: 0;
        padding: 0;
        background: #fff;
        z-index: 1050;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-105%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.25);
    }

    .os-sidebar.os-sidebar--open {
        transform: translateX(0);
    }

    .os-sidebar .os-filter-block {
        margin-bottom: 0;
        border: none;
        box-shadow: none;
        border-radius: 0;
        padding: 15px;
    }

    /* Botão "Filtros" no cabeçalho dos resultados */
    .os-mobile-filter-toggle {
        display: inline-flex !important;
    }

    /* Botão "X" dentro da gaveta */
    .os-sidebar-close-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 15px 10px 15px;
        border-bottom: 2px solid #f1f1f1;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 2;
    }
}

html[data-theme="dark"] .os-sidebar, body.dark-theme .os-sidebar,
[data-bs-theme="dark"] .os-sidebar, .dark-mode .os-sidebar {
    background-color: #1e1e1e !important;
}
html[data-theme="dark"] .os-sidebar-close-row, body.dark-theme .os-sidebar-close-row,
[data-bs-theme="dark"] .os-sidebar-close-row, .dark-mode .os-sidebar-close-row {
    background-color: #1e1e1e !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}