/* STREAMHUB shared floating navbar.
 * Visual direction: compact floating capsule inspired by the supplied reference,
 * adapted to STREAMHUB's existing light/dark palette and current navigation content.
 */

.sh-site-nav {
  --sh-nav-height: 56px;
  --sh-nav-edge: 16px;
  --sh-nav-gap: 7px;

  width: min(calc(var(--shell, 1200px) + 48px), calc(100% - 32px));
  min-height: var(--sh-nav-height) !important;
  margin: var(--sh-nav-edge) auto 0 !important;
  padding: 6px 8px 6px 14px !important;
  position: sticky !important;
  top: var(--sh-nav-edge) !important;
  z-index: 80 !important;

  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;

  border: 1px solid var(--border-subtle, rgba(219, 227, 238, 0.95)) !important;
  border-radius: 999px !important;
  /* Opaque base matches the page background exactly; no inherited navy tint. */
  background: var(--sh-nav-bg, var(--sh-paper, var(--headerbar-bg))) !important;
  --sh-nav-current-shadow: var(--sh-shadow-sm);
  box-shadow: var(--sh-nav-current-shadow) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;

  transition:
    width 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.sh-site-nav.sh-nav-scrolled {
  width: min(var(--shell, 1200px), calc(100% - 40px));
  box-shadow: var(--sh-nav-current-shadow) !important;
}

/* Softens only while a navbar control has focus; scrolled navbar uses the same token. */
.sh-site-nav:focus-within {
  --sh-nav-current-shadow: var(--sh-shadow-focus-sm);
}
.sh-nav-account-trigger:is(:hover, :focus-visible, [aria-expanded="true"]),
.sh-nav-account-menu:focus-within {
  box-shadow: var(--sh-shadow-focus-xs);
}

/* Directorio already has a sticky wrapper. Keep a single sticky layer there. */
html[data-sh-page="directorio"] .site-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  padding: 1px 0 12px !important;
  pointer-events: none;
}

