/*
 * Floating UI: toasts, modal dialogs, context menus, tooltips, dropdowns,
 * the shortcuts reference overlay.
 */

/* ---- toasts ---------------------------------------------------------- */
.toast-host {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(var(--statusbar-h) + var(--sp-3));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 200;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 260px;
  max-width: 440px;
  font-size: var(--fs-sm);
  animation: toast-in 160ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.toast.info { border-left-color: var(--accent); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
.toast .msg { flex: 1; }
.toast .toast-icon { color: var(--accent); }
.toast.warn .toast-icon { color: var(--warn); }
.toast.error .toast-icon { color: var(--danger); }
.toast button { border: 1px solid var(--border-strong); height: 24px; }
.toast .dismiss { border: none; color: var(--fg-dim); width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.toast .dismiss:hover { color: var(--fg); background: var(--bg-hover); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---- dialogs --------------------------------------------------------- */
dialog {
  background: var(--bg-panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: var(--sp-4);
  min-width: 340px;
  max-width: min(560px, 92vw);
}
dialog::backdrop { background: var(--bg-scrim); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-lg); font-weight: 600; }
dialog .row { margin: var(--sp-2) 0; }
dialog .row > label { min-width: 84px; }
dialog .actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-4); }
dialog .actions button { border: 1px solid var(--border-strong); padding: 4px 14px; height: 28px; }
dialog .actions button.primary { background: var(--accent); color: var(--fg-on-accent); border-color: var(--accent); }
dialog .actions button.primary:hover { background: var(--accent-hover); }

/* ---- context menu ---------------------------------------------------- */
.context-menu { position: fixed; z-index: 150; }
.context-menu .menu-popup { position: static; }

/* ---- tooltips -------------------------------------------------------- */
.tooltip {
  position: fixed;
  z-index: 300;
  background: var(--fg);
  color: var(--bg-panel);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-2);
}
.tooltip .sc { color: color-mix(in srgb, var(--bg-panel) 65%, var(--fg)); margin-left: 7px; font-family: var(--font-mono); }

/* ---- dropdowns ------------------------------------------------------- */
.dropdown {
  position: absolute;
  z-index: 120;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: var(--sp-1);
}
.dropdown div { padding: 4px 10px; border-radius: var(--radius-sm); white-space: nowrap; font-size: var(--fs-sm); }
.dropdown div:hover { background: var(--accent); color: var(--fg-on-accent); }

/* draggable numeric labels */
.scrub { cursor: ew-resize; }
.scrub:hover { color: var(--accent); }

/* ---- shortcuts reference -------------------------------------------- */
.shortcuts-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: var(--bg-scrim);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.shortcuts-panel {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: min(920px, 92vw);
  max-height: 86vh;
  overflow: auto;
  padding: var(--sp-4);
  box-shadow: var(--shadow-3);
}
.shortcuts-panel h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-lg); font-weight: 600; }
.shortcuts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.shortcuts-grid h3 {
  font-size: var(--fs-xs); margin: 0 0 var(--sp-1); color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.shortcuts-grid .sc-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); padding: 3px 0; color: var(--fg-muted); }
.shortcuts-grid .sc-row span:first-child { color: var(--fg); }
kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  background: var(--bg-input-alt);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 0 5px;
  color: var(--fg-muted);
}
