/* PÁGINA POR PROPIEDAD */

.detalle-propiedad {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

/* GALERÍA */
.detalle-topbar {
    max-width: 1000px;
    margin: 0 auto 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.breadcrumb--detalle {
    max-width: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 280px;
}

.galeria-propiedad {
    max-width: 1000px;
    margin: 0 auto 40px;
}

.detalle-acciones-galeria {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.accion-detalle-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #111;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.accion-detalle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    background: #fafafa;
}

.accion-detalle-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    flex-shrink: 0;
}

.accion-detalle-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.galeria-main {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 0;
}

.galeria-collage {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(240px, 0.9fr);
    gap: 10px;
    height: clamp(340px, 42vw, 520px);
}

.media-principal {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.media-wrap-imagen,
.media-wrap-video {
    width: 100%;
    height: 100%;
}

.media-wrap-imagen {
    overflow: hidden;
    cursor: pointer;
    background: #e5e7eb;
}

.media-wrap-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-wrap-video iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.galeria-side-preview {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    height: 100%;
    min-height: 0;
}

.galeria-side-preview.una-preview {
    grid-template-rows: 1fr;
}

.galeria-side-preview.sin-previews {
    display: none;
}

.side-preview-item {
    position: relative;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    overflow: hidden;
    border-radius: 0;
    background: #e5e7eb;
    min-height: 0;
    height: 100%;
}

.side-preview-item.oculto {
    display: none;
}

.side-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.side-preview-item:hover img {
    transform: scale(1.03);
}

.side-preview-item.es-video::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
}

.side-preview-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    pointer-events: none;
}

.galeria-flecha {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: rgba(17, 17, 17, 0.72);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s ease, transform 0.2s ease;
}

.galeria-flecha:hover {
    background: rgba(17, 17, 17, 0.9);
}

.galeria-prev {
    left: 16px;
}

.galeria-next {
    right: 16px;
}

.galeria-contador {
    position: absolute;
    right: 16px;
    bottom: 16px;
    background: rgba(17, 17, 17, 0.75);
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    z-index: 3;
}

.galeria-thumbs {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.galeria-thumbs::-webkit-scrollbar {
    height: 8px;
}

.galeria-thumbs::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}

.thumb-item {
    position: relative;
    border: 2px solid transparent;
    background: #fff;
    border-radius: 10px;
    padding: 0;
    cursor: pointer;
    flex: 0 0 110px;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.thumb-item:hover {
    transform: translateY(-2px);
}

.thumb-item.activa {
    border-color: #f5c400;
}

.thumb-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.thumb-item[data-tipo="video"]::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.22);
}

.thumb-play-icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 20px;
    z-index: 2;
    pointer-events: none;
}

/* MODAL FULLSCREEN */
body.modal-open {
    overflow: hidden;
}

.modal-galeria {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 30px;
}

.modal-galeria.activo {
    display: flex;
}

.modal-galeria-contenido {
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-galeria-contenido img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.modal-galeria-cerrar {
    position: absolute;
    top: 18px;
    right: 24px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 34px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
}

.modal-galeria-flecha {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.modal-galeria-prev {
    left: 24px;
}

.modal-galeria-next {
    right: 24px;
}

.modal-galeria-contador {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

/* INFO GENERAL */
.info-detalle {
    max-width: 1000px;
    margin: 0 auto;
}

.detalle-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 15px;
    align-items: start;
}

.detalle-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.detalle-direccion {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.25;
    color: #111;
    margin: 0;
}

.detalle-maps-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 15px;
    color: #444;
    text-decoration: underline;
}

.detalle-maps-link:hover {
    color: #000;
}

.detalle-precio {
    font-size: 22px;
    font-weight: 800;
    color: #111;
    white-space: nowrap;
}

/* PRINCIPALES */
.detalle-principales {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.principal-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f7f7f7;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #333;
    font-weight: 600;
}

.principal-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    color: #444;
    flex-shrink: 0;
}

.principal-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* DESCRIPCIÓN */
.detalle-descripcion {
    margin-bottom: 34px;
}

.detalle-descripcion h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #111;
}

.detalle-descripcion p {
    margin: 0;
    line-height: 1.7;
    color: #444;
    font-size: 15px;
}

/* BLOQUES */
.bloque-detalle {
    margin-bottom: 34px;
}

.bloque-detalle h3 {
    margin: 0 0 14px;
    font-size: 18px;
    color: #111;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 8px;
}

