/* General */

.search-container {
    margin-bottom: 20px;
    height: 100%;
    position: relative;
}

div#location-results {
    max-width: 360px;
    margin: auto;
}

.results-dropdown {
    position: absolute;
    background: white;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 10px;
    display: none; /* Se mostrará al enfocarse o escribir */
    width: max-content; /* Ocupa todo el ancho del contenedor padre */
    max-width: 615px; /* Máximo ancho en pantallas grandes */
    min-width: 320px; /* Ancho mínimo */
    box-sizing: border-box;
    top: calc(100% + 5px);
}

/* Botón */
#search-submit {
    color: #fff;
    background-color: #0049b1;
    transition: all .15s;
    cursor: pointer;
    background-position: center;
    display: none;
    border-radius: 0 .5rem .5rem 0;
    font-weight: 600;
    font-size: 1.13rem;
    padding: 0 1.87rem;
    display: flex;
    align-items: center;
    height: 100%;
    border: none;
}
#search-submit:hover {
    background-color: #1475ff;
}

/* Vista "default" */
.results-dropdown.default-view ul {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* Dos columnas */
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins';
    grid-auto-rows: min-content; /* Ajusta automáticamente la altura de las filas */
}

/* Estilos para títulos como "Recepciones" y "Proveedores" */
.results-dropdown ul li:has(strong) {
    grid-column: span 3; /* Ocupa ambas columnas */
    padding: 2px 5px;
    font-size: 16px;
    font-weight: 500; /* Fondo diferente para destacar */
    border: none;
    text-align: left;
}

/* Estilos para elementos en la vista "default" */
.results-dropdown.default-view li.result-item {
    display: flex
;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    transition: background-color 0.3s ease;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
    font-size: 14px;
    line-height: 16px;
}


.results-dropdown.default-view li.result-item:hover {
    background-color: #eaeaea;
    cursor: pointer;
}

/* Vista "search" */
.results-dropdown.search-view ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.results-dropdown.search-view li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
    border-radius: 5px;
}

.results-dropdown.search-view li:hover {
    background-color: #f9f9f9;
    cursor: pointer;
}

/* Ajuste de imagen en resultados */
.results-dropdown.search-view li img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 5px;
}

.results-dropdown.search-view li span {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sin resultados */
.search-no-results {
    text-align: center;
    font-size: 14px;
    color: #888;
    padding: 10px;
}

/* Efecto para el dropdown completo */
.results-dropdown ul {
    padding: 0;
    margin: 0;
}

.results-dropdown ul li {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    background: white;
}

div#location-results li {
    list-style: none;
    border-bottom: 1px solid #ddd;
    background: white;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    transition: background-color 0.3s ease;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 7px;
    font-family: 'Poppins';
    font-size: 14px;
    cursor: pointer;
}

div#location-results ul li:nth-child(-n + 1) {
    box-shadow: none;
    border: none;
    padding-top: 5px;
    padding-left: 1px;
    margin-bottom: 0px;
    cursor: default;
}

div#location-results ul li:nth-child(-n + 1):hover {
    background: none;
}


.results-dropdown ul li:hover, div#location-results li:hover{
    background: #eaeaea;
}

/* Ajustes para el contenedor del buscador */
div#custom-search-widget {
    display: grid;
    grid-template-columns: 1fr 250px auto;
    border-radius: .5rem;
    box-shadow: 0 2px 8px #00000026;
    grid-template-rows: auto;
    grid-row-gap: 0;
}

input#taxonomy-search, input#location-search {
    border: none;
    width: 100%;
    outline: none;
    font-size: 15px;
    height: 100%;
    text-overflow: ellipsis;
    border-right: 1px solid #d9d9d9;
    border-radius: 0px;
    font-family: Poppins;
    background: transparent;
}

.results-dropdown ul li:has(strong):hover {
    background: none;
}

/* Responsivo para columnas */
@media (max-width: 1024px) {
    .results-dropdown.default-view ul {
        grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columnas */
    }
    .results-dropdown ul li:has(strong) {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .results-dropdown.default-view ul {
        grid-template-columns: repeat(2, 1fr); /* Tablet pequeña */
    }
    .results-dropdown ul li:has(strong) {
        grid-column: span 2;
    }
    .results-dropdown {
        max-width: 100%; /* Ocupa todo el ancho disponible */
        left: 0; /* Asegura que no se desborde hacia los lados */
    }
    
    div#custom-search-widget {
        grid-template-columns: 1fr 160px auto;
    }
    
}

@media (max-width: 480px) {
    .results-dropdown.default-view ul {
        grid-template-columns: 1fr; /* Mobile: 1 columna */
    }
    
    .results-dropdown ul li:has(strong) {
        grid-column: span 1;
    }
    .results-dropdown {
        max-width: 100%; /* Ocupa el ancho completo del contenedor en móvil */
    }
    
    div#custom-search-widget {
        grid-template-columns: 1fr 120px auto;
    }
}
