/* ===== Help Drawer ===== */

/* Trigger: the (?) button that lives next to a panel title */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.help-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.help-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Header layout when help button is alongside title */
.header.with-help {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.header.with-help .header__main {
  flex: 1 1 auto;
  min-width: 0;
}

/* Backdrop */
.help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 1100;
  opacity: 0;
  transition: opacity .2s ease;
}
.help-backdrop.is-open { opacity: 1; }
.help-backdrop[hidden] { display: none !important; }

/* Drawer panel */
.help-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(540px, 100vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
  z-index: 1101;
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}
.help-drawer.is-open { transform: translateX(0); }
.help-drawer[hidden] { display: none !important; }

/* Drawer header */
.help-drawer__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.help-drawer__title {
  flex: 1 1 auto;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.help-drawer__lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: #f9f7f4;
}
.help-drawer__lang button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: .04em;
}
.help-drawer__lang button.is-active {
  background: var(--primary);
  color: #fff;
}
.help-drawer__close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  flex-shrink: 0;
}
.help-drawer__close:hover { background: #f5f2ed; color: var(--text); }

/* Drawer body (scrolling) */
.help-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

/* Section structure */
.help-section + .help-section { margin-top: 24px; }
.help-section__heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.help-section__lead {
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 8px;
  color: var(--text);
}

/* Step blocks */
.help-step {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  background: #fefcf8;
}
.help-step__label {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
}
.help-step__body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 12px;
}
.help-step__body p { margin: 0 0 8px; }
.help-step__body p:last-child { margin: 0; }
.help-step__body code {
  font-size: 12px;
  background: #f5f2ed;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Mockup container — frames the recreated UI snippet */
.help-mockup {
  position: relative;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  overflow: visible; /* annotation badges hang outside */
}
.help-mockup::before {
  content: 'Preview';
  position: absolute;
  top: -9px;
  left: 12px;
  background: var(--bg);
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.help-mockup [data-help-disabled] { pointer-events: none; }

/* Annotation badges — numbered circles attached to mockup elements */
.help-mockup [data-annot] {
  position: relative;
}
.help-mockup [data-annot]::after {
  content: attr(data-annot);
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #b00020;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 2;
}

/* Inside table cells, anchor badges INSIDE the cell so they don't bleed
   past the mockup edge on right-aligned columns or wide tables. */
.help-mockup th[data-annot]::after,
.help-mockup td[data-annot]::after {
  width: 18px;
  height: 18px;
  font-size: 10px;
  top: 2px;
  right: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
/* Reserve space on the right of badged cells so the badge does not
   overlap the cell's content. */
.help-mockup th[data-annot],
.help-mockup td[data-annot] {
  padding-right: 24px;
}

/* Annotation legend below the mockup */
.help-annots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.help-annots li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
}
.help-annots .help-annot__num {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #b00020;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.help-annots .help-annot__text {
  flex: 1 1 auto;
}

/* Tip / FAQ blocks */
.help-tips, .help-faq {
  list-style: none;
  margin: 0;
  padding: 0;
}
.help-tips li {
  position: relative;
  padding: 8px 12px 8px 28px;
  font-size: 13px;
  line-height: 1.5;
  border-left: 3px solid #b45309;
  background: #fff7ed;
  border-radius: 6px;
  margin-bottom: 6px;
}
.help-tips li::before {
  content: '!';
  position: absolute;
  left: 10px;
  top: 8px;
  font-weight: 700;
  color: #b45309;
}
.help-faq__item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--card);
}
.help-faq__q {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
}
.help-faq__a {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  color: var(--muted);
}

/* Mockup inner adjustments — keep mockups compact so they fit drawer width */
.help-mockup .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.help-mockup .field { font-size: 12px; }
.help-mockup .field input,
.help-mockup .field select {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}
.help-mockup .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}
.help-mockup .pill {
  padding: 5px 10px;
  font-size: 11px;
}
.help-mockup .row { gap: 6px; }
.help-mockup .checkbox { font-size: 12px; }
.help-mockup .actions { gap: 6px; }
.help-mockup table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--card);
}
.help-mockup th, .help-mockup td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.help-mockup th {
  background: #f9f7f4;
  font-weight: 600;
  color: var(--muted);
}

/* Single-column grid in narrow mockups */
.help-mockup .grid--single { grid-template-columns: 1fr; }

/* Small-screen behavior */
@media (max-width: 640px) {
  .help-drawer { width: 100vw; }
  .help-drawer__body { padding: 14px; }
  .help-step { padding: 12px; }
  .help-mockup { padding: 12px; }
}
