/* 
 * Estilos mejorados del modal de propiedades
 * Con responsividad completa para todos los dispositivos
 */

 :root {
    --primary: #00574c;
    --primary-light: #006755;
    --primary-dark: #003d35;
    --gold: #c5a572;
    --gold-light: #e0c48f;
    --text-dark: #333333;
    --text-light: #ffffff;
    --text-secondary: #666666;
    --bg-light: #ffffff;
    --bg-gray: #f9f9f9;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.16);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease;
    
    /* Breakpoints */
    --breakpoint-xs: 320px;  /* Teléfonos pequeños como iPhone SE */
    --breakpoint-sm: 576px;  /* Smartphones en modo vertical */
    --breakpoint-md: 768px;  /* Tablets y smartphones en modo horizontal */
    --breakpoint-lg: 992px;  /* Laptops y tablets grandes */
    --breakpoint-xl: 1200px; /* Pantallas de escritorio */
}

/* Base del Modal con mejor rendimiento y adaptabilidad */
.modal-property {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--transition-fast);
    will-change: opacity;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.modal-property::-webkit-scrollbar {
    display: none;
}

.modal-property.show {
    display: block;
    opacity: 1;
}

.modal-property .modal-dialog {
    position: relative;
    width: 100%; /* Fullscreen en móviles */
    height: 100%;
    margin: 0; /* Sin margen en móviles */
    background: var(--bg-light);
    border-radius: 0; /* Sin bordes redondeados en móviles */
    overflow: hidden;
    transform: translateY(0); /* Sin animación de entrada en móviles */
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: none; /* Sin sombra en móviles */
    border: none;
    will-change: transform, opacity;
}

/* Ajustes para tablets y desktop */
@media (min-width: 768px) {
    .modal-property .modal-dialog {
        width: 95%;
        max-width: 1200px;
        height: auto;
        min-height: 80vh;
        max-height: 90vh;
        margin: 2rem auto;
        border-radius: var(--border-radius-lg);
        transform: translateY(-20px);
        box-shadow: var(--shadow-lg);
        border: 1px solid #f1f1f1;
    }
}

.modal-property.show .modal-dialog {
    transform: translateY(0);
    opacity: 1;
}

.modal-property .modal-content {
    height: 100%;
    border: none;
    border-radius: 0;
    position: relative;
}

/* Botón de Cerrar optimizado para táctil */
.close-modal {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    color: #fff;
    cursor: pointer;
    z-index: 200;
    width: 40px; /* Más grande para mejor toque en móviles */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: none;
    will-change: transform;
}

@media (min-width: 768px) {
    .close-modal {
        right: 1.25rem;
        top: 1.25rem;
        background: rgba(255, 255, 255, 0.9);
        color: #000;
        width: 36px;
        height: 36px;
    }
}

/* Efecto hover solo en dispositivos con hover */
@media (hover: hover) {
    .close-modal:hover, 
    .close-modal:focus {
        transform: rotate(90deg);
        background: white;
        outline: none;
        box-shadow: 0 0 0 3px rgba(197, 165, 114, 0.3);
    }
}

/* Layout del Modal completamente rediseñado para responsividad */
.modal-split {
    display: flex;
    flex-direction: column; /* Apilar verticalmente en móviles */
    width: 100%;
    height: 100%;
    overflow: hidden;
}

@media (min-width: 992px) {
    .modal-split {
        display: grid;
        grid-template-columns: 45% 55%; /* División en dos columnas en desktop */
        max-height: 90vh;
    }
}

/* Galería optimizada para todos los dispositivos */
.modal-gallery {
    width: 100%;
    background: #fff;
    padding: 1rem; /* Menos padding en móviles */
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

@media (min-width: 576px) {
    .modal-gallery {
        padding: 1.5rem;
    }
}

@media (min-width: 992px) {
    .modal-gallery {
        padding: 2rem;
        overflow-y: auto; /* Scroll independiente en desktop */
    }
}

.main-image-container {
    position: relative;
    height: 250px; /* Altura más pequeña en móviles */
    overflow: hidden;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius-sm);
    background: #f1f1f1;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 576px) {
    .main-image-container {
        height: 300px;
        margin-bottom: 1rem;
    }
}

