/* ========================================
   LEGAL PAGES STYLES
   Terms of Service, Privacy Policy, etc.
   Clean, professional document styling
   ======================================== */

/* ----------------------------------------
   LEGAL HERO SECTION
   ---------------------------------------- */
.legal-hero {
  padding: 4rem 0 3rem;
  background: linear-gradient(135deg, #f8fafa 0%, #fff 50%, #f0f9f9 100%);
}

.legal-hero-content {
  max-width: 720px;
}

.legal-hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
  margin: 1rem 0 1rem;
  letter-spacing: -0.02em;
}

.legal-hero-description {
  font-size: 1.125rem;
  color: #4b5563;
  line-height: 1.7;
  margin: 0 0 2rem;
}

/* Document Meta */
.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-item > i {
  font-size: 1.25rem;
  color: var(--color-primary);
}

.meta-content {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
}

/* Document Actions */
.document-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-doc-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  color: #374151;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-doc-action:hover {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.15);
  color: #111827;
}

.btn-doc-action i {
  font-size: 1.125rem;
}

@media (max-width: 768px) {
  .legal-hero {
    padding: 3rem 0 2rem;
  }

  .legal-hero-title {
    font-size: 2rem;
  }

  .legal-hero-description {
    font-size: 1.0625rem;
  }

  .document-meta {
    gap: 1rem;
  }
}

/* ----------------------------------------
   CONTENT LAYOUT
   Two-column: Sidebar + Main Content
   ---------------------------------------- */
.legal-content-section {
  padding: 3rem 0 5rem;
}

.legal-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 4rem;
  align-items: start;
}

@media (max-width: 991.98px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ----------------------------------------
   SIDEBAR: TABLE OF CONTENTS
   ---------------------------------------- */
.legal-sidebar {
  position: sticky;
  top: 100px;
}

.toc-container {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
}

.toc-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1rem;
}

.toc-title i {
  font-size: 1.125rem;
  color: var(--color-primary);
}

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

.toc-list li {
  counter-increment: toc-counter;
  margin-bottom: 0.125rem;
}

.toc-link {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #4b5563;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.toc-link::before {
  content: counter(toc-counter) ".";
  flex-shrink: 0;
  width: 1.25rem;
  font-weight: 500;
  color: #9ca3af;
}

.toc-link:hover {
  background: rgba(35, 118, 124, 0.06);
  color: var(--color-primary);
}

.toc-link:hover::before {
  color: var(--color-primary);
}

.toc-link.active {
  background: rgba(35, 118, 124, 0.08);
  color: var(--color-primary);
  font-weight: 500;
}

.toc-link.active::before {
  color: var(--color-primary);
}

/* Reading Progress */
.reading-progress {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.progress-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}

.progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 100px;
  transition: width 0.1s ease;
}

@media (max-width: 991.98px) {
  .legal-sidebar {
    position: relative;
    top: 0;
  }

  .toc-container {
    max-height: none;
  }

  .toc-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
  }
}

@media (max-width: 575.98px) {
  .toc-list {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------------------
   MAIN CONTENT
   ---------------------------------------- */
.legal-content {
  max-width: 760px;
}

/* Introduction */
.legal-intro {
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.legal-intro p {
  font-size: 1.0625rem;
  color: #4b5563;
  line-height: 1.8;
  margin: 0 0 1rem;
}

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

/* Sections */
.legal-section {
  display: flex;
  gap: 1.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  scroll-margin-top: 100px;
}

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

.section-number {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(35, 118, 124, 0.1);
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
}

.section-content {
  flex: 1;
  min-width: 0;
}

.section-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 1rem;
  line-height: 1.3;
}

.section-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 1.75rem 0 0.75rem;
  line-height: 1.4;
}

.section-content h3:first-of-type {
  margin-top: 0;
}

.section-content p {
  font-size: 1rem;
  color: #4b5563;
  line-height: 1.8;
  margin: 0 0 1rem;
}

.section-content a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.section-content a:hover {
  text-decoration: underline;
}

/* Legal Lists */
.legal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.legal-list li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: 0.625rem;
  font-size: 1rem;
  color: #4b5563;
  line-height: 1.7;
}

