:root {
  --azul-uk: #102847;
  --naranja-uk: #ff671b;
}

/* Navbar principal */

.navbar-uk {
  background-color: var(--azul-uk) !important;
  padding: 0.8rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand img {
  height: 34px;
  transition: transform 0.3s ease;
}

.navbar-brand:hover img {
  transform: scale(1.05);
}

/* Links del navbar */

.navbar-nav .nav-link {
  color: white !important;
  margin: 0 0.2rem;
  border-radius: 5px;
  transition: all 0.3s ease;
  position: relative;
  font-size: .9rem;
}

.navbar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* Dropdown personalizado */

.dropdown-uk {
  position: static;
}

.dropdown-menu-uk {
  min-width: auto;
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: white;
  border-radius: 12px;
  padding: 1.2rem;
  width: calc(100vw - 40px);
  max-width: 1200px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  border: none;
}

/* FIX 1: Dropdown centrado en toda la pantalla */

.navbar-expand-lg .dropdown-uk:hover .dropdown-menu-uk {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Grid de categorías */

.categorias-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
}

.categoria-item {
  text-align: left;
}

.categoria-item h6 {
  color: var(--azul-uk);
  font-weight: 700;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.categoria-item ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.categoria-item li {
}

.categoria-item a {
  color: #666;
  text-decoration: none;
  line-height: .5;
  font-size: 0.85rem;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.categoria-item a:hover {
  color: var(--naranja-uk);
}

/* Selector de país */

.country-selector {
  position: relative;
}

.country-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 25px;
  padding: 0.4rem 1rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.country-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.country-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 8px;
  padding: 0.5rem;
  min-width: 160px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  margin-top: 0.5rem;
}

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

.country-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: 5px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s ease;
}

.country-item:hover {
  background-color: #f8f9fa;
  color: var(--naranja-uk);
}

/* Botón principal */

.btn-portal {
  background-color: var(--naranja-uk) !important;
  border: none;
  border-radius: 25px;
  padding: 0.6rem 1.5rem;
  color: white;
  font-size: .8rem;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-portal:hover {
  background-color: #e55a16 !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 103, 27, 0.4);
  color: white;
}

/* Responsive */

@media (max-width: 1399px) {
  .dropdown-menu-uk {
    width: calc(100vw - 60px);
    max-width: 1000px;
  }
}

@media (max-width: 1199px) {
  .dropdown-menu-uk {
    width: calc(100vw - 40px);
    max-width: 900px;
  }
}

@media (max-width: 1199px) {
  .categorias-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Resetear posición para móvil */

@media (max-width: 991px) {
  .dropdown-uk {
    position: relative;
  }
}

/* FIX: Dropdown móvil centrado y ancho completo */

@media (max-width: 991px) {
  .dropdown-menu-uk {
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    top: auto !important;
    margin-top: 0;
    opacity: 1;
    visibility: visible;
    display: none;
    border-radius: 0;
    box-shadow: none;
    background: white !important;
    padding: 1rem;
    margin-left: -15px;
    margin-right: -15px;
    border-top: 1px solid #eee;
    max-height: 400px;
    overflow-y: auto;
  }
}

/* Desactivar hover en móvil */

@media (max-width: 991px) {
  .dropdown-uk:hover .dropdown-menu-uk {
    display: none;
  }
}

@media (max-width: 991px) {
  .dropdown-uk.show .dropdown-menu-uk {
    display: block;
  }
}

@media (max-width: 991px) {
  .categorias-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* FIX 2: Títulos en azul y texto en negro en móvil */

@media (max-width: 991px) {
  .categoria-item h6 {
    color: var(--azul-uk) !important;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
  }
}

@media (max-width: 991px) {
  .categoria-item a {
    color: #333 !important;
  }
}

@media (max-width: 991px) {
  .categoria-item a:hover {
    color: var(--naranja-uk) !important;
  }
}

@media (max-width: 991px) {
  .navbar-nav {
    text-align: left;
    width: 100%;
  }
}

@media (max-width: 991px) {
  .navbar-nav .nav-item {
    padding: 0.5rem 0;
  }
}

@media (max-width: 991px) {
  .navbar-nav .nav-link {
    padding: 0.8rem 0 !important;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

/* FIX 3: Selector de país mejorado en móvil */

@media (max-width: 991px) {
  .country-selector {
    order: 1;
    width: 100%;
  }
}

@media (max-width: 991px) {
  .country-btn {
    width: 100%;
    justify-content: center;
    border-radius: 25px;
  }
}

/* FIX 3: Dropdown de países funcional en móvil */

@media (max-width: 991px) {
  .country-dropdown {
    position: static;
    right: auto;
    left: 0;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    border-radius: 8px;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
    margin-top: 1rem;
    background: white;
    border: 1px solid #eee;
  }
}

@media (max-width: 991px) {
  .country-selector.show .country-dropdown {
    display: block;
  }
}

/* Desactivar hover en móvil para países */

@media (max-width: 991px) {
  .country-selector:hover .country-dropdown {
    opacity: 0;
    visibility: hidden;
    display: none;
  }
}

@media (max-width: 991px) {
  .d-flex.align-items-center {
    flex-direction: column;
    align-items: stretch !important;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }
}

@media (max-width: 991px) {
  .btn-portal {
    order: 2;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 767px) {
  .navbar-brand img {
    height: 28px;
  }
}

/* Animación del toggler */

.navbar-toggler {
  border: none;
  padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='m4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* FIX: Media query específica para centrado perfecto en desktop */

@media (min-width: 992px) {
  .dropdown-uk {
    position: static;
  }
}

@media (min-width: 992px) {
  .dropdown-menu-uk {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(-10px) !important;
    top: 80px !important;
  }
}

@media (min-width: 992px) {
  .dropdown-uk:hover .dropdown-menu-uk {
    transform: translateX(-50%) translateY(0) !important;
  }
}

/* ====== NAVBAR COMPACT MODE (iPad / laptops chicas) ====== */

/* 1) Quita el límite de 960px del .container solo dentro del navbar */

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-uk .container {
    /*max-width: 100% !important;*/
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* 3) Compacta el menú central */

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-uk .navbar-nav .nav-link {
    font-size: 0.85rem !important;
    padding: 0.35rem 0.4rem !important;
    margin: 0 0.1rem !important;
  }
}

/* Iconos extra pequeños (por ejemplo el de Blog) para ahorrar px */

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-uk .navbar-nav .nav-link i {
    font-size: 0.8em;
    margin-left: 0.25rem;
  }
}

/* 4) Reduce logo y espacios */

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-uk .navbar-brand img {
    height: 20px !important;
  }
}

/* 5) Compacta el bloque derecho (país + botón) */

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-uk .d-flex.align-items-center {
    gap: .5rem !important;
  }
}

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-uk .country-btn {
    padding: 0.3rem 0.75rem !important;
  }
}

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-uk .btn-portal {
    padding: 0.5rem 1.1rem !important;
    font-size: 0.8rem !important;
  }
}

/* Extra: si aún se aprieta MUCHO (≈1024px), oculta el iconito externo del Blog */

@media (min-width: 992px) and (max-width: 1050px) {
  .navbar-uk .nav-link i.fa-external-link-alt {
    display: none !important;
  }
}

/* Hover solo en dispositivos con mouse */

@media (hover: hover) and (pointer: fine) {
  .country-selector:hover .country-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

@media (hover: hover) and (pointer: fine) {
  .navbar-expand-lg .dropdown-uk:hover .dropdown-menu-uk {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}

/* En pantallas táctiles, NUNCA abrir por hover */

@media (hover: none) and (pointer: coarse) {
  .country-selector:hover .country-dropdown, .dropdown-uk:hover .dropdown-menu-uk {
    opacity: 0 !important;
    visibility: hidden !important;
    display: none !important;
  }
}

@media (min-width: 1200px) {
  .country-item {
    white-space: normal;
    width: 100%;
  }
}

/* 1) El dropdown nunca se sale del viewport y queda centrado */

.dropdown-menu-uk {
  width: min(1200px, calc(100vw - 40px));
  max-width: 100vw;
  left: 50% !important;
  transform: translateX(-50%);
  overflow: hidden;
}

/* Si usas grid/flex para las columnas del mega-menu, esto ayuda a reflow */

.dropdown-menu-uk .uk-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  column-gap: 32px;
}

/* 2) Los textos deben poder partir en varias líneas */

.dropdown-menu-uk a, .dropdown-menu-uk li, .dropdown-menu-uk .uk-item {
  white-space: normal !important;
  word-break: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* Ajustes responsivos para monitores más pequeños */

@media (max-width: 1400px) {
  .dropdown-menu-uk .uk-columns {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    column-gap: 24px;
  }
}

@media (max-width: 1200px) {
  .dropdown-menu-uk {
    width: calc(100vw - 32px);
  }
}

@media (max-width: 1200px) {
  .dropdown-menu-uk .uk-columns {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    column-gap: 20px;
  }
}

@media (max-width: 992px) {
  .dropdown-menu-uk .uk-columns {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 576px) {
  .dropdown-menu-uk .uk-columns {
    grid-template-columns: 1fr;
  }
}

/* Reduce la separación entre líneas en el menú desplegable */

.dropdown-menu-uk li a {
  line-height: 1.4;
  display: inline-block;
}

/* Ajusta solo las líneas que se van hacia abajo (segunda línea) */

.dropdown-menu-uk li a {
  /*white-space: normal;*/
  /*text-indent: -0.5em;*/
  padding-left: 0.5em;
}

.edtech {
  padding-top: 5px;
  line-height: 1.5!important;
  display: inline-block;
}

/* Mega menú móvil: que ocupe el ancho y sea scrollable */

@media (max-width: 992px) {
  .dropdown-menu-uk {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--uk-nav-height, 64px);
    width: 100vw;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 1050;
    border-radius: 18px;
    margin: 0;
  }
}

/* Espaciado interno para que no se corte el último ítem */

/* Altura real aproximada del navbar (ajústala si tu barra es más alta/baja) */

:root {
  --uk-nav-h: 80px;
}

/* Fijar navbar arriba */

.navbar-uk {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: #0f2a47;
  /*Opcional: transición de sombra;*/
  transition: box-shadow .2s ease;
}

/* Evitar que el contenido quede oculto detrás del navbar */

body {
  padding-top: var(--uk-nav-h);
}

/* Asegurar que el contenedor interno no “salte” en fijo */

.navbar-uk .container {
  min-height: var(--uk-nav-h);
  display: flex;
  align-items: center;
}

/* Mega menú por encima del contenido */

.dropdown-menu-uk {
  z-index: 1200;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
}

/* En móvil: el menú colapsado que pueda hacer scroll si es muy alto */

@media (max-width: 991.98px) {
  .navbar-uk .navbar-collapse {
    max-height: calc(100vh - var(--uk-nav-h));
    overflow-y: auto;
  }
}

/* (Opcional) Estética: sombra al hacer scroll */

.navbar-uk.uk-shadow {
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

