/**
 * Menubar styles
 * @countermeasure/web-components/navigation/menubar
 */

/* ============================================================================
   MENUBAR CONTAINER
   ============================================================================ */
.cmm-menubar {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  background-color: hsl(var(--background));
}

/* ============================================================================
   TRIGGER BUTTONS
   ============================================================================ */
.cmm-menubar__trigger {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.cmm-menubar__trigger:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.cmm-menubar__trigger:focus-visible {
  outline: 2px solid hsl(var(--focus-ring));
  outline-offset: -1px;
}

.cmm-menubar__trigger--active {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* ============================================================================
   DROPDOWN PANEL
   ============================================================================ */
.cmm-menubar__dropdown {
  position: fixed;
  z-index: var(--z-popover, 500);
  min-width: 180px;
  max-width: 280px;
  padding: 0.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  background-color: hsl(var(--background));
  box-shadow: var(--shadow-lg);
  animation: cmm-menubar-in var(--transition-fast, 150ms) ease-out;
}

@keyframes cmm-menubar-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   MENU ITEMS
   ============================================================================ */
.cmm-menubar__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4375rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 0.8125rem;
  line-height: 1.4;
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.cmm-menubar__item:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.cmm-menubar__item--active {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.cmm-menubar__item--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cmm-menubar__item--disabled:hover {
  background: transparent;
  color: hsl(var(--foreground));
}

/* ============================================================================
   SEPARATOR
   ============================================================================ */
.cmm-menubar__separator {
  height: 1px;
  margin: 0.25rem 0.375rem;
  background-color: hsl(var(--border));
}

/* ============================================================================
   ICON, LABEL, SHORTCUT, ARROW, CHECK
   ============================================================================ */
.cmm-menubar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}

.cmm-menubar__icon svg {
  width: 100%;
  height: 100%;
}

.cmm-menubar__item:hover .cmm-menubar__icon {
  color: inherit;
}

.cmm-menubar__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmm-menubar__shortcut {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.025em;
}

.cmm-menubar__arrow {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.625rem;
  color: hsl(var(--muted-foreground));
}

.cmm-menubar__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  font-size: 0.625rem;
  color: hsl(var(--primary));
}

/* ============================================================================
   TOUCH DEVICE ENHANCEMENTS (WCAG 2.5.5 - 44px minimum)
   ============================================================================ */
@media (pointer: coarse) {
  .cmm-menubar__trigger {
    min-height: var(--cmm-touch-target-min, 44px);
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
  }

  .cmm-menubar__item {
    min-height: var(--cmm-touch-target-min, 44px);
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
  }

  .cmm-menubar__icon,
  .cmm-menubar__check {
    width: 20px;
    height: 20px;
  }
}
