/* ============================================
   MOBILE FIX - Correcciones de Responsividad
   ============================================ */

/* MÃ“VIL: Hero ocupa toda la pantalla */
@media (max-width: 768px) {
    #inicio {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 100vh !important;
        height: 100vh !important;
        padding: 2rem 1rem !important;
    }

    #inicio .z-10 {
        width: 100%;
    }

    /* Secciones con altura automÃ¡tica y padding reducido */
    .scroll-section {
        min-height: auto !important;
        height: auto !important;
        padding: 3rem 1rem !important;
        justify-content: flex-start !important;
    }

    /* Animaciones instantÃ¡neas en mÃ³vil */
    .reveal-item {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important;
    }

    /* TÃ­tulos mÃ¡s compactos */
    h1,
    .text-5xl,
    .text-6xl,
    .text-7xl {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }

    h2,
    .text-4xl {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Grids a 1 columna */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}
    
    /* MENÚ MÓVIL AJUSTADO */
    #mobile-menu nav {
        display: flex;
        flex-direction: column;
        gap: 1.5rem !important;
        padding: 2rem 0 !important;
        max-height: 60vh !important;
        overflow-y: auto !important;
    }
    
    #mobile-menu .mobile-nav-link {
        font-size: 1.3rem !important;
        padding: 0.5rem !important;
    }
    
    /* Botones de idioma visibles en móvil */
    #mobile-menu .absolute.bottom-10 {
        position: fixed !important;
        bottom: 2rem !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        display: flex !important;
        gap: 1rem !important;
        font-size: 1rem !important;
        z-index: 1000 !important;
    }
    
    .mobile-lang-switcher {
        color: white !important;
        opacity: 0.7 !important;
        font-weight: 600 !important;
    }
    
    .mobile-lang-switcher.active {
        opacity: 1 !important;
        color: #798C5D !important;
    }
}


/* ============================================
   RESPONSIVE CARDS - LAPTOP & TABLET
   ============================================ */

/* Ajuste para laptops y tablets */
@media (min-width: 769px) and (max-width: 1440px) {
    /* Cards de filosofía más compactas */
    .philosophy-card,
    .feature-card,
    .architecture-card {
        padding: 1.5rem !important;
    }
    
    .philosophy-card img,
    .feature-card img,
    .architecture-card img {
        height: 200px !important;
        object-fit: cover !important;
    }
    
    .philosophy-card p,
    .feature-card p,
    .architecture-card p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        max-height: 200px !important;
        overflow-y: auto !important;
    }
    
    .philosophy-card h3,
    .feature-card h3,
    .architecture-card h3 {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* Ajuste para pantallas grandes */
@media (min-width: 1441px) {
    .philosophy-card p,
    .feature-card p,
    .architecture-card p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
}


/* ============================================
   AJUSTE AGRESIVO PARA CARDS EN LAPTOP
   ============================================ */

@media (min-width: 769px) and (max-width: 1600px) {
    /* Reducir padding de secciones */
    .scroll-section {
        padding: 4rem 1.5rem !important;
    }
    
    /* Cards mucho más compactas */
    .philosophy-card,
    .feature-card,
    .architecture-card {
        padding: 1rem !important;
        max-width: 100% !important;
    }
    
    /* Imágenes más pequeñas */
    .philosophy-card img,
    .feature-card img,
    .architecture-card img {
        height: 150px !important;
        max-height: 150px !important;
        object-fit: cover !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Títulos más pequeños */
    .philosophy-card h3,
    .feature-card h3,
    .architecture-card h3 {
        font-size: 1.25rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.2 !important;
    }
    
    /* Texto más compacto */
    .philosophy-card p,
    .feature-card p,
    .architecture-card p {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
        text-align: justify !important;
    }
    
    /* Grid más ajustado */
    .grid.md\\:grid-cols-2 {
        gap: 1.5rem !important;
    }
}


/* ============================================
   BALANCE PERFECTO PARA CARDS EN LAPTOP
   ============================================ */

@media (min-width: 769px) and (max-width: 1600px) {
    /* Imágenes con altura balanceada */
    .philosophy-card img,
    .feature-card img,
    .architecture-card img {
        height: 180px !important;
        max-height: 180px !important;
        object-fit: cover !important;
        margin-bottom: 1rem !important;
    }
    
    /* Padding balanceado */
    .philosophy-card,
    .feature-card,
    .architecture-card {
        padding: 1.25rem !important;
    }
    
    /* Títulos con tamaño legible */
    .philosophy-card h3,
    .feature-card h3,
    .architecture-card h3 {
        font-size: 1.4rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Texto legible pero compacto */
    .philosophy-card p,
    .feature-card p,
    .architecture-card p {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
    }
}


/* ============================================
   FIX: Evitar que cards estorben al menú lateral
   ============================================ */

@media (min-width: 1024px) {
    /* Agregar margen derecho para no estorbar el menú lateral */
    .scroll-section .container {
        padding-right: 4rem !important;
    }
    
    /* Asegurar que el side-nav esté siempre visible */
    #side-nav {
        z-index: 200 !important;
    }
}


/* ============================================
   MODAL DE PROYECTOS - SOPORTE PARA TEMA CLARO/OSCURO
   ============================================ */

/* Tema Claro (por defecto) */
.modal-container-premium {
    background: #f8f9fa !important;
    color: #1a1a1a !important;
}

.modal-container-premium h2 {
    color: #1a1a1a !important;
}

.modal-container-premium .filter-button-premium {
    color: #4a5568 !important;
    border-color: #cbd5e0 !important;
}

.modal-container-premium .filter-button-premium.active {
    background: #798C5D !important;
    color: white !important;
    border-color: #798C5D !important;
}

/* Tema Oscuro */
html.dark-theme .modal-container-premium {
    background: #0d0d0d !important;
    color: #ffffff !important;
}

html.dark-theme .modal-container-premium h2 {
    color: #ffffff !important;
}

html.dark-theme .modal-container-premium .filter-button-premium {
    color: #a0aec0 !important;
    border-color: #2d3748 !important;
}

html.dark-theme .modal-container-premium .filter-button-premium.active {
    background: #798C5D !important;
    color: white !important;
    border-color: #798C5D !important;
}

/* Botón de cerrar */
.modal-container-premium .close {
    color: #4a5568 !important;
}

html.dark-theme .modal-container-premium .close {
    color: #a0aec0 !important;
}

.modal-container-premium .close:hover {
    color: #1a1a1a !important;
}

html.dark-theme .modal-container-premium .close:hover {
    color: white !important;
}


/* ============================================
   FIX: Posición del botón de cerrar modal
   ============================================ */

.modal-container-premium .close,
.modal .close {
    position: absolute !important;
    top: 1.5rem !important;
    right: 1.5rem !important;
    left: auto !important;
    font-size: 2rem !important;
    cursor: pointer !important;
    z-index: 1000 !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
}

.modal-container-premium .close:hover,
.modal .close:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    transform: rotate(90deg) !important;
}

html.dark-theme .modal-container-premium .close:hover,
html.dark-theme .modal .close:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}


