/* =============================================
   Mapa clínicas HeySmile — Responsive styles
   ============================================= */

#search-container {
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

#search-input {
    flex: 1;
    min-width: 140px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 14px;
}

#search-button,
#reset-button {
    padding: 10px 16px;
    background-color: #0078d4;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
}

#search-button:hover,
#reset-button:hover {
    background-color: #005a9e;
}

/* ── Layout principal ── */
#container {
    display: flex;
    width: 100%;
    /* Sin altura fija: se adapta al contenido/iframe */
}

#results {
    width: 300px;
    min-width: 220px;
    /* Altura relativa al viewport para funcionar bien en iframes */
    height: calc(100vh - 120px);
    max-height: 700px;
    min-height: 300px;
    overflow-y: auto;
    border-right: 1px solid #ccc;
    padding: 10px;
    background-color: #f9f9f9;
    box-sizing: border-box;
    flex-shrink: 0;
}

#map {
    flex: 1;
    height: calc(100vh - 120px);
    max-height: 700px;
    min-height: 300px;
}

/* ── Tarjetas de resultado ── */
#results .elementor-widget-icon-box {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    cursor: pointer;
}

#results .elementor-widget-icon-box:hover {
    background-color: #e9e9e9;
}

/* ── Popup ── */
.popup-content {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    max-width: 260px;
}

.popup-content h3 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #333;
}

.popup-content p {
    margin: 4px 0;
    font-size: 13px;
    color: #555;
}

/* ── Mensajes de estado ── */
.no-results {
    display: block;
    color: #cc0000;
    font-weight: bold;
    margin: 20px 0;
    text-align: center;
}

.error-message {
    color: #cc0000;
    font-weight: bold;
    margin: 20px 0;
    text-align: center;
}

/* ── Tablet: ≤ 900px ── */
@media (max-width: 900px) {
    #results {
        width: 240px;
    }
}

/* ── Móvil: ≤ 650px — apilar verticalmente ── */
@media (max-width: 650px) {
    #container {
        flex-direction: column;
    }

    /* El mapa arriba, la lista debajo */
    #map {
        order: 1;
        width: 100%;
        height: 55vw;          /* proporcional al ancho de pantalla */
        min-height: 240px;
        max-height: 400px;
    }

    #results {
        order: 2;
        width: 100%;
        height: auto;
        max-height: 45vh;
        min-height: 160px;
        border-right: none;
        border-top: 1px solid #ccc;
    }

    #search-container {
        flex-direction: column;
        align-items: stretch;
    }

    #search-input {
        width: 100%;
    }

    #search-button,
    #reset-button {
        width: 100%;
        text-align: center;
    }
}

/* ── Pantallas muy pequeñas: ≤ 380px ── */
@media (max-width: 380px) {
    #map {
        height: 220px;
    }

    .popup-content {
        max-width: 200px;
        font-size: 12px;
    }
}
