/* Hogares Adulto Mayor - Estilos Frontend */

:root {
    --color-primary: #2c5aa0;
    --color-secondary: #f39c12;
    --color-success: #27ae60;
    --color-warning: #e74c3c;
    --color-light: #ecf0f1;
    --color-dark: #2c3e50;
    --color-border: #bdc3c7;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ========================================
   GENERAL
   ======================================== */
.hogares-alerta {
    background: linear-gradient(135deg, #f9f9f9, #efefef);
    border-left: 4px solid var(--color-warning);
    padding: 20px;
    border-radius: var(--radius);
    color: var(--color-dark);
    font-weight: 500;
    text-align: center;
}

/* ========================================
   BUSCADOR
   ======================================== */
.hogares-buscador-container {
    margin-bottom: 30px;
}

.hogares-search-box {
    margin-bottom: 25px;
}

.hogares-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.hogares-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.hogares-resultados {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* ========================================
   TARJETAS DE HOGAR (CARD)
   ======================================== */
.hogar-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.hogar-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hogar-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-dark));
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.hogar-nombre {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    flex: 1;
}

.hogar-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.hogar-status.disponible {
    background-color: var(--color-success);
    color: white;
}

.hogar-status.reservado {
    background-color: var(--color-warning);
    color: white;
}

.hogar-cupos {
    background: var(--color-light);
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    border-bottom: 1px solid var(--color-border);
}

.hogar-info {
    padding: 15px;
    flex: 1;
    border-bottom: 1px solid var(--color-border);
}

.hogar-info p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--color-dark);
    line-height: 1.5;
}

.hogar-info strong {
    color: var(--color-primary);
}

.hogar-mapa-pequeño {
    padding: 10px 15px;
    border-bottom: 1px solid var(--color-border);
}

