/* ══ CONTEXT MENU — the app's own right-click menu (.cm-*) ══
   Engine + item builders live in js/core/context-menu.js. This file is chrome
   only: the popup, its rows, and the "Customise shortcuts" dialog. */

/* ── Popup ─────────────────────────────────────────────────────────────────── */
.cm-menu {
  position: fixed; top: 0; left: 0;
  z-index: 13000;                       /* above every modal (max in-app is 12000) */
  min-width: 214px; max-width: 300px;
  padding: 5px;
  background: #12161d;
  border: 1px solid #232a36;
  border-radius: 11px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.55), 0 2px 6px rgba(0,0,0,0.4);
  font-family: 'Barlow', sans-serif;
  user-select: none;
  transform-origin: top left;
  animation: cm-pop 0.11s cubic-bezier(0.2, 0, 0.2, 1);
}
@keyframes cm-pop {
  from { opacity: 0; transform: scale(0.96) translateY(-3px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .cm-menu { animation: none; } }

/* Menus opened near the bottom / right edge flip, so the growth anchor moves. */
.cm-menu.cm-up    { transform-origin: bottom left; }
.cm-menu.cm-left  { transform-origin: top right; }
.cm-menu.cm-up.cm-left { transform-origin: bottom right; }

/* ── Context header (what you right-clicked) ───────────────────────────────── */
.cm-head {
  padding: 7px 10px 8px;
  margin-bottom: 3px;
  border-bottom: 1px solid #1c222c;
  overflow: hidden;
}
.cm-head-t {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
  color: #dce3ed;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cm-head-s {
  display: block; margin-top: 1px;
  font-size: 11px; font-weight: 500; color: #5d6b7d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Rows ──────────────────────────────────────────────────────────────────── */
.cm-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 7px 10px;
  background: none; border: none; border-radius: 7px;
  font-family: inherit; font-size: 13px; font-weight: 500; text-align: left;
  color: #b9c4d2; cursor: pointer;
  transition: background 0.11s, color 0.11s;
}
.cm-item .material-symbols-outlined {
  font-size: 17px; color: #5d6b7d; flex-shrink: 0;
  transition: color 0.11s;
}
.cm-item-l {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cm-item-hint {
  flex-shrink: 0;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px;
  color: #45505f;
}
.cm-item:hover,
.cm-item.cm-on {
  background: #1b2129;
  color: #eef3f9;
}
.cm-item:hover .material-symbols-outlined,
.cm-item.cm-on .material-symbols-outlined { color: var(--accent); }
.cm-item:disabled {
  opacity: 0.34; cursor: default;
}
.cm-item:disabled:hover { background: none; color: #b9c4d2; }
.cm-item:disabled:hover .material-symbols-outlined { color: #5d6b7d; }

.cm-item.cm-danger:hover,
.cm-item.cm-danger.cm-on { background: rgba(239,68,68,0.13); color: #f8837d; }
.cm-item.cm-danger:hover .material-symbols-outlined,
.cm-item.cm-danger.cm-on .material-symbols-outlined { color: #ef4444; }

/* Trailing utility row (Customise shortcuts…) sits quieter than the actions. */
.cm-item.cm-quiet { font-size: 12px; color: #6b7a8d; }

.cm-sep { height: 1px; margin: 4px 6px; background: #1c222c; }

/* ── Customise-shortcuts dialog ────────────────────────────────────────────── */
.cm-cfg-back {
  position: fixed; inset: 0; z-index: 13010;
  background: rgba(4,6,9,0.62);
  backdrop-filter: blur(2px);
}
.cm-cfg {
  position: fixed; z-index: 13011;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 48px));
  display: flex; flex-direction: column;
  background: #0f1318;
  border: 1px solid #1f2530;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6);
  font-family: 'Barlow', sans-serif;
  overflow: hidden;
}
.cm-cfg-h {
  flex-shrink: 0;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #1a2030;
}
.cm-cfg-h b {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 19px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  color: #dce3ed;
}
.cm-cfg-h small {
  display: block; margin-top: 3px;
  font-size: 12px; color: #6b7a8d; line-height: 1.5;
}
.cm-cfg-b {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex; flex-direction: column; gap: 5px;
}
.cm-cfg-b::-webkit-scrollbar       { width: 5px; }
.cm-cfg-b::-webkit-scrollbar-thumb { background: #1f2530; border-radius: 3px; }

/* Fixed row — My Jobs, always in the menu, shown so the list reads complete. */
.cm-cfg-fixed {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin-bottom: 3px;
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 9px;
  font-size: 13px; font-weight: 600; color: #dce3ed;
}
.cm-cfg-fixed .material-symbols-outlined { font-size: 18px; color: var(--accent); }
.cm-cfg-fixed span.cm-cfg-pin {
  margin-left: auto;
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: #6b7a8d;
}

.cm-cfg-opt {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 12px;
  background: none; border: 1px solid transparent; border-radius: 9px;
  font-family: inherit; font-size: 13px; font-weight: 500; text-align: left;
  color: #b9c4d2; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.cm-cfg-opt .material-symbols-outlined { font-size: 18px; color: #5d6b7d; flex-shrink: 0; }
.cm-cfg-opt:hover { background: #141a22; color: #eef3f9; }
.cm-cfg-opt.on {
  background: #161c25; border-color: #2c3646; color: #eef3f9;
}
.cm-cfg-opt.on .material-symbols-outlined { color: var(--accent); }
/* Inert only because the 3 slots are full — kept legible, not greyed to death. */
.cm-cfg-opt:disabled { opacity: 0.5; cursor: default; }
.cm-cfg-opt:disabled:hover { background: none; color: #b9c4d2; }
.cm-cfg-opt-l { flex: 1; min-width: 0; }
.cm-cfg-opt-l small {
  display: block; margin-top: 1px;
  font-size: 11px; font-weight: 500; color: #5d6b7d;
}
/* Slot number badge — shows the order the shortcut appears in the menu. */
.cm-cfg-num {
  flex-shrink: 0;
  min-width: 19px; height: 19px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); border-radius: 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px; font-weight: 800; color: #0a0d11;
}
.cm-cfg-empty-slot {
  flex-shrink: 0;
  min-width: 19px; height: 19px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px dashed #2c3646; border-radius: 6px;
}

.cm-cfg-f {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 14px;
  border-top: 1px solid #1a2030;
}
.cm-cfg-count {
  flex: 1;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.3px; color: #6b7a8d;
}
.cm-cfg-f button {
  padding: 9px 16px;
  border-radius: 8px; border: 1px solid #2c3646;
  background: none; color: #b9c4d2; cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  transition: background 0.12s, color 0.12s;
}
.cm-cfg-f button:hover { background: #161c25; color: #eef3f9; }
.cm-cfg-f button.cm-cfg-done {
  background: var(--accent); border-color: var(--accent); color: #0a0d11;
}
.cm-cfg-f button.cm-cfg-done:hover { filter: brightness(1.08); }

/* ── Light mode ────────────────────────────────────────────────────────────── */
body.light-mode .cm-menu {
  background: #ffffff; border-color: #dde2ec;
  box-shadow: 0 14px 40px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.06);
}
body.light-mode .cm-head { border-bottom-color: #eef0f5; }
body.light-mode .cm-head-t { color: #1a2030; }
body.light-mode .cm-head-s { color: #8a95a5; }
body.light-mode .cm-item { color: #4a5567; }
body.light-mode .cm-item .material-symbols-outlined { color: #a0aab8; }
body.light-mode .cm-item:hover,
body.light-mode .cm-item.cm-on { background: #f0f3f8; color: #1a2030; }
body.light-mode .cm-item:hover .material-symbols-outlined,
body.light-mode .cm-item.cm-on .material-symbols-outlined { color: #5a7a00; }
body.light-mode .cm-item:disabled:hover { background: none; color: #4a5567; }
body.light-mode .cm-item:disabled:hover .material-symbols-outlined { color: #a0aab8; }
body.light-mode .cm-item.cm-danger:hover,
body.light-mode .cm-item.cm-danger.cm-on { background: rgba(220,38,38,0.08); color: #c02626; }
body.light-mode .cm-item.cm-danger:hover .material-symbols-outlined,
body.light-mode .cm-item.cm-danger.cm-on .material-symbols-outlined { color: #dc2626; }
body.light-mode .cm-item.cm-quiet { color: #8a95a5; }
body.light-mode .cm-item-hint { color: #b3bcc9; }
body.light-mode .cm-sep { background: #eef0f5; }

body.light-mode .cm-cfg-back { background: rgba(30,38,50,0.35); }
body.light-mode .cm-cfg { background: #ffffff; border-color: #dde2ec; box-shadow: 0 24px 70px rgba(0,0,0,0.18); }
body.light-mode .cm-cfg-h { border-bottom-color: #eef0f5; }
body.light-mode .cm-cfg-h b { color: #1a2030; }
body.light-mode .cm-cfg-h small { color: #6b7a8d; }
body.light-mode .cm-cfg-b::-webkit-scrollbar-thumb { background: #dde2ec; }
body.light-mode .cm-cfg-fixed { background: #f6faea; border-color: #d8e8a0; color: #1a2030; }
body.light-mode .cm-cfg-fixed .material-symbols-outlined { color: #5a7a00; }
body.light-mode .cm-cfg-opt { color: #4a5567; }
body.light-mode .cm-cfg-opt .material-symbols-outlined { color: #a0aab8; }
body.light-mode .cm-cfg-opt:hover { background: #f0f3f8; color: #1a2030; }
body.light-mode .cm-cfg-opt.on { background: #f0f3f8; border-color: #dde2ec; color: #1a2030; }
body.light-mode .cm-cfg-opt.on .material-symbols-outlined { color: #5a7a00; }
body.light-mode .cm-cfg-opt:hover:disabled { background: none; color: #4a5567; }
body.light-mode .cm-cfg-opt-l small { color: #8a95a5; }
body.light-mode .cm-cfg-num { color: #2a3a00; }
body.light-mode .cm-cfg-empty-slot { border-color: #dde2ec; }
body.light-mode .cm-cfg-f { border-top-color: #eef0f5; }
body.light-mode .cm-cfg-f button { border-color: #dde2ec; color: #4a5567; }
body.light-mode .cm-cfg-f button:hover { background: #f0f3f8; color: #1a2030; }
body.light-mode .cm-cfg-f button.cm-cfg-done { background: #d4f542; border-color: #d4f542; color: #2a3a00; }

/* ── Touch / small screens ─────────────────────────────────────────────────── */
/* The engine ignores touch-originated contextmenu events (fleet rows already own
   long-press), so this only sizes the menu when a mouse is used on a small
   screen — e.g. the desktop app in a narrow window. */
@media (max-width: 600px) {
  .cm-menu { min-width: 190px; max-width: calc(100vw - 16px); }
  .cm-item { padding: 9px 10px; }
}
