/* ========================================
   OPTIMIZACIÓN MÓVIL COMPLETA NGC
   Mobile-First + Progressive Enhancement
   ======================================== */

/* === META VIEWPORT (Agregar al HTML) ===
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
*/

/* === MEJORAS BASE PARA MÓVIL === */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(107, 78, 46, 0.2);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #e9e3d5;
  color: #3c2f2f;
  overflow-x: hidden;
  min-height: 100vh;
}

/* === MEJORAS DEL HEADER MÓVIL === */
@media (max-width: 768px) {
  header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #e9e3d5;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #c8b79a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  }

  nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
  }

  .logo {
    font-size: 1.3rem;
    z-index: 1001;
  }

  /* Menú hamburguesa */
  nav ul {
    position: fixed;
    top: 0;
    right: -100%;
    width: 75%;
    max-width: 300px;
    height: 100vh;
    background: linear-gradient(180deg, #f1ede4 0%, #e9e3d5 100%);
    flex-direction: column;
    padding: 5rem 0 2rem 0;
    margin: 0;
    gap: 0;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    overflow-y: auto;
  }

  nav ul.active {
    right: 0;
  }

  nav ul li {
    width: 100%;
    border-bottom: 1px solid rgba(200, 183, 154, 0.3);
  }

  nav ul li a {
    display: block;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    border-radius: 0;
    transition: all 0.3s ease;
  }

  nav ul li a:hover,
  nav ul li a.active {
    background: linear-gradient(90deg, #6b4e2e 0%, #8b6f47 100%);
    color: #f8f5f0;
    transform: translateX(8px);
  }

  /* Dropdown móvil */
  .dropdown-content {
    position: static;
    display: none;
    background-color: rgba(107, 78, 46, 0.05);
    box-shadow: none;
    border: none;
    min-width: 100%;
  }

  .dropdown.active .dropdown-content {
    display: block;
  }

  .dropdown-content a {
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
  }

  .dropdown-content a:hover {
    border-left-color: #6b4e2e;
    background: rgba(107, 78, 46, 0.1);
  }

  /* Botón hamburguesa */
  .mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
    position: relative;
  }

  .hamburger {
    display: block;
    width: 28px;
    height: 2px;
    background: #6b4e2e;
    position: relative;
    transition: background 0.3s ease;
  }

  .hamburger::before,
  .hamburger::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 2px;
    background: #6b4e2e;
    transition: transform 0.3s ease;
  }

  .hamburger::before {
    top: -8px;
  }

  .hamburger::after {
    top: 8px;
  }

  .mobile-menu-toggle.active .hamburger {
    background: transparent;
  }

  .mobile-menu-toggle.active .hamburger::before {
    transform: rotate(45deg) translate(5px, 6px);
  }

  .mobile-menu-toggle.active .hamburger::after {
    transform: rotate(-45deg) translate(5px, -6px);
  }

  /* Overlay */
  .menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .menu-overlay.active {
    display: block;
    opacity: 1;
  }
}

/* === PORTADA MÓVIL === */
@media (max-width: 768px) {
  .portada {
    min-height: 60vh;
    padding: 4rem 1.5rem;
    background-position: center;
    background-attachment: scroll;
  }

  .portada-contenido {
    perspective: none;
  }

  .portada h1 {
    font-size: 2rem;
    margin-bottom: 0.6rem;
    line-height: 1.2;
  }

  .portada p {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    line-height: 1.4;
  }

  .portada .btn {
    padding: 0.7rem 1.3rem;
    font-size: 0.95rem;
    display: inline-block;
    width: auto;
    max-width: 100%;
  }
}

/* === INFO SECTIONS MÓVIL === */
@media (max-width: 768px) {
  .info-section {
    flex-direction: column !important;
    min-height: auto;
    margin: 1.5rem 0;
    border-radius: 8px;
  }

  .info-left,
  .info-right {
    width: 100% !important;
  }

  .info-left {
    min-height: 300px;
    padding: 2rem 1.5rem;
  }

  .info-left-inner {
    max-width: 100%;
  }

  .info-left-inner h2 {
    font-size: 1.8rem;
    line-height: 1.2;
  }

  .info-right {
    padding: 2rem 1.5rem;
  }

  .info-right-inner {
    text-align: left;
  }

  .info-right-inner p {
    font-size: 1rem;
    line-height: 1.6;
  }

  .info-right-inner .btn {
    margin: 1.2rem 0 0 0;
    width: 100%;
    max-width: 300px;
  }

  /* Full BG móvil */
  .info-section.full-bg {
    height: 50vh;
    padding: 2rem 1.5rem;
  }

  .info-center-full-bg h2 {
    font-size: 1.6rem;
    padding-bottom: 0.4rem;
  }

  .info-center-full-bg p {
    font-size: 1rem;
    line-height: 1.5;
  }

  /* Service icons móvil */
  .services-icons {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem 0;
  }

  .service-icon {
    padding: 0.8rem 0.5rem;
  }

  .service-icon svg {
    width: 36px;
    height: 36px;
  }

  .service-icon span {
    font-size: 0.8rem;
  }
}

