/* ==========================================================================
   1. VARIABLES Y CONFIGURACIÓN BASE
   ========================================================================== */
:root {
    --primary-blue: #3b82f6;
    --dark-blue: #1a365d;
    --success-green: #22c55e;
    --danger-red: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.banner-detalle {
    background-color: var(--bg-light);
    font-family: 'Inter', 'Montserrat', sans-serif;
    padding-top: 1.5rem !important;
    margin-top: 76px;
}

/* ==========================================================================
   2. GALERÍA Y CONTENEDORES PRINCIPALES
   ========================================================================== */
.gallery-wrapper,
.main-card-shadow {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.lg-image,
#image-gallery img {
    width: 100% !important;
    height: 550px !important;
    object-fit: cover !important;
    transition: transform 0.5s ease;
}

.card-modern {
    background: #ffffff;
    border-radius: 15px;
    padding: 24px;
    border: 1px solid #f0f0f0;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   3. CABECERA (BADGES, BOTONES Y VOLVER)
   ========================================================================== */
.badge-new-top-modern {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-volver-modern {
    text-decoration: none !important;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-volver-modern:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.btn-action-outline-modern {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-action-outline-modern:hover {
    background: var(--bg-light);
    border-color: #cbd5e1;
    color: var(--text-main);
}

.btn-action-outline-modern.active {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger-red);
}

.cp-badge-modern {
    background: #f1f5f9;
    color: #475569;
    padding: 5px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   4. GRID DE CARACTERÍSTICAS
   ========================================================================== */
.modern-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.feature-box i {
    font-size: 1.5rem;
    color: var(--primary-blue);
}

.feature-box label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin: 0;
}

/* ==========================================================================
   5. SIDEBAR (STICKY, PRECIO Y FORMULARIO)
   ========================================================================== */
.sticky-sidebar {
    position: sticky;
    top: 100px;
}

.price-card-premium {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--primary-blue) 100%);
    border-radius: 20px;
    padding: 1.5rem;
    color: white;
    text-align: center;
    margin-bottom: 1.5rem;
}

.price-card-premium h2 {
    font-size: 2.5rem !important;
    font-weight: 800;
    margin: 0.5rem 0;
}

.form-control-modern {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 15px;
}

.btn-primary-modern,
.btn-appointment,
.btn-whatsapp-modern {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    color: white !important;
}

.btn-primary-modern {
    background-color: var(--primary-blue);
}

.btn-appointment {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-whatsapp-modern {
    background-color: var(--success-green);
}

/* --- Contenedor del Logo de la Agencia --- */
.agency-logo-container {
    width: 100%;
    height: 120px;
    /* Altura fija para que el sidebar sea uniforme */
    display: flex;
    align-items: center;
    /* Centrado vertical */
    justify-content: center;
    /* Centrado horizontal */
    background-color: #f8fafc;
    /* Fondo suave para que el logo resalte si es transparente */
    border-radius: 12px;
    padding: 15px;
    /* Espacio para que el logo no toque los bordes */
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid #f0f0f0;
}

/* --- Estilo de la imagen del logo --- */
.agency-logo-fit {
    max-width: 100%;
    max-height: 100%;
    /* CLAVE: Mantiene la proporción sin estirar, centrando la imagen */
    object-fit: contain;
    object-position: center;
}

/* ==========================================================================
   6. SECCIÓN DE PROPIEDADES SIMILARES
   ========================================================================== */
.container_similares_wrapper {
    background: transparent;
    margin-top: 3rem !important;
}

.section-title-modern {
    font-size: 1.2rem;
    color: var(--dark-blue);
    font-weight: 800;
}

.container_similares_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* Card Similar */
.img_similar_card {
    background: #ffffff !important;
    border-radius: 20px;
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.img_similar_card:hover {
    transform: translateY(-12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Imagen y Efecto Zoom */
.similar-image-wrapper {
    position: relative;
    height: 150px;
    overflow: hidden;
}

.similar-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.img_similar_card:hover .similar-image-wrapper img {
    transform: scale(1.15);
}

.price-tag {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--dark-blue);
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Cuerpo Card Similar */
.similar-card-body {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.similar-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.similar-card-features {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid #f8fafc;
    margin-top: auto;
    margin-bottom: 10px;
}

.similar-card-features span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.similar-card-features i {
    color: var(--primary-blue);
}

.btn-ver-premium {
    background-color: var(--primary-blue);
    color: white !important;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none !important;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-ver-premium:hover {
    background-color: var(--dark-blue);
}

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {

    .lg-image,
    #image-gallery img {
        height: 350px !important;
    }

    .price-card-premium h2 {
        font-size: 2rem !important;
    }
}

@media (max-width: 576px) {
    .container_similares_grid {
        gap: 15px;
    }

    .card-modern {
        padding: 1.5rem !important;
    }
}

.title-header-modern {
    margin-top: 1rem;
    padding-bottom: 0.5rem;
}

.property-main-title {
    font-size: 2.2rem;
    font-weight: 850;
    color: var(--dark-blue);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 8px;
    text-transform: capitalize;
    /* Para que no se vea todo en mayúsculas si viene de la DB así */
}

.property-location-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.property-location-subtitle i {
    color: var(--primary-blue);
}

/* Ajuste para móviles */
@media (max-width: 768px) {
    .property-main-title {
        font-size: 1.6rem;
    }

    .property-location-subtitle {
        font-size: 0.95rem;
    }
}

/* --- Contenedor del Título --- */
.title-header-modern {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

/* --- Título Principal --- */
.property-main-title {
    /* Tamaño reducido para que no sature */
    font-size: 1.85rem;
    /* Peso semibold en lugar de extra-bold para mayor elegancia */
    font-weight: 700;
    /* Un color azul pizarra profundo pero menos agresivo */
    color: #1e293b;
    line-height: 1.2;
    /* Espaciado de letras estándar para mejor legibilidad */
    letter-spacing: -0.01em;
    /* Cambiamos a normal o capitalize si prefieres que no grite tanto */
    text-transform: none;
    margin: 0;
}

/* Ajuste para móviles */
@media (max-width: 768px) {
    .property-main-title {
        font-size: 1.5rem;
    }

    .title-principal {
        display: none !important;
        /* Oculta el título principal en móviles para evitar saturación */
    }
}

.gallery-item {
    cursor: zoom-in;
    overflow: hidden;
}

.lg-image {
    transition: transform 0.3s ease;
}

.gallery-item:hover .lg-image {
    transform: scale(1.05);
    /* Efecto sutil al pasar el mouse */
}

/* Evita el zoom automático y muestra la imagen completa */
.lg-outer .lg-content .lg-image {
    object-fit: contain !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Opcional: Si quieres que el fondo sea un negro más profundo 
   para que resalte la imagen */
.lg-backdrop {
    background-color: rgba(0, 0, 0, 0.95) !important;
}

/* Ajuste de tamaño y borde de las miniaturas activas */
.lg-thumb-item {
    border-radius: 4px;
    margin-bottom: 5px;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.lg-thumb-item.active,
.lg-thumb-item:hover {
    border-color: #2563eb !important;
    /* El azul de tu diseño */
}

/* Opcional: Centrar la barra de miniaturas */
.lg-thumb {
    margin: 0 auto !important;
}

/* Botón Volver Minimalista en Detalle */
.btn-back-detail {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    padding: 8px 15px;
    font-size: 13px;
    color: #475569;
    backdrop-filter: blur(4px);
}

/* El botón Guardar (Favorito) alineado a la derecha */
.btn-save-detail {
    background: #ffffff;
    border: 1px solid #fee2e2;
    border-radius: 50px;
    padding: 8px 15px;
    color: #ef4444;
    /* Rojo para el corazón */
    font-weight: 600;
}

/* Contenedor de navegación superior */
.detail-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 15px;
}

/* Botón Volver (Estilo Pill) */
.btn-back-detail {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.btn-back-detail:hover {
    background: var(--bg-light);
    color: var(--dark-blue);
}

/* Botón Favorito/Guardar */
.btn-save-detail {
    background: #ffffff;
    border: 1px solid #fee2e2;
    border-radius: 50px;
    padding: 8px 16px;
    color: var(--danger-red);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

/* Contenedor Principal */
.header-action-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 10px;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Botón Volver Estilo Pill */
.btn-back-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.btn-back-pill:hover {
    background: #f8fafc;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Etiqueta de Estado (Nuevo, etc) */
.badge-status-pill {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Botones de Acción (Favorito/Compartir) */
.btn-action-circle {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    height: 40px;
    padding: 0 15px;
    /* Desktop: Con texto */
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action-circle:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-action-circle.active {
    background: #fef2f2;
    border-color: #fecaca;
    color: #ef4444;
}

/* --- AJUSTES MÓVILES --- */
@media (max-width: 576px) {
    .btn-action-circle {
        width: 40px;
        /* Se vuelven circulares */
        padding: 0;
        font-size: 18px;
    }

    .header-left {
        gap: 8px;
    }

    .btn-back-pill {
        padding: 8px 12px;
        font-size: 13px;
    }

    .badge-status-pill {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Color azul corporativo para el precio sencillo */
.text-primary-blue {
    color: #1e3a8a !important;
}

.property-main-title {
    font-size: 1.5rem !important;
    line-height: 1.2;
    color: #1e293b;
    font-weight: 800;
}

.mobile-price-simple {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {

    /* Eliminamos márgenes excesivos para que todo quepa en la primera pantalla */
    .title-header-modern {
        margin-top: 0.5rem;
    }

    .banner-detalle {
        margin-top: 0px;
    }
}