/**
 * ToolaBrowser Legal Pages
 * Styles for Terms of Service, Privacy Policy, and EULA pages
 * Version 1.0 | December 2025
 */

/* ============================================
   PAGE HERO (Legal Page Headers)
   ============================================ */

.page-hero {
  background: linear-gradient(151.4deg,
    var(--color-primary-50) 0%,
    var(--color-accent-50) 100%);
  padding: var(--space-20) 0 var(--space-12);
  margin-top: 73px; /* Account for fixed header */
  text-align: center;
  border-bottom: 1px solid var(--color-neutral-200);
}

.page-title {
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
  color: var(--color-primary-800);
  margin-bottom: var(--space-3);
  line-height: var(--leading-tight);
}

.page-subtitle {
  font-size: var(--text-lg);
  color: var(--color-neutral-600);
  margin: 0;
}

/* ============================================
   LEGAL CONTENT LAYOUT
   ============================================ */

.legal-content {
  padding: var(--space-20) 0;
  background: white;
}

.legal-content .container {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-16);
  max-width: 1200px;
  align-items: start;
}

/* Main Content Area */
.legal-text {
  max-width: 800px;
}

/* ============================================
   LEGAL SECTIONS
   ============================================ */

.legal-section {
  margin-bottom: var(--space-12);
  scroll-margin-top: 100px; /* Offset for fixed header when jumping to anchors */
}

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

/* Section Headings */
.legal-section h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-primary-800);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-neutral-200);
  line-height: var(--leading-tight);
}

.legal-section h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  line-height: var(--leading-tight);
}

.legal-section h4 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-800);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

/* Paragraphs */
.legal-section p {
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--color-neutral-700);
  margin-bottom: var(--space-4);
}

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

/* Strong/Bold text */
.legal-section strong {
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
}

/* Emphasis */
.legal-section em {
  font-style: italic;
  color: var(--color-neutral-800);
}

/* Lists */
.legal-section ul,
.legal-section ol {
  margin: var(--space-4) 0;
  padding-left: var(--space-8);
  color: var(--color-neutral-700);
}

.legal-section ul {
  list-style-type: disc;
}

.legal-section ol {
  list-style-type: decimal;
}

.legal-section li {
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  margin-bottom: var(--space-3);
  padding-left: var(--space-2);
}

.legal-section li:last-child {
  margin-bottom: 0;
}

/* Nested lists */
.legal-section ul ul,
.legal-section ol ol,
.legal-section ul ol,
.legal-section ol ul {
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.legal-sidebar {
  position: relative;
}

.sticky-nav {
  position: sticky;
  top: 100px; /* Below fixed header */
  background: var(--color-neutral-50);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.sticky-nav h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-neutral-300);
}

/* Navigation List */
.legal-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legal-nav li {
  margin-bottom: var(--space-2);
}

.legal-nav li:last-child {
  margin-bottom: 0;
}

.legal-nav a {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-neutral-600);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: all var(--duration-base) ease;
  line-height: var(--leading-normal);
}

.legal-nav a:hover {
  color: var(--color-primary-600);
  background: var(--color-primary-50);
  transform: translateX(4px);
}

.legal-nav a:focus-visible {
  outline: 2px solid var(--color-primary-600);
  outline-offset: 2px;
}

.legal-nav a.active {
  color: var(--color-primary-600);
  background: var(--color-primary-50);
  font-weight: var(--font-medium);
}

/* ============================================
   SPECIAL CONTENT BLOCKS
   ============================================ */

/* Contact Information Block */
.contact-block {
  background: var(--color-primary-50);
  border-left: 4px solid var(--color-primary-600);
  padding: var(--space-6);
  border-radius: var(--radius-base);
  margin: var(--space-6) 0;
}

.contact-block h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-primary-800);
  margin-top: 0;
  margin-bottom: var(--space-3);
}

.contact-block p {
  margin-bottom: var(--space-2);
}

.contact-block a {
  color: var(--color-primary-600);
  text-decoration: underline;
  font-weight: var(--font-medium);
}

.contact-block a:hover {
  color: var(--color-primary-700);
}

/* Important Notice Block */
.notice-block {
  background: var(--color-warning-100);
  border-left: 4px solid var(--color-warning-600);
  padding: var(--space-6);
  border-radius: var(--radius-base);
  margin: var(--space-6) 0;
}

.notice-block p {
  color: var(--color-neutral-800);
  margin-bottom: 0;
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */

.back-to-top {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  width: 48px;
  height: 48px;
  background: var(--color-primary-600);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) ease;
  z-index: var(--z-sticky);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--color-primary-700);
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.back-to-top:active {
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 4px solid rgba(0, 102, 166, 0.3);
  outline-offset: 2px;
}

.back-to-top svg {
  width: 24px;
  height: 24px;
}

/* ============================================
   TABLE OF CONTENTS (Alternative to Sidebar)
   ============================================ */

.table-of-contents {
  background: var(--color-neutral-50);
  border: 2px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: var(--space-12);
}

.table-of-contents h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-primary-800);
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.table-of-contents ol {
  list-style-position: inside;
  padding-left: 0;
  counter-reset: toc-counter;
}

.table-of-contents ol li {
  counter-increment: toc-counter;
  margin-bottom: var(--space-2);
}

.table-of-contents a {
  color: var(--color-primary-600);
  text-decoration: none;
  font-weight: var(--font-medium);
}

.table-of-contents a:hover {
  text-decoration: underline;
  color: var(--color-primary-700);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .site-header,
  .site-footer,
  .legal-sidebar,
  .back-to-top,
  .sticky-nav {
    display: none;
  }

  .page-hero {
    margin-top: 0;
    page-break-after: avoid;
  }

  .legal-content .container {
    grid-template-columns: 1fr;
  }

  .legal-section {
    page-break-inside: avoid;
  }

  .legal-section h2 {
    page-break-after: avoid;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }
}

/* ============================================
   RESPONSIVE BEHAVIOR
   ============================================ */

@media (max-width: 980px) {
  .legal-content .container {
    grid-template-columns: 1fr;
  }

  .legal-sidebar {
    display: none; /* Hide sidebar on tablets and mobile */
  }

  .page-hero {
    padding: var(--space-16) 0 var(--space-10);
  }

  .page-title {
    font-size: var(--text-4xl);
  }

  .legal-section h2 {
    font-size: var(--text-xl);
  }

  .legal-section h3 {
    font-size: var(--text-lg);
  }
}

@media (max-width: 740px) {
  .page-hero {
    padding: var(--space-12) 0 var(--space-8);
  }

  .page-title {
    font-size: var(--text-3xl);
  }

  .page-subtitle {
    font-size: var(--text-base);
  }

  .legal-section {
    margin-bottom: var(--space-10);
  }

  .legal-section h2 {
    font-size: var(--text-lg);
  }

  .back-to-top {
    bottom: var(--space-6);
    right: var(--space-6);
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: var(--text-2xl);
  }

  .legal-section ul,
  .legal-section ol {
    padding-left: var(--space-6);
  }
}
