/* /src/dock/dock.css
   Left-sidebar dockable panel system for Zim-X Design Studio.

   Layout:
     ┌──────────┬──────────────────┬──────────────────────────┐
     │ #leftDock│  #dockPanel      │     #canvas              │
     │  (54px)  │  (0 – 360px)     │  (rest of viewport)      │
     └──────────┴──────────────────┴──────────────────────────┘

   Z-index layers used:
     499  dock panel
     500  dock rail
     (existing chrome: app-tray 900, trash/add btns 9999)
*/

/* ============================================================
   DOCK RAIL — narrow icon launcher strip on the left edge
   ============================================================ */

#leftDock {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;               /* full height; bottom chrome sits on top via z-index */
  width: 54px;
  background: #1a2235;
  border-right: 1px solid #243448;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 14px;
  gap: 6px;
  z-index: 500;
  box-shadow: 2px 0 14px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

/* ── Dock icon button ───────────────────────────────────────── */

.dock-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1.5px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: #8ab4d8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  position: relative;
  user-select: none;
  flex-shrink: 0;
  outline: none;
}

.dock-icon-btn:hover {
  background: rgba(77, 208, 255, 0.13);
  border-color: #4dd0ff;
  color: #4dd0ff;
}

.dock-icon-btn.active {
  background: rgba(77, 208, 255, 0.20);
  border-color: #4dd0ff;
  color: #4dd0ff;
}

.dock-icon-btn:focus-visible {
  outline: 2px solid #4dd0ff;
  outline-offset: 2px;
}

/* Tooltip label that appears to the right of the icon on hover */
.dock-icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #0d1522;
  color: #deeeff;
  font-size: 12px;
  font-family: system-ui, "Segoe UI", sans-serif;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
  border: 1px solid #243448;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.dock-icon-btn:hover::after {
  opacity: 1;
}

/* ============================================================
   DOCK PANEL — slides out to the right of the dock rail
   ============================================================ */

#dockPanel {
  position: fixed;
  top: 0;
  left: 54px;
  width: 0;
  height: 100vh;
  overflow: hidden;
  background: #1e2a3e;
  border-right: 1px solid #243448;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.32);
  z-index: 499;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

#dockPanel.open {
  width: 360px;
}

/* ── Panel header ───────────────────────────────────────────── */

.dock-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: 44px;
  background: #141d2e;
  border-bottom: 1px solid #243448;
  flex-shrink: 0;
}

.dock-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #4dd0ff;
  letter-spacing: 0.04em;
  font-family: system-ui, "Segoe UI", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-panel-close {
  background: none;
  border: none;
  color: #5a7a9a;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
  font-family: system-ui, sans-serif;
}

.dock-panel-close:hover {
  color: #fa5050;
}

/* ── Panel body — container for app panes ───────────────────── */

.dock-panel-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Each dock app renders into a pane */
.dock-app-pane {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
}

.dock-app-pane.visible {
  display: flex;
}

/* ============================================================
   CANVAS OFFSET — shift canvas right when the panel is open
   ============================================================ */

/* Animate canvas displacement smoothly */
#canvas {
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dock-open #canvas {
  left: 414px; /* 54px rail + 360px panel */
}

/* ── Undock button (shown only for Help Shell) ──────────────── */

.dock-panel-undock {
  background: none;
  border: 1px solid #2a4060;
  border-radius: 4px;
  color: #5a7a9a;
  font-size: 11.5px;
  cursor: pointer;
  padding: 2px 8px;
  margin-right: 4px;
  line-height: 1.5;
  transition: color 0.15s, border-color 0.15s;
  font-family: system-ui, sans-serif;
  flex-shrink: 0;
}

.dock-panel-undock:hover {
  color: #4dd0ff;
  border-color: #4dd0ff;
}

.dock-panel-undock:focus-visible {
  outline: 2px solid #4dd0ff;
  outline-offset: 2px;
}

/* ============================================================
   HELP SHELL FLOATING PANEL
   ============================================================ */

#helpShell-float {
  position: fixed;
  z-index: 600;
  top: 80px;
  left: 80px;
  width: 580px;
  height: 540px;
  min-width: 360px;
  min-height: 220px;
  background: #1e2a3e;
  border: 1px solid #2a4a6a;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
}

/* Help Shell fills the remaining height inside the float */
#helpShell-float .help-shell {
  flex: 1;
  height: auto;
  min-height: 0;
}

.helpshell-float-header {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 44px;
  background: #141d2e;
  border-bottom: 1px solid #243448;
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
  cursor: move;
  user-select: none;
  gap: 6px;
}

.helpshell-float-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #4dd0ff;
  letter-spacing: 0.04em;
  font-family: system-ui, "Segoe UI", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.helpshell-float-btn {
  background: none;
  border: 1px solid #2a4060;
  border-radius: 4px;
  color: #5a7a9a;
  font-size: 11.5px;
  cursor: pointer;
  padding: 2px 8px;
  line-height: 1.5;
  transition: color 0.15s, border-color 0.15s;
  font-family: system-ui, sans-serif;
  flex-shrink: 0;
}

.helpshell-float-btn:hover {
  color: #4dd0ff;
  border-color: #4dd0ff;
}

.helpshell-float-btn:focus-visible {
  outline: 2px solid #4dd0ff;
  outline-offset: 2px;
}

.helpshell-float-close {
  font-size: 16px;
  padding: 0 7px;
}

.helpshell-float-close:hover {
  color: #fa5050;
  border-color: #fa5050;
}

/* ============================================================
   HELP SHELL APP
   ============================================================ */

.help-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  color: #cde6f9;
}