.grid-detalle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.grid-detalle div {
    background: #fafafa;
    border: 1px solid #ededed;
    border-radius: 8px;
    padding: 11px 12px;
    line-height: 1.5;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

/* CONTACTO */
.detalle-contacto {
    background: #f8f8f8;
    border: 1px solid #ececec;
    padding: 20px;
    border-radius: 12px;
    height: fit-content;
    position: sticky;
    top: 20px;
    text-align: center;
}

.detalle-contacto p {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.6;
    color: #444;
    text-align: center;
}

.btn-whatsapp-detalle,
.btn-volver-propiedades {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-whatsapp-detalle {
    background: #25d366;
    color: #fff;
}

.btn-volver-propiedades {
    background: #111;
    color: #fff;
    margin-top: 12px;
}

.btn-whatsapp-detalle:hover,
.btn-volver-propiedades:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

/* NO DISPONIBLE */
.propiedad-no-disponible {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.no-disponible-box {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 30px;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 14px;
    text-align: center;
}

.no-disponible-box h1 {
    font-size: 30px;
    margin: 0 0 14px;
    color: #111;
}

.no-disponible-box p {
    color: #555;
    line-height: 1.7;
    margin: 0 0 24px;
}

.no-disponible-acciones {
    max-width: 320px;
    margin: 0 auto;
}

/* TOAST */
.share-toast {
    position: fixed;
    right: 24px;
    bottom: 98px;
    background: #111;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1001;
}

.share-toast.activo {
    opacity: 1;
    transform: translateY(0);
}

/* PRINT FICHA */
.print-ficha {
    display: none;
}

.print-page {
    break-after: page;
    page-break-after: always;
}

.print-page:last-of-type {
    page-break-after: auto;
    break-after: auto;
}

.print-meta-line {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 11px;
    color: #444;
    margin-bottom: 10px;
}

.print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 12px;
}

.print-head h1 {
    font-size: 24px;
    line-height: 1.15;
    margin: 0 0 4px;
}

.print-head p {
    margin: 0;
    font-size: 14px;
    color: #444;
}

.print-precio {
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
}

.print-galeria-top {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.print-galeria-top__principal {
    height: 250px;
    overflow: hidden;
}

.print-galeria-top__secundarias {
    display: grid;
    gap: 8px;
    align-content: start;
}

.print-galeria-top__secundarias--dos {
    grid-template-columns: 1fr;
}

.print-thumb-top {
    height: 121px;
    overflow: hidden;
}

.print-thumb-top img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.print-resumen-linea {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #f4f4f4;
    border: 1px solid #e5e5e5;
}

.print-resumen-linea div {
    font-size: 14px;
}

.print-resumen-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.print-resumen-grid div {
    border: 1px solid #e5e5e5;
    background: #fafafa;
    padding: 10px 12px;
    min-height: 60px;
}

.print-resumen-grid strong {
    display: block;
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
}

.print-resumen-grid span {
    font-size: 14px;
    font-weight: 700;
    color: #111;
}

.print-bloque {
    margin-top: 16px;
}

.print-bloque h2 {
    font-size: 18px;
    margin: 0 0 8px;
}

.print-bloque p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #222;
}

.print-galeria-completa {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
    break-inside: auto;
    page-break-inside: auto;
}

.print-galeria-continuacion {
    margin-top: 14px;
    break-before: page;
    page-break-before: always;
}

.print-galeria-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    break-inside: avoid;
    page-break-inside: avoid;
}

.print-galeria-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/*RESPONSIVE*/

@media (max-width: 992px) {
    .detalle-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .detalle-contacto {
        position: static;
    }
}

@media (max-width: 900px) {
    .galeria-collage {
        grid-template-columns: 1fr;
        height: auto;
    }

    .media-principal {
        height: 380px;
    }

    .galeria-side-preview {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: none;
        height: 180px;
    }

    .galeria-side-preview.una-preview {
        grid-template-columns: 1fr;
    }

    .side-preview-item {
        height: 180px;
        border-radius: 0;
    }
}

@media (max-width: 768px) {
    .detalle-propiedad {
        padding: 16px 12px 28px;
        overflow-x: hidden;
    }

    .detalle-topbar,
    .galeria-propiedad,
    .info-detalle,
    .detalle-grid,
    .detalle-top,
    .detalle-descripcion,
    .bloque-detalle,
    .detalle-contacto {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .breadcrumb--detalle {
        min-width: 0;
        font-size: 12px;
        line-height: 1.4;
    }

    .detalle-topbar {
        gap: 10px;
        margin-bottom: 12px;
    }

    .detalle-acciones-galeria {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .accion-detalle-btn {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .accion-detalle-icon {
        width: 15px;
        height: 15px;
    }

    .galeria-propiedad {
        margin-bottom: 22px;
    }

    .galeria-main {
        border-radius: 10px;
        width: 100%;
        max-width: 100%;
    }

    .media-principal {
        width: 100%;
        max-width: 100%;
        height: 280px;
    }

    .media-wrap-imagen,
    .media-wrap-video,
    .media-wrap-imagen img,
    .media-wrap-video iframe {
        width: 100%;
        max-width: 100%;
        height: 100%;
    }

    .galeria-flecha {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .galeria-prev {
        left: 8px;
    }

    .galeria-next {
        right: 8px;
    }

    .galeria-contador {
        right: 10px;
        bottom: 10px;
        padding: 5px 9px;
        font-size: 11px;
    }

    .galeria-thumbs {
        gap: 6px;
        margin-top: 10px;
        padding-bottom: 4px;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
    }

    .thumb-item {
        flex: 0 0 72px;
        border-radius: 8px;
        scroll-snap-align: center;
    }

    .thumb-item img {
        height: 52px;
    }

    .detalle-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 18px;
    }

    .detalle-direccion {
        font-size: 18px;
        line-height: 1.25;
        word-break: break-word;
    }

    .detalle-precio {
        font-size: 18px;
        white-space: normal;
    }

    .detalle-maps-link {
        font-size: 13px;
        margin-top: 6px;
    }

    .detalle-principales {
        gap: 8px;
        margin-bottom: 18px;
    }

    .principal-item {
        padding: 6px 9px;
        font-size: 11px;
    }

    .principal-icon {
        width: 14px;
        height: 14px;
    }

    .detalle-descripcion {
        margin-bottom: 24px;
    }

    .detalle-descripcion h2,
    .bloque-detalle h3 {
        font-size: 16px;
    }

    .detalle-descripcion p {
        font-size: 14px;
        line-height: 1.6;
        overflow-wrap: anywhere;
    }

    .bloque-detalle {
        margin-bottom: 24px;
    }

    .grid-detalle {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .grid-detalle div {
        padding: 9px 10px;
        font-size: 13px;
        overflow-wrap: anywhere;
    }

    .detalle-contacto {
        padding: 16px 14px;
        border-radius: 10px;
    }

    .detalle-contacto p {
        font-size: 13px;
        margin-bottom: 12px;
        overflow-wrap: anywhere;
    }

    .btn-whatsapp-detalle,
    .btn-volver-propiedades {
        min-height: 42px;
        font-size: 13px;
    }

    .share-toast {
        right: 12px;
        bottom: 78px;
        font-size: 12px;
        padding: 10px 12px;
    }

    .modal-galeria {
        padding: 12px;
    }

    .modal-galeria-cerrar {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 26px;
    }

    .modal-galeria-flecha {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .modal-galeria-prev {
        left: 8px;
    }

    .modal-galeria-next {
        right: 8px;
    }

    .modal-galeria-contador {
        bottom: 14px;
        font-size: 12px;
        padding: 6px 10px;
    }
}

@media (max-width: 640px) {
    .media-principal {
        height: 250px;
    }

    .galeria-side-preview {
        display: none;
    }

    .galeria-flecha {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .galeria-prev {
        left: 8px;
    }

    .galeria-next {
        right: 8px;
    }

    .galeria-contador {
        right: 10px;
        bottom: 10px;
        padding: 5px 9px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .detalle-propiedad {
        padding: 14px 10px 24px;
    }

    .detalle-direccion,
    .detalle-precio {
        font-size: 17px;
    }

    .accion-detalle-btn {
        width: 100%;
        justify-content: center;
    }

    .thumb-item {
        flex: 0 0 68px;
    }

    .thumb-item img {
        height: 48px;
    }
}

/* IMPRESIÓN */
@page {
    size: A4 portrait;
    margin: 12mm;
}

@media print {
    html, body {
        background: #fff !important;
    }

    body {
        display: block !important;
    }

    .header,
    .footer,
    .whatsapp-float,
    .no-print,
    .info-detalle,
    .breadcrumb,
    .galeria-propiedad,
    .detalle-topbar {
        display: none !important;
    }

    .detalle-propiedad {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-ficha {
        display: block !important;
    }

    .print-page {
        page-break-after: always;
        break-after: page;
    }

    .print-page:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    .print-head h1,
    .print-precio,
    .print-bloque h2,
    .print-resumen-linea,
    .print-resumen-grid,
    .print-bloque,
    .print-galeria-top{
        break-inside: avoid;
        page-break-inside: avoid;
    }
}