.site-header {
  border-bottom: 0;
}

/* =========================
   CONTENEDOR TOP (DESKTOP)
   ========================= */
.header-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* SEARCH */
.search-pill {
  display: flex;
  align-items: center;
  gap: 10px;

  border: 2px solid #000;
  border-radius: 999px;
  padding: 8px 14px;

  flex: 0 0 320px;
}

.search-pill img {
  width: 18px;
  height: 18px;
}

.search-pill input {
  border: 0;
  outline: none;
  width: 100%;
  min-width: 0;
  background: transparent;
}

/* LOGO */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo img {
  max-height: 60px;
  width: auto;
}

/* =========================
   RIGHT (SOCIAL + TOGGLE)
   ========================= */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

/* Social (con iconos de fuente <i>) */
.social {
  display: flex;
  align-items: center;
  gap: 6px;
}

.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  text-decoration: none;
}

.social i {
  font-size: 32px;
  line-height: 1;
  color: #b3262e; /* modo claro */
  transition: color .2s ease;
}

.social a:hover i {
  color: #111; /* rojo RedExpertos */
}

/* Toggle Claro/Oscuro */
.theme-toggle {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid #2ecc71;
  background: #eaffef;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 2px;
}

.theme-toggle::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #2ecc71;
  display: block;
  transform: translateX(0);
  transition: transform .2s ease;
}

/* =========================
   DARK MODE (HEADER)
   ========================= */
html.dark .theme-toggle {
  border-color: #ddd;
  background: #1b1b1b;
}

html.dark .theme-toggle::after {
  background: #fff;
  transform: translateX(20px);
}

/* Iconos en dark */
html.dark .social i {
  color: #fff;
}

html.dark .social a:hover i {
  color: #2ecc71; /* verde sutil en dark */
}

/* Buscador en dark */
html.dark .search-pill {
  background: #0f1414;
  border-color: #2a2f2f;
}

html.dark .search-pill input[type="search"] {
  background: transparent;
  color: #eaeaea;
  -webkit-text-fill-color: #eaeaea; /* Safari/Chrome */
  border: 0;
}

html.dark .search-pill input[type="search"]::placeholder {
  color: #9aa3a3;
  opacity: 1;
}

html.dark .search-pill img {
  filter: invert(1) brightness(1.2);
}

/* Autofill (Chrome) */
html.dark .search-pill input:-webkit-autofill,
html.dark .search-pill input:-webkit-autofill:hover,
html.dark .search-pill input:-webkit-autofill:focus {
  -webkit-text-fill-color: #eaeaea !important;
  box-shadow: 0 0 0px 1000px #0f1414 inset !important;
  transition: background-color 9999s ease-out 0s;
}

/* Logos light/dark (si los usas) */
.logo-dark {
  display: none;
}
html.dark .logo-light {
  display: none;
}
html.dark .logo-dark {
  display: block;
}

/* =========================
   MÓVIL (LO QUE QUIERES)
   Logo izquierda / Redes+toggle derecha / Buscador abajo full
   ========================= */
@media (max-width: 900px) {

  .header-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px 12px;
    padding: 12px 16px;
    align-items: center;
  }

  /* FILA 1 */
  .logo {
    grid-column: 1 / 2;
    grid-row: 1;
    justify-self: start;
  }

  .header-right {
    grid-column: 2 / 3;
    grid-row: 1;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
  }

  /* FILA 2: buscador full width */
  .search-pill {
    grid-column: 1 / -1;
    grid-row: 2;

    width: 100%;
    max-width: none;
    flex: none;
  }

  /* Logo más grande */
  .logo img {
    max-height: 44px;
    width: auto;
  }

  /* Iconos más pequeños */
  .social i {
    font-size: 22px;
  }

  .social a {
    width: 22px;
    height: 22px;
  }

  /* Toggle más compacto */
  .theme-toggle {
    width: 36px;
    height: 20px;
  }

  .theme-toggle::after {
    width: 16px;
    height: 16px;
  }

  html.dark .theme-toggle::after {
    transform: translateX(16px);
  }
}
/* =========================
   SUBMENÚ (DROPDOWN) FIX
   Alineado bajo el ítem
   ========================= */

/* El <li> padre debe ser referencia */
.main-menu li{
  position: relative;
}

/* Submenu base */
.main-menu .sub-menu{
  position: absolute;
  top: calc(100% + 10px);
  left: 0;                 /* <-- clave: pegado a la izquierda del item */
  transform: none !important; /* <-- por si lo tenías centrado */
  min-width: 220px;
  width: max-content;      /* se adapta al contenido */
  max-width: 280px;

  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 10px 10px;
  margin: 0;

  list-style: none;
  z-index: 9999;

  box-shadow: 0 10px 30px rgba(0,0,0,.12);

  display: none;           /* oculto por defecto */
}

/* Mostrar en hover y también cuando haces tab (focus) */
.main-menu li:hover > .sub-menu,
.main-menu li:focus-within > .sub-menu{
  display: block;
}

/* Links del submenú (en columna) */
.main-menu .sub-menu li{
  margin: 0;
}

.main-menu .sub-menu a{
  display: block;
  padding: 10px 12px;
  border-radius: 10px;

  color: #111;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.main-menu .sub-menu a:hover{
  background: #f3f3f3;
}

/* Dark mode */
html.dark .main-menu .sub-menu{
  background: #0f1414;
  border-color: #1f2a2a;
}

html.dark .main-menu .sub-menu a{
  color: #eaeaea;
}

html.dark .main-menu .sub-menu a:hover{
  background: #121c1c;
}