@media (min-width: 992px) {
    .main-image-container {
        height: 350px;
    }
}

#modalMainImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

#modalMainImage.transitioning {
    opacity: 0.5;
}

#modalMainImage.loading {
    opacity: 0.7;
}

#modalMainImage.loaded {
    opacity: 1;
}

/* Lanzar animación de carga para imágenes */
@keyframes imagePulse {
    0% { opacity: 0.7; }
    50% { opacity: 0.9; }
    100% { opacity: 0.7; }
}

.main-image-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.05);
    display: none;
    z-index: 0;
    animation: imagePulse 1.5s infinite;
}

.main-image-container.loading::before {
    display: block;
}

.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; /* Ligeramente más pequeño en móviles */
    height: 36px;
    background: rgba(197, 165, 114, 0.85);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.15rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0.8; /* Más visible por defecto en móviles */
    transition: all 0.3s ease;
    will-change: transform, opacity;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 576px) {
    .modal-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        opacity: 0; /* Oculto por defecto en desktop */
    }
    
    .main-image-container:hover .modal-nav-btn,
    .main-image-container:focus-within .modal-nav-btn {
        opacity: 0.9;
    }
}

@media (hover: hover) {
    .modal-nav-btn:hover,
    .modal-nav-btn:focus {
        background: rgba(197, 165, 114, 1);
        opacity: 1 !important;
        transform: translateY(-50%) scale(1.1);
        outline: none;
    }
}

.modal-nav-btn.prev {
    left: 0.5rem;
}

.modal-nav-btn.next {
    right: 0.5rem;
}

@media (min-width: 576px) {
    .modal-nav-btn.prev {
        left: 1rem;
    }
    
    .modal-nav-btn.next {
        right: 1rem;
    }
}

/* Miniaturas con scroll horizontal y optimizadas para táctil */
.thumbnail-container {
    display: flex;
    gap: 0.35rem; /* Menos espacio en móviles */
    margin-top: 0.5rem;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(0,0,0,0.05);
    padding: 0.3rem 0;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 576px) {
    .thumbnail-container {
        gap: 0.5rem;
        margin-top: 1rem;
        padding: 0.5rem 0;
    }
}

.thumbnail-container::-webkit-scrollbar {
    height: 4px;
    width: 4px;
}

.thumbnail-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 2px;
}

.thumbnail-container::-webkit-scrollbar-thumb {
    background-color: var(--gold);
    border-radius: 2px;
}

.thumbnail-wrapper {
    flex: 0 0 auto;
    width: 60px; /* Más pequeño en móviles */
    height: 50px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    will-change: transform, border-color;
}

@media (min-width: 576px) {
    .thumbnail-wrapper {
        width: 80px;
        height: 60px;
    }
}

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

@media (hover: hover) {
    .thumbnail-wrapper:hover,
    .thumbnail-wrapper:focus {
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
        outline: none;
    }
}

.thumbnail-wrapper.active {
    border-color: var(--gold);
}

.thumbnail-wrapper:focus-visible {
    box-shadow: 0 0 0 3px rgba(197, 165, 114, 0.5);
}

/* Soporte de estado de carga para imágenes */
.thumbnail-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #f5f5f5;
    display: none;
    z-index: 0;
}

.thumbnail-wrapper.loading::before {
    display: block;
}

.thumbnail.loaded {
    opacity: 1;
}

/* Botón Ver todas las fotos mejorado para táctil */
.view-all-photos {
    background-color: var(--primary);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    padding: 0.75rem;
    cursor: pointer;
    width: 100%;
    display: block;
    border: none;
    border-radius: 4px;
    margin-top: 1rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 48px; /* Altura mínima para mejor toque */
}

@media (min-width: 576px) {
    .view-all-photos {
        font-size: 0.9rem;
        padding: 0.8rem;
    }
}

@media (hover: hover) {
    .view-all-photos:hover,
    .view-all-photos:focus {
        background-color: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
        outline: none;
    }
}