/* === TWO SECTIONS MÓVIL === */
@media (max-width: 768px) {
  .two-sections {
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem 1rem;
  }

  .info-block {
    max-width: 100%;
    padding: 2rem 1.5rem;
  }

  .info-block h2 {
    font-size: 1.5rem;
  }

  .info-block p {
    font-size: 1rem;
  }

  .info-block .btn {
    width: 100%;
    text-align: center;
    max-width: 250px;
    display: block;
    margin: 0 auto;
  }
}

/* === SERVICIOS PAGE MÓVIL === */
@media (max-width: 768px) {
  .service-section {
    height: auto;
    min-height: auto;
    margin-bottom: 2rem;
  }

  .service-image {
    position: relative;
    width: 100% !important;
    height: 300px;
    border-radius: 8px 8px 0 0;
  }

  .service-title {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    font-size: 1.8rem;
    text-align: left;
  }

  .service-section.reverse .service-title {
    left: 1.5rem;
    right: 1.5rem;
  }

  .service-content {
    position: relative;
    width: 100% !important;
    transform: translateX(0) !important;
    padding: 2rem 1.5rem;
    border-radius: 0 0 8px 8px;
  }

  .service-description {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 1 !important;
    transform: translateY(0) !important;
  }

  .service-icons {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem 0 0 0;
    opacity: 1 !important;
    transform: translateY(0) !important;
  }

  .service-icon svg {
    width: 32px;
    height: 32px;
  }

  .service-icon span {
    font-size: 0.85rem;
  }
}

/* === SERVICIOS DETALLADOS MÓVIL === */
@media (max-width: 768px) {
  .hero-servicio {
    height: 50vh;
    min-height: 400px;
  }

  .hero-content {
    padding: 0 1.5rem;
  }

  .hero-content .subtitulo {
    font-size: 1.2rem;
    letter-spacing: 1px;
  }

  .hero-content h1 {
    font-size: 2rem;
    line-height: 1.2;
  }

  .hero-content p {
    font-size: 1rem;
    line-height: 1.6;
  }

  .servicios-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 3rem auto;
    padding: 0 1rem;
  }

  .servicio-card {
    padding: 1.8rem;
  }

  .servicio-card h3 {
    font-size: 1.3rem;
  }

  .servicio-card p {
    font-size: 0.95rem;
  }

  .categoria-section {
    padding: 3rem 0;
  }

  .categoria-header {
    padding: 0 1rem;
    margin-bottom: 2rem;
  }

  .categoria-header h2 {
    font-size: 1.8rem;
  }

  .categoria-header p {
    font-size: 1rem;
  }

  .servicios-lista {
    padding: 0 1rem;
  }

  .servicio-item {
    padding: 1.2rem 1.5rem;
    margin-bottom: 0.8rem;
  }

  .servicio-item:hover {
    transform: translateX(4px);
  }

  .servicio-item h4 {
    font-size: 1.05rem;
    line-height: 1.4;
  }

  /* Ejemplos móvil */
  .ejemplos-wrapper {
    padding: 1.5rem 1rem;
  }

  .ejemplo-row {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 1rem 0;
  }

  .ejemplo-titulo {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
  }

  .ejemplo-descripcion {
    font-size: 0.9rem;
  }

  .cta-section {
    padding: 3rem 1.5rem;
    margin-top: 3rem;
  }

  .cta-section h2 {
    font-size: 1.8rem;
  }

  .cta-section p {
    font-size: 1rem;
  }

  .cta-section .btn {
    width: 100%;
    max-width: 300px;
    display: inline-block;
  }
}

