/**
 * PROPERTY MODAL - PROFESSIONAL UI REFACTOR
 * ========================================
 * 
 * INDENANT DESIGN SYSTEM
 * =====================
 * 
 * PALETA DE COLORES:
 * - Primary Orange: #f97316 (orange-500)
 * - Secondary Orange: #ea580c (orange-600)  
 * - Accent Red: #dc2626 (red-600)
 * - Light Orange: #fed7aa (orange-200)
 * - Ultra Light: #ffedd5 (orange-50)
 * 
 * GRISES:
 * - Dark: #1f2937 (gray-800)
 * - Medium: #6b7280 (gray-500)
 * - Light: #f9fafb (gray-50)
 * - Border: #e5e7eb (gray-200)
 * 
 * TIPOGRAFÍA:
 * - Primary: Inter, system-ui, sans-serif
 * - Weights: 400 (normal), 500 (medium), 600 (semibold), 700 (bold), 800 (extrabold)
 * 
 * ESPACIADO CONSISTENTE:
 * - Base unit: 4px (0.25rem)
 * - Section padding: 16px (1rem)
 * - Card padding: 12px (0.75rem)
 * - Chip padding: 8px 12px (0.5rem 0.75rem)
 */

/* ========================================
   MODAL BASE STRUCTURE
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    padding-top: 8rem; /* Más espacio para la navbar */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 1.5rem;
    max-width: 72rem;
    width: 100%;
    max-height: calc(100vh - 10rem); /* Altura máxima considerando márgenes aumentados */
    min-height: 60vh; /* Altura mínima para mantener proporciones */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    margin-bottom: 2rem; /* Margen inferior para separar del final de la página */
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

/* ========================================
   CLOSE BUTTON
   ======================================== */
#close-property-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#close-property-modal-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.15);
}

#close-property-modal-btn i {
    color: #374151;
    font-size: 1rem;
}

/* ========================================
   LAYOUT GRID
   ======================================== */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 85vh;
}

@media (max-width: 1024px) {
    .modal-grid {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 85vh;
    }
}

/* ========================================
   GALLERY SECTION
   ======================================== */
.gallery-section {
    background: #111827;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.gallery-nav-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

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

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

.gallery-counter {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 87, 51, 0.3);
    z-index: 10;
}

.gallery-fullscreen-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.gallery-fullscreen-btn:hover {
    background: white;
    transform: scale(1.1);
}

/* ========================================
   CONTENT SECTION
   ======================================== */
.property-content {
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.property-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

.property-content-scroll::-webkit-scrollbar {
    width: 6px;
}

.property-content-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.property-content-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.property-content-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   SECTION CARDS
   ======================================== */
.section-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section-card:hover {
    box-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f97316, #dc2626);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.section-card:hover::before {
    opacity: 1;
}

/* ========================================
   SECTION TITLES
   ======================================== */
.section-title {
    display: flex;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.section-icon {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    box-shadow: 0 2px 8px rgba(255, 87, 51, 0.25);
}

.section-icon i {
    color: white;
    font-size: 0.875rem;
}

/* ========================================
   PROPERTY HEADER
   ======================================== */
.property-header {
    position: relative;
}

.property-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.property-location {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.property-location i {
    color: #f97316;
    margin-right: 0.75rem;
    margin-top: 0.125rem;
    font-size: 1rem;
}

.property-location-text {
    flex: 1;
}

.property-neighborhood {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.property-city {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.property-address {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.property-operation-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 87, 51, 0.3);
}

.property-operation-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 87, 51, 0.4);
}

.property-operation-badge i {
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

/* ========================================
   PRICE SECTION
   ======================================== */
.price-section {
    position: relative;
    padding-right: 10rem;
}

.property-price-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.property-price-display {
    font-size: 2rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.property-currency {
    color: #f97316;
}

.property-period {
    font-size: 1.25rem;
    color: #6b7280;
}

.property-expenses {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.contact-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 87, 51, 0.3);
}

.contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 87, 51, 0.4);
}

.contact-btn i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* ========================================
   FEATURES GRID
   ======================================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.feature-card {
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    cursor: default;
}

/* Asegurar que feature-card se oculte cuando tiene clase hidden */
.feature-card.hidden {
    display: none !important;
}

.feature-card:hover {
    border-color: #fed7aa;
    background: linear-gradient(135deg, #ffedd5, #fed7aa);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.1);
}

.feature-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 87, 51, 0.25);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

.feature-icon i {
    color: white;
    font-size: 1rem;
}

.feature-content {
    flex: 1;
}

.feature-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.feature-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

/* ========================================
   AMENITIES SECTION
   ======================================== */
.amenities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.amenity-chip {
    background: linear-gradient(135deg, #fed7aa, #fb923c);
    border: 2px solid #f97316;
    color: #9a3412;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    box-shadow: 0 1px 3px rgba(249, 115, 22, 0.2);
}

.amenity-chip:hover {
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    border-color: #ea580c;
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 87, 51, 0.3);
}

.amenity-chip i {
    margin-right: 0.5rem;
    font-size: 0.875rem;
    color: #f97316;
    transition: color 0.3s ease;
}

.amenity-chip:hover i {
    color: white;
}

/* ========================================
   REQUIREMENTS SECTION
   ======================================== */
.requirements-subsection {
    margin-bottom: 1.5rem;
}

.requirements-subsection:last-child {
    margin-bottom: 0;
}

.subsection-title {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}

.subsection-icon {
    width: 1.5rem;
    height: 1.5rem;
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

.subsection-icon i {
    color: white;
    font-size: 0.75rem;
}

.requirements-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.requirement-chip {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    cursor: default;
    border: 2px solid;
}

.requirement-chip i {
    margin-right: 0.375rem;
    font-size: 0.75rem;
}

/* Mandatory requirements */
.requirement-chip.mandatory {
    background: linear-gradient(135deg, #fed7aa, #fb923c);
    border-color: #f97316;
    color: #9a3412;
}

.requirement-chip.mandatory:hover {
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    border-color: #ea580c;
    color: white;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 87, 51, 0.3);
}

.requirement-chip.mandatory i {
    color: #f97316;
}

.requirement-chip.mandatory:hover i {
    color: white;
}

/* Guarantee requirements */
.requirement-chip.guarantee {
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    border-color: #ea580c;
    color: #7c2d12;
}

.requirement-chip.guarantee:hover {
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    border-color: #dc2626;
    color: white;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 87, 51, 0.3);
}

.requirement-chip.guarantee i {
    color: #ea580c;
}

.requirement-chip.guarantee:hover i {
    color: white;
}

/* Extra requirements */
.requirement-chip.extra {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-color: #cbd5e1;
    color: #475569;
}

.requirement-chip.extra:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    border-color: #94a3b8;
    color: #334155;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 15px rgba(148, 163, 184, 0.2);
}