/* Panel de detalles completamente rediseñado para mejor scroll en móviles */
.property-details {
    width: 100%;
    padding: 1rem;
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(0,0,0,0.05);
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 576px) {
    .property-details {
        padding: 1.5rem;
    }
}

@media (min-width: 992px) {
    .property-details {
        padding: 2rem;
        max-height: 90vh;
    }
}

.property-details::-webkit-scrollbar {
    width: 4px;
}

@media (min-width: 576px) {
    .property-details::-webkit-scrollbar {
        width: 6px;
    }
}

.property-details::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.03);
}

.property-details::-webkit-scrollbar-thumb {
    background-color: var(--gold);
    border-radius: 3px;
}

/* Encabezado del modal adaptativo */
.property-title {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(197, 165, 114, 0.5);
    line-height: 1.3;
}

@media (min-width: 576px) {
    .property-title {
        font-size: 1.8rem;
    }
}

.property-location {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

@media (min-width: 576px) {
    .property-location {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        gap: 0.5rem;
    }
}

.property-location i {
    color: var(--gold);
}

.property-price {
    font-size: 1.5rem;
    color: var(--gold);
    font-weight: 600;
    margin: 1rem 0;
    font-family: 'Playfair Display', serif;
}

@media (min-width: 576px) {
    .property-price {
        font-size: 1.8rem;
        margin: 1.5rem 0;
    }
}

/* MLS Information mejorada para móviles */
.property-mls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

@media (min-width: 576px) {
    .property-mls {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        font-size: 1rem;
    }
}

.mls-button {
    display: inline-block;
    width: 100%; /* Ancho completo en móviles */
    padding: 0.75rem 1rem;
    background-color: #ffffff;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    text-align: center;
    min-height: 44px; /* Altura mínima para mejor toque */
}

@media (min-width: 576px) {
    .mls-button {
        width: auto; /* Ancho automático en pantallas más grandes */
        font-size: 0.9rem;
    }
}

@media (hover: hover) {
    .mls-button:hover,
    .mls-button:focus {
        background-color: var(--primary);
        color: white;
        text-decoration: none;
        outline: none;
        transform: translateY(-2px);
    }
}

/* Sección de imágenes de vista previa adaptativa */
.featured-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en móviles */
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 576px) {
    .featured-images {
        grid-template-columns: repeat(3, 1fr); /* 3 columnas en pantallas más grandes */
        gap: 0.75rem;
        margin-bottom: 2rem;
    }
}

.featured-image-card {
    position: relative;
    height: 80px; /* Más pequeño en móviles */
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    will-change: transform;
}

@media (min-width: 576px) {
    .featured-image-card {
        height: 100px;
    }
}

.featured-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    will-change: transform;
}

@media (hover: hover) {
    .featured-image-card:hover img,
    .featured-image-card:focus img {
        transform: scale(1.05);
    }
    
    .featured-image-card:hover,
    .featured-image-card:focus {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
        outline: none;
    }
}

.featured-image-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(197, 165, 114, 0.5);
}

.view-all-photos.featured {
    grid-column: span 2; /* Ocupa 2 columnas en móviles */
    height: 80px; /* Misma altura que las imágenes en móviles */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 87, 76, 0.9);
    color: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    font-size: 0.85rem;
}

@media (min-width: 576px) {
    .view-all-photos.featured {
        grid-column: span 1; /* Ocupa 1 columna en pantallas más grandes */
        height: 100px; /* Misma altura que las imágenes */
        font-size: 0.9rem;
    }
}

@media (hover: hover) {
    .view-all-photos.featured:hover,
    .view-all-photos.featured:focus {
        background-color: var(--primary);
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
    }
}

/* Secciones principales con títulos adaptables */
.section-title {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    position: relative;
}

@media (min-width: 576px) {
    .section-title {
        font-size: 1.5rem;
        margin: 2rem 0 1rem 0;
        padding-bottom: 0.75rem;
    }
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, var(--gold), var(--gold) 60%, rgba(197, 165, 114, 0.3));
}

/* Datos principales en formato de grid adaptativo */
.property-main-data {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columnas siempre */
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 576px) {
    .property-main-data {
        gap: 1rem;
        margin-bottom: 2rem;
    }
}

