/* Paleta de colores IBC Institute */
:root {
  --azul: #162247;
  --naranja: #ed8112;
  --azul-oscuro: #0f1a3a;
  --azul-claro: #e8ebf5;
  --naranja-claro: #fef4e6;
  --texto: #1f2a37;
  --texto-claro: #546e7a;
  --fondo: #ffffff;
  --gris: #f8f9fa;
  --gris-claro: #f1f3f4;
  --borde: #e0e0e0;
  --sombra: rgba(22, 34, 71, 0.1);
  --sombra-hover: rgba(22, 34, 71, 0.2);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--texto);
  background: var(--fondo);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

/* Header mejorado */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: white;
  color: var(--azul);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
}
.brand img { 
  height: 60px; 
  width: auto;
  transition: transform 0.3s ease;
  filter: none;
}
.brand:hover img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.primary-nav ul { 
  list-style: none; 
  display: flex; 
  gap: 8px; 
  margin: 0; 
  padding: 0; 
}
.primary-nav a {
  display: inline-block;
  padding: 12px 16px;
  color: var(--azul);
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.primary-nav a:hover, .primary-nav a:focus { 
  background: var(--azul-claro);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(1, 87, 155, 0.2);
}
.primary-nav a[aria-current="page"] {
  background: var(--naranja);
  color: var(--azul);
  font-weight: 600;
}

/* Dropdown menu */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dropdown-toggle::after {
  content: '▼';
  font-size: 10px;
  transition: transform 0.3s ease;
}

.dropdown:hover .dropdown-toggle::after {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  padding: 8px 0;
  margin: 8px 0 0 0;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  list-style: none;
}

.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li {
  margin: 0;
}

.dropdown-menu a {
  display: block;
  padding: 12px 20px;
  color: var(--texto);
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 0;
  font-weight: 500;
}

.dropdown-menu a:hover {
  background: var(--azul-claro);
  color: var(--azul);
  transform: none;
  box-shadow: none;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nav-toggle .bar { display: block; width: 24px; height: 2px; background: var(--azul); margin: 5px 0; }

/* Sections mejoradas */
.section { 
  padding: 80px 0; 
  position: relative;
}
.section.alt { 
  background: linear-gradient(135deg, var(--gris) 0%, var(--gris-claro) 100%);
  border-top: 1px solid var(--borde);
  border-bottom: 1px solid var(--borde);
}
.section h2 { 
  color: var(--azul); 
  margin-top: 0; 
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
}

/* Section headers with icons mejorados */
.section-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  border-radius: 16px;
  flex-shrink: 0;
  box-shadow: 0 8px 20px var(--sombra);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.icon-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px var(--sombra-hover);
}

.section-icon {
  width: 28px;
  height: 28px;
  color: white;
  stroke-width: 2.5;
}


/* Hero mejorado */
.hero {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  color: white;
  text-align: center;
  padding: 120px 0 100px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 { 
  font-size: clamp(32px, 5vw, 52px); 
  margin: 0 0 20px; 
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.hero p { 
  font-size: clamp(18px, 2.8vw, 22px); 
  opacity: .95; 
  text-align: justify;
  text-align-last: center;
  line-height: 1.7;
  max-width: 800px;
  margin: 0 auto 30px;
}

/* Buttons mejorados */
.btn {
  position: relative;
  display: inline-block;
  padding: 16px 32px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transform: translateZ(0);
  transition: all 0.3s ease;
  text-decoration: none;
  border: none;
}
.btn:hover { 
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}
.btn:active { 
  transform: translateY(-1px);
}
.btn:focus-visible {
  outline: 3px solid var(--naranja);
  outline-offset: 2px;
}

/* Ripple element (creado via JS) */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple .6s ease-out;
  background: rgba(0,0,0,.15);
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(3); opacity: 0; }
}

.btn.primary {
  background: linear-gradient(135deg, var(--naranja) 0%, #ff9a3d 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(237, 129, 18, 0.4);
  font-weight: 700;
}
.btn.primary:hover { 
  box-shadow: 0 12px 30px rgba(237, 129, 18, 0.6);
  background: linear-gradient(135deg, #ff9a3d 0%, var(--naranja) 100%);
}

.btn.secondary {
  background: white;
  color: var(--azul);
  border: 2px solid var(--azul);
  box-shadow: 0 4px 15px rgba(1, 87, 155, 0.1);
}
.btn.secondary:hover { 
  background: var(--azul); 
  color: white;
  border-color: var(--azul);
  box-shadow: 0 8px 25px var(--sombra);
}

/* Estado deshabilitado opcional */
.btn[disabled], .btn.disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  .btn, .btn:hover, .btn:active { transition: none; transform: none; }
  .btn .ripple { display: none; }
}

/* Contacto mejorado */
.contact { 
  background: linear-gradient(135deg, var(--azul-claro) 0%, var(--naranja-claro) 100%);
  border-radius: 20px;
  margin: 40px 0;
  padding: 60px 40px;
  box-shadow: 0 10px 30px var(--sombra);
}

.contact .contact-form { 
  display: grid; 
  gap: 24px; 
  max-width: 600px;
  margin: 0 auto;
}
.contact .grid { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 20px; 
}
.contact label { 
  display: grid; 
  gap: 8px; 
  font-weight: 600; 
  color: var(--azul);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.contact input, .contact textarea {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--borde);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.contact input:focus, .contact textarea:focus { 
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(1, 87, 155, 0.1);
  transform: translateY(-2px);
}
.contact textarea {
  resize: vertical;
  min-height: 120px;
}

/* Footer mejorado */
.site-footer { 
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  color: white; 
  padding: 30px 0; 
  margin-top: 60px;
  box-shadow: 0 -4px 20px var(--sombra);
}
.footer-content { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 20px; 
}
.to-top { 
  color: var(--naranja); 
  font-weight: 700; 
  font-size: 18px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
}
.to-top:hover {
  background: var(--naranja);
  color: white;
  transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 900px) {
  .contact .grid { grid-template-columns: 1fr; }
  
  /* Ajustes para tablets */
  .section:not(.hero) p {
    max-width: 85%;
    text-align: justify;
    text-align-last: center;
    text-justify: inter-word;
    word-spacing: 0.05em;
  }
  
  .section:not(.hero) ul {
    max-width: 85%;
    text-align: justify;
    text-align-last: center;
    text-justify: inter-word;
  }
}

@media (max-width: 600px) {
  .section-header {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .icon-container {
    width: 56px;
    height: 56px;
  }
  
  .section-icon {
    width: 24px;
    height: 24px;
  }
  
  .contact {
    margin: 20px 0;
    padding: 40px 20px;
    border-radius: 16px;
  }
  
  
  /* Ajustes de texto para móvil */
  .section:not(.hero) p {
    max-width: 90%;
    text-align: justify;
    text-align-last: center;
    font-size: 16px;
    line-height: 1.7;
    hyphens: auto;
    word-spacing: 0.05em;
    text-justify: inter-word;
  }
  
  .section:not(.hero) ul {
    max-width: 90%;
    text-align: justify;
    text-align-last: center;
    padding-left: 20px;
    line-height: 1.7;
    text-justify: inter-word;
  }
  
  .section:not(.hero) li {
    text-align: justify;
    margin-bottom: 0.4em;
    text-justify: inter-word;
  }
  
  .feature-list li {
    padding: 12px 16px;
    margin-bottom: 16px;
    gap: 12px;
  }
  
  .list-icon {
    width: 20px;
    height: 20px;
  }
  
  .hero p {
    text-align: justify;
    text-align-last: center;
    padding: 0 20px;
  }
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .primary-nav { position: absolute; left: 0; right: 0; top: 90px; background: var(--azul); display: none; }
  .primary-nav.open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; }
  .primary-nav a { 
    padding: 14px 20px; 
    border-top: 1px solid rgba(255,255,255,.1); 
    color: white;
  }
  .primary-nav a:hover, .primary-nav a:focus {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
    box-shadow: none;
  }
  
  /* Mobile dropdown */
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: rgba(255,255,255,0.1);
    box-shadow: none;
    margin: 0;
    border-radius: 0;
    padding: 0;
    display: none;
  }
  
  .dropdown-menu a {
    padding: 12px 40px;
    color: rgba(255,255,255,0.8);
    border-top: 1px solid rgba(255,255,255,.1);
  }
  
  .dropdown-menu a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
  }
  
  .dropdown-toggle::after {
    display: none;
  }
  
  .dropdown-menu.show {
    display: block;
  }
  
  /* Ajustes adicionales para móvil */
  .section {
    padding: 50px 0;
  }
  
  .hero {
    padding: 80px 0 60px;
  }
  
  .hero h1 {
    font-size: clamp(24px, 6vw, 36px);
  }
  
  .hero p {
    font-size: clamp(14px, 4vw, 18px);
    padding: 0 15px;
  }
  
  .brand img {
    height: 50px;
  }
}

/* Pantallas muy pequeñas */
@media (max-width: 480px) {
  .container {
    width: 95%;
  }
  
  .section:not(.hero) p {
    max-width: 95%;
    font-size: 15px;
    padding: 0 10px;
    text-align: justify;
    text-align-last: center;
    line-height: 1.6;
    hyphens: auto;
    word-spacing: 0.05em;
    text-justify: inter-word;
  }
  
  .section:not(.hero) ul {
    max-width: 95%;
    padding-left: 15px;
    font-size: 15px;
    text-align: justify;
    text-align-last: center;
    line-height: 1.6;
    text-justify: inter-word;
  }
  
  .section:not(.hero) li {
    text-align: justify;
    margin-bottom: 0.3em;
    text-justify: inter-word;
  }
  
  .feature-list li {
    padding: 10px 12px;
    margin-bottom: 12px;
    gap: 10px;
    border-radius: 8px;
  }
  
  .list-icon {
    width: 18px;
    height: 18px;
  }
  
  .hero p {
    padding: 0 10px;
  }
  
  .brand img {
    height: 45px;
  }
  
}

/* Accesibilidad: enlace para saltar contenido */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  background: var(--naranja);
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  z-index: 2000;
}

