/* ==========================================================================
   YourAppSpace Legal Documentation Stylesheet (Privacy Policy & Terms of Service)
   ========================================================================== */

:root {
  --bg-primary: #071324;
  --bg-secondary: #0c1d37;
  --bg-surface: rgba(255, 255, 255, 0.035);
  --bg-surface-hover: rgba(255, 255, 255, 0.06);
  --bg-surface-active: rgba(255, 255, 255, 0.08);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(233, 66, 89, 0.4);
  --border-cyan: rgba(56, 189, 248, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-heading: #ffffff;
  
  --accent-red: #E94259;
  --accent-cyan: #38bdf8;
  --accent-green: #2EB086;
  --accent-purple: #8B5CF6;
  
  --font-family-base: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  
  --header-height: 72px;
  --max-content-width: 1240px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.legal-page {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-family-base);
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Ambient Glows */
.legal-glow-1 {
  position: fixed;
  top: -150px;
  left: 20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(233, 66, 89, 0.05) 50%, transparent 80%);
  filter: blur(100px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.legal-glow-2 {
  position: fixed;
  bottom: 10%;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
  filter: blur(120px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* Top Sticky Navigation Bar */
.legal-navbar {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: rgba(7, 19, 36, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  z-index: 50;
  display: flex;
  align-items: center;
}

.legal-navbar-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.legal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.legal-brand-logo {
  width: 34px;
  height: 38px;
}

.legal-brand-name {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.legal-doc-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.legal-switcher-link {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.legal-switcher-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.legal-switcher-link.active {
  background: var(--accent-red);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(233, 66, 89, 0.35);
}

.legal-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  transition: all 0.2s ease;
}

.legal-back-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(-2px);
}

/* Page Layout Container */
.legal-main-container {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
}

/* Sidebar TOC Navigation */
.legal-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  padding-right: 8px;
}

.legal-sidebar::-webkit-scrollbar {
  width: 4px;
}
.legal-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.legal-toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid var(--border-color);
  padding-left: 14px;
}

.legal-toc-link {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 5px 0;
  transition: all 0.2s ease;
  position: relative;
}

.legal-toc-link:hover {
  color: var(--accent-cyan);
  transform: translateX(3px);
}

.legal-toc-link.active {
  color: #ffffff;
  font-weight: 600;
}

.legal-toc-link.active::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 16px;
  background: var(--accent-red);
  border-radius: 2px;
}

/* Document Content Body */
.legal-content {
  max-width: 820px;
}

/* Hero Section */
.legal-hero {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(233, 66, 89, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(233, 66, 89, 0.3);
  margin-bottom: 16px;
}

.legal-hero h1 {
  font-size: 38px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 16px;
}

.legal-metadata-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.legal-metadata-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Summary Box */
.legal-summary-box {
  margin: 32px 0 40px;
  padding: 22px 26px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(233, 66, 89, 0.04) 100%);
  border: 1px solid var(--border-cyan);
  position: relative;
}

.legal-summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legal-summary-box p {
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1.65;
  margin: 0;
}

/* Typography Inside Content */
.legal-section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.legal-section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.legal-section-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-red);
  font-family: var(--font-family-mono);
}

.legal-section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.3px;
  margin: 0;
}

.legal-subsection-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 28px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-subsection-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.legal-content p {
  color: var(--text-secondary);
  font-size: 15.5px;
  line-height: 1.75;
  margin-bottom: 16px;
}

.legal-content strong {
  color: #ffffff;
  font-weight: 600;
}

.legal-content a {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.legal-content a:hover {
  color: #7dd3fc;
}

/* Lists */
.legal-content ul,
.legal-content ol {
  margin: 14px 0 22px 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal-content ul li {
  position: relative;
  padding-left: 24px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.legal-content ul li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 6px rgba(233, 66, 89, 0.4);
}

/* Definitions Grid */
.legal-defs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 24px 0 32px;
}

.legal-def-card {
  padding: 18px 22px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.legal-def-card:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.legal-def-term {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.legal-def-term span.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
}

.legal-def-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

/* Highlight / Alert Callout */
.legal-callout {
  padding: 20px 24px;
  border-radius: 12px;
  margin: 24px 0;
  background: rgba(255, 255, 255, 0.025);
  border-left: 4px solid var(--accent-red);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.legal-callout-warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.04);
}

.legal-callout-info {
  border-left-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.04);
}

.legal-callout-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffffff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-callout p:last-child {
  margin-bottom: 0;
}

/* Contact Details Card */
.legal-contact-card {
  padding: 24px 28px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  margin-top: 24px;
}

.legal-contact-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
}

.legal-contact-card p {
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--text-secondary);
}

.legal-contact-card a {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Document Footer */
.legal-footer {
  border-top: 1px solid var(--border-color);
  padding: 48px 24px;
  background: rgba(7, 19, 36, 0.95);
  position: relative;
  z-index: 2;
}

.legal-footer-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.legal-footer-left p {
  font-size: 13px;
  color: var(--text-muted);
}

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.legal-footer-links a {
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-footer-links a:hover {
  color: #ffffff;
}

/* Responsive adjustments */
@media screen and (max-width: 1024px) {
  .legal-main-container {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .legal-sidebar {
    position: static;
    max-height: none;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 16px;
  }
  
  .legal-toc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    border-left: none;
    padding-left: 0;
    gap: 8px;
  }
  
  .legal-toc-link.active::before {
    display: none;
  }
}

@media screen and (max-width: 640px) {
  .legal-navbar-inner {
    padding: 0 16px;
  }
  
  .legal-doc-switcher {
    display: none;
  }
  
  .legal-hero h1 {
    font-size: 28px;
  }
  
  .legal-main-container {
    padding: 24px 16px 60px;
  }
}
