/* ===================================
   Responsive Design Automático
   =================================== */

/* Variables CSS Fluidas - Se adaptan automáticamente al viewport */
:root {
    /* Tamaños de fuente fluidos con clamp() */
    --font-size-fluid-xs: clamp(0.75rem, 1.5vw, 0.875rem);
    --font-size-fluid-sm: clamp(0.875rem, 2vw, 1rem);
    --font-size-fluid-base: clamp(1rem, 2.5vw, 1.125rem);
    --font-size-fluid-lg: clamp(1.125rem, 3vw, 1.5rem);
    --font-size-fluid-xl: clamp(1.5rem, 4vw, 2rem);
    --font-size-fluid-2xl: clamp(2rem, 5vw, 3rem);
    --font-size-fluid-3xl: clamp(2.5rem, 6vw, 4rem);
    
    /* Espaciados fluidos */
    --spacing-fluid-xs: clamp(0.25rem, 1vw, 0.5rem);
    --spacing-fluid-sm: clamp(0.5rem, 2vw, 1rem);
    --spacing-fluid-md: clamp(1rem, 3vw, 2rem);
    --spacing-fluid-lg: clamp(2rem, 4vw, 3rem);
    --spacing-fluid-xl: clamp(3rem, 5vw, 5rem);
    
    /* Tamaños de contenedor fluidos */
    --container-fluid: min(95%, 1400px);
}

/* Hero Slider - Responsive automático */
.hero-slider {
    height: clamp(500px, 100vh, 800px);
    min-height: 100vh;
}

.slide-content {
    max-width: var(--container-fluid);
    padding: var(--spacing-fluid-md);
}

.slide-title {
    font-size: var(--font-size-fluid-3xl);
    line-height: 1.2;
    margin-bottom: var(--spacing-fluid-sm);
}

.slide-text {
    font-size: var(--font-size-fluid-lg);
    margin-bottom: var(--spacing-fluid-md);
}

/* Botones responsive automáticos */
.btn {
    font-size: var(--font-size-fluid-base);
    padding: var(--spacing-fluid-sm) var(--spacing-fluid-md);
}

.hero-phone-button {
    font-size: var(--font-size-fluid-lg) !important;
    padding: var(--spacing-fluid-sm) var(--spacing-fluid-md) !important;
}

/* Grids automáticos */
.services-grid,
.features-grid,
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: var(--spacing-fluid-md);
}

/* Textos fluidos automáticos */
h1, .section-title {
    font-size: var(--font-size-fluid-3xl);
}

h2 {
    font-size: var(--font-size-fluid-2xl);
}

h3 {
    font-size: var(--font-size-fluid-xl);
}

p, .nav-link {
    font-size: var(--font-size-fluid-base);
}

/* Container fluido automático */
.container {
    width: var(--container-fluid);
    padding-left: var(--spacing-fluid-sm);
    padding-right: var(--spacing-fluid-sm);
}

/* ===================================
   Media Queries para ajustes finos
   =================================== */

/* Tablets y dispositivos medianos (768px - 1024px) */
@media (max-width: 1024px) {
    :root {
        --font-size-base: 15px;
        --spacing-xl: 4rem;
    }
    
    .container {
        width: 92%;
    }
    
    .slide-title {
        font-size: 2.5rem;
    }
    
    .slide-text {
        font-size: 1.2rem;
    }
}