/* Mejoras tipográficas y espaciado */
.section { 
  scroll-margin-top: 80px; 
  text-align: center;
}
.section:not(.hero) p { 
  max-width: 70ch; 
  text-align: justify;
  text-align-last: center;
  margin: 0 auto;
  hyphens: auto;
  word-spacing: 0.05em;
  line-height: 1.7;
  text-justify: inter-word;
}
.section:not(.hero) ul {
  max-width: 70ch;
  text-align: justify;
  text-align-last: center;
  margin: 0 auto;
  line-height: 1.7;
}
.section:not(.hero) li {
  text-align: justify;
  margin-bottom: 0.5em;
  text-justify: inter-word;
}

/* Lista con iconos mejorada */
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  border-left: 4px solid var(--azul);
  text-align: justify;
  text-justify: inter-word;
  word-spacing: 0.05em;
}

.feature-list li:hover {
  transform: translateX(8px);
  box-shadow: 0 8px 20px rgba(22, 34, 71, 0.15);
  border-left-color: var(--naranja);
}

.list-icon {
  width: 24px;
  height: 24px;
  color: var(--azul);
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.3s ease;
}

.feature-list li:hover .list-icon {
  color: var(--naranja);
  transform: scale(1.1);
}

/* Modal de confirmación */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0;
  border-bottom: 1px solid var(--borde);
  margin-bottom: 20px;
}

