/* ============================================================
   MENU BAR (js/features/menubar.js) — the Mac look.

   The bar is FIXED over the header and slides in from above, so it never
   pushes the page down: with it closed the app is pixel-for-pixel what it
   was before the bar existed. z-index 300 puts it over the header (z-60)
   and under every modal (z-400 and up).

   Colours follow macOS: translucent material, 13px system font, a blue
   highlight on the item under the mouse, shortcuts in grey on the right.
   ============================================================ */
#menubar-hot { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 299; }

#menubar {
  position: fixed; top: 0; left: 0; right: 0; height: 28px; z-index: 300;
  display: flex; align-items: center; gap: 0; padding: 0 10px;
  font: 500 14px/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", sans-serif;
  color: #1d1d1f; background: rgba(246, 246, 246, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  transform: translateY(-100%); opacity: 0; pointer-events: none;
  transition: transform 160ms ease-out, opacity 160ms ease-out;
  -webkit-user-select: none; user-select: none;
}
#menubar.mb-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.dark #menubar { color: #f5f5f7; background: rgba(40, 40, 44, 0.78); border-bottom-color: rgba(255, 255, 255, 0.10); }

#menubar .mb-title { height: 22px; padding: 0 9px; border-radius: 4px; color: inherit; font: inherit; white-space: nowrap; }
#menubar .mb-app { font-weight: 700; }
#menubar .mb-title:hover, #menubar .mb-title.mb-on { background: rgba(0, 0, 0, 0.10); }
.dark #menubar .mb-title:hover, .dark #menubar .mb-title.mb-on { background: rgba(255, 255, 255, 0.16); }

