/* =============================================================================
   Krool 2.0 — Fixes responsive y de layout.
   Carga DESPUÉS de style.css. Sobrescribe reglas del template original.
   ========================================================================== */

/* -------------------------------------------------------------------------
 *  1) Overflow horizontal cero. El template usa .row de Bootstrap con
 *     margin negativo y en algunos puntos el contenedor padre no lo compensa,
 *     cortando el contenido por la izquierda. Red de seguridad global.
 * ----------------------------------------------------------------------- */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
}

/* Imágenes, iframes y videos nunca más anchos que el contenedor */
img, iframe, video, embed, object {
    max-width: 100% !important;
}

/* Palabras largas (URLs, emails) no rompen el layout */
p, h1, h2, h3, h4, h5, h6, span, a, li, td {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* -------------------------------------------------------------------------
 *  2) Wrapper responsive del detalle. Estaba con padding:10px en mobile,
 *     que es menor que el margin negativo del .row (-12px) → desborde.
 *     Subimos a 15px en mobile para compensar.
 * ----------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .property-section > div[style*="padding-left:10px"],
    .property-section > div[style*="padding-left: 10px"] {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* -------------------------------------------------------------------------
 *  3) HOME — Hero. El template usa dos <div> con position:absolute
 *     (top:38% para el H1 y top:55% para el buscador). En mobile se
 *     superponen porque la altura del hero no alcanza para separarlos.
 *     En mobile los sacamos del flujo absoluto y los apilamos.
 * ----------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .hero-section .hero-item {
        min-height: 520px !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        padding: 2.5rem 1rem;
        margin-top: 70px;
    }

    /* El slideshow queda de fondo real, no empujando al contenido */
    .hero-section .kenburns-slideshow {
        position: absolute !important;
        inset: 0;
        z-index: 0;
        margin: 0;
        padding: 0;
        list-style: none;
    }
    .hero-section .kenburns-slideshow li,
    .hero-section .kenburns-slideshow img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
    }
    .hero-section .kenburns-slideshow::after {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
    }

    /* El H1 y el buscador: estáticos, apilados, legibles */
    .hero-section .hero-item > div[style*="position:absolute"],
    .hero-section .hero-item > div[style*="position: absolute"] {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: 2;
    }
    .hero-section h1 {
        color: #fff !important;
        font-size: 1.75rem !important;
        line-height: 1.2;
        margin: 0 0 1.5rem !important;
        text-align: center;
    }
    .hero-section .property-search {
        background: rgba(0, 0, 0, 0.35);
        padding: 1rem;
        border-radius: 8px;
    }
    .hero-section form > div,
    .hero-section .col-md-3 {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-bottom: 0.75rem !important;
    }
    .hero-section .nice-select,
    .hero-section select,
    .hero-section button {
        width: 100% !important;
    }
    .hero-section button {
        padding: 0.75rem 1rem !important;
        font-weight: 600;
    }
}

/* -------------------------------------------------------------------------
 *  4) Property cards (listado + destacados). El template tenía height:120px
 *     fijo en .content > .left, que en mobile apretaba el título + dirección
 *     y en desktop lo hacía chocar con el precio cuando el título era largo.
 * ----------------------------------------------------------------------- */
.property-item .content {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.property-item .content .left,
.property-item .content .right {
    height: auto !important;
}
.property-item .content .left { flex: 1 1 60%; min-width: 0; }
.property-item .content .right { flex: 0 1 40%; text-align: right; }
.property-item .content .title {
    font-size: 1rem;
    line-height: 1.3;
    margin: 0 0 0.3rem;
    word-break: break-word;
}
.property-item .content .location {
    display: block;
    font-size: 0.875rem;
    color: #555;
}
.property-item .content .price h4 {
    font-size: 1.05rem;
    margin: 0 0 0.5rem;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .property-item .content { flex-direction: column; gap: 0.4rem; }
    .property-item .content .left,
    .property-item .content .right { flex: 1 1 auto; text-align: left; width: 100%; }
    .property-item .content .right .type-wrap {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex-wrap: wrap;
    }
}

/* -------------------------------------------------------------------------
 *  5) DETALLE — cabecera (.head) y características.
 *     - .head usa .left + .right floats que se encastran en mobile.
 *     - Las "col-md-3" de características no cambian a col-12 en mobile,
 *       quedan 4 columnas apretadas.
 * ----------------------------------------------------------------------- */
.single-property .head {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-start;
}
.single-property .head .left { flex: 1 1 60%; min-width: 0; }
.single-property .head .right { flex: 0 1 auto; text-align: right; }
.single-property .head .title {
    font-size: 1.5rem;
    line-height: 1.25;
    margin: 0.5rem 0;
    word-break: break-word;
}
.single-property .head .location {
    display: block;
    font-size: 0.95rem;
    color: #555;
}
.single-property .head .type-wrap { display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-end; }
.single-property .head .type-wrap .price { font-size: 1.25rem; font-weight: 700; color: #03008a; }
.single-property .head .type-wrap .type { font-size: 0.85rem; text-transform: uppercase; color: #777; }

@media (max-width: 575.98px) {
    .single-property .head { flex-direction: column; }
    .single-property .head .right { text-align: left; }
    .single-property .head .type-wrap { align-items: flex-start; }
    .single-property .head .title { font-size: 1.25rem; }
}

/* Características (los "image; col-md-3") en mobile y tablet pasan a 2 col */
@media (max-width: 767.98px) {
    .single-property .content .row > [class*="col-md-"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0.4rem 0.6rem !important;
        box-sizing: border-box;
    }
}
@media (max-width: 400px) {
    .single-property .content .row > [class*="col-md-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* -------------------------------------------------------------------------
 *  6) Descripción — tipografía legible, respeta <br> del CMS
 * ----------------------------------------------------------------------- */
.single-property .content p {
    font-size: 1rem;
    line-height: 1.65;
    color: #333;
}
.single-property .content h3 {
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #222;
}

/* -------------------------------------------------------------------------
 *  7) Sidebar contacto (iframe GVAMAX Labs). Mantener accesible en mobile.
 * ----------------------------------------------------------------------- */
.sidebar iframe {
    width: 100% !important;
    max-width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

/* -------------------------------------------------------------------------
 *  8) Galería (carousel fullscreen). Botones y controles accesibles.
 * ----------------------------------------------------------------------- */
#myCarousel { min-height: 300px; }
#myCarousel .carousel-inner .item .fill { height: 100vh; }
@media (max-width: 575.98px) {
    #myCarousel .carousel-inner .item .fill { height: 60vh; }
}

/* -------------------------------------------------------------------------
 *  9) Footer — dar aire, respetar ancho en mobile
 * ----------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    footer .container, .footer .container { padding-left: 1rem; padding-right: 1rem; }
    footer .row > div, .footer .row > div { margin-bottom: 1.25rem; }
}

/* -------------------------------------------------------------------------
 *  10) Navbar — el logo y el menú compiten por espacio en tablet
 * ----------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .header .main-menu ul { flex-wrap: wrap; justify-content: center; }
    .header img { max-height: 60px; width: auto !important; }
}

/* -------------------------------------------------------------------------
 *  11) Botón flotante de WhatsApp — que no tape contenido importante
 * ----------------------------------------------------------------------- */
.div-flotante, .div-flotante-mobile {
    z-index: 999;
}
@media (max-width: 575.98px) {
    .div-flotante, .div-flotante-mobile {
        top: auto !important;
        bottom: 1rem !important;
        left: auto !important;
        right: 1rem !important;
    }
}
