:root {
    --bg: #f5f7fb;
    --text: #333;
    --muted: #667085;
    --card: #ffffff;
    --border: #e6e8ef;
    --green: #234b2e;
    --green-2: #2f6b3e;
    --green-soft: #e8f3ec;
    --pill: #eef1f6;
    --shadow: 0 6px 24px rgba(16, 24, 40, .08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

.container {
    max-width: 1200px;
}

.notice {
    background: #fff4e5;
    border: 1px solid #ffe3bf;
    color: #7a4d10;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.head {
    margin-bottom: 10px;
}

.title {
    margin: 0 0 6px 0;
    font-weight: 800;
    line-height: 1.2;
    font-size: clamp(22px, 3.2vw, 36px);
}

.meta-strip {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 6px 0 10px 0;
    color: var(--muted);
    font-weight: 600;
}

.meta {
    display: inline-flex;
    align-items: flex-end;
    gap: 6px;
    color: #535353;
    letter-spacing: -1px;
    font-size: 18px;
}

.badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 14px 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--pill);
    border: 1px solid var(--border);
    font-weight: 700;
}

.badge-green {
    background: var(--green-soft);
    border-color: #cfe7d7;
    color: var(--green-2);
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

@media (max-width: 980px) {
    .grid {
        display: block;
    }

    .col-right {
        order: 2
    }

    .col-left {
        order: 1
    }

    .container {
        margin: 0 20px;
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 16px;
    margin-top: 12px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.card h2 {
    margin: 0 0 6px 0;
    font-size: 20px;
    letter-spacing: -1px;
}

.title h2 {
    margin-top: 20px;
    letter-spacing: -2px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}


/* --- Grid principal responsivo --- */

.gallery-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    /* 3 columnas siempre */
    grid-auto-rows: 160px;
    /* misma altura de celda */
    grid-auto-flow: dense;
    /* rellena huecos */
    max-width: 100%;
}

.gallery-grid img {
    cursor: pointer;
}

#grid-ficha-propiedad .gallery-grid img {
    display: block;
    /* evita sumar ancho por espacios inline */
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    background: #f0f2f7;
}


/* spans del mosaico (idénticos en móvil y desktop) */

#grid-ficha-propiedad .gallery-grid img.main {
    grid-column: span 2;
    grid-row: span 2;
}

#grid-ficha-propiedad .gallery-grid img.wide {
    grid-column: span 2;
    grid-row: span 1;
}


/* ====== Slider de miniaturas ====== */

#grid-ficha-propiedad .thumbs-wrap {
    position: relative;
    margin-top: 10px;
    overflow: hidden;
}

#grid-ficha-propiedad .thumb-slider {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 44px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    background: var(--card);
    border-radius: 12px;
}

#grid-ficha-propiedad .thumb-slider img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    background: #f0f2f7;
    flex: 0 0 auto;
    scroll-snap-align: start;
    cursor: pointer;
}

.slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}

.slide-btn.left {
    left: 6px;
}

.slide-btn.right {
    right: 6px;
}

#default_content input.wpcf7-form-control.wpcf7-submit.has-spinner {
    appearance: none;
    border: solid 1px #5c5c4b !important;
    background: #5b5c4b !important;
    color: #fff !important;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer
}

#default_content input.wpcf7-form-control.wpcf7-submit.has-spinner:hover {
    background: white !important;
    color: #5b5c4b !important;
}


/* ====== Slider de miniaturas (ya lo tenías) ====== */

.thumbs-wrap {
    position: relative;
    margin-top: 10px
}

.thumb-slider {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 44px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 12px
}

.thumb-slider img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    background: #f0f2f7;
    border: 1px solid var(--border);
    flex: 0 0 auto;
    scroll-snap-align: start;
    cursor: pointer
}

.slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}

.slide-btn.left {
    left: 6px
}

.slide-btn.right {
    right: 6px
}


/* Panel derecho */

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.panel-head {
    background-color: #5b5c4a;
    padding: 12px 16px;
}

#grid-ficha-propiedad .panel-head h3 {
    margin: 0;
    font-size: 18px !important;
    color: #fff !important;
}

.panel-body {
    padding: 10px 14px;
}

.deflist {
    margin: 0;
}

.deflist .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.deflist .row:last-child {
    border-bottom: 0;
}

.deflist dt {
    font-weight: 600;
    color: #2f3a4b;
}

.deflist dd {
    margin: 0;
    text-align: right;
}

.updated {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}


/* Pills / botones */

.pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--pill);
    border: 1px solid var(--border);
    font-weight: 600;
}

.pill.small {
    padding: 4px 8px;
    font-size: 12px;
}


/* Video responsivo */

.video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-top: 8px;
}

.video iframe {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}


/* Back + precio */

.backlink {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    gap: 16px;
}

.btn-back {
    text-decoration: none;
    background: #eef2ff;
    border: 1px solid #d6dbff;
    color: #21306a;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
}

.price-inline {
    display: flex;
    gap: 8px;
    font-weight: 800;
    color: #208348;
    font-size: 40px;
    align-content: flex-end;
    line-height: 100%;
    align-items: flex-end;
}


/* Modal de galería */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .84);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.open {
    display: flex;
}