/* Tablets pequeñas y móviles grandes (481px - 768px) */
@media (max-width: 768px) {
    :root {
        --font-size-base: 14px;
        --spacing-sm: 0.8rem;
        --spacing-md: 1.5rem;
        --spacing-lg: 3rem;
        --spacing-xl: 3rem;
    }
    
    .container {
        width: 95%;
    }
    
    /* Header Mobile */
    .header-content {
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
    }
    
    .logo-link {
        z-index: 1002;
    }
    
    .logo {
        height: 70px;
    }
    
    .nav-toggle {
        display: flex;
        order: 2;
        z-index: 1002;
        position: relative;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: var(--color-primary);
        flex-direction: column;
        align-items: flex-start;
        padding: 6rem var(--spacing-md) var(--spacing-md);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 1001;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-item {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid rgba(228, 226, 221, 0.1);
    }
    
    .nav-link {
        display: block;
        padding: 1rem var(--spacing-sm);
        width: 100%;
        font-size: 1.05rem;
        transition: all 0.3s ease;
    }
    
    .nav-link::after {
        display: none;
    }
    
    /* =============================================
       DROPDOWN MOBILE - VERSIÓN CORREGIDA
       ============================================= */
    .dropdown {
        width: 100%;
    }
    
    .dropdown-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none;
        background-color: rgba(228, 226, 221, 0.08);
        margin: 0 var(--spacing-sm) var(--spacing-sm);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, padding 0.3s ease;
        border-radius: var(--radius-sm);
        display: block !important;
        min-width: auto;
    }
    
    .dropdown.active .dropdown-menu {
        max-height: 500px !important;
        padding: 0.5rem 0 !important;
    }
    
    .dropdown-menu li {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        margin: 0 !important;
        border-bottom: none;
    }
    
    .dropdown-menu a {
        display: block;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        color: var(--color-text-light);
        transition: all 0.2s ease;
    }
    
    .dropdown-menu a:hover {
        background-color: rgba(212, 175, 55, 0.15);
        color: var(--color-accent);
    }
    
    /* Flecha del dropdown */
    .dropdown > .nav-link {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-right: 1rem;
    }
    
    .dropdown > .nav-link::after {
        content: '▼';
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
        font-size: 0.65rem;
        opacity: 0.7;
        width: auto;
        height: auto;
        background: none;
    }
    
    .dropdown.active > .nav-link::after {
        transform: translateY(-50%) rotate(180deg);
        opacity: 1;
    }
    
    /* Anular comportamiento hover del desktop en móvil */
    .dropdown:hover .dropdown-menu {
        max-height: 0;
        padding: 0;
    }
    
    .dropdown.active:hover .dropdown-menu,
    .dropdown.active .dropdown-menu {
        max-height: 500px !important;
        padding: 0.5rem 0 !important;
    }

    /* Mobile Menu Toggle Animation */
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Mobile Menu Overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        z-index: 1000;
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Hero Slider Mobile */
    .hero-slider {
        height: 100vh;
        min-height: 600px;
    }
    
    .slide {
        padding: 2rem 1rem;
    }
    
    .slide-content {
        max-width: 90%;
        padding: 1.5rem;
    }
    
    .slide-title {
        font-size: 1.8rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .slide-text {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .slider-btn {
        width: 40px;
        height: 40px;
    }
    
    .slider-btn.prev {
        left: var(--spacing-sm);
    }
    
    .slider-btn.next {
        right: var(--spacing-sm);
    }
    
    /* Hero phone button mobile */
    .hero-phone-cta {
        margin: 1.5rem 0 1rem !important;
    }
    
    .hero-phone-button {
        font-size: 1.2rem !important;
        padding: 1rem 1.8rem !important;
        white-space: nowrap;
    }
    
    .hero-phone-button svg {
        width: 24px !important;
        height: 24px !important;
    }
    
    .hero-phone-cta p {
        font-size: 0.9rem !important;
    }
    
    /* Services Grid Mobile */
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    /* CTA Buttons Mobile */
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
    
    /* Floating Buttons Mobile */
    .floating-contact {
        right: var(--spacing-sm);
        bottom: calc(var(--spacing-sm) + 60px);
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
    }
    
    .floating-btn::before {
        display: none;
    }
    

    
    /* Section Spacing Mobile */
    .services-section,
    .why-us-section,
    .cta-section {
        padding: var(--spacing-lg) 0;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
}

    /* Móviles pequeños (320px - 480px) */
@media (max-width: 480px) {
    :root {
        --font-size-base: 13px;
        --spacing-xs: 0.4rem;
        --spacing-sm: 0.6rem;
        --spacing-md: 1rem;
        --spacing-lg: 2rem;
        --spacing-xl: 2.5rem;
    }
    
    .container {
        width: 95%;
        padding: 0 var(--spacing-xs);
    }
    
    /* Header Extra Small */
    .logo {
        height: 60px;
    }
    
    .nav-menu {
        width: 90%;
        max-width: 280px;
        padding: 5rem var(--spacing-sm) var(--spacing-md);
    }
    
    /* Hero Slider Extra Small */
    .hero-slider {
        height: auto;
        min-height: 450px;
        padding: 2rem 0;
    }
    
    .slide-title {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    .slide-text {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .slider-btn {
        width: 35px;
        height: 35px;
    }
    
    .slider-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* Hero phone button responsive */
    .hero-phone-cta {
        margin: 1.5rem 0 1rem !important;
        gap: 0.75rem !important;
    }
    
    .hero-phone-button {
        font-size: 1.1rem !important;
        padding: 0.9rem 1.3rem !important;
        gap: 0.5rem !important;
    }
    
    .hero-phone-button svg {
        width: 22px !important;
        height: 22px !important;
    }
    
    .hero-phone-cta p {
        font-size: 0.85rem !important;
    }
    
    /* Service Cards Extra Small */
    .service-card {
        padding: 1.25rem;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
    }
    
    .service-icon svg {
        width: 35px;
        height: 35px;
    }
    
    .service-card h3 {
        font-size: 1.15rem;
    }
    
    .service-card p {
        font-size: 0.9rem;
    }
    
    /* Feature Items Extra Small */
    .feature-number {
        font-size: 2rem;
    }
    
    .feature-item h3 {
        font-size: 1.15rem;
    }
    
    .feature-item p {
        font-size: 0.9rem;
    }
    
    /* CTA Section Extra Small */
    .cta-content h2 {
        font-size: 1.5rem;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
    
    /* Footer Extra Small */
    .footer {
        padding: var(--spacing-lg) 0 var(--spacing-sm);
    }
    
    .footer-logo {
        height: 100px;
    }
    
    .footer-grid {
        gap: 2rem;
    }
    
    .social-btn {
        width: 40px;
        height: 40px;
    }
    
    .social-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* Floating Buttons Extra Small */
    .floating-btn {
        width: 45px;
        height: 45px;
    }
    
    .floating-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* Section Titles Extra Small */
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
    }
    
    /* Gallery improvements for mobile */
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .gallery-item {
        height: 280px !important;
    }
    
    /* Form improvements for mobile */
    .contact-form,
    .contact-info {
        padding: 1.5rem !important;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Previene el zoom automático en iOS */
    }
}

/* Landscape Mode para móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-slider {
        height: 100vh;
        min-height: 400px;
    }
    
    .header {
        padding: var(--spacing-xs) 0;
    }
    
    .logo {
        height: 60px;
    }
}

/* Desktop Grande (1440px+) */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-slider {
        height: 700px;
    }
    
    .slide-title {
        font-size: 4.5rem;
    }
    
    .slide-text {
        font-size: 1.8rem;
    }
}

/* Ultra Wide Screens (1920px+) */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    .hero-slider {
        height: 800px;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
}

/* ===================================
   Utilidades Responsive
   =================================== */

/* Mostrar/Ocultar elementos según el dispositivo */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Texto responsive */
.text-responsive {
    font-size: clamp(0.875rem, 2vw, 1rem);
}

.heading-responsive {
    font-size: clamp(1.5rem, 4vw, 3rem);
}

/* Grid responsive automático */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.grid-auto-fill {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

/* Espaciado responsive */
@media (max-width: 768px) {
    .spacing-responsive {
        padding: var(--spacing-sm);
        margin: var(--spacing-sm);
    }
}

/* Imágenes responsive */
.img-responsive {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Videos responsive */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    .header,
    .footer,
    .whatsapp-float,
    .slider-btn,
    .slider-dots {
        display: none;
    }
    
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
    
    a {
        text-decoration: underline;
        color: #000;
    }
    
    .container {
        width: 100%;
        max-width: none;
    }
}

/* ===================================
   Dark Mode Support (Opcional)
   =================================== */

@media (prefers-color-scheme: dark) {
    /* Aquí puedes agregar estilos para modo oscuro si lo deseas */
    /* Por ahora mantenemos los colores de la marca */
}

/* ===================================
   Accesibilidad
   =================================== */

/* Mejora para usuarios con problemas de visión */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #000000;
        --color-secondary: #ffffff;
    }
}

/* Mejora para usuarios que prefieren reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .parallax-bg {
        background-attachment: scroll;
    }
}

/* Focus visible para navegación por teclado */
:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent);
    color: var(--color-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    text-decoration: none;
    z-index: 100;
}

.skip-to-main:focus {
    top: 0;
}