.legal-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 6px;
  height: 6px;
  background: var(--color-primary);
  border-radius: 50%;
}

.legal-list.prohibited li::before {
  background: #dc2626;
}

/* Definition List */
.definition-list {
  margin: 0;
}

.definition-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.definition-item:last-child {
  border-bottom: none;
}

.definition-item dt {
  font-weight: 600;
  color: #111827;
  min-width: 180px;
}

.definition-item dd {
  flex: 1;
  margin: 0;
  color: #4b5563;
  min-width: 200px;
}

/* Legal Callouts */
.legal-callout {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  margin: 1.25rem 0;
  border-radius: 10px;
  border-left: 4px solid;
}

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

.legal-callout.info {
  background: rgba(35, 118, 124, 0.06);
  border-color: var(--color-primary);
}

.callout-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.legal-callout.warning .callout-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.legal-callout.info .callout-icon {
  background: rgba(35, 118, 124, 0.15);
  color: var(--color-primary);
}

.callout-icon i {
  font-size: 1.125rem;
}

.callout-content {
  flex: 1;
}

.callout-content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.375rem;
}

.callout-content p {
  font-size: 0.9375rem;
  color: #4b5563;
  margin: 0;
  line-height: 1.6;
}

/* Contact Card */
.contact-card {
  padding: 1.5rem;
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  margin-top: 1rem;
}

.contact-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1rem !important;
}

.contact-card .contact-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: -0.5rem 0 1rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.contact-item i {
  color: var(--color-primary);
  font-size: 1.125rem;
  margin-top: 0.125rem;
}

.contact-item a {
  color: #374151;
  text-decoration: none;
}

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

.contact-item address {
  font-style: normal;
  color: #4b5563;
  line-height: 1.5;
  margin: 0;
}

/* Acknowledgment */
.legal-acknowledgment {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  margin-top: 2rem;
  background: rgba(35, 118, 124, 0.06);
  border: 1px solid rgba(35, 118, 124, 0.15);
  border-radius: 12px;
}

.acknowledgment-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
}

.acknowledgment-icon i {
  font-size: 1.125rem;
}

.legal-acknowledgment p {
  font-size: 0.9375rem;
  color: #374151;
  line-height: 1.6;
  margin: 0;
}

.legal-acknowledgment a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}

.legal-acknowledgment a:hover {
  text-decoration: underline;
}