/* === NOSOTROS PAGE MÓVIL === */
@media (max-width: 768px) {
  .hero-nosotros {
    height: 50vh;
    min-height: 400px;
  }

  .hero-nosotros h1 {
    font-size: 2rem;
  }

  .hero-nosotros .tagline {
    font-size: 1.1rem;
  }

  .mision-vision {
    padding: 3rem 1rem;
  }

  .mv-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .mv-card {
    padding: 2rem 1.5rem;
  }

  .mv-card h2 {
    font-size: 1.6rem;
  }

  .mv-card p {
    font-size: 1rem;
  }

  .valores-section {
    padding: 3rem 1rem;
  }

  .valores-container h2 {
    font-size: 2rem;
  }

  .valores-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .valores-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .valor-item {
    padding: 2rem 1.5rem;
  }

  .valor-item h3 {
    font-size: 1.3rem;
  }

  .valor-item p {
    font-size: 0.95rem;
  }

  .fundadores-section {
    padding: 3rem 1rem;
  }

  .fundadores-container h2 {
    font-size: 2rem;
  }

  .fundadores-intro {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .credenciales {
    flex-direction: column;
    gap: 1.5rem;
  }

  .credencial-item {
    padding: 1.5rem 2rem;
  }

  .universidades {
    flex-direction: column;
    gap: 1.5rem;
  }

  .universidad-logo {
    font-size: 1.5rem;
    padding: 1.2rem 2rem;
  }

  .cta-final {
    padding: 3rem 1.5rem;
  }

  .cta-final h2 {
    font-size: 1.8rem;
  }

  .cta-final p {
    font-size: 1rem;
  }

  .cta-final .btn {
    width: 100%;
    max-width: 300px;
  }
}

/* === AUTH PAGES MÓVIL === */
@media (max-width: 768px) {
  .auth-container {
    padding: 2rem 1rem;
    min-height: calc(100vh - 150px);
  }

  .auth-box {
    padding: 2rem 1.5rem;
    border-radius: 12px;
  }

  .auth-header h1 {
    font-size: 1.8rem;
  }

  .auth-header p {
    font-size: 0.95rem;
  }

  .section-title {
    font-size: 1.2rem;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
    padding: 0.8rem;
  }

  .service-items {
    grid-template-columns: 1fr;
    padding: 0.8rem;
  }

  .form-group input[type="text"],
  .form-group input[type="email"],
  .form-group input[type="tel"],
  .form-group input[type="password"],
  .form-group textarea {
    font-size: 16px; /* Evita zoom en iOS */
  }

  .btn {
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .dashboard-header h1 {
    font-size: 2rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .tool-card {
    padding: 1.5rem;
  }

  .support-card {
    flex-direction: column;
    padding: 2rem 1.5rem;
    text-align: center;
  }

  .support-icon {
    width: 60px;
    height: 60px;
  }
}

/* === FOOTER MÓVIL === */
@media (max-width: 768px) {
  footer {
    padding: 1.5rem 1rem;
    font-size: 0.9rem;
  }
}

/* === MEJORAS DE RENDIMIENTO === */
@media (max-width: 768px) {
  /* Reducir animaciones en móviles de gama baja */
  @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;
    }
  }

  /* Optimizar imágenes de fondo */
  .portada,
  .hero-servicio,
  .hero-nosotros,
  .service-image,
  .info-left,
  .info-section.full-bg {
    background-attachment: scroll; /* Mejor rendimiento que fixed */
  }

  /* Mejorar rendimiento de transforms */
  .info-left-inner,
  .portada-contenido,
  .servicio-card,
  .tool-card {
    will-change: auto; /* Solo cuando sea necesario */
  }
}

/* === MEJORAS DE TOUCH === */
@media (max-width: 768px) {
  /* Aumentar área de toque */
  a, button, .service-icon, .tool-card {
    min-height: 44px; /* Recomendación de Apple */
    min-width: 44px;
  }

  /* Mejorar feedback táctil */
  a:active,
  button:active,
  .btn:active {
    opacity: 0.7;
    transform: scale(0.98);
  }

  /* Prevenir zoom en inputs */
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* === LANDSCAPE MODE (Horizontal) === */
@media (max-width: 900px) and (orientation: landscape) {
  .portada,
  .hero-servicio,
  .hero-nosotros,
  .info-section.full-bg {
    height: 80vh;
    min-height: 400px;
  }

  .service-image {
    height: 250px;
  }

  header {
    padding: 0.6rem 1rem;
  }

  nav ul {
    padding: 4rem 0 1.5rem 0;
  }
}

/* === TABLETS (768px - 1024px) === */
@media (min-width: 769px) and (max-width: 1024px) {
  .servicios-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .valores-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .services-icons {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === PANTALLAS MUY PEQUEÑAS (<375px) === */
@media (max-width: 374px) {
  .logo {
    font-size: 1.1rem;
  }

  .portada h1,
  .hero-content h1 {
    font-size: 1.6rem;
  }

  .service-icons,
  .services-icons {
    grid-template-columns: 1fr;
  }

  .auth-box {
    padding: 1.5rem 1rem;
  }
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
  /* Opcional: puedes agregar soporte para modo oscuro */
  /* Por ahora lo dejamos comentado para mantener tu diseño */
}

/* === ACCESIBILIDAD === */
@media (max-width: 768px) {
  /* Mejorar contraste para móviles */
  .portada::before,
  .hero-servicio::before,
  .hero-nosotros::before,
  .info-section.full-bg::before {
    background: rgba(0, 0, 0, 0.5); /* Más contraste */
  }

  /* Focus visible para navegación por teclado */
  *:focus-visible {
    outline: 3px solid #6b4e2e;
    outline-offset: 2px;
  }
}