.requirement-chip.extra i {
    color: #64748b;
}

/* ========================================
   AMENITIES SECTION
   ======================================== */
.amenities-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: flex-start;
    margin-top: 1rem;
}

.amenity-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 44px;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid #fed7aa;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    flex-shrink: 0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.amenity-chip:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px 0 rgba(255, 87, 51, 0.25);
    border-color: #fb923c;
}

.amenity-chip i {
    margin-right: 0.5rem;
    font-size: 0.875rem;
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.amenity-chip span {
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.amenity-chip:hover {
    background: linear-gradient(135deg, #FF5733, #FF8A50);
    color: white;
}

.amenity-chip:hover i,
.amenity-chip:hover span {
    -webkit-text-fill-color: white;
    background: none;
}

/* Estado activo para la segunda definición de amenity-chip */
.amenity-chip.active {
    background: linear-gradient(135deg, #FF5733, #FF8C42) !important;
    border-color: #FF5733 !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 15px rgba(255, 87, 51, 0.3) !important;
}

.amenity-chip.active i,
.amenity-chip.active span {
    -webkit-text-fill-color: white !important;
    background: none !important;
    color: white !important;
}

.amenity-placeholder {
    width: 100%;
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
}

/* ========================================
   DESCRIPTION SECTION
   ======================================== */
.property-description {
    line-height: 1.6;
    color: #4b5563;
    font-size: 0.875rem;
}

.property-description p {
    margin-bottom: 1rem;
}

.property-description p:last-child {
    margin-bottom: 0;
}

/* ========================================
   PLACEHOLDER STATES
   ======================================== */
.placeholder-message {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.placeholder-icon {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.placeholder-icon i {
    color: white;
    font-size: 1.25rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
    .modal-content {
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .amenities-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .price-section {
        padding-right: 0;
        padding-bottom: 4rem;
    }
    
    .contact-btn {
        position: static;
        margin-top: 1rem;
        align-self: flex-start;
    }
    
    .property-operation-badge {
        position: static;
        margin-top: 1rem;
        align-self: flex-start;
    }
}

@media (max-width: 640px) {
    .modal-content {
        border-radius: 1rem;
        margin: 0.25rem;
    }
    
    .property-content-scroll {
        padding: 1rem;
    }
    
    .section-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .property-title {
        font-size: 1.25rem;
    }
    
    .property-price-display {
        font-size: 1.5rem;
    }
    
    .amenities-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .requirements-chips {
        gap: 0.375rem;
    }
    
    .requirement-chip {
        font-size: 0.6875rem;
        padding: 0.375rem 0.625rem;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */
@media (prefers-contrast: high) {
    .section-card {
        border-width: 2px;
        border-color: #374151;
    }
    
    .amenity-chip,
    .requirement-chip {
        border-width: 3px;
    }
}

/* ========================================
   RESPONSIVE MODAL ADJUSTMENTS
   ======================================== */

/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
    .modal-overlay {
        padding: 1.5rem 1rem;
        padding-top: 7rem; /* Ajustado para tablets */
    }
    
    .modal-content {
        max-height: calc(100vh - 8rem);
        min-height: 50vh;
        margin-bottom: 1.5rem;
    }
}

/* Móviles */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem 0.5rem;
        padding-top: 6rem; /* Ajustado para móviles */
    }
    
    .modal-content {
        border-radius: 1rem;
        max-height: calc(100vh - 6rem);
        min-height: 40vh;
        margin-bottom: 1rem;
    }
    
    #close-property-modal-btn {
        top: 0.5rem;
        right: 0.5rem;
        width: 2rem;
        height: 2rem;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 0.5rem;
        padding-top: 5rem; /* Ajustado para móviles pequeños */
    }
    
    .modal-content {
        border-radius: 0.75rem;
        max-height: calc(100vh - 5rem);
        min-height: 35vh;
        margin-bottom: 0.5rem;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .modal-overlay {
        position: static;
        background: none;
        backdrop-filter: none;
    }
    
    .modal-content {
        box-shadow: none;
        max-height: none;
        height: auto;
    }
    
    .gallery-section {
        display: none;
    }
    
    .modal-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .contact-btn,
    #close-property-modal-btn,
    .gallery-nav-btn,
    .gallery-fullscreen-btn {
        display: none;
    }
}
