/* ============================================================
   SPWR User Guide — shared stylesheet
   Reuses tokens from /static/css/style.css (Nunito, green palette)
   ============================================================ */

:root {
  --guide-max-width: 1200px;
  --guide-gap: 1.5rem;
  --guide-pill-shadow: 0 2px 6px rgba(30, 45, 31, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.guide-shell {
  max-width: var(--guide-max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ── Top bar ──────────────────────────────────────────────── */
.guide-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.guide-topbar-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 900;
  font-size: 1.125rem;
  color: var(--color-text);
}

.guide-topbar-title .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-mid));
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.guide-topbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  min-height: 38px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.guide-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); }
.guide-btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}
.guide-btn.primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

/* ── Cross-link banner ────────────────────────────────────── */
.guide-banner {
  background: linear-gradient(135deg, var(--color-primary-light), #fff);
  border: 1px solid var(--color-primary);
  border-left-width: 5px;
  border-radius: var(--radius-md);
  padding: 0.875rem 1.125rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.guide-banner a { color: var(--color-primary-dark); font-weight: 800; }

/* ── Panel (one printed page) ─────────────────────────────── */
.guide-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.75rem;
  page-break-after: always;
}

.guide-panel:last-child { page-break-after: auto; }

.guide-panel-header {
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.guide-panel-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.guide-panel-title {
  font-size: 1.75rem;
  font-weight: 900;
  margin: 0 0 0.375rem;
  color: var(--color-text);
  line-height: 1.1;
}

.guide-panel-subtitle {
  font-size: 0.975rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* ── Columns ──────────────────────────────────────────────── */
.guide-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--guide-gap);
}
@media (max-width: 900px) {
  .guide-cols { grid-template-columns: 1fr; }
}
.guide-cols.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .guide-cols.two { grid-template-columns: 1fr; }
}

/* ── Card (one topic inside a panel) ─────────────────────── */
.guide-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.125rem 1.125rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.guide-card-title {
  font-size: 1.05rem;
  font-weight: 900;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
}
.guide-card-title .emoji { font-size: 1.2rem; }

.guide-card-body {
  font-size: 0.9rem;
  color: var(--color-text);
  margin: 0;
}

.guide-card-body p { margin: 0 0 0.5rem; }
.guide-card-body p:last-child { margin-bottom: 0; }

/* ── Numbered step pills ──────────────────────────────────── */
.guide-steps {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  counter-reset: step;
}
.guide-steps li {
  position: relative;
  padding: 0.5rem 0.625rem 0.5rem 2.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  counter-increment: step;
}
.guide-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-primary);
  color: #fff;
  font-weight: 900;
  font-size: 0.75rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: var(--guide-pill-shadow);
}

/* ── Bullet lists ─────────────────────────────────────────── */
.guide-ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.guide-ul li {
  position: relative;
  padding: 0.25rem 0 0.25rem 1.25rem;
  font-size: 0.9rem;
}
.guide-ul li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 900;
}

/* ── Callouts (Tip / Important / Info) ────────────────────── */
.guide-callout {
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.guide-callout .ico { font-size: 1.125rem; line-height: 1; flex-shrink: 0; }

.guide-callout.tip {
  background: #fff9db;
  border: 1px solid var(--color-yellow-dark);
  color: #7a5b00;
}
.guide-callout.important {
  background: #fff0f0;
  border: 1px solid var(--color-red);
  color: #a32020;
}
.guide-callout.info {
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  color: var(--color-primary-dark);
}

/* ── Screenshot container ─────────────────────────────────── */
.guide-shot {
  margin: 0;
  background: #f0f4f1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.375rem;
  display: block;
}
.guide-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}
.guide-shot figcaption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
}

/* Phone-viewport screenshots — narrower, centered */
.guide-shot.phone {
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}

/* Missing screenshot placeholder — before captures land */
.guide-shot.placeholder {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-style: italic;
  background: repeating-linear-gradient(
    45deg,
    #f0f4f1,
    #f0f4f1 10px,
    #e6ede8 10px,
    #e6ede8 20px
  );
}
.guide-shot.phone.placeholder { aspect-ratio: 9 / 19.5; }

/* ── Key-value table (for the 8 Settings sections etc.) ── */
.guide-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.375rem 0.75rem;
  font-size: 0.875rem;
}
.guide-kv dt {
  font-weight: 800;
  color: var(--color-text);
  display: flex;
  gap: 0.375rem;
  align-items: center;
  white-space: nowrap;
}
.guide-kv dd {
  margin: 0;
  color: var(--color-text-muted);
}

/* ── Status badges reference row ──────────────────────────── */
.guide-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.guide-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}
.guide-badge.scheduled  { background: var(--color-status-scheduled); }
.guide-badge.inprogress { background: var(--color-status-inprogress); }
.guide-badge.completed  { background: var(--color-status-completed); }
.guide-badge.cancelled  { background: var(--color-status-cancelled); }
.guide-badge.paid       { background: var(--color-status-paid); }
.guide-badge.sent       { background: var(--color-status-sent); color: #134b77; }
.guide-badge.draft      { background: var(--color-status-draft); color: #333; }
.guide-badge.pending    { background: var(--color-status-pending); color: #4a3b00; }

/* ── Print ────────────────────────────────────────────────── */
@media print {
  :root {
    --color-bg: #fff;
    --color-surface: #fff;
    --color-surface-2: #fff;
  }
  body { background: #fff; }
  .guide-topbar,
  .guide-banner,
  .guide-topbar-actions { display: none !important; }
  .guide-shell { max-width: none; padding: 0; }
  .guide-panel {
    box-shadow: none;
    border: none;
    padding: 0.5in 0.4in;
    margin: 0;
    page-break-after: always;
  }
  .guide-panel:last-child { page-break-after: auto; }
  .guide-card {
    break-inside: avoid;
    border: 1px solid var(--color-border);
  }
  .guide-shot { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .guide-callout { border: 1px solid; }
}

/* ── driver.js tour theme override ────────────────────────── */
.driver-popover.spwr-tour {
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-family: 'Nunito', sans-serif;
  color: var(--color-text);
}
.driver-popover.spwr-tour .driver-popover-title {
  font-weight: 900;
  color: var(--color-primary-dark);
}
.driver-popover.spwr-tour .driver-popover-description {
  color: var(--color-text);
  line-height: 1.5;
}
.driver-popover.spwr-tour button.driver-popover-next-btn,
.driver-popover.spwr-tour button.driver-popover-prev-btn,
.driver-popover.spwr-tour button.driver-popover-close-btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-shadow: none;
  min-height: 34px;
  padding: 0.375rem 0.875rem;
}
.driver-popover.spwr-tour button.driver-popover-next-btn {
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
}
.driver-popover.spwr-tour button.driver-popover-next-btn:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}
.driver-popover.spwr-tour button.driver-popover-prev-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.driver-popover.spwr-tour .driver-popover-progress-text {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.driver-popover-arrow-side-top.spwr-tour,
.driver-popover-arrow-side-bottom.spwr-tour,
.driver-popover-arrow-side-left.spwr-tour,
.driver-popover-arrow-side-right.spwr-tour {
  border-color: var(--color-primary);
}

/* Replay tour button — floats top-right of the page it belongs to */
.replay-tour-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 0.12s ease;
}
.replay-tour-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
}
