/**
 * LibZen Menu — vertical overflow menu.
 * Default theme matches LibZen Panel / TripZen dark tokens.
 */

:root {
  --libzen-mn-bg: var(--panel, #1a2332);
  --libzen-mn-text: var(--text, #e2e8f0);
  --libzen-mn-muted: var(--text-muted, #94a3b8);
  --libzen-mn-border: var(--border, #2d3a4f);
  --libzen-mn-hover: rgba(255, 255, 255, 0.06);
  --libzen-mn-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --libzen-mn-accent: var(--accent, #3b82f6);
  --libzen-mn-danger: #f87171;
  --libzen-mn-toggle-off: rgba(255, 255, 255, 0.16);
  --libzen-mn-radius: 8px;
  --libzen-mn-font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

[data-libzen-menu-theme='light'] {
  --libzen-mn-bg: #ffffff;
  --libzen-mn-text: #37352f;
  --libzen-mn-muted: #9b9a97;
  --libzen-mn-border: rgba(55, 53, 47, 0.09);
  --libzen-mn-hover: rgba(55, 53, 47, 0.06);
  --libzen-mn-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px,
    rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;
  --libzen-mn-accent: #2383e2;
  --libzen-mn-danger: #eb5757;
  --libzen-mn-toggle-off: rgba(55, 53, 47, 0.16);
}

/* —— Trigger (⋯) —— */
.libzen-mn-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--libzen-mn-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}

.libzen-mn-trigger:hover,
.libzen-mn-trigger[aria-expanded='true'] {
  background: var(--libzen-mn-hover);
  color: var(--libzen-mn-text);
}

.libzen-mn-trigger-dots {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transform: translateY(-1px);
}

.libzen-mn-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.libzen-mn-trigger-icon svg {
  width: 16px;
  height: 16px;
}

/* —— Panel —— */
.libzen-mn-panel,
.libzen-mn-submenu {
  position: fixed;
  z-index: 10000;
  background: var(--libzen-mn-bg);
  color: var(--libzen-mn-text);
  border: 1px solid var(--libzen-mn-border);
  border-radius: var(--libzen-mn-radius);
  box-shadow: var(--libzen-mn-shadow);
  font-family: var(--libzen-mn-font);
  font-size: 14px;
  line-height: 1.4;
  padding: 6px 0;
  max-height: min(70vh, 520px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.libzen-mn-submenu {
  padding: 6px 0;
  min-width: 200px;
  max-height: min(60vh, 400px);
  overflow-y: auto;
}

/* —— Search —— */
.libzen-mn-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 8px 6px;
  padding: 0 10px;
  border: 1px solid var(--libzen-mn-border);
  border-radius: 6px;
  background: var(--libzen-mn-bg);
}

.libzen-mn-search-wrap:focus-within {
  border-color: var(--libzen-mn-accent);
  box-shadow: 0 0 0 1px var(--libzen-mn-accent);
}

.libzen-mn-search-icon {
  display: flex;
  color: var(--libzen-mn-muted);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.libzen-mn-search-icon svg {
  width: 16px;
  height: 16px;
}

.libzen-mn-search {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--libzen-mn-text);
  font: inherit;
  font-size: 14px;
  padding: 8px 0;
  outline: none;
}

.libzen-mn-search::placeholder {
  color: var(--libzen-mn-muted);
}

/* —— List —— */
.libzen-mn-list {
  overflow-y: auto;
  padding: 2px 0;
}

.libzen-mn-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--libzen-mn-border);
}

.libzen-mn-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 8px);
  margin: 0 4px;
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.libzen-mn-item:hover:not(:disabled),
.libzen-mn-item-submenu-open {
  background: var(--libzen-mn-hover);
}

.libzen-mn-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.libzen-mn-item-danger {
  color: var(--libzen-mn-danger);
}

.libzen-mn-item-toggle {
  cursor: default;
}

.libzen-mn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--libzen-mn-text);
  opacity: 0.85;
}

.libzen-mn-icon svg {
  width: 16px;
  height: 16px;
}

.libzen-mn-item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.libzen-mn-item-trailing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--libzen-mn-muted);
}

.libzen-mn-shortcut {
  font-size: 12px;
  color: var(--libzen-mn-muted);
  white-space: nowrap;
}

.libzen-mn-badge {
  font-size: 12px;
  min-width: 18px;
  text-align: center;
  color: var(--libzen-mn-muted);
}

.libzen-mn-chevron {
  display: flex;
  width: 16px;
  height: 16px;
  opacity: 0.55;
}

.libzen-mn-chevron svg {
  width: 16px;
  height: 16px;
}

/* —— Toggle switch —— */
.libzen-mn-toggle {
  position: relative;
  width: 32px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--libzen-mn-toggle-off);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.libzen-mn-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.libzen-mn-toggle-on {
  background: var(--libzen-mn-accent);
}

.libzen-mn-toggle-on::after {
  transform: translateX(14px);
}

/* —— Meta footer —— */
.libzen-mn-meta {
  padding: 8px 14px 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--libzen-mn-muted);
  white-space: pre-line;
}

.libzen-mn-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--libzen-mn-muted);
  text-align: center;
}
