/*
 * legal-doc.css — Shared styles for legal document pages
 * Used by: /clinicmind-terms-conditions, /privacy-notice
 *
 * Sections
 *   1. Page wrapper padding              (both pages)
 *   2. Sidebar sticky position           (both pages — shared top/max-height)
 *   3. TOC list & links                  (both pages — left-border style)
 *   4. TOC section label                 (terms only — group headings)
 *   5. TOC scroll container + scrollbar  (both pages)
 *   6. TOC label heading                 (privacy only)
 *   7. Mobile: hidden defaults           (both pages)
 *   8. Mobile ≤991px: responsive overrides
 *      a. Wrap padding                   (both pages)
 *      b. Hide desktop sidebar           (both pages)
 *      c. Floating Action Button (FAB)   (both pages)
 *      d. Overlay backdrop               (both pages)
 *      e. Slide-up panel                 (both pages)
 *      f. Panel header & close           (both pages)
 *      g. Panel link list                (both pages)
 *
 * What stays page-specific (NOT here):
 *   - Grid layout — column widths and gap differ (264px vs 260px)
 *   - Sidebar overflow/display — terms uses overflow:hidden + flex for inner .toc-scroll;
 *                                privacy uses overflow-y:auto directly on the aside
 *   - Document body typography — terms (.tc-*, .terms-section) vs privacy (.privacy-section)
 *   - Terms-only panel internals: panel-body, panel-dl, panel-divider
 *   - Privacy-only desktop elements: toc-toggle, toc-caret
 */

/* ── 1. Page wrapper padding — both pages ────────────────────────── */
.terms-wrap,
.privacy-wrap {
  padding: 64px 0 96px;
}

/* ── 2. Sidebar sticky position — both pages ─────────────────────── */
/* top: 132px = nav height (≤118px) + ~14px gap, safe for both A/B variants.
 * Changing the nav height? Update top and max-height here only — not in each page. */
.terms-toc,
.privacy-toc {
  position: sticky;
  top: 132px;
  max-height: calc(100vh - 152px);
}

/* ── 3. TOC list & links — left-border style, both pages ─────────── */
.toc-list,
.privacy-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--line-soft);
}

.toc-list li,
.privacy-toc ol li {
  margin: 0;
}

.toc-list a,
.privacy-toc ol li a {
  display: block;
  padding: 6px 0 6px 16px;
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--ink-400);
  text-decoration: none;
  line-height: 1.45;
  transition: color 0.15s, border-color 0.15s;
  border-left: 2px solid transparent;
  margin-left: -2px;
}

.toc-list a:hover,
.privacy-toc ol li a:hover {
  color: var(--blue-800);
  border-left-color: var(--blue-800);
}

.toc-list a.toc-active,
.privacy-toc ol li a.toc-active {
  color: var(--blue-800);
  border-left-color: var(--blue-800);
  font-weight: 600;
  background: var(--bg-soft);
}

/* ── 4. TOC section label (terms group headings) ─────────────────── */
.toc-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-300);
  padding: 14px 0 4px;
  display: block;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.toc-section-label:first-of-type { padding-top: 4px; }

/* ── 5. TOC scroll container + scrollbar — both pages ────────────── */
.toc-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 6px;
}
.toc-scroll::-webkit-scrollbar,
.privacy-toc::-webkit-scrollbar { width: 4px; }
.toc-scroll::-webkit-scrollbar-track,
.privacy-toc::-webkit-scrollbar-track { background: transparent; }
.toc-scroll::-webkit-scrollbar-thumb,
.privacy-toc::-webkit-scrollbar-thumb { background: var(--line-soft); border-radius: 2px; }

/* ── 6. TOC label heading (privacy) ──────────────────────────────── */
.privacy-toc-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-300);
  margin-bottom: 14px;
}

/* ── 7. Mobile FABs/panels hidden by default on desktop — both pages */
.terms-toc-fab,
.terms-toc-overlay,
.terms-toc-panel,
.privacy-toc-fab,
.privacy-toc-overlay,
.privacy-toc-panel {
  display: none;
}

/* ── 8. Mobile ≤991px — both pages ──────────────────────────────── */
@media (max-width: 991px) {

  /* a. Wrap padding */
  .terms-wrap,
  .privacy-wrap { padding: 56px 0 80px; }

  /* b. Hide desktop sidebar */
  .terms-toc,
  .privacy-toc { display: none; }

  /* c. Floating Action Button (FAB) — both pages */
  .terms-toc-fab,
  .privacy-toc-fab {
    display: flex;
    align-items: center;
    gap: 7px;
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 200;
    background: var(--blue-800);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 11px 18px 11px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(21, 88, 176, 0.35);
    transition: background 0.15s;
  }
  .terms-toc-fab:hover,
  .privacy-toc-fab:hover { background: var(--blue-700); }
  .terms-toc-fab svg,
  .privacy-toc-fab svg { width: 16px; height: 16px; flex-shrink: 0; }

  /* d. Overlay backdrop */
  .terms-toc-overlay,
  .privacy-toc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 201;
  }
  .terms-toc-overlay.is-open,
  .privacy-toc-overlay.is-open { display: block; }

  /* e. Slide-up panel */
  .terms-toc-panel,
  .privacy-toc-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 202;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 0 0 env(safe-area-inset-bottom, 0);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
  }
  .terms-toc-panel.is-open,
  .privacy-toc-panel.is-open { transform: translateY(0); }

  /* f. Panel header & close button */
  .terms-toc-panel-head,
  .privacy-toc-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--line-soft);
    flex-shrink: 0;
  }
  .terms-toc-panel-head span,
  .privacy-toc-panel-head span {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-300);
  }
  .terms-toc-panel-close,
  .privacy-toc-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-400);
    padding: 4px;
    display: flex;
  }

  /* g. Panel link list */
  .terms-toc-panel ul,
  .privacy-toc-panel ol {
    list-style: none;
    padding: 8px 0 20px;
    margin: 0;
    overflow-y: auto;
  }
  .terms-toc-panel ul li a,
  .privacy-toc-panel ol li a {
    display: block;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-600);
    text-decoration: none;
  }
  .terms-toc-panel ul li a:active,
  .privacy-toc-panel ol li a:active { background: var(--bg-soft); }
}