.mb-drop {
  position: fixed; z-index: 301; min-width: 220px; max-width: 320px; padding: 5px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  display: flex; flex-direction: column;
  font: 400 14px/1.2 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", sans-serif;
  color: #1d1d1f; background: rgba(246, 246, 246, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid rgba(0, 0, 0, 0.14); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  -webkit-user-select: none; user-select: none;
}
#menubar-sub { z-index: 302; }
/* The toolbar's Video button opens its list in the same look (Recap.videoMenu). */
#video-menu { z-index: 320; }
#video-menu .vm-head { padding: 4px 10px 6px; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.6; }
.dark .mb-drop { color: #f5f5f7; background: rgba(44, 44, 48, 0.92); border-color: rgba(255, 255, 255, 0.14); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); }

.mb-drop .mb-item {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  width: 100%; padding: 4px 10px; border-radius: 5px;
  color: inherit; font: inherit; text-align: left; white-space: nowrap;
}
.mb-drop .mb-key { color: rgba(60, 60, 67, 0.6); font-size: 14px; }
.dark .mb-drop .mb-key { color: rgba(235, 235, 245, 0.5); }
.mb-drop .mb-item:hover, .mb-drop .mb-item.mb-focus, .mb-drop .mb-item.mb-on { background: #0a64f0; color: #fff; }
.mb-drop .mb-item:hover .mb-key, .mb-drop .mb-item.mb-focus .mb-key, .mb-drop .mb-item.mb-on .mb-key { color: rgba(255, 255, 255, 0.85); }
.mb-drop .mb-sep { height: 1px; margin: 5px 10px; background: rgba(0, 0, 0, 0.12); flex: none; }
.dark .mb-drop .mb-sep { background: rgba(255, 255, 255, 0.14); }

/* A phone or tablet has no mouse to rest on the top edge (Jeff: desktop only).
   Both conditions, not just (hover: none): a headless or remote-desktop Chrome
   reports no hover at all yet is driven by a mouse, and the browser test runs
   in one. A finger is the thing to exclude. */
@media (hover: none) and (pointer: coarse) { #menubar-hot, #menubar { display: none; } }
@media print { #menubar-hot, #menubar, .mb-drop, #menubar-customize { display: none !important; } }

/* ---- Customize window ---------------------------------------------------- */
#menubar-customize {
  position: fixed; inset: 0; z-index: 450; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  font: 400 14px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", sans-serif;
}
#menubar-customize .mbc-card {
  width: min(640px, 94vw); height: min(640px, 90vh); display: flex; flex-direction: column; overflow: hidden;
  color: #1d1d1f; background: #ffffff; border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.dark #menubar-customize .mbc-card { color: #f5f5f7; background: #1a1d24; }
#menubar-customize .mbc-head, #menubar-customize .mbc-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; flex: none; }
#menubar-customize .mbc-head { justify-content: space-between; border-bottom: 1px solid #e2e8f0; font-size: 15px; }
#menubar-customize .mbc-foot { border-top: 1px solid #e2e8f0; }
.dark #menubar-customize .mbc-head, .dark #menubar-customize .mbc-foot { border-color: #2a2e38; }
#menubar-customize .mbc-x { font-size: 20px; line-height: 1; padding: 0 6px; color: #64748b; }
#menubar-customize .mbc-gap { flex: 1; }
#menubar-customize .mbc-foot button { padding: 6px 12px; border-radius: 7px; font-weight: 600; background: #e2e8f0; color: #334155; }
.dark #menubar-customize .mbc-foot button { background: #2a2e38; color: #e2e8f0; }
#menubar-customize .mbc-foot .mbc-done, .dark #menubar-customize .mbc-foot .mbc-done { background: #0a64f0; color: #fff; }

#menubar-customize .mbc-body { display: flex; flex: 1; min-height: 0; }
#menubar-customize .mbc-menus { width: 132px; flex: none; padding: 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; border-right: 1px solid #e2e8f0; }
.dark #menubar-customize .mbc-menus { border-color: #2a2e38; }
#menubar-customize .mbc-menus button { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 6px; font-weight: 600; color: inherit; text-align: left; }
#menubar-customize .mbc-menus button span { color: #94a3b8; font-weight: 500; }
#menubar-customize .mbc-menus button:hover { background: #f1f5f9; }
.dark #menubar-customize .mbc-menus button:hover { background: #2a2e38; }
#menubar-customize .mbc-menus button.mbc-on { background: #0a64f0; color: #fff; }
#menubar-customize .mbc-menus button.mbc-on span { color: rgba(255, 255, 255, 0.8); }

#menubar-customize .mbc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 10px 14px; gap: 8px; }
#menubar-customize .mbc-sub { color: #64748b; font-size: 14px; }
.dark #menubar-customize .mbc-sub { color: #94a3b8; }
#menubar-customize .mbc-list, #menubar-customize .mbc-results { overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; padding: 4px; }
#menubar-customize .mbc-list { flex: 2; min-height: 90px; }
#menubar-customize .mbc-results { flex: 1; min-height: 70px; }
.dark #menubar-customize .mbc-list, .dark #menubar-customize .mbc-results { border-color: #2a2e38; }
#menubar-customize .mbc-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; }
#menubar-customize .mbc-row:hover { background: #f1f5f9; }
.dark #menubar-customize .mbc-row:hover { background: #22262e; }
#menubar-customize .mbc-row[draggable="true"] { cursor: grab; }
#menubar-customize .mbc-dragging { opacity: 0.4; }
#menubar-customize .mbc-grip { color: #94a3b8; font-size: 11px; letter-spacing: -2px; }
#menubar-customize .mbc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
#menubar-customize .mbc-key, #menubar-customize .mbc-from { color: #94a3b8; font-size: 14px; }
#menubar-customize .mbc-row button { padding: 2px 9px; border-radius: 5px; font-weight: 600; background: #e2e8f0; color: #334155; }
.dark #menubar-customize .mbc-row button { background: #2a2e38; color: #e2e8f0; }
#menubar-customize .mbc-row button[data-act="add"] { background: #0a64f0; color: #fff; }
#menubar-customize .mbc-row button:disabled { opacity: 0.35; cursor: default; }
#menubar-customize .mbc-empty { padding: 10px; color: #94a3b8; }
#menubar-customize .mbc-search {
  flex: none; padding: 7px 10px; border-radius: 8px; border: 1px solid #cbd5e1; background: #f8fafc; color: inherit; font: inherit; outline: none;
}
#menubar-customize .mbc-search:focus { border-color: #0a64f0; }
.dark #menubar-customize .mbc-search { background: #13151a; border-color: #3a3e48; }