/* ── Sidebar wrapper — groups search + nav for the left column ──────────────
   In docked mode this is a transparent flex child (inherits column direction).
   In undocked mode (.help-shell--undocked) it becomes the fixed-width left
   column containing the menu. */
.help-shell-sidebar {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* ============================================================
   HELP SHELL — UNDOCKED (FLOATING) HORIZONTAL LAYOUT
   When the help shell is in its undocked/floating window the
   menu (search + nav) appears on the LEFT and the reading pane
   appears on the RIGHT, using a horizontal flex layout.
   The .help-shell--undocked class is added by _undockHelpShell()
   in dock.js and removed by _redockHelpShell() when docking.
   ============================================================ */

/* Switch top-level flex direction to row */
.help-shell--undocked {
  flex-direction: row;
}

/* Left column: fixed width, scrollable, separated by a right border */
.help-shell--undocked .help-shell-sidebar {
  width: 160px;
  min-width: 130px;
  overflow-y: auto;
  border-right: 1px solid #243448;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: #2a3d57 transparent;
}

.help-shell--undocked .help-shell-sidebar::-webkit-scrollbar {
  width: 4px;
}

.help-shell--undocked .help-shell-sidebar::-webkit-scrollbar-thumb {
  background: #2a3d57;
  border-radius: 3px;
}

/* Search box fills the sidebar width */
.help-shell--undocked .help-shell-search {
  width: calc(100% - 16px);
  margin: 8px 8px 6px;
}

/* Nav items can wrap text in the narrower sidebar */
.help-shell--undocked .help-shell-nav li {
  white-space: normal;
  font-size: 12px;
  padding: 5px 8px;
}

/* Hide the horizontal <hr> divider — the sidebar border-right takes its place */
.help-shell--undocked .help-shell-divider {
  display: none;
}

/* Reading pane expands to fill all remaining horizontal space */
.help-shell--undocked .help-shell-body {
  flex: 1;
  min-width: 0;
}

.help-shell-search {
  width: calc(100% - 24px);
  margin: 10px 12px 6px;
  background: #141d2e;
  border: 1px solid #2a4060;
  border-radius: 6px;
  padding: 6px 10px;
  color: #e4f2ff;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
  font-family: inherit;
}

.help-shell-search:focus {
  border-color: #4dd0ff;
}

.help-shell-nav {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  flex-shrink: 0;
}

.help-shell-nav li {
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: #7aaed4;
  font-size: 12.5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.help-shell-nav li:hover {
  background: #1e3045;
  color: #4dd0ff;
}

.help-shell-nav li.active {
  background: #1e3045;
  color: #4dd0ff;
  font-weight: 600;
}

.help-shell-divider {
  height: 1px;
  border: none;
  background: #243448;
  margin: 6px 12px;
  flex-shrink: 0;
}

.help-shell-body {
  flex: 1;
  padding: 10px 16px 16px;
  overflow-y: auto;
  line-height: 1.58;
  scrollbar-width: thin;
  scrollbar-color: #2a3d57 transparent;
}

.help-shell-body::-webkit-scrollbar {
  width: 5px;
}

.help-shell-body::-webkit-scrollbar-thumb {
  background: #2a3d57;
  border-radius: 3px;
}

.help-shell-body h2 {
  font-size: 14px;
  color: #4dd0ff;
  margin: 0 0 10px;
  font-weight: 600;
}

.help-shell-body p,
.help-shell-body li {
  color: #9abcd8;
  font-size: 12.5px;
}

.help-shell-body ul,
.help-shell-body ol {
  padding-left: 18px;
  margin: 5px 0 10px;
}

.help-shell-body code {
  background: #141d2e;
  color: #54f0b8;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11.5px;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
}

.help-shell-body a {
  color: #35ffc7;
  text-decoration: underline;
}

.help-shell-body a:hover {
  color: #4dd0ff;
}

.faq-question {
  font-weight: 600;
  color: #4dd0ff;
  cursor: pointer;
  margin: 10px 0 0;
  font-size: 12.5px;
  user-select: none;
  padding-left: 2px;
}

.faq-question::before {
  content: "▶ ";
  font-size: 9px;
  vertical-align: middle;
}

.faq-question.open::before {
  content: "▼ ";
}

.faq-answer {
  display: none;
  padding: 4px 0 6px 14px;
  border-left: 2px solid #2a4060;
  color: #7aaed4;
  font-size: 12px;
  margin-bottom: 4px;
}

.faq-question.open + .faq-answer,
.faq-answer.visible {
  display: block;
}

/* ============================================================
   NOTES APP
   ============================================================ */

.notes-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 12px 12px;
  box-sizing: border-box;
  gap: 8px;
}

.notes-app-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.notes-label {
  flex: 1;
  font-size: 11px;
  color: #4a6a8a;
  font-family: system-ui, sans-serif;
}

.notes-btn {
  background: #1a2c42;
  border: 1px solid #2a4060;
  border-radius: 5px;
  color: #7aaed4;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: system-ui, sans-serif;
}

.notes-btn:hover {
  background: #1e3a56;
  color: #4dd0ff;
}

.notes-textarea {
  flex: 1;
  background: #141d2e;
  border: 1px solid #2a4060;
  border-radius: 7px;
  color: #cde6f9;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  resize: none;
  outline: none;
  font-family: system-ui, "Segoe UI", sans-serif;
  transition: border-color 0.15s;
  box-sizing: border-box;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: #2a3d57 transparent;
}

.notes-textarea:focus {
  border-color: #4dd0ff;
}

.notes-textarea::-webkit-scrollbar {
  width: 5px;
}

.notes-textarea::-webkit-scrollbar-thumb {
  background: #2a3d57;
  border-radius: 3px;
}