@media (max-width: 575.98px) {
  .legal-section {
    flex-direction: column;
    gap: 1rem;
  }

  .section-number {
    width: 36px;
    height: 36px;
    font-size: 0.9375rem;
  }

  .section-content h2 {
    font-size: 1.375rem;
  }

  .definition-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  .definition-item dt {
    min-width: unset;
  }

  .legal-callout {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ----------------------------------------
   RELATED LINKS SECTION
   ---------------------------------------- */
.related-links-section {
  padding: 0 0 5rem;
}

.related-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.related-link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.related-link-card:hover {
  border-color: rgba(35, 118, 124, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.related-link-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 118, 124, 0.1);
  color: var(--color-primary);
  border-radius: 12px;
  font-size: 1.375rem;
}

.related-link-content {
  flex: 1;
  min-width: 0;
}

.related-link-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.25rem;
}

.related-link-content p {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

.related-link-arrow {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: #d1d5db;
  transition: all 0.2s ease;
}

.related-link-card:hover .related-link-arrow {
  color: var(--color-primary);
  transform: translateX(4px);
}

@media (max-width: 991.98px) {
  .related-links-grid {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------------------
   BACK TO TOP BUTTON (Legal Specific)
   ---------------------------------------- */
.back-to-top-legal {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(35, 118, 124, 0.3);
  transition: all 0.2s ease;
  z-index: 100;
}

.back-to-top-legal:hover {
  background: #1c5f64;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(35, 118, 124, 0.4);
}

.back-to-top-legal.show {
  display: flex;
}

.back-to-top-legal i {
  font-size: 1.25rem;
}

/* ----------------------------------------
   DATA TABLES (for Privacy Policy)
   ---------------------------------------- */
.data-table-container {
  margin: 1.25rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.legal-table thead {
  background: #f9fafb;
}

.legal-table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: #111827;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.legal-table td {
  padding: 0.875rem 1.25rem;
  color: #4b5563;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: top;
}

.legal-table tbody tr:last-child td {
  border-bottom: none;
}

.legal-table tbody tr:hover {
  background: rgba(35, 118, 124, 0.02);
}

.legal-table td strong {
  color: #111827;
  font-weight: 600;
}

/* Contact Card Subtitle */
.contact-card .contact-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: -0.5rem 0 1rem;
}

/* Margin Utilities for Legal Content */
.section-content .mt-3 {
  margin-top: 1rem;
}

/* Responsive Tables */
@media (max-width: 575.98px) {
  .legal-table {
    font-size: 0.875rem;
  }

  .legal-table th,
  .legal-table td {
    padding: 0.75rem 1rem;
  }

  /* Stack table on very small screens */
  .data-table-container {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0 1rem;
  }
}

/* ----------------------------------------
   PRIVACY-SPECIFIC CALLOUT STYLES
   ---------------------------------------- */
.legal-callout.info .callout-icon i.ti-shield-check {
  color: #16a34a;
}

.legal-callout.info:has(.ti-shield-check) {
  background: rgba(34, 197, 94, 0.06);
  border-color: #16a34a;
}

.legal-callout.info:has(.ti-shield-check) .callout-icon {
  background: rgba(34, 197, 94, 0.15);
}

/* Warning callout with mail icon for contact */
.legal-callout.warning:has(.ti-mail) {
  background: rgba(35, 118, 124, 0.06);
  border-color: var(--color-primary);
}

.legal-callout.warning:has(.ti-mail) .callout-icon {
  background: rgba(35, 118, 124, 0.15);
  color: var(--color-primary);
}

.legal-callout.warning:has(.ti-mail) .callout-icon i {
  color: var(--color-primary);
}

/* ----------------------------------------
   PRINT STYLES
   ---------------------------------------- */
@media print {
  .legal-hero {
    background: none;
    padding: 2rem 0;
  }

  .document-actions,
  .legal-sidebar,
  .related-links-section,
  .back-to-top-legal {
    display: none !important;
  }

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

  .legal-content {
    max-width: 100%;
  }

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

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

  a {
    color: inherit !important;
    text-decoration: none !important;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  a[href^="#"]:after,
  a[href^="/"]:after {
    content: "";
  }

  .legal-callout {
    border: 1px solid #ccc;
    background: #f9f9f9 !important;
  }
}

/* ----------------------------------------
   ANIMATIONS
   ---------------------------------------- */
.legal-section {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInSection 0.4s ease forwards;
}

.legal-section:nth-child(1) {
  animation-delay: 0s;
}
.legal-section:nth-child(2) {
  animation-delay: 0.05s;
}
.legal-section:nth-child(3) {
  animation-delay: 0.1s;
}
.legal-section:nth-child(4) {
  animation-delay: 0.15s;
}
.legal-section:nth-child(5) {
  animation-delay: 0.2s;
}
.legal-section:nth-child(6) {
  animation-delay: 0.25s;
}
.legal-section:nth-child(7) {
  animation-delay: 0.3s;
}
.legal-section:nth-child(8) {
  animation-delay: 0.35s;
}
.legal-section:nth-child(9) {
  animation-delay: 0.4s;
}
.legal-section:nth-child(10) {
  animation-delay: 0.45s;
}
.legal-section:nth-child(11) {
  animation-delay: 0.5s;
}
.legal-section:nth-child(12) {
  animation-delay: 0.55s;
}
.legal-section:nth-child(13) {
  animation-delay: 0.6s;
}
.legal-section:nth-child(14) {
  animation-delay: 0.65s;
}

@keyframes fadeInSection {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