/* ============================================
   FIX: Color de la X según tema
   ============================================ */

/* Tema Claro - X oscura */
.modal-container-premium .close,
.modal .close {
    color: #1a1a1a !important;
}

/* Tema Oscuro - X blanca */
html.dark-theme .modal-container-premium .close,
html.dark-theme .modal .close {
    color: #ffffff !important;
}

/* ============================================
   MODAL DE DETALLE DE PROYECTO - TEMA CLARO/OSCURO
   ============================================ */

/* Tema Claro */
.modal-container-detail {
    background: #ffffff !important;
    color: #1a1a1a !important;
}

.modal-container-detail h3,
.modal-container-detail #project-detail-title {
    color: #1a1a1a !important;
    background: linear-gradient(135deg, #1a1a1a 0%, #4a5568 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.modal-container-detail .detail-item strong {
    color: rgba(0, 0, 0, 0.5) !important;
}

.modal-container-detail .detail-item span {
    color: rgba(0, 0, 0, 0.9) !important;
}

.modal-container-detail #project-detail-description {
    color: rgba(0, 0, 0, 0.7) !important;
}

.modal-container-detail .btn-back {
    color: #4a5568 !important;
}

.modal-container-detail .btn-back:hover {
    color: #1a1a1a !important;
}

/* Tema Oscuro */
html.dark-theme .modal-container-detail {
    background: #0a0a0a !important;
    color: white !important;
}

html.dark-theme .modal-container-detail h3,
html.dark-theme .modal-container-detail #project-detail-title {
    background: linear-gradient(135deg, #ffffff 0%, #a5a5a5 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

html.dark-theme .modal-container-detail .detail-item strong {
    color: rgba(255, 255, 255, 0.4) !important;
}

html.dark-theme .modal-container-detail .detail-item span {
    color: rgba(255, 255, 255, 0.9) !important;
}

html.dark-theme .modal-container-detail #project-detail-description {
    color: rgba(255, 255, 255, 0.6) !important;
}

html.dark-theme .modal-container-detail .btn-back {
    color: rgba(255, 255, 255, 0.6) !important;
}

html.dark-theme .modal-container-detail .btn-back:hover {
    color: white !important;
}

/* Badge de país en modal de detalle */
.project-country-badge-modal {
    background: rgba(0, 0, 0, 0.1) !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    color: #1a1a1a !important;
}

html.dark-theme .project-country-badge-modal {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}


/* ============================================
   FIX URGENTE: X visible en tema claro
   ============================================ */

/* Forzar color de X en tema claro con máxima especificidad */
body:not(.dark-theme) .modal-container-premium .close,
body:not(.dark-theme) .modal .close,
.modal-container-premium .close,
.modal .close {
    color: #000000 !important;
    opacity: 0.8 !important;
}

.modal-container-premium .close:hover,
.modal .close:hover {
    opacity: 1 !important;
}

/* Solo en tema oscuro, X blanca */
html.dark-theme .modal-container-premium .close,
html.dark-theme .modal .close,
body.dark-theme .modal-container-premium .close,
body.dark-theme .modal .close {
    color: #ffffff !important;
    opacity: 0.8 !important;
}

