/* contextHelp.css */
/* Contextual help: header button + slide-out panel */

/* ===============================
   HEADER BUTTON
   =============================== */

#contextHelpBtn {
  height: 30px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

#contextHelpBtn:hover {
  background: rgba(209,139,60,0.10);
  border-color: rgba(209,139,60,0.30);
  color: #d18b3c;
}

#contextHelpBtn.active {
  background: rgba(209,139,60,0.15);
  border-color: rgba(209,139,60,0.40);
  color: #d18b3c;
}

#contextHelpBtn svg {
  flex-shrink: 0;
}

/* ===============================
   BACKDROP
   =============================== */

.ctx-help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ctx-help-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ===============================
   SLIDE-OUT PANEL
   =============================== */

.ctx-help-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: calc(100vw - 24px);
  height: 100vh;
  height: 100dvh;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel, #24242b);
  border-left: 1px solid var(--border, #4b4b50);
  box-shadow: -8px 0 30px rgba(0,0,0,0.35);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.ctx-help-panel.open {
  transform: translateX(0);
}

/* ===============================
   PANEL HEADER
   =============================== */

.ctx-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #4b4b50);
  flex-shrink: 0;
}

.ctx-help-title {
  font-family: "Staatliches", sans-serif;
  font-size: 22px;
  color: var(--accent, #d18b3c);
  letter-spacing: 0.02em;
}

.ctx-help-close {
  appearance: none;
  background: none;
  border: none;
  color: var(--text-secondary, #b5b5b5);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.ctx-help-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary, #e6e6e6);
}

/* ===============================
   PANEL BODY
   =============================== */

.ctx-help-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #4b4b50) transparent;
}

.ctx-help-body::-webkit-scrollbar {
  width: 6px;
}

.ctx-help-body::-webkit-scrollbar-track {
  background: transparent;
}

.ctx-help-body::-webkit-scrollbar-thumb {
  background: var(--border, #4b4b50);
  border-radius: 3px;
}

/* Content styling — mirror help page styles at a slightly smaller scale */

.ctx-help-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text-primary, #e6e6e6);
}

.ctx-help-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 18px 0 8px 0;
  color: var(--text-primary, #e6e6e6);
}

.ctx-help-section h3:first-child {
  margin-top: 0;
}

.ctx-help-section p {
  font-size: 13px;
  line-height: 1.65;
  margin: 0 0 10px 0;
  color: var(--text-secondary, #aaa);
}

.ctx-help-section ul,
.ctx-help-section ol {
  margin: 0 0 12px 0;
  padding-left: 20px;
}

.ctx-help-section li {
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 4px;
  color: var(--text-secondary, #aaa);
}

.ctx-help-section li strong {
  color: var(--text-primary, #e6e6e6);
}

.ctx-help-section code {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 11px;
  background: var(--bg-elevated, #2a2a32);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--accent, #d18b3c);
}

.ctx-help-section kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  background: var(--bg-elevated, #2a2a32);
  border: 1px solid var(--border, #4b4b50);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  color: var(--text-primary, #e6e6e6);
}

/* Shortcuts table */
.ctx-help-section .shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px 0;
}

.ctx-help-section .shortcuts-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border, #4b4b50);
  font-size: 12px;
}

.ctx-help-section .shortcuts-table td:first-child {
  width: 150px;
  white-space: nowrap;
}

.ctx-help-section .shortcuts-table td:last-child {
  color: var(--text-secondary, #aaa);
}

.ctx-help-section .shortcuts-table tr:last-child td {
  border-bottom: none;
}

/* Help tips */
.ctx-help-section .help-tip {
  display: flex;
  gap: 10px;
  background: rgba(209, 139, 60, 0.08);
  border: 1px solid rgba(209, 139, 60, 0.2);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 0;
}

.ctx-help-section .help-tip .tip-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctx-help-section .help-tip .tip-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent, #d18b3c);
}

.ctx-help-section .help-tip .tip-content {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary, #aaa);
}

.ctx-help-section .help-tip .tip-content strong {
  color: var(--accent, #d18b3c);
}

/* ===============================
   DIVIDER BETWEEN SECTIONS
   =============================== */

.ctx-help-divider {
  height: 1px;
  background: var(--border, #4b4b50);
  margin: 20px 0;
}

/* ===============================
   PANEL FOOTER
   =============================== */

.ctx-help-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border, #4b4b50);
  flex-shrink: 0;
  text-align: center;
}

.ctx-help-footer a {
  color: var(--accent, #d18b3c);
  text-decoration: none;
  font-size: 13px;
  transition: opacity 0.15s ease;
}

.ctx-help-footer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ===============================
   MOBILE
   =============================== */

@media (max-width: 520px) {
  .ctx-help-panel {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ===============================
   FOCUS MODE — hide the button
   =============================== */

body.focus-mode #contextHelpBtn {
  display: none;
}

/* ===============================
   PRINT — hide everything
   =============================== */

@media print {
  .ctx-help-panel,
  .ctx-help-backdrop,
  #contextHelpBtn {
    display: none !important;
  }
}
