/* ============================================
   LIBERTY INMOBILIARIA - CSS RESPONSIVO
   Versión: 3.0 - Optimizado para todos los dispositivos
   ============================================ */

/* ====== VARIABLES RESPONSIVAS ====== */
:root {
    /* Breakpoints principales */
    --breakpoint-xs: 480px;
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
    
    /* Espaciado fluido */
    --container-padding-mobile: 1rem;
    --container-padding-tablet: 1.5rem;
    --container-padding-desktop: 2rem;
    
    /* Tamaños de grid fluidos */
    --grid-gap-mobile: 1rem;
    --grid-gap-tablet: 1.5rem;
    --grid-gap-desktop: 2rem;
}

/* ====== MOBILE FIRST - EXTRA SMALL (hasta 480px) ====== */
@media (max-width: 479px) {
    /* Contenedores */
    .container {
        padding: 0 var(--container-padding-mobile);
    }
    
    /* Tipografía móvil */
    h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
        line-height: 1.1;
    }
    
    h2 {
        font-size: clamp(1.5rem, 4vw, 2rem);
        line-height: 1.2;
    }
    
    h3 {
        font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    }
    
    /* Hero section móvil */
    .hero {
        min-height: 90vh;
        padding: 2rem 0;
    }
    
    .hero-title {
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 2rem 0;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    .hero-cta {
        flex-direction: column;
        gap: 1rem;
        margin-top: 1.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.5rem;
    }
    
    /* Header móvil */
    .header-container {
        padding: 0.75rem 0;
    }
    
    .logo span {
        font-size: 1.125rem;
    }
    
    .header-cta .btn {
        width: auto;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Búsqueda móvil */
    .search-container {
        padding: 1.5rem;
        margin-top: 2rem;
    }
    
    .search-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .search-inputs {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .search-input {
        padding: 0.875rem 2.5rem 0.875rem 0.875rem;
        font-size: 1rem;
    }
    
    .search-button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Propiedades móvil */
    .property-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .property-card {
        border-radius: 0.75rem;
    }
    
    .property-image {
        height: 200px;
    }
    
    .property-details {
        padding: 1.25rem;
    }
    
    .property-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .property-actions .btn {
        width: 100%;
    }
    
    /* Ventajas móvil */
    .advantages-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .advantage-card {
        padding: 1.5rem;
    }
    
    .advantage-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin: 0 auto 1rem;
    }
    
    /* Proyecto destacado móvil */
    .project-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .project-features {
        margin-bottom: 1.5rem;
    }
    
    .feature-row {
        margin-bottom: 0.75rem;
        font-size: 0.9rem;
    }
    
    .project-pricing {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .price-amount {
        font-size: 2rem;
    }
    
    .project-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    /* Footer móvil */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    .contact-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* Botones flotantes móvil */
    .floating-buttons {
        bottom: 1rem;
        right: 1rem;
    }
    
    .floating-whatsapp,
    .back-to-top {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    /* Secciones móvil */
    section {
        padding: 3rem 0;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
}

/* ====== SMALL DEVICES (480px - 639px) ====== */
@media (min-width: 480px) and (max-width: 639px) {
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .property-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
    
    .advantages-grid {
        grid-template-columns: 1fr;
    }
    
    .search-inputs {
        grid-template-columns: 1fr;
    }
    
    .btn {
        width: auto;
    }
    
    .hero-cta {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ====== MEDIUM DEVICES - TABLETS (640px - 767px) ====== */
@media (min-width: 640px) and (max-width: 767px) {
    .container {
        padding: 0 var(--container-padding-tablet);
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .property-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-inputs {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-cta {
        flex-direction: row;
        justify-content: center;
    }
    
    .project-actions {
        flex-direction: row;
        justify-content: flex-start;
    }
    
    .property-actions {
        flex-direction: row;
    }
}

/* ====== LARGE TABLETS - SMALL LAPTOPS (768px - 1023px) ====== */
@media (min-width: 768px) and (max-width: 1023px) {
    .nav {
        display: none; /* Mantener menú móvil */
    }
    
    .hero-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    .property-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .search-inputs {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .project-content {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    
    /* Header en tablet */
    .header-container {
        padding: 1rem 0;
    }
    
    .logo span {
        font-size: 1.25rem;
    }
    
    /* Formularios en tablet */
    .search-container {
        padding: 2rem;
    }
    
    .property-details {
        padding: 1.5rem;
    }
}

/* ====== DESKTOP (1024px - 1279px) ====== */
@media (min-width: 1024px) and (max-width: 1279px) {
    .container {
        padding: 0 var(--container-padding-desktop);
    }
    
    /* Mostrar navegación desktop */
    .nav {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    .hero-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .property-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .advantages-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .search-inputs {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .project-content {
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
    }
    
    /* Efectos hover en desktop */
    .property-card:hover {
        transform: translateY(-8px);
    }
    
    .advantage-card:hover {
        transform: translateY(-5px);
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* ====== LARGE DESKTOP (1280px - 1535px) ====== */
@media (min-width: 1280px) and (max-width: 1535px) {
    .container {
        max-width: 1280px;
    }
    
    .property-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
    
    .advantages-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
    
    .search-inputs {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    /* Espaciado mejorado */
    section {
        padding: 6rem 0;
    }
    
    .hero {
        min-height: 100vh;
    }
    
    .hero-stats {
        margin: 4rem 0;
    }
    
    .search-container {
        padding: 3rem;
        margin-top: 4rem;
    }
}

/* ====== EXTRA LARGE DESKTOP (1536px+) ====== */
@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
        padding: 0 3rem;
    }
    
    .property-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3rem;
    }
    
    .advantages-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3rem;
    }
    
    /* Tipografía para pantallas grandes */
    h1 {
        font-size: 4rem;
    }
    
    h2 {
        font-size: 3rem;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
    }
    
    /* Espaciado premium */
    section {
        padding: 8rem 0;
    }
    
    .hero-stats {
        margin: 5rem 0;
        gap: 3rem;
    }
    
    .search-container {
        padding: 4rem;
        margin-top: 5rem;
    }
}

/* ====== LANDSCAPE MOBILE (altura máxima 480px) ====== */
@media (max-height: 480px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 1rem 0;
    }
    
    .hero-content {
        padding: 1rem 0;
    }
    
    .hero-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
        margin: 1.5rem 0;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .search-container {
        margin-top: 1.5rem;
        padding: 1.5rem;
    }
    
    .header-spacer {
        height: 60px !important;
    }
}

/* ====== PRINT STYLES ====== */
@media print {
    /* Ocultar elementos no necesarios para impresión */
    .header,
    .mobile-menu,
    .floating-buttons,
    .hero-cta,
    .search-container,
    .final-cta,
    .social-links,
    .btn,
    button {
        display: none !important;
    }
    
    /* Ajustar para impresión */
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: none;
        padding: 0;
        margin: 0;
    }
    
    .hero {
        min-height: auto;
        padding: 1rem 0;
        background: none !important;
        color: #000;
    }
    
    .hero::before,
    .hero::after {
        display: none;
    }
    
    .property-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .property-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .section-header h2 {
        border-bottom: 2px solid #000;
        padding-bottom: 0.5rem;
    }
    
    /* Asegurar contraste para impresión */
    h1, h2, h3, h4, h5, h6 {
        color: #000;
    }
    
    .property-price {
        color: #000 !important;
        font-weight: bold;
    }
}

/* ====== HIGH CONTRAST MODE ====== */
@media (prefers-contrast: high) {
    :root {
        --primary: #0066CC;
        --primary-dark: #003366;
        --secondary: #CC0000;
        --gray-500: #666666;
        --gray-700: #333333;
    }
    
    .btn {
        border-width: 3px;
    }
    
    .property-card {
        border: 2px solid var(--gray-300);
    }
    
    .search-input:focus {
        border-width: 3px;
        box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.3);
    }
}

/* ====== REDUCED MOTION ====== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero {
        animation: none;
    }
    
    .property-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .floating-whatsapp {
        animation: none;
    }
}

/* ====== DARK MODE SUPPORT ====== */
@media (prefers-color-scheme: dark) {
    /* Implementación básica de modo oscuro */
    :root {
        --white: #1a1a1a;
        --black: #ffffff;
        --light: #2a2a2a;
        --dark: #ffffff;
        --gray-50: #2a2a2a;
        --gray-100: #333333;
        --gray-200: #404040;
        --gray-800: #cccccc;
        --gray-900: #ffffff;
    }
    
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .property-card {
        background: #2a2a2a;
        border-color: #404040;
    }
    
    .search-container {
        background: rgba(42, 42, 42, 0.95);
    }
    
    .advantage-card {
        background: #2a2a2a;
        border-color: #404040;
    }
}

/* ====== UTILITIES RESPONSIVAS ====== */
.hidden-mobile {
    display: block;
}

.visible-mobile {
    display: none;
}

@media (max-width: 767px) {
    .hidden-mobile {
        display: none !important;
    }
    
    .visible-mobile {
        display: block !important;
    }
    
    .visible-mobile.flex {
        display: flex !important;
    }
    
    .visible-mobile.grid {
        display: grid !important;
    }
}

.hidden-tablet {
    display: block;
}

.visible-tablet {
    display: none;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hidden-tablet {
        display: none !important;
    }
    
    .visible-tablet {
        display: block !important;
    }
}

.hidden-desktop {
    display: block;
}

.visible-desktop {
    display: none;
}

@media (min-width: 1024px) {
    .hidden-desktop {
        display: none !important;
    }
    
    .visible-desktop {
        display: block !important;
    }
}

/* ====== ASPECT RATIOS RESPONSIVOS ====== */
.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
}

.aspect-ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.aspect-ratio-1-1 {
    aspect-ratio: 1 / 1;
}

/* Fallback para navegadores que no soportan aspect-ratio */
@supports not (aspect-ratio: 1) {
    .aspect-ratio-16-9 {
        position: relative;
        height: 0;
        padding-bottom: 56.25%;
    }
    
    .aspect-ratio-4-3 {
        position: relative;
        height: 0;
        padding-bottom: 75%;
    }
    
    .aspect-ratio-1-1 {
        position: relative;
        height: 0;
        padding-bottom: 100%;
    }
    
    .aspect-ratio-16-9 > *,
    .aspect-ratio-4-3 > *,
    .aspect-ratio-1-1 > * {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* ====== PERFORMANCE OPTIMIZATIONS ====== */
/* Optimización para imágenes en dispositivos móviles */
@media (max-width: 767px) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Optimización de fuentes para pantallas pequeñas */
@media (max-width: 479px) {
    body {
        -webkit-text-stroke: 0.01em transparent;
        text-rendering: optimizeSpeed;
    }
}

/* Optimización de animaciones para dispositivos móviles */
@media (max-width: 767px) {
    .property-card,
    .advantage-card,
    .btn {
        will-change: auto;
    }
    
    .property-card:hover,
    .advantage-card:hover {
        transform: none;
    }
}
