/* =========================================================================
 * 3DShawn admin -- help-tip system (ported from DriftSense's .ds-help,
 * blue-palette variant matching the 3DShawn admin theme).
 *
 * Usage in HTML:
 *
 *   <span class="ds-help"
 *         data-help-title="What this does"
 *         data-help-body="Longer explanation. <strong>Bold</strong> and
 *                         <code>code snippets</code> are supported."
 *         data-help-link="/somewhere.cgi"
 *         data-help-link-label="Try it &rarr;">
 *   </span>
 *
 * Renders as a small blue "?" chip. Hover / focus opens a dark popover
 * (positioned by admin-help.js) with title + body + optional link.
 * The .ds-help class name is kept so the same JS from DriftSense works
 * verbatim; the only difference is the palette below.
 * ========================================================================= */

.ds-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.14);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.40);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 10px;
  font-weight: 800;
  cursor: help;
  user-select: none;
  vertical-align: 2px;
  margin-left: 6px;
  transition: all .15s ease;
  outline: none;
}
.ds-help::before { content: '?'; }
.ds-help:hover,
.ds-help:focus {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.55);
}

/* The floating popover, positioned by admin-help.js */
.ds-help-popover {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity .18s ease, transform .18s ease;
  max-width: 340px;
  background: linear-gradient(180deg, #1a2740 0%, #131e30 100%);
  border: 1px solid #2563eb;
  border-radius: 12px;
  padding: 14px 16px;
  color: #e5edf5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  box-shadow:
    0 20px 45px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(37, 99, 235, 0.20),
    0 0 40px rgba(37, 99, 235, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ds-help-popover.on {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
/* Arrow pointing DOWN at the chip (above-mode) */
.ds-help-popover::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #131e30;
  border-right: 1px solid #2563eb;
  border-bottom: 1px solid #2563eb;
}
.ds-help-popover .dsh-title {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #60a5fa;
  margin-bottom: 6px;
}
.ds-help-popover .dsh-body {
  color: #e5edf5;
  font-size: 13px;
}
.ds-help-popover .dsh-body strong { color: #ffffff; font-weight: 700; }
.ds-help-popover .dsh-body code {
  background: rgba(37, 99, 235, 0.14);
  color: #93c5fd;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  font-size: 11.5px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.ds-help-popover .dsh-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 12px;
  background: rgba(37, 99, 235, 0.14);
  color: #93c5fd;
  border: 1px solid rgba(37, 99, 235, 0.40);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 11.5px;
  transition: all .15s ease;
}
.ds-help-popover .dsh-link:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Below-flip variant: when the ? is near the top of the viewport, the
 * popover flips below the chip. JS toggles the .below class + arrow. */
.ds-help-popover.below { transform: translate(-50%, 12px); }
.ds-help-popover.below.on { transform: translate(-50%, 0); }
.ds-help-popover.below::before {
  bottom: auto;
  top: -7px;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid #2563eb;
  border-top: 1px solid #2563eb;
}

/* Larger inline help block for page-header guidance (info bar variant). */
.ds-guide {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px 12px 14px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.10), transparent 65%);
  border-left: 3px solid #2563eb;
  border-radius: 8px;
  margin: 12px 0 18px;
  color: #96a3b8;
  font-size: 13px;
  line-height: 1.6;
}
.ds-guide .dsg-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(37, 99, 235, 0.35);
  display: grid;
  place-items: center;
  color: #60a5fa;
  font-weight: 800;
  font-size: 13px;
  margin-top: 1px;
}
.ds-guide .dsg-title {
  color: #ffffff;
  font-weight: 700;
  margin-right: 6px;
}
.ds-guide a { color: #60a5fa; text-decoration: none; font-weight: 600; }
.ds-guide a:hover { text-decoration: underline; }

/* =========================================================================
 * .ds-explainer — collapsible info block for page headers.
 *
 * Uses native <details>/<summary> for zero-JS toggle behaviour.
 *
 *   <details class="ds-explainer">
 *     <summary class="ds-explainer-head">
 *       <span class="ds-explainer-icon">i</span>
 *       <span class="ds-explainer-title">How this thing works</span>
 *       <span class="ds-explainer-chev">v</span>
 *     </summary>
 *     <div class="ds-explainer-body">
 *       Longer HTML explanation with <strong>bold</strong>, <code>code</code>,
 *       <ul><li>lists</li></ul>, <a>links</a>, etc.
 *     </div>
 *   </details>
 * ========================================================================= */

.ds-explainer {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02) 65%);
  border: 1px solid rgba(37, 99, 235, 0.30);
  border-left: 3px solid #2563eb;
  border-radius: 10px;
  margin: 14px 0 20px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.ds-explainer[open] {
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.50);
}
.ds-explainer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  color: #e5edf5;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.12s ease;
}
.ds-explainer-head::-webkit-details-marker { display: none; }
.ds-explainer-head:hover { background: rgba(37, 99, 235, 0.05); }
.ds-explainer-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.40);
  display: grid;
  place-items: center;
  color: #60a5fa;
  font-weight: 800;
  font-size: 13px;
  font-family: 'Georgia', serif;
  font-style: italic;
}
.ds-explainer-title {
  flex: 1;
  color: #ffffff;
  letter-spacing: 0.01em;
}
.ds-explainer-chev {
  flex: 0 0 auto;
  color: #60a5fa;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
  display: inline-block;
}
.ds-explainer[open] .ds-explainer-chev { transform: rotate(180deg); }

.ds-explainer-body {
  padding: 4px 20px 18px;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.65;
  border-top: 1px solid rgba(37, 99, 235, 0.18);
  margin-top: 0;
}
.ds-explainer-body h4 {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  margin: 16px 0 6px;
  letter-spacing: 0.02em;
}
.ds-explainer-body p { margin: 8px 0; }
.ds-explainer-body ul,
.ds-explainer-body ol {
  margin: 8px 0 8px 20px;
  padding: 0;
}
.ds-explainer-body li { margin: 4px 0; }
.ds-explainer-body strong { color: #ffffff; }
.ds-explainer-body code {
  background: rgba(37, 99, 235, 0.14);
  color: #93c5fd;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  font-size: 11.5px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.ds-explainer-body a { color: #60a5fa; text-decoration: none; font-weight: 600; }
.ds-explainer-body a:hover { text-decoration: underline; }
.ds-explainer-body kbd {
  background: #0a1220;
  color: #ffffff;
  border: 1px solid #223050;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