html[data-sh-page="directorio"] .site-header > .shell {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

html[data-sh-page="directorio"] .sh-site-nav {
  position: relative !important;
  top: auto !important;
  pointer-events: auto;
}

.sh-site-nav .back-btn {
  grid-column: 1;
  justify-self: start;
  position: static !important;
  inset: auto !important;
  transform: none !important;
  min-width: 0;
  height: 38px;
  padding: 0 11px 0 7px;
  border-radius: 999px;
  color: var(--text-subtle) !important;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease !important;
}

.sh-site-nav .back-btn:hover {
  color: var(--text-main) !important;
  background: color-mix(in srgb, var(--text-main) 6%, transparent);
  transform: translateX(-1px) !important;
}

.sh-site-nav .logo {
  grid-column: 2;
  justify-self: center;
  position: static !important;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
  font-size: 1.28rem !important;
}

.sh-site-nav .logo > a {
  display: inline-flex;
  align-items: center;
  padding: 6px 4px;
  border-radius: 999px;
}

.sh-site-nav > .theme-toggle {
  grid-column: 3;
  justify-self: end;
}

.sh-nav-actions {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: var(--sh-nav-gap);
  min-width: 0;
}

.sh-site-nav .theme-toggle {
  position: relative !important;
  inset: auto !important;
  transform: none !important;
  flex: 0 0 38px;
  width: 38px !important;
  height: 38px !important;
  border-radius: 999px !important;
  border: 1px solid var(--border-subtle, rgba(219, 227, 238, 0.95)) !important;
  background: color-mix(in srgb, var(--bg-surface-strong, var(--bg-surface-elevated, var(--surface))) 84%, transparent) !important;
  color: var(--text-subtle) !important;
  box-shadow: none !important;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease !important;
}

.sh-site-nav .theme-toggle:hover {
  color: var(--accent-main) !important;
  background: var(--bg-surface-strong, var(--bg-surface-elevated, var(--surface))) !important;
  transform: translateY(-1px) !important;
  box-shadow: none !important;
}

.sh-site-nav .theme-toggle:active {
  transform: translateY(0) scale(0.97) !important;
}

.sh-nav-auth {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.sh-nav-auth-login,
.sh-nav-account-trigger {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sh-nav-auth-login {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--accent-main);
  background: var(--accent-main);
  color: var(--button-on-accent) !important;
  box-shadow: var(--sh-shadow-xs);
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.sh-nav-auth-login::before {
  content: "";
  width: 18px;
  height: 18px;
  display: block;
  background: currentColor;
  -webkit-mask: url("../../../assets/svg/lucide-icons/user.svg") center / contain no-repeat;
  mask: url("../../../assets/svg/lucide-icons/user.svg") center / contain no-repeat;
}

.sh-nav-auth-login__full,
.sh-nav-auth-login__compact {
  display: none !important;
}

.sh-nav-auth-login:hover {
  color: var(--button-on-accent) !important;
  background: color-mix(in srgb, var(--accent-main) 88%, var(--sh-mix-ink));
  border-color: color-mix(in srgb, var(--accent-main) 88%, var(--sh-mix-ink));
  transform: translateY(-1px);
  box-shadow: var(--sh-shadow-focus-xs);
}

.sh-nav-auth-login:focus-visible {
  box-shadow: var(--sh-shadow-focus-xs);
}

.sh-nav-auth-login:active {
  transform: translateY(0) scale(0.97);
}

.sh-nav-account {
  position: relative;
  min-width: 0;
}

.sh-nav-account-trigger {
  max-width: 210px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 5px;
  color: var(--button-on-accent);
  background: var(--accent-main);
  border: 1px solid var(--accent-main);
  box-shadow: var(--sh-shadow-xs);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 180ms ease;
}

.sh-nav-account-trigger:hover,
.sh-nav-account-trigger[aria-expanded="true"] {
  background: color-mix(in srgb, var(--accent-main) 88%, var(--sh-mix-ink));
  border-color: color-mix(in srgb, var(--accent-main) 88%, var(--sh-mix-ink));
}

.sh-nav-account-trigger:active {
  transform: scale(0.985);
}

.sh-nav-account-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  background: var(--bg-surface-strong, var(--bg-surface-elevated, var(--surface)));
  border: 1px solid rgba(255, 255, 255, 0.58);
}

.sh-nav-account-name {
  min-width: 0;
  max-width: 125px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sh-nav-account-caret {
  width: 14px;
  height: 14px;
  opacity: 0;
  overflow: hidden;
  flex: 0 0 14px;
  transform: translateY(-2px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.sh-nav-account-trigger:hover .sh-nav-account-caret,
.sh-nav-account-trigger:focus-visible .sh-nav-account-caret,
.sh-nav-account-trigger[aria-expanded="true"] .sh-nav-account-caret {
  opacity: 0.72;
  transform: translateY(0);
}

.sh-nav-account-trigger[aria-expanded="true"] .sh-nav-account-caret {
  transform: rotate(180deg);
}

.sh-nav-account-menu {
  position: absolute;
  top: calc(100% + 11px);
  right: 0;
  width: 190px;
  padding: 7px;
  border: 1px solid var(--border-subtle, rgba(219, 227, 238, 0.95));
  border-radius: 18px;
  background: var(--bg-surface-strong, var(--bg-surface-elevated, var(--surface)));
  color: var(--text-main);
  box-shadow: var(--sh-shadow-lg);
  transform-origin: top right;
  z-index: 100;
}

.sh-nav-account-menu[hidden] {
  display: none !important;
}

.sh-nav-account-menu a,
.sh-nav-account-menu button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: inherit !important;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.055em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.sh-nav-account-menu a:hover,
.sh-nav-account-menu button:hover {
  background: color-mix(in srgb, var(--text-main) 6%, transparent);
}

.sh-nav-account-menu a[aria-disabled="true"] {
  opacity: 0.42;
  pointer-events: none;
}

.sh-nav-account-menu .sh-nav-account-menu__logout {
  margin-top: 5px;
  padding-top: 5px !important;
  border-top: 1px solid var(--border-subtle, rgba(219, 227, 238, 0.95)) !important;
  border-radius: 0 0 11px 11px !important;
  color: var(--status-danger) !important;
}

.sh-nav-auth-status {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-main) 6%, transparent);
  overflow: hidden;
  position: relative;
}

.sh-nav-auth-status::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text-main) 7%, transparent), transparent);
  transform: translateX(-100%);
  animation: sh-nav-loading 1.25s ease-in-out infinite;
}

@keyframes sh-nav-loading {
  to { transform: translateX(100%); }
}

@media (max-width: 760px) {
  .sh-site-nav {
    --sh-nav-edge: 10px;
    width: calc(100% - 20px);
    min-height: 54px !important;
    margin-top: var(--sh-nav-edge) !important;
    padding: 5px 7px 5px 10px !important;
    column-gap: 7px;
  }

  .sh-site-nav.sh-nav-scrolled {
    width: calc(100% - 24px);
  }

  html[data-sh-page="directorio"] .site-header {
    padding-bottom: 8px !important;
  }

  .sh-site-nav .logo {
    font-size: 1.08rem !important;
  }

  .sh-site-nav .back-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }

  .sh-site-nav .back-btn span {
    display: none;
  }

  .sh-site-nav .theme-toggle {
    flex-basis: 38px;
    width: 38px !important;
    height: 38px !important;
  }

  .sh-nav-auth-login,
  .sh-nav-account-trigger {
    min-height: 38px;
  }

  .sh-nav-auth-login {
    width: 38px;
    min-width: 38px;
    padding: 0;
  }

  .sh-nav-account-trigger {
    max-width: 164px;
    padding: 3px 9px 3px 4px;
    gap: 7px;
  }

  .sh-nav-account-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .sh-nav-account-name {
    max-width: 82px;
    font-size: 0.8rem;
  }

  .sh-nav-account-menu {
    top: calc(100% + 9px);
    width: min(190px, calc(100vw - 24px));
  }
}