.data-box {
    text-align: center;
    background: var(--bg-gray);
    padding: 1rem 0.75rem;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    will-change: transform;
    border-top: 3px solid transparent;
}

@media (hover: hover) {
    .data-box:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
        border-top-color: var(--gold);
    }
}

.data-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 576px) {
    .data-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
}

.data-value {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
}

@media (min-width: 576px) {
    .data-value {
        font-size: 1.25rem;
    }
}

/* Información de la propiedad en formato de tabla adaptativo */
.info-table {
    margin-bottom: 1.5rem;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
    font-size: 0.9rem;
}

@media (min-width: 576px) {
    .info-table {
        margin-bottom: 2rem;
        font-size: 1rem;
    }
}

.info-row {
    display: flex;
    flex-direction: column; /* Apilar en móviles */
    border-bottom: 1px solid #f0f0f0;
    padding: 0.75rem;
    transition: background 0.2s ease;
}

@media (min-width: 576px) {
    .info-row {
        flex-direction: row; /* Lado a lado en tablets y superiores */
        padding: 1rem;
    }
}

.info-row:last-child {
    border-bottom: none;
}

.info-row:hover {
    background: rgba(197, 165, 114, 0.05);
}

.info-label {
    width: 100%; /* Ancho completo en móviles */
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 0.3rem;
}

@media (min-width: 576px) {
    .info-label {
        width: 40%; /* Anchos proporcionales en pantallas más grandes */
        margin-bottom: 0;
    }
}

.info-value {
    flex: 1;
    color: var(--text-dark);
}

/* Mapa de ubicación adaptativo */
.map-container {
    width: 100%;
    height: 200px; /* Más pequeño en móviles */
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid #eaeaea;
    position: relative;
}

@media (min-width: 576px) {
    .map-container {
        height: 250px;
    }
}

@media (min-width: 992px) {
    .map-container {
        height: 300px;
    }
}

/* Indicador de carga para el mapa */
.map-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(245, 245, 245, 0.7);
    z-index: 1;
    display: none;
}

.map-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(197, 165, 114, 0.3);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
    display: none;
}

.map-container.loading::before,
.map-container.loading::after {
    display: block;
}

.location-address {
    margin: 0.75rem 0;
    color: var(--text-dark);
    font-size: 0.9rem;
}

@media (min-width: 576px) {
    .location-address {
        margin: 1rem 0;
        font-size: 1rem;
    }
}

.google-maps-button {
    display: block;
    width: 100%;
    padding: 0.75rem;
    text-align: center;
    background: white;
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    min-height: 44px; /* Para mejor usabilidad en táctiles */
}

@media (hover: hover) {
    .google-maps-button:hover,
    .google-maps-button:focus {
        background-color: var(--gold);
        color: white;
        text-decoration: none;
        outline: none;
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }
}

/* Sección de Características rediseñada para todos los dispositivos */
.features-grid {
    display: grid;
    grid-template-columns: 1fr; /* Una columna en móviles pequeños */
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr); /* Dos columnas en móviles más grandes */
    }
}

@media (min-width: 992px) {
    .features-grid {
        gap: 1rem;
        margin-bottom: 2rem;
    }
}

.feature-card {
    border: 1px solid #eaeaea;
    border-radius: 4px;
    padding: 1rem;
    position: relative;
    background: #ffffff;
    border-left: 4px solid var(--gold);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 576px) {
    .feature-card {
        padding: 1.5rem;
    }
}

@media (hover: hover) {
    .feature-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
    }
}

.feature-title {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-weight: 500;
    position: relative;
    padding-bottom: 0.4rem;
}

@media (min-width: 576px) {
    .feature-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
}

.feature-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: var(--gold);
}

.feature-content {
    color: var(--text-dark);
    line-height: 1.5;
    font-size: 0.85rem;
}

