/* AppTopBar - BEM-style naming for external package consumers */

/* Motion tokens — shared across AppTopBar subcomponents */
:root {
  --mint-ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

/* Base topbar styles */
.mint-topbar {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-secondary);
  box-sizing: border-box;
}

/* Main container layout — relative so the center can anchor to viewport midline */
.mint-topbar__container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.375rem;
  position: relative;
}

/* Brand container */
.mint-topbar__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.mint-topbar__identity {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Slotted logos sized above 36px shrink to fit instead of stretching the tile. */
.mint-topbar__identity > * {
  max-width: 100%;
  max-height: 100%;
}

/* Left and right fields share the 36px identity tile height. */
.mint-topbar .mint-experiment-popover__trigger,
.mint-topbar .mint-experiment-popover__save-trigger {
  height: 2.25rem;
}

.mint-topbar .mint-experiment-popover__save-trigger {
  width: 2.25rem;
}

/* Centered section — absolute so asymmetric left/right weight never shifts the
   pill-nav off the topbar midline. Pointer-events: none lets the pill-nav
   overlay the background while remaining interactive via its own children. */
.mint-topbar__center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 1;
}

.mint-topbar__center > * {
  pointer-events: auto;
}

.mint-topbar__right {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  min-width: 0;
  justify-content: flex-end;
  flex-shrink: 0;
  margin-left: auto;
}

/* Logo styles */
.mint-topbar__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mint-topbar__logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  background-color: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mint-topbar__logo-text {
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
}

.mint-topbar__title-only {
  font-weight: 600;
  color: var(--text-primary);
}

/* Static plugin identity: name only, not a control (5a) */
.mint-topbar__plugin-identity {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  padding: 0 0.375rem 0 0;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.mint-topbar__plugin-name {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Variant: card - inline card with margins and rounded corners */
.mint-topbar--card {
  width: calc(100% - 2rem);
  margin: 1rem 1rem 0 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
}

/* Variant: default - basic inline header */
.mint-topbar--default {
  border-bottom: 1px solid var(--border-color);
}

.mint-topbar-home-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.mint-topbar-home-link:hover {
  opacity: 0.8;
}

/* Title + subtitle stay inside the 36px control row. */
.mint-topbar-title-group {
  display: flex;
  flex-direction: column;
}

.mint-topbar-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.15;
}

.mint-topbar-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.2;
}

/* Right-side buttons (notifications, settings, admin) share the IconButton
   ghost look: 32px, --radius-md, 16px icons, neutral ink, offset focus ring. */
.mint-topbar__icon-btn,
.mint-topbar__settings-btn,
.mint-topbar__admin-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--mint-transition), color var(--mint-transition);
}

.mint-topbar__icon-btn:hover,
.mint-topbar__settings-btn:hover,
.mint-topbar__admin-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mint-topbar__icon-btn:focus-visible,
.mint-topbar__settings-btn:focus-visible,
.mint-topbar__admin-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

.mint-topbar__icon-btn-icon,
.mint-topbar__settings-icon,
.mint-topbar__admin-icon {
  width: 1rem;
  height: 1rem;
}

/* The ring takes the bar color so the dot reads cut out of the icon. */
.mint-topbar__icon-btn-dot {
  position: absolute;
  top: 0.4375rem;
  right: 0.4375rem;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 9999px;
  background: var(--color-cta);
  box-shadow: 0 0 0 2px var(--bg-secondary);
  pointer-events: none;
}

.mint-topbar__icon-btn:hover .mint-topbar__icon-btn-dot {
  box-shadow: 0 0 0 2px var(--bg-hover);
}

/* Divider before the account menu. */
.mint-topbar__right > .mint-avatar-menu {
  display: inline-flex;
  align-items: center;
}

.mint-topbar__right > .mint-avatar-menu::before {
  content: '';
  width: 1px;
  height: 1.25rem;
  margin: 0 0.375rem;
  background: var(--border-color);
}

@media (prefers-reduced-motion: reduce) {
  .mint-topbar__icon-btn,
  .mint-topbar__settings-btn,
  .mint-topbar__admin-btn {
    transition: none;
  }
}

/* Standalone mode badge */
.mint-topbar__standalone-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--mint-warning-text);
  background: var(--mint-warning-bg);
  border: 1px solid var(--mint-warning-border);
  border-radius: 9999px;
  white-space: nowrap;
  user-select: none;
}
