/* ========================================
   FICHA DE INMUEBLES - DISEÑO MODERNO
   ======================================== */

/* Reset y configuración base */
.realstate-card {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

/* ========================================
   HEADER PRINCIPAL
   ======================================== */
.realstate-header {
    background: linear-gradient(135deg, #52a788 0%, #4a9d72 100%);
    color: white;
    padding: 25px;
}

.realstate-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}

.realstate-title-section {
    flex: 1;
    min-width: 280px;
}

.realstate-title {
    margin: 0 0 15px 0;
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.realstate-location {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1.2rem;
    opacity: 0.95;
}

.realstate-location i {
    margin-right: 8px;
    font-size: 1.2rem;
}

.realstate-type-operation {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.realstate-type,
.realstate-operation {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.realstate-price-section {
    text-align: right;
}

.realstate-price {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.price-currency {
    display: block;
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.price-amount {
    font-size: 2.7rem;
    font-weight: 800;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ========================================
   SECCIÓN DE MEDIA
   ======================================== */
.realstate-media {
    position: relative;
    background: #f8f9fa;
}

.media-container {
    position: relative;
    width: 100%;
    height: 450px;
    overflow: hidden;
}

.video-wrapper,
.image-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.realstate-video,
.realstate-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

.realstate-main-image.no-image {
    object-fit: contain;
    background: #f8f9fa;
}

.image-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(10px);
}

.no-image-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
}

.no-image-text i {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
}

/* ========================================
   GALERÍA INTEGRADA CON ZOOM
   ======================================== */
.realstate-gallery {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-main-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: zoom-in;
}

.gallery-main-container:hover .realstate-main-image {
    transform: scale(1.5);
}

.gallery-main-container .realstate-main-image {
    transition: transform 0.5s ease;
    transform-origin: center;
}

.zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-main-container:hover .zoom-overlay {
    opacity: 1;
}

.zoom-hint {
    color: white;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
}

.zoom-hint i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

/* Controles de navegación */
.gallery-nav-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    pointer-events: none;
    z-index: 10;
}

.gallery-nav-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.gallery-nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.gallery-nav-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.gallery-nav-btn i {
    font-size: 1.2rem;
}

/* Indicadores de posición */
.gallery-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.gallery-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.gallery-indicator.active,
.gallery-indicator:hover {
    background: white;
    transform: scale(1.2);
}

/* Elementos de media (video + imágenes) */
.media-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.media-item.active {
    opacity: 1;
    pointer-events: auto;
}

.media-item.image-item img {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.media-item.image-item:hover img {
    transform: scale(1.05);
}

/* Indicadores especiales para video */
.gallery-indicator.video-indicator {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
}

.gallery-indicator.image-indicator {
    width: 12px;
    height: 12px;
}

/* Contador de imágenes actualizado */
.realstate-gallery .image-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

/* ========================================
   POPUP DE IMÁGENES
   ======================================== */
.image-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.image-popup-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-popup-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.image-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.image-popup-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-popup-caption {
    color: white;
    margin-top: 15px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    max-width: 600px;
    padding: 0 20px;
}

/* ========================================
   CARACTERÍSTICAS PRINCIPALES
   ======================================== */
.realstate-main-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: #e9ecef;
    margin: 0;
}

.feature-item {
    background: white;
    padding: 25px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

.feature-item i {
    font-size: 1.8rem;
    color: #52a788;
    width: 40px;
    text-align: center;
}

.feature-content {
    display: flex;
    flex-direction: column;
}

.feature-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.feature-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #343a40;
}

/* ========================================
   DESCRIPCIÓN
   ======================================== */
.realstate-description {
    padding: 30px 25px;
    border-bottom: 1px solid #e9ecef;
}

.realstate-description h3 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #343a40;
}

.description-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #495057;
}

/* ========================================
   CARACTERÍSTICAS DETALLADAS
   ======================================== */
.realstate-detailed-features {
    padding: 30px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.realstate-detailed-features h3 {
    margin: 0 0 25px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #343a40;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detailed-feature-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.detailed-feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.detailed-feature-item i {
    font-size: 1.3rem;
    color: #52a788;
    width: 30px;
    text-align: center;
}

.detailed-feature-content {
    display: flex;
    flex-direction: column;
}

.detailed-feature-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 3px;
}

.detailed-feature-value {
    font-size: 1rem;
    font-weight: 600;
    color: #343a40;
}

/* ========================================
   BOTONES DE ACCIÓN
   ======================================== */
.realstate-actions {
    padding: 25px;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

.btn-action:focus {
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #52a788 0%, #4a9d72 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    color: white;
}

.btn-action i {
    font-size: 1.2rem;
}

/* ========================================
   INFORMACIÓN DEL AGENTE
   ======================================== */
.realstate-agent {
    padding: 30px 25px;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.agent-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.agent-photo {
    flex-shrink: 0;
}

.agent-photo img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.agent-info {
    flex: 1;
}

.agent-title {
    margin: 0 0 10px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #343a40;
    margin-bottom: 5px;
}

.agent-position {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 15px;
}

.agent-contact {
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #495057;
}

.contact-item i {
    color: #52a788;
    width: 16px;
}

.agent-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-agent {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.btn-agent:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-call {
    background: #007bff;
    color: white;
}

.btn-call:hover {
    background: #0056b3;
    color: white;
}

.btn-whatsapp {
    background: #25d366;
    color: white;
}

.btn-whatsapp:hover {
    background: #1da851;
    color: white;
}

.btn-email {
    background: #6c757d;
    color: white;
}

.btn-email:hover {
    background: #545b62;
    color: white;
}

/* ========================================
   COMPARTIR
   ======================================== */
.realstate-share {
    padding: 25px;
    background: #f8f9fa;
    text-align: center;
}

.realstate-share h4 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #343a40;
}

/* ========================================
   MODAL MEJORAS
   ======================================== */
.modal-lg {
    max-width: 900px;
}

.modal-header {
    background: linear-gradient(135deg, #52a788 0%, #4a9d72 100%);
    color: white;
    border-bottom: none;
}

.modal-title {
    font-weight: 600;
}

.modal-header .close {
    color: white;
    opacity: 0.8;
    text-shadow: none;
}

.modal-header .close:hover {
    opacity: 1;
}

.modal-body {
    padding: 30px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablets */
@media (max-width: 768px) {
    .realstate-card {
        margin: 10px;
        border-radius: 8px;
    }
    
    .realstate-header {
        padding: 20px;
    }
    
    .realstate-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .realstate-title {
        font-size: 2rem;
    }
    
    .realstate-price-section {
        text-align: left;
        margin-top: 15px;
    }
    
    .price-amount {
        font-size: 2.2rem;
    }
    
    .media-container {
        height: 300px;
    }
    
    /* Ajustes de galería para tablet */
    .gallery-nav-btn {
        width: 45px;
        height: 45px;
    }
    
    .gallery-nav-btn i {
        font-size: 1.1rem;
    }
    
    .gallery-indicator {
        width: 10px;
        height: 10px;
    }
    
    .zoom-hint {
        font-size: 0.9rem;
    }
    
    .zoom-hint i {
        font-size: 1.5rem;
    }
    
    .realstate-main-features {
        grid-template-columns: 1fr;
    }
    
    .realstate-description,
    .realstate-detailed-features,
    .realstate-actions,
    .realstate-agent {
        padding: 20px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .agent-card {
        flex-direction: column;
        text-align: center;
    }
    
    .agent-photo {
        align-self: center;
    }
    
    .agent-actions {
        justify-content: center;
    }
    
    /* Popup responsive para tablet */
    .image-popup-close {
        top: -45px;
        width: 45px;
        height: 45px;
    }
    
    .image-popup-img {
        max-height: 80vh;
    }
}

/* Móviles */
@media (max-width: 480px) {
    .realstate-card {
        margin: 5px;
        border-radius: 6px;
    }
    
    .realstate-header {
        padding: 15px;
    }
    
    .realstate-title {
        font-size: 1.7rem;
    }
    
    .price-amount {
        font-size: 2rem;
    }
    
    .media-container {
        height: 250px;
    }
    
    /* Ajustes de galería para móvil */
    .gallery-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .gallery-nav-btn i {
        font-size: 1rem;
    }
    
    .gallery-indicators {
        bottom: 15px;
    }
    
    .gallery-indicator {
        width: 8px;
        height: 8px;
    }
    
    .zoom-hint {
        font-size: 0.8rem;
    }
    
    .zoom-hint i {
        font-size: 1.3rem;
    }
    
    .zoom-hint span {
        display: none; /* Ocultar texto en móvil */
    }
    
    /* Cambiar comportamiento de zoom en móvil */
    .gallery-main-container:hover .realstate-main-image {
        transform: scale(1); /* Desactivar zoom hover en móvil */
    }
    
    .gallery-main-container {
        cursor: pointer; /* Cambiar cursor para indicar que es clickeable */
    }
    
    .feature-item {
        padding: 20px 15px;
    }
    
    .feature-item i {
        font-size: 1.5rem;
    }
    
    .realstate-description,
    .realstate-detailed-features,
    .realstate-actions,
    .realstate-agent {
        padding: 15px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .btn-action {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .detailed-feature-item {
        padding: 15px;
    }
    
    .agent-card {
        padding: 20px;
    }
    
    .agent-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-agent {
        justify-content: center;
    }
    
    /* Popup responsive para móvil */
    .image-popup-close {
        top: -40px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .image-popup-img {
        max-height: 75vh;
    }
    
    .image-popup-caption {
        font-size: 1rem;
        margin-top: 10px;
    }
}

/* ========================================
   MEJORAS DE ACCESIBILIDAD
   ======================================== */
.realstate-card *:focus {
    outline: 2px solid #52a788;
    outline-offset: 2px;
}

.btn-action:focus,
.btn-agent:focus {
    outline: 3px solid rgba(82, 167, 136, 0.5);
    outline-offset: 2px;
}

/* ========================================
   ANIMACIONES SUAVES
   ======================================== */
@media (prefers-reduced-motion: no-preference) {
    .realstate-card {
        animation: fadeIn 0.6s ease-out;
    }
    
    .feature-item,
    .detailed-feature-item {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    
    .btn-action,
    .btn-agent {
        transition: all 0.3s ease;
    }
}

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

/* ========================================
   MEJORAS PARA IMPRESIÓN
   ======================================== */
@media print {
    .realstate-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .realstate-actions,
    .realstate-share {
        display: none;
    }
    
    .realstate-header {
        background: white !important;
        color: black !important;
        border-bottom: 2px solid #ddd;
    }
}