html.dark-theme .modal-container-premium .close:hover,
html.dark-theme .modal .close:hover {
    opacity: 1 !important;
}


/* ============================================
   FIX DEFINITIVO: X visible (SVG stroke)
   ============================================ */

/* Tema Claro - X negra (para SVG) */
.modal-container-premium .close,
.modal .close,
.modal-container-premium .close svg,
.modal .close svg,
.modal-container-premium .close i,
.modal .close i {
    color: #000000 !important;
    stroke: #000000 !important;
    fill: none !important;
}

/* Tema Oscuro - X blanca (para SVG) */
html.dark-theme .modal-container-premium .close,
html.dark-theme .modal .close,
html.dark-theme .modal-container-premium .close svg,
html.dark-theme .modal .close svg,
html.dark-theme .modal-container-premium .close i,
html.dark-theme .modal .close i {
    color: #ffffff !important;
    stroke: #ffffff !important;
    fill: none !important;
}

/* Si es un carácter × en lugar de SVG */
.modal-container-premium .close::before,
.modal .close::before {
    color: #000000 !important;
}

html.dark-theme .modal-container-premium .close::before,
html.dark-theme .modal .close::before {
    color: #ffffff !important;
}


/* ============================================
   FIX: Navbar visible en desktop
   ============================================ */

@media (min-width: 768px) {
    /* Asegurar que el menú desktop sea visible */
    header .hidden.md\\:flex {
        display: flex !important;
    }
    
    /* Asegurar que los enlaces sean visibles */
    .nav-link {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}


/* ============================================
   NAVBAR: Estados según scroll y tema
   ============================================ */

/* Estado inicial (en Hero) - Transparente con texto blanco */
#header {
    background: transparent !important;
}

#header .nav-link,
#header .lang-switcher button,
#header #theme-toggle-button {
    color: white !important;
}

/* Estado scrolled - Fondo según tema */
#header.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

#header.scrolled .nav-link,
#header.scrolled .lang-switcher button,
#header.scrolled #theme-toggle-button {
    color: #1a1a1a !important;
}

/* Tema oscuro + scrolled */
html.dark-theme #header.scrolled {
    background: rgba(13, 13, 13, 0.95) !important;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.1) !important;
}

html.dark-theme #header.scrolled .nav-link,
html.dark-theme #header.scrolled .lang-switcher button,
html.dark-theme #header.scrolled #theme-toggle-button {
    color: #ffffff !important;
}

/* Hover states */
#header .nav-link:hover {
    color: #798C5D !important;
}

#header.scrolled .nav-link:hover {
    color: #798C5D !important;
}


/* ============================================
   RESPONSIVIDAD GENERAL
   ============================================ */

/* Mobile First - Base styles */
.scroll-section {
    padding: 4rem 1rem !important;
}

/* Tablet */
@media (min-width: 768px) {
    .scroll-section {
        padding: 6rem 2rem !important;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .scroll-section {
        padding: 8rem 3rem !important;
    }
}

/* Hero section - siempre full height */
#inicio {
    min-height: 100vh !important;
    padding: 0 1rem !important;
}

/* Asegurar que las tarjetas de proyecto sean responsive */
.project-card {
    width: 100% !important;
}

@media (min-width: 640px) {
    .project-card {
        width: calc(50% - 1rem) !important;
    }
}

@media (min-width: 1024px) {
    .project-card {
        width: calc(33.333% - 1rem) !important;
    }
}

/* Modales responsive */
.modal-container-premium,
.modal-container-detail {
    width: 95% !important;
    max-width: 1200px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
}

@media (max-width: 767px) {
    .modal-container-premium,
    .modal-container-detail {
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
}


/* ============================================
   FIX: Banderas visibles en desktop
   ============================================ */

.country-badge-card {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    padding: 0.5rem 1rem !important;
    border-radius: 9999px !important;
    z-index: 10 !important;
    font-size: 0.875rem !important;
    color: white !important;
}

.country-badge-card span {
    color: white !important;
}

/* Asegurar que el emoji de la bandera sea visible */
.country-badge-card .mr-2 {
    font-size: 1.25rem !important;
    line-height: 1 !important;
}

/* Dark mode */
html.dark-theme .country-badge-card {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}


/* ============================================
   OPTIMIZACIÓN DE RENDIMIENTO VISUAL
   ============================================ */

/* Skeleton loading para imágenes */
img[loading='lazy']:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Optimizar renderizado de imágenes */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Reducir calidad en conexiones lentas */
.slow-connection img {
    image-rendering: auto;
    filter: blur(0.5px);
}

/* Transición suave al cargar imágenes */
img {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img.loaded,
img[src] {
    opacity: 1;
}

/* Optimizar background images */
[style*='background-image'] {
    background-size: cover;
    background-position: center;
    will-change: auto;
}

/* Hero image optimization */
#hero-bg-image {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}


/* Estilos para SVG de banderas */
.flag-svg {
    display: inline-flex !important;
    align-items: center !important;
    margin-right: 0.5rem !important;
}

.flag-svg svg {
    width: 24px !important;
    height: 18px !important;
    border-radius: 2px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
}

