/* =============================================
   RESPONSIVE STYLES - WebBasic
   Mobile-first approach
   ============================================= */

/* ===== TABLET (768px and down) ===== */
@media (max-width: 1024px) {
    :root {
        --header-height: var(--header-height-mobile);
        --font-size-5xl: 2.5rem;
        --font-size-4xl: 2rem;
    }
    
    .banner-title {
        font-size: var(--font-size-4xl);
    }
    
    .welcome-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .welcome-image {
        order: -1;
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .social-sidebar {
        display: none;
    }
}

/* ===== MOBILE (767px and down) ===== */
@media (max-width: 767px) {
    .main-nav {
        position: fixed;
        top: var(--header-height-mobile);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height-mobile));
        background: var(--color-white);
        box-shadow: var(--shadow-xl);
        transition: left var(--transition-base);
        z-index: 999;
    }
    
    .main-nav.active {
        left: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        padding: 2rem;
        gap: 0;
    }
    
    .main-nav li {
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .main-nav a {
        display: block;
        padding: 1rem 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    .hero-banner {
        height: 70vh;
    }
    
    .banner-title {
        font-size: var(--font-size-3xl);
    }
    
    .banner-subtitle {
        font-size: var(--font-size-base);
    }
    
    .welcome-section,
    .services-section {
        padding: var(--spacing-3xl) 0;
    }
    
    .section-title {
        font-size: var(--font-size-3xl);
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .whatsapp-float i {
        font-size: 1.75rem;
    }
    
    .modal-content {
        margin: 10% 1rem;
        padding: 1.5rem;
    }
    
    .swiper-button-prev,
    .swiper-button-next {
        width: 40px;
        height: 40px;
    }
}

/* ===== SMALL MOBILE (480px and down) ===== */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .logo-text {
        font-size: var(--font-size-lg);
    }
    
    .banner-title {
        font-size: var(--font-size-2xl);
    }
    
    .section-title {
        font-size: var(--font-size-2xl);
    }
    
    .service-card {
        padding: 2rem 1.5rem;
    }
    
    .service-icon {
        width: 70px;
        height: 70px;
    }
    
    .service-icon i {
        font-size: 1.75rem;
    }
}

/* ===== LARGE DESKTOP (1400px and up) ===== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Products */
@media (max-width: 767px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Contact */
@media (max-width: 1024px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 767px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .contact-form-wrapper,
    .contact-info-wrapper {
        padding: 2rem;
    }
    
    .map-container {
        height: 350px;
    }
}

/* Content Sections */
@media (max-width: 767px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .content-cta {
        flex-direction: column;
    }
    
    .content-cta .btn {
        width: 100%;
    }
}

/* Values & Team */
@media (max-width: 767px) {
    .values-grid,
    .team-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Error 404 */
@media (max-width: 767px) {
    .error-number {
        font-size: 6rem;
    }
    
    .error-title {
        font-size: var(--font-size-3xl);
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .error-actions .btn {
        width: 100%;
    }
}

/* CTA Section */
@media (max-width: 767px) {
    .cta-content h2 {
        font-size: var(--font-size-3xl);
    }
    
    .cta-content p {
        font-size: var(--font-size-base);
    }
}

/* Search button responsive */
@media (max-width: 767px) {
    .search-toggle {
        margin-left: auto;
        margin-right: 1rem;
    }
    
    .search-modal-content {
        padding: 0 1rem;
    }
    
    .search-close {
        right: 1rem;
    }
    
    .search-box input {
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }
    
    .search-submit {
        padding: 1rem 1.5rem;
    }
}

/* Clients Section */
@media (max-width: 767px) {
    .clients-section {
        padding: 2rem 0;
    }
    
    .client-logo {
        height: 100px;
    }
    
    .client-logo img {
        max-height: 60px;
    }
}
/* ============================================
   MOBILE FIXES
   ============================================ */

/* Titulares más pequeños en móvil */
@media (max-width: 767px) {
    .section-title,
    .page-title {
        font-size: 1.75rem !important;
    }
    
    h2.section-title {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    .banner-title {
        font-size: 1.5rem !important;
    }
    
    /* Header mobile - lupa junto al hamburguesa */
    .search-toggle {
        order: 2;
        margin-left: 0.5rem;
    }
    
    .mobile-menu-toggle {
        order: 3;
        margin-left: 0.5rem;
    }
    
    /* Modal mobile - quitar fixed del footer */
    .modal-content {
        max-height: 90vh;
    }
    
    .modal-body {
        max-height: none;
        padding-bottom: 2rem;
    }
    
    .modal-footer {
        position: static;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    /* Modal close button más visible */
    .modal-close {
        font-size: 2.5rem;
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.5);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Redes sociales en menú móvil */
    .main-nav {
        padding-bottom: 4rem;
    }
    
    .mobile-social {
        display: flex;
        gap: 1rem;
        justify-content: center;
        padding: 2rem 0 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 2rem;
    }
    
    .mobile-social a {
        width: 45px;
        height: 45px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--color-white);
        font-size: 1.25rem;
        transition: var(--transition-base);
    }
    
    .mobile-social a:hover {
        background: var(--color-primary);
    }
}
/* ============================================
   MOBILE FIXES CORRECTOS
   ============================================ */

@media (max-width: 767px) {
    /* 1. TITULARES MÁS PEQUEÑOS */
    .section-title,
    .page-title {
        font-size: 1.75rem !important;
    }
    
    h2.section-title {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    .banner-title {
        font-size: 1.5rem !important;
    }
    
    /* 2. HEADER MOBILE - LUPA Y HAMBURGUESA JUNTOS A LA DERECHA */
    .header-content {
        justify-content: space-between;
    }
    
    .logo {
        order: 1;
    }
    
    .main-nav {
        order: 4;
    }
    
    .search-toggle {
        order: 2;
        margin-left: auto;
        margin-right: 0.5rem;
        display: flex;
    }
    
    .mobile-menu-toggle {
        order: 3;
        margin-left: 0;
    }
    
    /* 3. MODAL - X DE CERRAR MÁS GRANDE Y VISIBLE */
    .modal-content {
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-close {
        position: sticky;
        top: 0;
        right: 0;
        margin-left: auto;
        font-size: 2.5rem;
        width: 50px;
        height: 50px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        z-index: 10;
        margin-bottom: -50px;
    }
    
    .modal-close:hover {
        background: rgba(0, 0, 0, 0.9);
    }
    
    /* 4. MODAL - FOOTER SIN FIXED (SCROLL NORMAL) */
    .modal-body {
        max-height: none !important;
        overflow-y: visible !important;
        padding-bottom: 1rem;
    }
    
    .modal-footer {
        position: static !important;
        padding: 2rem 1.5rem;
        margin-top: 0;
    }
    
    /* 5. REDES SOCIALES EN MENÚ MÓVIL */
    .mobile-social {
        display: flex !important;
        gap: 1.5rem;
        justify-content: center;
        padding: 2rem 0 1rem;
        border-top: 1px solid var(--color-gray-200);
        margin-top: auto;
        position: absolute;
        bottom: 2rem;
        left: 0;
        right: 0;
    }
    
    .mobile-social a {
        width: 50px;
        height: 50px;
        background: var(--color-primary);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.25rem;
        transition: var(--transition-base);
    }
    
    .mobile-social a:hover {
        background: var(--color-secondary);
        transform: translateY(-3px);
    }
    
    /* Ajustar nav para que las redes no se corten */
    .main-nav {
        padding-bottom: 6rem;
    }
}
/* ============================================
   MOBILE FINAL FIXES
   ============================================ */

@media (max-width: 767px) {
    /* FIX 1: X del hamburguesa visible completa */
    .mobile-menu-toggle {
        width: 35px;
        height: 35px;
        padding: 5px;
    }
    
    .mobile-menu-toggle span {
        width: 100%;
        height: 3px;
        background: var(--color-dark);
        display: block;
        margin: 5px 0;
        transition: 0.3s;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* FIX 2: Redes sociales visibles en menú */
    .main-nav {
        position: relative;
        display: flex;
        flex-direction: column;
    }
    
    .main-nav ul {
        flex: 1;
    }
    
    .mobile-social {
        display: flex !important;
        gap: 1.5rem;
        justify-content: center;
        padding: 2rem;
        border-top: 1px solid var(--color-gray-200);
        background: var(--color-light);
        position: static !important;
    }
    
    .mobile-social a {
        width: 50px;
        height: 50px;
        background: var(--color-primary);
        border-radius: 50%;
        display: flex !important;
        align-items: center;
        justify-content: center;
        color: white !important;
        font-size: 1.25rem;
    }
    
    /* FIX 3: Espacios del modal con scroll */
    .modal-body {
        padding-bottom: 1rem !important;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem 1.5rem !important;
    }
}
/* ============================================
   FIX URGENTE - MENÚ MÓVIL
   ============================================ */

@media (max-width: 767px) {
    /* Menú OCULTO por defecto */
    .main-nav {
        position: fixed;
        top: var(--header-height-mobile);
        left: -100% !important;
        width: 100%;
        height: calc(100vh - var(--header-height-mobile));
        background: var(--color-white);
        box-shadow: var(--shadow-xl);
        transition: left 0.3s ease;
        z-index: 999;
        overflow-y: auto;
    }
    
    /* Menú VISIBLE cuando está activo */
    .main-nav.active {
        left: 0 !important;
    }
    
    /* Estructura interna del menú */
    .main-nav ul {
        flex-direction: column;
        padding: 2rem;
        gap: 0;
    }
    
    .main-nav li {
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .main-nav a {
        display: block;
        padding: 1rem 0;
        color: var(--color-dark);
    }
    
    /* Redes sociales DENTRO del menú */
    .mobile-social {
        display: flex !important;
        gap: 1.5rem;
        justify-content: center;
        padding: 2rem;
        border-top: 1px solid var(--color-gray-200);
        background: var(--color-light);
        margin-top: 2rem;
    }
    
    .mobile-social a {
        width: 50px;
        height: 50px;
        background: var(--color-primary);
        border-radius: 50%;
        display: flex !important;
        align-items: center;
        justify-content: center;
        color: white !important;
        font-size: 1.25rem;
    }
    
    /* Hamburguesa visible */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        width: 30px;
        height: 30px;
        justify-content: center;
    }
    
    .mobile-menu-toggle span {
        width: 100%;
        height: 3px;
        background: var(--color-dark);
        transition: 0.3s;
    }
    
    /* X cuando está activo */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
}

/* Gallery responsive */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-modal-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-filters {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .gallery-overlay h3 {
        font-size: 1.25rem;
    }
}
/* ============================================
   HEADER MÓVIL - FIX FINAL
   ============================================ */

@media (max-width: 767px) {
    /* HAMBURGUESA VISIBLE EN NEGRO */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        width: 28px;
        height: 28px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }
    
    .mobile-menu-toggle span {
        width: 100%;
        height: 3px;
        background: #000;
        display: block;
        transition: 0.3s;
        border-radius: 2px;
    }
    
    /* X CUANDO ESTÁ ACTIVO - MÁS VISIBLE */
    .mobile-menu-toggle.active span {
        background: #000;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* LUPA PEGADA AL HAMBURGUESA */
    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .logo {
        order: 1;
    }
    
    .search-toggle {
        order: 2;
        margin-left: auto;
        margin-right: 0.75rem;
        color: #000;
        font-size: 1.25rem;
    }
    
    .mobile-menu-toggle {
        order: 3;
        margin-left: 0;
    }
    
    .main-nav {
        order: 4;
    }
    
    /* REDES SOCIALES DESTACADAS CON FONDO OSCURO */
    .mobile-social {
        display: flex !important;
        gap: 1rem;
        justify-content: center;
        padding: 2rem;
        background: linear-gradient(135deg, #1e3a8a, #3b82f6);
        margin: 2rem -2rem 0 -2rem;
    }
    
    .mobile-social a {
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.2);
        border: 2px solid white;
        border-radius: 50%;
        display: flex !important;
        align-items: center;
        justify-content: center;
        color: white !important;
        font-size: 1.25rem;
        transition: all 0.3s ease;
    }
    
    .mobile-social a:hover {
        background: white;
        color: #1e3a8a !important;
        transform: translateY(-3px);
    }
}

/* Gallery Modal Responsive */
@media (max-width: 767px) {
    .gallery-modal-fullscreen {
        max-width: 100vw;
        max-height: 100vh;
    }
    
    .gallery-modal-image-full {
        height: 70vh;
    }
    
    .gallery-modal-image-full img {
        max-height: 70vh;
    }
    
    .gallery-modal-info-overlay {
        padding: 2rem 1.5rem 1.5rem;
    }
    
    .gallery-modal-info-overlay h3 {
        font-size: 1.5rem;
    }
    
    .gallery-modal-info-overlay ul {
        grid-template-columns: 1fr;
    }
}
