/* The musician avatar in the navbar and the level panel it opens (Pages/Shared/_MusicianBadge,
   dashboard decision 17). Gold replaces teal once every title is earned (Encores).

   Bootstrap's .dropdown-menu and the global button rule in button.css load outside the
   cascade layers, and unlayered rules beat layered ones, so the properties they also set
   carry !important here (the same approach as tag.css). */
@layer components {
  .av-musician__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 0 !important; /* no taller than the nav links, so the navbar keeps its height */
    border: 0 !important;
    border-radius: var(--av-clickable-card-radius) !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--av-card);
    text-align: left;
    transition: transform 120ms ease, background-color 140ms ease;
  }

  .av-musician__btn:hover,
  .av-musician__btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.03);
  }

  .av-musician__btn::after {
    display: none;
  }

  .av-musician__text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
  }

  /* Between 992px and 1199px the navbar is one row with no room to spare: with the handle and
     title beside the avatar, the logo broke onto two lines and the nav labels dropped under
     their icons. Show just the avatar there; its button keeps the full aria-label and the
     panel shows the handle and title. */
  @media (min-width: 992px) and (max-width: 1199.98px) {
    .av-musician__text {
      display: none;
    }
  }

  .av-musician__handle {
    font-size: 0.85rem;
  }

  .av-musician__title {
    font-size: 0.72rem;
    color: var(--av-accent);
  }

  .av-avatar--max ~ .av-musician__text .av-musician__title {
    color: var(--av-tone-repertoire);
  }

  .av-avatar {
    position: relative;
    flex: none;
    width: 34px;
    height: 34px;
  }

  .av-avatar__ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .av-avatar__track,
  .av-avatar__progress {
    fill: none;
    stroke-width: 3;
  }

  .av-avatar__track {
    stroke: rgba(255, 255, 255, 0.18);
  }

  .av-avatar__progress {
    stroke: var(--av-accent);
    stroke-linecap: round;
  }

  .av-avatar--max .av-avatar__progress {
    stroke: var(--av-tone-repertoire);
  }

  .av-avatar__initial {
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--av-card);
    background: var(--av-smart-song);
  }

  .av-avatar--c1 .av-avatar__initial { background: var(--av-tone-exercise); }
  .av-avatar--c2 .av-avatar__initial { background: var(--av-break); }
  .av-avatar--c3 .av-avatar__initial { background: var(--av-accent); }
  .av-avatar--c4 .av-avatar__initial { background: var(--av-danger-dark); }
  .av-avatar--c5 .av-avatar__initial { background: var(--av-ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }

  /* The panel */
  .av-level-panel {
    width: min(340px, calc(100vw - 32px)) !important;
    padding: 0 !important;
    border: 2px solid rgba(15, 23, 42, 0.32) !important;
    border-radius: var(--av-card-radius) !important;
    box-shadow: 6px 6px 0 rgba(15, 23, 42, 0.18) !important;
    overflow: hidden;
    color: var(--av-ink);
  }

  .av-level-panel__header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 20px;
    background: var(--av-nav);
    color: var(--av-card);
  }

  .av-level-panel__handle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.72);
  }

  .av-level-panel__title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
  }

  .av-level-panel__level {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--av-accent);
  }

  .av-level-panel--max .av-level-panel__level {
    color: var(--av-tone-repertoire);
  }

  .av-level-panel__tagline {
    margin-top: 6px;
    font-size: 0.85rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.72);
  }

  .av-level-panel__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px;
  }

  .av-level-panel__bar {
    height: 12px;
    border-radius: var(--av-pill-radius);
    background: rgba(34, 36, 52, 0.1);
    overflow: hidden;
  }

  .av-level-panel__bar span {
    display: block;
    height: 100%;
    border-radius: var(--av-pill-radius);
    background: var(--av-accent);
  }

  .av-level-panel--max .av-level-panel__bar span {
    background: var(--av-tone-repertoire);
  }

  .av-level-panel__next {
    margin: -6px 0 0;
    font-size: 0.85rem;
    color: var(--av-muted);
  }

  .av-level-panel__next b {
    color: var(--av-text);
  }

  .av-level-panel__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 14px;
    border-top: 1px solid var(--av-border);
    background: var(--av-bg);
    font-size: 0.9rem;
  }

  .av-level-panel__footer form {
    margin: 0;
  }

  .av-level-panel__logout {
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    color: var(--av-ink) !important;
    text-decoration: underline;
  }
}
