/*
 * Hatipikal · cabecera común de acceso y alta
 *
 * «← Volver» a la izquierda y el selector de idioma a la derecha. La dibuja
 * `includes/auth-topbar.php` y la comparten el acceso, la elección de cuenta,
 * el alta de cliente y el alta de coach: una sola fuente para que la fila sea
 * idéntica en las cuatro. La estructura del desplegable vive en
 * `auth-onboarding.css` (`body.auth-topbar-host`); aquí va su composición y su
 * paleta.
 */

body.auth-topbar-host {
  --login-ink: #2f2f2b;
  --login-muted: #9b8573;
  --login-line: rgba(205, 191, 174, 0.78);
}

/* Fila como cabecera de página (alta de cliente y de coach): mismo ancho útil
   que el resto del contenido. Dentro de la tarjeta (acceso y elección) no se
   aplica y la fila ocupa el ancho de la propia tarjeta. */
body.auth-topbar-host .auth-topbar {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding-top: 14px;
  margin-bottom: 22px;
}

body.auth-topbar-host .login-card-back:focus-visible,
body.auth-topbar-host .login-language-trigger:focus-visible,
body.auth-topbar-host .login-language-option:focus-visible {
  outline: 3px solid rgba(199, 169, 119, 0.34);
  outline-offset: 3px;
}

body.auth-topbar-host .login-card-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--login-muted);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 180ms ease, transform 180ms ease;
}

body.auth-topbar-host .login-card-back:hover,
body.auth-topbar-host .login-card-back:focus-visible {
  color: var(--login-ink);
  transform: translateX(-2px);
}

body.auth-topbar-host .login-card-top {
  position: relative;
  z-index: 30 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 44px;
  margin-bottom: 30px;
}

body.auth-topbar-host .login-card-top .login-card-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
}

body.auth-topbar-host .login-card-top .language-dropdown-toggle {
  position: static;
  min-height: 40px;
  border: 1px solid var(--login-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
  color: var(--login-muted);
}

body.auth-topbar-host .login-card-top .language-dropdown-current-code,
body.auth-topbar-host .login-card-top .language-dropdown-option span {
  background: rgba(244, 239, 231, 0.12);
  color: #faf8f4;
}

body.auth-topbar-host .login-card-top .auth-language-picker {
  position: static !important;
  top: auto !important;
  right: auto !important;
  display: flex;
  align-items: center;
  height: 44px;
  margin-left: auto;
}

body.auth-topbar-host .login-card-top .login-language-dropdown {
  display: inline-flex;
  align-items: center;
}

body.auth-topbar-host .login-language-trigger {
  /* El ancho y el hueco son estructura del desplegable (auth-onboarding.css); aquí
     solo la paleta. Un ancho distinto aquí lo hacía desbordar los 68px de
     `.auth-language-picker`/`.login-language-dropdown` y comerse el margen derecho
     de la tarjeta (issue #3823). */
  height: 44px;
  padding: 0 12px;
  border-color: rgba(244, 239, 231, 0.2);
  background: rgba(244, 239, 231, 0.08);
  color: #f4efe7;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 22px rgba(52, 42, 34, 0.12);
  backdrop-filter: blur(14px);
}

body.auth-topbar-host .login-language-trigger::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #c7a977;
  box-shadow: 0 0 0 4px rgba(199, 169, 119, 0.12);
  content: "";
}

body.auth-topbar-host .login-language-trigger:hover,
body.auth-topbar-host .login-language-dropdown.is-open .login-language-trigger {
  border-color: rgba(199, 169, 119, 0.72);
  background: rgba(244, 239, 231, 0.14);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(199, 169, 119, 0.12), 0 14px 30px rgba(52, 42, 34, 0.18);
}

body.auth-topbar-host .login-language-panel {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  width: min(408px, calc(100vw - 32px)) !important;
  max-height: none !important;
  padding: 9px !important;
  overflow: visible !important;
  border-color: rgba(244, 239, 231, 0.22);
  background: #4a4a42;
  box-shadow: 0 28px 64px rgba(52, 42, 34, 0.34);
  backdrop-filter: blur(24px);
}

body.auth-topbar-host .login-language-highlight { display: none !important; }

body.auth-topbar-host .login-language-option {
  grid-template-columns: 28px minmax(0, 1fr) 12px;
  gap: 5px;
  min-height: 50px;
  padding: 6px;
  border: 1px solid rgba(244, 239, 231, 0.09);
  background: rgba(244, 239, 231, 0.035);
  color: #f4efe7;
  transition: border-color 160ms ease, background-color 160ms ease, transform 150ms ease;
}

body.auth-topbar-host .login-language-option > span {
  grid-column: 2;
  grid-row: 1;
  color: #f4efe7;
  overflow: visible !important;
  font-size: 0.66rem;
  line-height: 1.08;
  white-space: normal !important;
  text-overflow: clip !important;
}

body.auth-topbar-host .login-language-option small {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  width: 28px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  background: rgba(199, 169, 119, 0.14);
  color: #dcc8b5;
  font-size: 0.6rem;
}

body.auth-topbar-host .login-language-option svg {
  grid-column: 3;
  grid-row: 1;
  stroke: #dcc8b5;
}

body.auth-topbar-host .login-language-option:hover,
body.auth-topbar-host .login-language-option:focus-visible,
body.auth-topbar-host .login-language-option.is-selected {
  border-color: rgba(199, 169, 119, 0.46);
  background: rgba(199, 169, 119, 0.12);
}

body.auth-topbar-host .login-language-option:hover { transform: translateY(-1px); }

/* Paleta clara Hatipikal. */
body.auth-topbar-host .login-language-trigger {
  border-color: rgba(205, 191, 174, 0.8);
  background: rgba(255, 255, 255, 0.58);
  color: #4a4a42;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 8px 22px rgba(74, 74, 66, 0.08);
}

body.auth-topbar-host .login-language-trigger:hover,
body.auth-topbar-host .login-language-dropdown.is-open .login-language-trigger {
  background: rgba(255, 255, 255, 0.9);
  color: #2f2f2b;
  box-shadow: 0 0 0 4px rgba(199, 169, 119, 0.12), 0 14px 30px rgba(74, 74, 66, 0.1);
}

body.auth-topbar-host .login-language-panel {
  border-color: rgba(220, 200, 181, 0.9);
  background: rgba(250, 248, 244, 0.98);
  box-shadow: 0 28px 64px rgba(74, 74, 66, 0.18);
}

body.auth-topbar-host .login-language-option {
  border-color: rgba(205, 191, 174, 0.58);
  background: rgba(255, 255, 255, 0.5);
  color: #4a4a42;
}

body.auth-topbar-host .login-language-option > span { color: #4a4a42; }
body.auth-topbar-host .login-language-option small { background: rgba(220, 200, 181, 0.42); color: #6b5b4b; }
body.auth-topbar-host .login-language-option svg { stroke: #6b5b4b; }

@media (max-width: 540px) {
  body.auth-topbar-host .login-card-top { margin-bottom: 26px; }
  body.auth-topbar-host .auth-topbar { width: calc(100% - 28px); margin-bottom: 18px; }
  body.auth-topbar-host .login-language-panel {
    right: -1px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(324px, calc(100vw - 28px)) !important;
  }
  body.auth-topbar-host .login-card-top .language-dropdown-current-name { display: none; }
}

@media (max-height: 760px) and (min-width: 541px) {
  body.auth-topbar-host .login-card-top { margin-bottom: 20px; }
}