@media (max-width: 430px) {
  .sh-site-nav {
    grid-template-columns: 38px minmax(70px, auto) minmax(0, 1fr);
  }

  .sh-site-nav:not(:has(.back-btn)) {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sh-site-nav:not(:has(.back-btn)) .logo {
    grid-column: 1;
    justify-self: start;
    padding-left: 3px;
  }

  .sh-site-nav:not(:has(.back-btn)) .sh-nav-actions {
    grid-column: 2;
  }

  .sh-site-nav .logo {
    font-size: 0.98rem !important;
  }

  .sh-nav-actions {
    gap: 5px;
  }

  .sh-nav-account-trigger {
    max-width: 132px;
  }

  .sh-nav-account-name {
    max-width: 58px;
  }
}

@media (max-width: 350px) {
  .sh-site-nav .logo {
    font-size: 0.9rem !important;
  }

  .sh-nav-account-name {
    display: none;
  }

  .sh-nav-account-trigger {
    padding-right: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sh-site-nav,
  .sh-site-nav *,
  .sh-site-nav *::before,
  .sh-site-nav *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* V10 — Account menu opens with the shared dropdown easing; layout never animates. */
.sh-nav-account-menu:not([hidden]) {
 animation: sh-account-menu-in var(--sh-dropdown-open-duration, 480ms) var(--sh-dropdown-easing, cubic-bezier(.16,1,.3,1)) both;
}
@keyframes sh-account-menu-in {
 from { opacity: 0; transform: translateY(-8px) scale(.97); }
 to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .sh-nav-account-menu:not([hidden]) { animation: none; } }

/* V14: public full-profile navigation matches directory floating width even when
   a generated profile template places it inside a narrower .shell wrapper. */
html[data-sh-page="perfil"] .sh-site-nav,
html:not([data-sh-page]):has(.page--hybrid) .sh-site-nav {
  width: min(calc(var(--shell, 1200px) + 48px), calc(100vw - 32px)) !important;
  max-width: none !important;
  /* Sticky left offsets do not behave like relative offsets. Center via margins. */
  margin-left: calc(50% - min(624px, calc(50vw - 16px))) !important;
  margin-right: 0 !important;
  left: auto !important;
  transform: none !important;
}
html[data-sh-page="perfil"] .sh-site-nav.sh-nav-scrolled,
html:not([data-sh-page]):has(.page--hybrid) .sh-site-nav.sh-nav-scrolled {
  width: min(var(--shell, 1200px), calc(100vw - 40px)) !important;
}

@media (max-width: 760px) {
  html[data-sh-page="perfil"] .sh-site-nav,
  html:not([data-sh-page]):has(.page--hybrid) .sh-site-nav {
    width: calc(100vw - 20px) !important;
    margin-left: calc(50% - 50vw + 10px) !important;
  }
  html[data-sh-page="perfil"] .sh-site-nav.sh-nav-scrolled,
  html:not([data-sh-page]):has(.page--hybrid) .sh-site-nav.sh-nav-scrolled {
    width: calc(100vw - 24px) !important;
    margin-left: calc(50% - 50vw + 12px) !important;
  }
}

/* V16 — New support messages appear on the account picture on public pages. */
.sh-site-nav .sh-nav-account-avatar-wrap {
  position: relative;
  flex: 0 0 30px;
  display: inline-flex;
  width: 30px;
  height: 30px;
}
.sh-site-nav .sh-notification-badge--avatar {
  position: absolute;
  top: -8px;
  right: -11px;
  z-index: 2;
  border: 2px solid var(--accent-main);
  height: 20px;
  min-width: 20px;
  padding: 0 4px;
}
.sh-site-nav .sh-nav-account-menu .sh-nav-account-menu__unread {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main) !important;
  text-transform: none;
  letter-spacing: 0;
  font-size: .82rem;
  font-weight: 730;
  margin: 3px 0;
  background: color-mix(in srgb, var(--sh-notice-red) 8%, transparent);
}
.sh-site-nav .sh-nav-account-menu .sh-nav-account-menu__unread[hidden] { display: none !important; }
.sh-nav-account-menu__unread-dot {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sh-notice-red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sh-notice-red) 12%, transparent);
}
.sh-nav-account-menu__unread-label { min-width: 0; }