.modal img {
    max-width: 92vw;
    max-height: 84vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.modal .close,
.modal .prev,
.modal .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #000a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 999px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px;
    user-select: none;
}

.modal .close {
    top: 6%;
    right: 4%;
    transform: none;
}

.modal .prev {
    left: 3%;
}

.modal .next {
    right: 3%;
}

dl.deflist .row::before {
    display: none;
}

input.wpcf7-form-control.wpcf7-email.wpcf7-validates-as-required.wpcf7-text.wpcf7-validates-as-email {
    border: 1px solid #aaaaaa !important;
}

.meta {
    color: #5b5c4a;
}

.meta a {
    color: #5b5c4a;
}

.meta.print-button-wrap {
    font-weight: normal;
}

.meta i {
    color: #5b5c4a;
}

.page-template-template-ficha i.fa-brands.fa-whatsapp {
    color: #5b5c4a;
    font-size: 27px;
}

.meta.whats i {
    position: relative;
    top: 5px;
}


/* =======================================================
   ESTILOS PARA BOTÓN DE COPIAR Y TOOLTIPS
   ======================================================= */


/* Tooltip para Desktop */

.meta.copy a {
    color: #535353;
}

.meta.copy {
    font-size: 16px;
    font-weight: normal;
}

.copy-tooltip {
    position: absolute;
    margin-left: 10px;
    padding: 2px 10px;
    font-weight: normal;
    background: rgb(0 0 0 / 80%);
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    z-index: 100;
    transform: translateY(30px);
}


/* Contenedor del botón para posicionar el tooltip */

.actions-strip .meta {
    position: relative;
    /* Es importante que el padre sea relativo para que el tooltip se posicione correctamente */
}


/* Clase para mostrar el tooltip en Desktop */

.copy-tooltip.show {
    opacity: 1;
}


/* Mensaje flotante para Móvil (Toast) */

.mobile-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 8px;
    font-size: 16px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-toast.show {
    opacity: 1;
    visibility: visible;
}


/* Ocultar elementos según el dispositivo */

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 980px) {

    /* Ocultar el tooltip de desktop en móvil */
    .desktop-only {
        display: none !important;
    }

    /* El toast móvil ya se mostrará por defecto en móvil */
}

@media (min-width: 981px) {

    /* Ocultar el toast móvil en desktop */
    .mobile-toast {
        display: none !important;
    }

    .mobile-only {
        display: block;
    }
}


/* =======================================================
   ESTILOS ESPECÍFICOS PARA VISTA DE IMPRESIÓN (@media print)
   ======================================================= */

@media print {

    /* 1. Ocultar elementos que no deben imprimirse */
    .head .actions-strip,
    /* Botón de WhatsApp */
    .backlink,
    /* Botón de volver */
    .thumbs-wrap,
    /* Slider de miniaturas */
    .slide-btn,
    /* Botones del slider */
    .modal,
    /* Modal de imágenes */
    .notice,
    /* Avisos de rate limit */
    .gallery-grid {
        /* <<-- PETICIÓN: Ocultar toda la galería -->> */
        display: none !important;
    }

    /* 2. Configurar la página impresa */
    @page {
        size: A4;
        margin: 1cm;
    }

    header#top,
    .whats,
    .badges,
    #default_content,
    .backlink,
    .nectar_hook_global_section_footer {
        display: none;
    }

    #header-space {
        height: 34px !important;
    }

    .pill {
        font-size: 12px;
        font-weight: normal;
    }

    .deflist .row {
        gap: 0px;
        padding: 2px 0;
    }

    .col-right {
        margin-top: 100px !important;
    }

    .panel {
        background: none !important;
        border: 0 !important;
        border-radius: 0 !important;
        border-color: white !important;
        box-shadow: none !important;
    }

    .card {
        box-shadow: none !important;
    }

    .panel-head {
        display: none !important;
        border: 0 !important;
        background: none !important;
        background-color: white !important;
        color: black !important;
        padding-bottom: 0 !important;
    }

    .panel-body {
        padding-top: 60px;
    }

    #grid-ficha-propiedad .panel-head h3 {
        margin: 50px !important;
        font-size: 18px !important;
        color: black !important;
    }

    /* 3. Forzar el diseño de columna simple (similar a la vista móvil) */
    .container {
        /* Quita el margen que se aplica en la media query móvil */
        margin: 0 !important;
    }

    .grid {
        /* Desactiva el grid y fuerza el diseño de bloque */
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 4. Asegurar que las columnas ocupen el ancho completo */
    .col-left,
    .col-right {
        width: 100% !important;
        flex-basis: 100% !important;
        max-width: 100% !important;
        /* Limpiamos padding/margin si los hubiera */
        padding: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* 5. Estilos para elementos de contenido */
    body {
        /* Fuerza colores para impresión */
        color: #000 !important;
        background-color: #fff !important;
    }

    /* Asegurar que los enlaces muestren su URL */
    a:after {
        content: " ("attr(href) ") ";
        word-break: break-all;
        font-size: 90%;
    }

    /* Eliminar la línea de puntos en la lista de detalles */
    .deflist .row {
        border-bottom: 1px solid #ccc !important;
    }

    .deflist .row:last-child {
        border-bottom: 0 !important;
    }
}