.modal-header h3 {
  color: var(--azul);
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--texto-claro);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: var(--gris-claro);
  color: var(--azul);
}

.modal-body {
  padding: 0 24px 20px;
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--naranja) 0%, #ff9a3d 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 20px rgba(237, 129, 18, 0.3);
}

.success-icon svg {
  width: 32px;
  height: 32px;
  color: white;
  stroke-width: 3;
}

.modal-body p {
  color: var(--texto);
  line-height: 1.6;
  margin-bottom: 12px;
  text-align: justify;
  text-align-last: center;
  text-justify: inter-word;
  word-spacing: 0.05em;
}

.modal-footer {
  padding: 0 24px 24px;
  text-align: center;
}

.modal-close-btn {
  min-width: 120px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal de carga */
.loading-modal .modal-content {
  text-align: center;
}

.loading-modal-body {
  padding: 40px 24px;
}

.loading-spinner {
  margin-bottom: 30px;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--gris-claro);
  border-top: 4px solid var(--naranja);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#loading-message {
  font-size: 18px;
  font-weight: 600;
  color: var(--azul);
  margin-bottom: 15px;
}

.loading-note {
  font-size: 14px;
  color: var(--texto-claro);
  font-style: italic;
  margin: 0;
}

/* Estilos para los enlaces de carga */
.loading-link {
  cursor: pointer;
}

.primary-nav a:focus-visible { outline: 3px solid rgba(237,129,18,.9); outline-offset: 2px; }