@media (min-width: 576px) {
    .feature-content {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}

/* Tour Virtual adaptativo */
.virtual-tour-container {
    background: linear-gradient(120deg, rgba(0, 87, 76, 0.05), rgba(197, 165, 114, 0.05));
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin: 1.5rem 0;
    border: 1px solid rgba(197, 165, 114, 0.2);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

@media (min-width: 576px) {
    .virtual-tour-container {
        padding: 2rem;
        margin: 2rem 0;
    }
}

.virtual-tour-container::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(197, 165, 114, 0.1);
    z-index: 0;
}

.virtual-tour-title {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

@media (min-width: 576px) {
    .virtual-tour-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

.virtual-tour-button {
    display: inline-block;
    width: 100%; /* Ancho completo en móviles */
    padding: 0.75rem 1.5rem;
    background-color: white;
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-sm);
    min-height: 44px; /* Para mejor usabilidad en táctiles */
}

@media (min-width: 576px) {
    .virtual-tour-button {
        width: auto; /* Ancho automático en pantallas más grandes */
        padding: 0.75rem 2rem;
    }
}

@media (hover: hover) {
    .virtual-tour-button:hover,
    .virtual-tour-button:focus {
        background-color: var(--gold);
        color: white;
        text-decoration: none;
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        outline: none;
    }
}

/* Descripción adaptativa */
.description-text {
    color: var(--text-dark);
    line-height: 1.6;
    white-space: pre-line;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

@media (min-width: 576px) {
    .description-text {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 2rem;
    }
}

/* Galería modal completa adaptativa */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 20000;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

.gallery-modal.show {
    display: block;
    opacity: 1;
}

.gallery-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 36px;
    height: 36px;
    background: var(--gold);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
    will-change: transform;
}

@media (min-width: 576px) {
    .gallery-close {
        right: 2rem;
        top: 2rem;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

@media (hover: hover) {
    .gallery-close:hover,
    .gallery-close:focus {
        transform: rotate(90deg);
        background: var(--primary);
        outline: none;
    }
}

.gallery-content {
    width: 100%;
    height: 100%;
    padding: 1.5rem; /* Menos padding en móviles */
    display: flex;
    flex-direction: column;
    position: relative;
}

@media (min-width: 576px) {
    .gallery-content {
        padding: 2rem;
    }
}

@media (min-width: 992px) {
    .gallery-content {
        padding: 3rem;
    }
}

.gallery-main {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
}

@media (min-width: 576px) {
    .gallery-main {
        margin: 2rem 0;
    }
}

.gallery-image-container {
    max-height: 60vh; /* Más pequeño en móviles */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

@media (min-width: 576px) {
    .gallery-image-container {
        max-height: 70vh;
    }
}

.gallery-image-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

.gallery-image-container img.transitioning {
    opacity: 0.5;
}

.gallery-counter {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: white;
    font-size: 0.9rem;
    background: var(--gold);
    padding: 0.4rem 1.2rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-md);
    font-weight: 500;
    letter-spacing: 0.5px;
}

@media (min-width: 576px) {
    .gallery-counter {
        top: 2rem;
        left: 2rem;
        font-size: 1rem;
        padding: 0.5rem 1.5rem;
    }
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(197, 165, 114, 0.8);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    will-change: transform, background-color;
    box-shadow: var(--shadow-md);
}

@media (min-width: 576px) {
    .gallery-nav {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

@media (hover: hover) {
    .gallery-nav:hover,
    .gallery-nav:focus {
        background: var(--gold);
        transform: translateY(-50%) scale(1.1);
        outline: none;
    }
}

.gallery-nav.prev {
    left: 1rem;
}

.gallery-nav.next {
    right: 1rem;
}

@media (min-width: 576px) {
    .gallery-nav.prev {
        left: 2rem;
    }
    
    .gallery-nav.next {
        right: 2rem;
    }
}

.gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.75rem;
    max-width: 100%;
    margin: 0 auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(255,255,255,0.1);
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 576px) {
    .gallery-thumbs {
        gap: 1rem;
        padding: 1rem;
        max-width: 90%;
    }
}

.gallery-thumbs::-webkit-scrollbar {
    height: 4px;
}

@media (min-width: 576px) {
    .gallery-thumbs::-webkit-scrollbar {
        height: 6px;
    }
}

.gallery-thumbs::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
    background-color: var(--gold);
    border-radius: 2px;
}

.gallery-thumb-wrapper {
    flex: 0 0 auto;
    width: 80px; /* Más pequeño en móviles */
    height: 60px;
    border: 2px solid transparent;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    will-change: opacity, transform, border-color;
    position: relative;
}

@media (min-width: 576px) {
    .gallery-thumb-wrapper {
        width: 120px;
        height: 80px;
    }
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (hover: hover) {
    .gallery-thumb-wrapper:hover,
    .gallery-thumb-wrapper:focus {
        opacity: 0.8;
        transform: translateY(-2px);
        outline: none;
    }
}

.gallery-thumb-wrapper.active {
    opacity: 1;
    border-color: var(--gold);
}

.gallery-thumb-wrapper.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--gold);
}

.gallery-thumb-wrapper:focus-visible {
    box-shadow: 0 0 0 3px rgba(197, 165, 114, 0.7);
}

/* Animaciones */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.property-modal-container {
    animation: fadeIn 0.3s ease forwards;
}

.data-box {
    animation: slideUp 0.5s ease forwards;
}

.data-box:nth-child(1) { animation-delay: 0.1s; }
.data-box:nth-child(2) { animation-delay: 0.2s; }
.data-box:nth-child(3) { animation-delay: 0.3s; }

/* Soporte para dispositivos extremadamente pequeños (Galaxy Fold, etc.) */
@media (max-width: 280px) {
    .property-title {
        font-size: 1.2rem;
    }
    
    .property-price {
        font-size: 1.3rem;
    }
    
    .property-main-data {
        grid-template-columns: 1fr; /* Una sola columna */
    }
    
    .data-box {
        padding: 0.75rem 0.5rem;
    }
    
    .featured-images {
        grid-template-columns: 1fr; /* Una sola columna */
    }
    
    .view-all-photos.featured {
        grid-column: span 1;
    }
    
    .gallery-thumb-wrapper {
        width: 60px;
        height: 40px;
    }
    
    .gallery-nav {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .gallery-counter {
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Mejoras para modo oscuro del sistema */
@media (prefers-color-scheme: dark) {
    .modal-property .modal-dialog {
        background: #222;
    }
    
    .property-title,
    .section-title,
    .data-value,
    .info-label,
    .feature-title,
    .virtual-tour-title {
        color: var(--gold);
    }
    
    .property-location,
    .info-value,
    .description-text,
    .feature-content,
    .location-address {
        color: #ddd;
    }
    
    .data-box {
        background: #333;
    }
    
    .info-row:hover {
        background: rgba(197, 165, 114, 0.1);
    }
    
    .google-maps-button {
        background: #333;
    }
    
    .feature-card {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .virtual-tour-container {
        background: linear-gradient(120deg, rgba(0, 87, 76, 0.2), rgba(197, 165, 114, 0.2));
        border-color: rgba(197, 165, 114, 0.3);
    }
    
    .virtual-tour-button {
        background: #333;
    }
    
    .close-modal {
        color: #eee;
        background: rgba(34, 34, 34, 0.9);
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .modal-property .modal-dialog,
    .close-modal,
    .modal-nav-btn,
    .gallery-close,
    #modalMainImage,
    .gallery-image-container img,
    .view-all-photos,
    .featured-image-card img,
    .data-box,
    .property-modal-container,
    .gallery-thumb-wrapper {
        transition: none !important;
        animation: none !important;
    }
    
    .main-image-container::before {
        animation: none !important;
    }
    
    .map-container::after {
        animation: none !important;
    }
}

/* Modo de alto contraste */
@media (forced-colors: active) {
    .modal-property .modal-dialog {
        border: 2px solid CanvasText;
    }
    
    .close-modal,
    .modal-nav-btn,
    .gallery-close,
    .gallery-nav {
        forced-color-adjust: none;
    }
    
    .thumbnail-wrapper.active,
    .gallery-thumb-wrapper.active {
        border: 2px solid Highlight;
    }
    
    .featured-image-card:focus,
    .thumbnail-wrapper:focus,
    .gallery-thumb-wrapper:focus,
    .view-all-photos:focus,
    .google-maps-button:focus,
    .virtual-tour-button:focus,
    .mls-button:focus {
        outline: 2px solid Highlight;
    }
}