/* ================================================================
   LEGAL PAGES — Privacy Policy, Terms of Service, Cookie Policy
   Standalone layout with theme support
   ================================================================ */

/* ── Page shell ── */
.legal-page {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.legal-page.theme-dark {
  background: #0b1320;
  color: #d5e0ef;
}

/* ── Top bar ── */
.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 2rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.legal-page.theme-dark .legal-topbar {
  background: #101827;
  border-bottom-color: #26334a;
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

.legal-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.legal-topbar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 0.75rem;
}

.legal-topbar-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.legal-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.legal-topbar-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}

.legal-topbar-link:hover {
  background: #f1f5f9;
  color: #1e40af;
}

.legal-page.theme-dark .legal-topbar-link {
  color: #8ba0bc;
}

.legal-page.theme-dark .legal-topbar-link:hover {
  background: #162133;
  color: #5b8cff;
}

.legal-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.legal-theme-btn:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.legal-page.theme-dark .legal-theme-btn {
  background: #162133;
  border-color: #2f4565;
  color: #d9e8fb;
}

.legal-page.theme-dark .legal-theme-btn:hover {
  background: #1a3354;
}

/* ── Layout ── */
.legal-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  gap: 2rem;
  padding: 2rem;
}

/* ── Sidebar / TOC ── */
.legal-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 60px;
  align-self: flex-start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.legal-sidebar::-webkit-scrollbar { width: 3px; }
.legal-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.legal-page.theme-dark .legal-sidebar::-webkit-scrollbar-thumb { background: #334560; }

.legal-toc-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 0.75rem;
}

.legal-page.theme-dark .legal-toc-title {
  color: #6a84a6;
}

.legal-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legal-toc-list li {
  margin-bottom: 0.15rem;
}

.legal-toc-list a {
  display: block;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-radius: 5px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.legal-toc-list a:hover,
.legal-toc-list a.active {
  color: #1e40af;
  background: #eff6ff;
  border-left-color: #1e40af;
}

.legal-page.theme-dark .legal-toc-list a {
  color: #8ba0bc;
}

.legal-page.theme-dark .legal-toc-list a:hover,
.legal-page.theme-dark .legal-toc-list a.active {
  color: #5b8cff;
  background: rgba(91,140,255,0.08);
  border-left-color: #5b8cff;
}

/* ── Main content ── */
.legal-main {
  flex: 1;
  min-width: 0;
}

.legal-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 2.5rem 3rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.legal-page.theme-dark .legal-card {
  background: #101827;
  border-color: #2a3a50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Header area ── */
.legal-doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  background: #eff6ff;
  color: #1e40af;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.legal-page.theme-dark .legal-doc-badge {
  background: rgba(91,140,255,0.12);
  color: #5b8cff;
}

.legal-doc-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.35rem 0;
  line-height: 1.2;
}

.legal-page.theme-dark .legal-doc-title {
  color: #f4f7fb;
}

.legal-doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 1.5rem;
}

.legal-page.theme-dark .legal-doc-meta {
  color: #8ba0bc;
}

.legal-doc-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── TL;DR box ── */
.legal-tldr {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.legal-page.theme-dark .legal-tldr {
  background: linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(91,140,255,0.05) 100%);
  border-color: rgba(59,130,246,0.2);
}

.legal-tldr-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e40af;
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legal-page.theme-dark .legal-tldr-title {
  color: #5b8cff;
}

.legal-tldr ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.82rem;
  color: #334155;
}

.legal-tldr li {
  margin-bottom: 0.3rem;
}

.legal-page.theme-dark .legal-tldr ul {
  color: #b4c2d7;
}

/* ── Section headings ── */
.legal-section {
  margin-bottom: 2rem;
  scroll-margin-top: 80px;
}

.legal-section-number {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  background: #1e40af;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.legal-page.theme-dark .legal-section-number {
  background: #5b8cff;
  color: #0b1320;
}

.legal-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.legal-page.theme-dark .legal-section h2 {
  color: #f4f7fb;
  border-bottom-color: #243248;
}

.legal-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  margin: 1.25rem 0 0.5rem 0;
}

.legal-page.theme-dark .legal-section h3 {
  color: #e7edf6;
}

.legal-section p,
.legal-section li {
  font-size: 0.88rem;
  color: #475569;
  margin-bottom: 0.5rem;
}

.legal-page.theme-dark .legal-section p,
.legal-page.theme-dark .legal-section li {
  color: #b4c2d7;
}

.legal-section ul,
.legal-section ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.legal-section strong {
  color: #1e293b;
  font-weight: 600;
}

.legal-page.theme-dark .legal-section strong {
  color: #e7edf6;
}

/* ── Tables ── */
.legal-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.legal-table th,
.legal-table td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border: 1px solid #e2e8f0;
}

.legal-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.legal-table td {
  color: #475569;
}

.legal-page.theme-dark .legal-table th,
.legal-page.theme-dark .legal-table td {
  border-color: #243248;
}

.legal-page.theme-dark .legal-table th {
  background: #162133;
  color: #d5e0ef;
}

.legal-page.theme-dark .legal-table td {
  color: #b4c2d7;
}

/* ── Info / warning boxes ── */
.legal-info-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.84rem;
  color: #166534;
}

.legal-page.theme-dark .legal-info-box {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.2);
  color: #34d399;
}

.legal-warning-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.84rem;
  color: #92400e;
}

.legal-page.theme-dark .legal-warning-box {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.2);
  color: #fbbf24;
}

/* ── Placeholder markers ── */
.legal-placeholder {
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.82rem;
}

.legal-page.theme-dark .legal-placeholder {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
}

/* ── Footer ── */
.legal-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
}

.legal-page.theme-dark .legal-footer {
  color: #6a84a6;
  border-top-color: #243248;
}

.legal-footer a {
  color: #64748b;
  text-decoration: none;
  margin: 0 0.5rem;
}

.legal-footer a:hover {
  color: #1e40af;
}

.legal-page.theme-dark .legal-footer a {
  color: #8ba0bc;
}

.legal-page.theme-dark .legal-footer a:hover {
  color: #5b8cff;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .legal-layout {
    flex-direction: column;
    padding: 1.25rem;
    gap: 0;
  }

  .legal-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    margin-bottom: 1.5rem;
    padding-right: 0;
  }

  .legal-card {
    padding: 1.5rem;
  }

  .legal-topbar {
    padding: 0.5rem 1rem;
  }
}

@media (max-width: 600px) {
  .legal-card {
    padding: 1.25rem 1rem;
    border-radius: 8px;
  }

  .legal-doc-title {
    font-size: 1.35rem;
  }

  .legal-doc-meta {
    flex-direction: column;
    gap: 0.3rem;
  }
}

/* ── Print ── */
@media print {
  .legal-topbar,
  .legal-sidebar,
  .legal-theme-btn { display: none !important; }
  .legal-layout { max-width: 100%; }
  .legal-card { box-shadow: none; border: none; padding: 0; }
}
