/**
 * ViaTone Pulse — theme chrome (switcher, brand, chat bubbles)
 */

.pulse-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.pulse-brand:hover {
  text-decoration: none;
}

.pulse-brand__picture {
  display: block;
  line-height: 0;
}

.pulse-brand__logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.a4u-sidebar__logo-img,
.pulse-brand__logo.a4u-sidebar__logo-img {
  width: min(100%, 188px);
  max-height: 52px;
  aspect-ratio: 180 / 53;
}

.pulse-brand--topbar {
  margin-left: 4px;
}

.pulse-brand--topbar .pulse-brand__logo--full {
  width: auto;
  max-width: 148px;
  max-height: 36px;
  aspect-ratio: 140 / 41;
}

.pulse-brand--topbar .pulse-brand__logo--mark {
  display: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

@media (max-width: 900px) {
  .pulse-brand--topbar .pulse-brand__logo--full {
    display: none;
  }
  .pulse-brand--topbar .pulse-brand__logo--mark {
    display: block;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .a4u-sidebar__logo-img {
    max-width: 160px;
    max-height: 44px;
  }
  .pulse-brand--topbar .pulse-brand__logo--full {
    max-width: 120px;
  }
}

/* Appearance control */
.a4u-theme-switcher {
  position: relative;
}

.a4u-theme-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--a4u-radius-sm);
  border: 1px solid var(--a4u-border);
  background: var(--a4u-surface);
  color: var(--a4u-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.a4u-theme-switcher__btn:hover {
  background: var(--a4u-surface-hover);
}

.a4u-theme-switcher__btn:focus-visible {
  box-shadow: var(--a4u-focus);
}

.a4u-theme-switcher__btn-icon {
  font-size: 14px;
  line-height: 1;
}

.a4u-theme-switcher__btn-label {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .a4u-theme-switcher__btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .a4u-theme-switcher__btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
}

.a4u-theme-switcher__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  padding: 6px;
  border-radius: var(--a4u-radius-md);
  border: 1px solid var(--a4u-border-strong);
  background: var(--a4u-surface-raised);
  box-shadow: var(--a4u-shadow);
  z-index: 60;
  display: grid;
  gap: 4px;
}

.a4u-theme-switcher__menu[hidden] {
  display: none !important;
}

.a4u-theme-switcher__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--a4u-radius-sm);
  background: transparent;
  color: var(--a4u-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.a4u-theme-switcher__opt:hover,
.a4u-theme-switcher__opt:focus-visible {
  background: var(--a4u-surface-hover);
}

.a4u-theme-switcher__opt--active {
  background: var(--a4u-music-soft);
  box-shadow: inset 3px 0 0 var(--a4u-music);
  font-weight: 700;
}

.a4u-theme-switcher__glyph {
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}

/* Chat / room bubbles */
.a4u-cn-bubble {
  background: var(--a4u-chat-other);
  color: var(--a4u-text);
  border: 1px solid var(--a4u-border);
}

.a4u-cn-bubble--mine {
  background: var(--a4u-chat-mine);
  border-color: color-mix(in srgb, var(--a4u-music) 35%, var(--a4u-border));
  justify-self: end;
}

.a4u-cn-bubble--other {
  background: var(--a4u-chat-other);
}

.a4u-cn-bubble--system {
  background: var(--a4u-chat-system);
  border-style: dashed;
  color: var(--a4u-muted);
  font-size: 0.9em;
  text-align: center;
}

.a4u-cn-bubble time {
  display: block;
  margin-top: 6px;
  color: var(--a4u-muted);
  font-size: 0.78em;
}

.a4u-cn-composer {
  background: var(--a4u-bg);
}

.a4u-cn-composer textarea {
  background: var(--a4u-input-bg);
  color: var(--a4u-text);
}

.a4u-cn-composer textarea:disabled,
.a4u-cn-composer:disabled textarea {
  opacity: 0.55;
  cursor: not-allowed;
}

.a4u-cn-conv--active,
.a4u-cn-conv[aria-current="true"] {
  background: var(--a4u-music-soft);
  border-color: color-mix(in srgb, var(--a4u-music) 40%, var(--a4u-border));
  box-shadow: inset 3px 0 0 var(--a4u-music);
}

@media (prefers-reduced-motion: reduce) {
  .a4u-theme-switcher__btn,
  .a4u-cn-bubble,
  .pulse-brand__logo {
    transition: none !important;
  }
}
