/* Shared SAG training manual styles — ParkHQ/PoolHQ layout grammar, SAG brand */
:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --accent: #2d6a4f;
  --money: #2d6a4f;
  --accent-dark: #1b4332;
  --accent-soft: #5c4d8a;
  --text: #14261c;
  --muted: #5a6b60;
  --border: #d5e0d8;
  --warn-bg: #fef3c7;
  --warn-border: #f59e0b;
  --warn-text: #92400e;
  --page-pad: clamp(16px, 4vw, 16mm);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@page {
  size: A4;
  margin: 12mm;
}

body {
  font-family: 'Figtree', 'Bricolage Grotesque', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 10pt;
  line-height: 1.55;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ── Screen shell (hidden when printing) ── */
.manual-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px clamp(12px, 3vw, 20px);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.manual-topbar__link {
  font-size: 9pt;
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: none;
}

.manual-topbar__link:hover {
  text-decoration: underline;
}

.manual-topbar__link--muted {
  color: var(--muted);
}

@media print {
  .manual-topbar {
    display: none !important;
  }
}

/* ── Page layout ── */
.page {
  width: 210mm;
  min-height: 297mm;
  padding: 12mm;
  margin: 0 auto 8mm;
  background: var(--surface);
  page-break-after: always;
  position: relative;
}

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

@media screen {
  body {
    font-size: clamp(10pt, 2.6vw, 11pt);
    padding: 0 clamp(0px, 2vw, 12px) clamp(16px, 4vw, 24px);
  }

  .page {
    width: 100%;
    max-width: 210mm;
    min-height: auto;
    padding: var(--page-pad);
    margin: 0 auto clamp(12px, 3vw, 8mm);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgb(15 23 42 / 6%), 0 8px 24px rgb(15 23 42 / 4%);
  }

  .cover-inner {
    min-height: min(72vh, 520px);
  }

  .footer-note {
    position: static;
    margin-top: clamp(20px, 4vw, 32px);
    flex-wrap: wrap;
    gap: 6px;
  }

  h1 {
    font-size: clamp(1.45rem, 5.5vw, 22pt);
  }

  h2 {
    font-size: clamp(1.05rem, 3.8vw, 14pt);
  }

  .step {
    grid-template-columns: min(44px, 12vw) 1fr;
    gap: clamp(8px, 2.5vw, 14px);
    padding: clamp(10px, 2.5vw, 14px) 0;
  }

  .step-num {
    width: clamp(34px, 10vw, 40px);
    height: clamp(34px, 10vw, 40px);
    font-size: clamp(11pt, 3vw, 14pt);
  }

  .quick-ref {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .quick-ref table {
    min-width: min(100%, 320px);
  }

  code {
    word-break: break-word;
  }
}

@media screen and (max-width: 480px) {
  .step {
    grid-template-columns: 1fr;
  }

  .step-num {
    justify-self: start;
  }

  .footer-note {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media print {
  body {
    background: white;
  }

  .page {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    width: 210mm;
    min-height: 297mm;
    padding: 12mm;
  }

  .cover-inner {
    min-height: calc(297mm - 24mm);
  }

  .footer-note {
    position: absolute;
    bottom: 12mm;
    left: 12mm;
    right: 12mm;
    flex-direction: row;
  }
}

/* ── Typography & components ── */
h1 {
  font-size: 22pt;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: 14pt;
  font-weight: 700;
  margin-bottom: 8px;
}

h3 {
  font-size: 11pt;
  font-weight: 600;
  margin: 0 0 6px;
}

p {
  margin-bottom: 8px;
}

.accent-bar {
  width: 48px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin: 12px 0 16px;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-dark);
  font-size: 8pt;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14pt;
  color: white;
  flex-shrink: 0;
}

.logo-wordmark {
  font-weight: 600;
  font-size: 11pt;
}

.cover-inner {
  display: flex;
  flex-direction: column;
  min-height: calc(297mm - 24mm);
}

.cover-lead {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cover-title {
  margin-top: 16px;
}

.cover-sub {
  font-size: clamp(10pt, 2.8vw, 12pt);
  max-width: 420px;
}

.cover-meta {
  margin-top: auto;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.demo-box {
  margin: 16px 0 20px;
  padding: 14px 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  font-size: 9.5pt;
  line-height: 1.5;
}

.demo-box p {
  margin: 0 0 6px;
}

.demo-box p:last-child {
  margin-bottom: 0;
}

.demo-box a {
  color: var(--accent-dark);
  font-weight: 500;
}

.step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.step:last-of-type {
  border-bottom: none;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 14pt;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fig {
  margin: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fig svg,
.fig img {
  display: block;
  max-width: 100%;
  height: auto;
}

.fig img {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 2px 8px rgb(15 23 42 / 6%);
}

.fig-caption {
  font-size: 8.5pt;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin: 12px 0 20px;
}

.shot-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.shot-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.shot-card span {
  display: block;
  padding: 8px 10px;
  font-size: 8.5pt;
  color: var(--muted);
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
}

.card-accent {
  border-left: 3px solid var(--accent);
}

.card-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn-border);
}

.card-warn h3 {
  color: var(--warn-text);
}

.card-warn li {
  color: var(--warn-text);
}

.quick-ref {
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 16px;
}

.quick-ref h3 {
  color: var(--accent-dark);
  margin-bottom: 10px;
}

.quick-ref table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
}

.quick-ref th,
.quick-ref td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.quick-ref th {
  background: rgba(99, 102, 241, 0.08);
  font-weight: 600;
}

ul.bullets {
  padding-left: 18px;
  margin-bottom: 8px;
}

ul.bullets li {
  margin-bottom: 4px;
}

.nav-back {
  font-size: 9pt;
  margin-bottom: 16px;
}

.nav-back a {
  color: var(--accent-dark);
  text-decoration: none;
}

.nav-back a:hover {
  text-decoration: underline;
}

.footer-note {
  position: absolute;
  bottom: 12mm;
  left: 12mm;
  right: 12mm;
  font-size: 8pt;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
}

.footer-note a {
  color: var(--accent-dark);
}

/* ── Training hub (index.html) ── */
.hub-intro {
  max-width: 480px;
  margin-bottom: 24px;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 14px;
  margin-top: 8px;
}

.role-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  height: 100%;
}

.role-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.role-card svg {
  margin-bottom: 10px;
  max-width: 100%;
  height: auto;
}

.role-card h3 {
  font-size: 11pt;
  font-weight: 600;
  margin-bottom: 4px;
}

.role-card p {
  font-size: 9pt;
  color: var(--muted);
  margin: 0;
}

.role-badge {
  font-size: 7.5pt;
  font-weight: 600;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-card--featured {
  grid-column: 1 / -1;
}

@media screen and (min-width: 560px) {
  .role-card--featured {
    max-width: calc(50% - 7px);
  }
}

.hub-footer {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 8.5pt;
  color: var(--muted);
}

.hub-footer a {
  color: var(--accent-dark);
}

.hub-footer p + p {
  margin-top: 6px;
}

.hub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

kbd {
  font-family: inherit;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}

/* ── WhatsApp chat transcripts (admin / member manuals) ── */
.chat-thread {
  max-width: 420px;
  margin: 10px 0 4px;
  padding: 12px;
  border-radius: 12px;
  background: #0b141a;
  border: 1px solid #1f2c34;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-meta {
  font-size: 8pt;
  color: #8696a0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.chat-bubble {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 9pt;
  line-height: 1.45;
  white-space: pre-wrap;
  color: #e9edef;
}

.chat-bubble--bot {
  align-self: flex-start;
  background: #202c33;
  border-top-left-radius: 2px;
}

.chat-bubble--user {
  align-self: flex-end;
  background: #005c4b;
  border-top-right-radius: 2px;
}

.chat-bubble strong {
  color: #fff;
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.chat-chip {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 8.5pt;
  font-weight: 600;
  background: #1f2c34;
  color: #53bdeb;
  border: 1px solid #2a3942;
}

.chat-chip--primary {
  background: #005c4b;
  color: #e9edef;
  border-color: #067e69;
}

.chat-note {
  font-size: 8.5pt;
  color: var(--muted);
  margin-top: 6px;
  max-width: 420px;
}

.chat-note a {
  color: var(--accent-dark);
}

/* ── Online chrome: switcher + actions + footer ── */
.manual-switcher {
  position: sticky;
  top: 44px;
  z-index: 19;
  background: rgb(243 246 244 / 94%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.manual-switcher__scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px clamp(12px, 3vw, 20px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.manual-switcher__link {
  flex: 0 0 auto;
  font-size: 8.5pt;
  font-weight: 650;
  text-decoration: none;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.manual-switcher__link:hover {
  color: var(--accent-dark);
  background: #fff;
  border-color: var(--border);
}
.manual-switcher__link.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.manual-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: space-between;
  align-items: center;
  padding: 10px clamp(12px, 3vw, 20px);
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.manual-actions__nav,
.manual-actions__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.manual-actions__btn {
  font: inherit;
  font-size: 8.5pt;
  font-weight: 650;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
.manual-actions__btn.ghost {
  background: #fff;
  color: var(--accent-dark);
  border-color: var(--border);
}
.manual-actions__btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.manual-actions__btn:hover {
  filter: brightness(1.05);
}

.manual-topbar__right {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.manual-footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(12px, 3vw, 24px) 28px;
  max-width: 210mm;
  margin: 0 auto;
  font-size: 9.5pt;
  font-weight: 650;
}
.manual-footer-nav a {
  color: var(--accent-dark);
  text-decoration: none;
}
.manual-footer-nav a:hover {
  text-decoration: underline;
}

@media print {
  .manual-switcher,
  .manual-actions,
  .manual-footer-nav {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .page {
    width: 100%;
    min-height: 0;
    padding: var(--page-pad);
  }
}