.hogar-contacto {
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ========================================
   BOTONES
   ======================================== */
.boton-telefono,
.boton-correo,
.boton-mapa {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    gap: 5px;
}

.boton-telefono {
    background-color: var(--color-success);
    color: white;
}

.boton-telefono:hover {
    background-color: #229954;
    transform: scale(1.05);
}

.boton-correo {
    background-color: var(--color-primary);
    color: white;
}

.boton-correo:hover {
    background-color: #1e4070;
    transform: scale(1.05);
}

.boton-mapa {
    background-color: var(--color-secondary);
    color: white;
    grid-column: 1 / -1;
}

.boton-mapa:hover {
    background-color: #e67e22;
    transform: scale(1.05);
}

/* ========================================
   LISTADO POR COMUNA
   ======================================== */
.hogares-listado-container {
    margin-bottom: 40px;
}

.hogares-comuna-filter {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: flex-end;
}

@media (max-width: 768px) {
    .hogares-comuna-filter {
        grid-template-columns: 1fr;
    }
}

.hogares-select,
.hogares-buscar {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.hogares-select {
    cursor: pointer;
}

.hogares-buscar {
    font-family: inherit;
}

.hogares-buscar::placeholder {
    color: #9ca3af;
}

.hogares-select:focus,
.hogares-buscar:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.hogares-filtro-columna {
    display: flex;
    flex-direction: column;
}

.hogares-filtro-columna label {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 8px;
}

.hogares-comuna-section {
    margin-bottom: 40px;
    animation: fadeIn 0.3s ease;
}

.hogares-comuna-section.hidden {
    display: none;
}

.hogares-comuna-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #d3def2;
}

.hogares-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.hogar-card-expandible {
    padding: 0;
}

.hogar-vista-simple {
    padding: 14px 16px;
    transition: opacity 0.2s ease;
}

/* Ocultar vista simple cuando se expande el detalle */
.hogar-card-expandible:not(.is-collapsed) .hogar-vista-simple {
    display: none;
}

.hogar-simple-fila {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.hogar-simple-nombre {
    margin: 0;
    font-size: 18px;
    color: var(--color-primary);
}

.hogar-simple-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hogar-simple-cupos {
    margin: 0;
    font-size: 13px;
    color: #1f2937;
    white-space: nowrap;
}

.hogar-toggle-detalle {
    width: 34px;
    height: 34px;
    border: 1px solid #c7d2da;
    border-radius: 999px;
    background: #fff;
    color: #007096;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    transition: all .2s ease;
}

.hogar-toggle-detalle:hover,
.hogar-toggle-detalle.is-open {
    background: #007096;
    color: #fff;
    border-color: #007096;
}

.hogar-reservado-hrt {
    margin: 10px 0 8px;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff3cd;
    color: #7a4e00;
    font-size: 12px;
    font-weight: 600;
}

.hogar-simple-meta {
    margin: 6px 0;
    font-size: 14px;
    color: #374151;
}

.hogar-vista-detallada {
    border-top: 1px solid #e5e7eb;
}

.hogar-detalle-banner {
    padding: 16px;
    height: 150px;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
}

.hogar-detalle-banner-acciones {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
}

.hogar-banner-zoom,
.hogar-banner-cierre {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #007096;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.hogar-banner-zoom .material-icons,
.hogar-banner-cierre .material-icons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: inherit;
}

.hogar-banner-zoom:hover,
.hogar-banner-cierre:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.hogar-banner-cierre:active {
    transform: scale(0.95);
}

.hogar-detalle-titulo {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.hogar-detalle-responsable,
.hogar-detalle-cupos {
    margin: 6px 0 0;
    font-size: 14px;
}

.hogar-reservado-hrt-detalle {
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.hogar-detalle-cuerpo {
    padding: 16px;
}

.hogar-detalle-cuerpo p,
.hogar-detalle-cuerpo > p:first-child,
.hogar-detalle-cuerpo > p:nth-child(2) {
    margin: 0 0 10px;
    font-size: 14px;
}

.hogar-detalle-post-content {
    margin: 14px 0;
    padding: 12px;
    border-left: 3px solid #007096;
    background: #f8fafc;
    font-size: 14px;
}

.hogar-detalle-contacto-titulo {
    margin: 16px 0 10px;
    color: #007096;
    font-size: 16px;
}

.hogar-detalle-contacto-linea {
    margin-bottom: 8px;
    font-size: 14px;
    color: #374151;
}

.hogar-detalle-contacto-linea a {
    color: #005a79;
    text-decoration: underline;
}

.hogar-mapa-detalle {
    padding: 0;
    margin-top: 14px;
}

/* Modal para ampliar imagen */
.hogar-modal-imagen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hogar-modal-imagen.activo {
    display: flex;
}

.hogar-modal-contenido {
    position: relative;
    max-width: 90%;
    max-height: 85vh;
}

.hogar-modal-imagen img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.hogar-modal-cierre {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #007096;
    transition: all 0.2s ease;
    padding: 0;
}

.hogar-modal-cierre .material-icons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hogar-modal-cierre:hover {
    background: #fff;
    transform: scale(1.1);
}

.hogar-mapa-ver-mas {
    transition: all 0.2s ease;
}

.hogar-mapa-ver-mas:hover {
    background: #005a79 !important;
    transform: scale(1.1);
}

.hogar-mapa-ver-mas:active {
    transform: scale(0.95);
}

/* ========================================
   MAPA
   ======================================== */
.hogares-mapa-container {
    margin-bottom: 40px;
}

.hogares-mapa-filtros {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.hogares-mapa-google {
    width: 100%;
    height: 500px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #f5f5f5;
}

.hogares-mapa-seccion {
    margin-bottom: 30px;
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Estilos para Google Maps Info Window */
.gm-style-iw-t::after {
    display: none !important;
}

.gm-style-iw {
    max-width: 280px !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
}

.gm-style-iw-d {
    overflow-y: auto !important;
    max-height: 400px !important;
}

/* Botón X circular blanco - Solo en Google Maps Info Window */
.gm-style-iw-c .gm-ui-hover-effect {
    top: 6px !important;
    right: 6px !important;
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    overflow: visible !important;
    font-size: 0 !important;
    border: none !important;
    padding: 0 !important;
}

.gm-style-iw-c .gm-ui-hover-effect::after {
    content: "✕" !important;
    font-size: 12px !important;
    font-weight: bold !important;
    color: #007096 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}

.gm-style-iw-c .gm-ui-hover-effect img {
    display: none !important;
}

.gm-style-iw-c .gm-ui-hover-effect:hover,
.gm-style-iw-c .gm-ui-hover-effect:focus,
.gm-style-iw-c .gm-ui-hover-effect:active {
    background: none !important;
    box-shadow: none !important;
}

.gm-style-iw-c .gm-ui-hover-effect:hover {
    background: transparent !important;
    box-shadow: none !important;
}

#hogares-mapa-por-comuna {
    height: 400px;
    width: 100%;
    border-radius: 6px;
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .hogares-resultados,
    .hogares-grid {
        grid-template-columns: 1fr;
    }

    .hogar-simple-fila {
        flex-direction: column;
        align-items: stretch;
    }

    .hogar-simple-right {
        justify-content: space-between;
    }

    .hogar-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .hogar-nombre {
        font-size: 16px;
    }

    .hogar-status {
        align-self: flex-start;
    }

    .hogar-contacto {
        grid-template-columns: 1fr;
    }

    .boton-mapa {
        grid-column: 1;
    }

    .hogares-mapa-google {
        height: 400px;
    }

    .hogares-comuna-title {
        font-size: 22px;
    }

    .hogares-select {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .hogar-card {
        border-radius: 6px;
    }

    .hogar-info {
        padding: 12px;
    }

    .hogar-info p {
        font-size: 13px;
    }

    .hogares-input {
        padding: 12px;
        font-size: 14px;
    }

    .hogares-mapa-google {
        height: 300px;
    }
}

/* ========================================
   ACCESIBILIDAD
   ======================================== */
.hogares-card:focus-within {
    box-shadow: var(--shadow-lg);
    outline: 2px solid var(--color-primary);
    outline-offset: 0;
}

a.boton-telefono:focus,
a.boton-correo:focus,
a.boton-mapa:focus {
    outline: 2px solid var(--color-dark);
    outline-offset: 2px;
}
