/* ============================================================
   JDServer.es — HEADER
   Estilo “app” con logo cuadrado, nav en pastillas
   y barra inferior con idioma + tema
   ============================================================ */

:root {
  --jd-header-bg: radial-gradient(
      1200px 400px at 10% -40%,
      rgba(56, 189, 248, 0.2),
      transparent
    ),
    radial-gradient(
      900px 380px at 90% -30%,
      rgba(59, 130, 246, 0.26),
      transparent
    ),
    #050b16;
  --jd-header-border: rgba(255, 255, 255, 0.12);
  --jd-nav-pill-bg: rgba(6, 12, 24, 0.92);
  --jd-nav-pill-border: rgba(255, 255, 255, 0.16);
  --jd-nav-pill-active-bg: #22d3ee;
  --jd-nav-pill-active-text: #021018;
  --jd-nav-pill-shadow: 0 18px 45px rgba(34, 211, 238, 0.55);
}

#jd-header {
  position: relative;
  z-index: 40;
  background: var(--jd-header-bg);
  color: #f5f7fb;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid var(--jd-header-border);
}

.jd-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 22px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 18px;
  row-gap: 10px;
}

/* Brand: logo + textos */

.jd-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.jd-header-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 20px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.jd-header-logo img {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  object-fit: cover;
}

.jd-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.jd-header-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #5eead4;
  white-space: nowrap;
}

.jd-header-subtitle {
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.9);
  white-space: nowrap;
}

/* Nav principal */

.jd-header-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;              /* 👉 permite varias filas */
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid var(--jd-nav-pill-border);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.8);
}

.jd-nav-link {
  border: none;
  outline: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.1s ease;
}

.jd-nav-link:hover {
  background: rgba(148, 163, 184, 0.25);
}

.jd-nav-link.is-active {
  background: var(--jd-nav-pill-active-bg);
  color: var(--jd-nav-pill-active-text);
  box-shadow: var(--jd-nav-pill-shadow);
  transform: translateY(-1px);
}

/* Barra inferior: idioma + tema */

.jd-header-toolbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.jd-header-lang,
.jd-header-theme {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

/* Language pills */

.jd-lang-pill {
  border: none;
  outline: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.7;
  transition:
    background 0.18s ease,
    opacity 0.18s ease,
    transform 0.08s ease;
}

.jd-lang-pill:hover {
  opacity: 1;
  background: rgba(148, 163, 184, 0.28);
}

.jd-lang-pill.is-active {
  opacity: 1;
  background: rgba(148, 163, 184, 0.4);
  transform: translateY(-1px);
}

/* Theme pills */

.jd-theme-pill {
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.7;
  transition:
    background 0.18s ease,
    opacity 0.18s ease,
    transform 0.08s ease;
}

.jd-theme-pill:hover {
  opacity: 1;
  background: rgba(148, 163, 184, 0.28);
}

.jd-theme-pill.is-active {
  opacity: 1;
  background: rgba(148, 163, 184, 0.4);
  transform: translateY(-1px);
}

/* En claro, que el activo sea un poco más suave */
:root[data-theme="light"] .jd-theme-pill.is-active,
:root[data-theme="light"] .jd-lang-pill.is-active {
  background: rgba(15, 23, 42, 0.08);
}

/* Responsive */

@media (max-width: 900px) {
  .jd-header-inner {
    align-items: flex-start;
  }

  .jd-header-nav {
    width: 100%;
    margin-left: 0;
    justify-content: center;    /* 👉 centrado en móvil */
    overflow-x: visible;        /* sin scroll horizontal */
    row-gap: 6px;
  }

  .jd-header-toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .jd-header-brand {
    width: 100%;
  }
  .jd-header-title {
    font-size: 1.2rem;
  }
  .jd-header-subtitle {
    font-size: 0.8rem;
  }
}
