/* ============================================
   LEGAL PAGES CSS - PREMIUM VERSION
   Used by: privacy-policy.html, terms-of-service.html
   ============================================ */

/* ============ LEGAL PAGE HEADER ============ */
.legal-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 6rem 3.75rem 4rem;
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden;
}

.legal-header::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(167,139,250,0.15), transparent 70%);
  pointer-events: none;
  z-index: -1;
  animation: floatGlow 8s ease-in-out infinite;
}

@keyframes floatGlow {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

.legal-header .badge {
  margin: 0 auto 1.5rem;
  animation: fadeInDown 0.6s ease;
}

.legal-header h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
  animation: fadeInUp 0.7s ease;
}

.legal-header p {
  color: #aaa;
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
  animation: fadeInUp 0.8s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ LEGAL CONTENT LAYOUT ============ */
.legal-content {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 3.75rem 4rem;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3rem;
  align-items: start;
}

/* ============ TABLE OF CONTENTS ============ */
.legal-toc {
  position: sticky;
  top: 6rem;
  align-self: start;
  background: linear-gradient(145deg, rgba(30,30,45,0.6), rgba(20,20,30,0.4));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 1.25rem;
  padding: 1.75rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.legal-toc:hover {
  border-color: rgba(167,139,250,0.2);
  box-shadow: 0 15px 50px rgba(167,139,250,0.1);
}

/* Custom scrollbar for TOC */
.legal-toc::-webkit-scrollbar {
  width: 5px;
}

.legal-toc::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
}

.legal-toc::-webkit-scrollbar-thumb {
  background: rgba(167,139,250,0.3);
  border-radius: 10px;
}

.legal-toc::-webkit-scrollbar-thumb:hover {
  background: rgba(167,139,250,0.5);
}

.legal-toc h3 {
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  color: #c4b5fd;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(167,139,250,0.15);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

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

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

.legal-toc a {
  color: #aaa;
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  position: relative;
  border-left: 2px solid transparent;
}

.legal-toc a::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, #c4b5fd, #a78bfa);
  border-radius: 3px;
  transition: height 0.3s ease;
}

.legal-toc a:hover {
  color: #c4b5fd;
  background: rgba(167,139,250,0.08);
  padding-left: 1rem;
}

.legal-toc a:hover::before {
  height: 20px;
}

.legal-toc a.active {
  color: #c4b5fd;
  background: rgba(167,139,250,0.12);
  padding-left: 1rem;
  font-weight: 500;
}

.legal-toc a.active::before {
  height: 24px;
}

/* ============ LEGAL BODY ============ */
.legal-body {
  min-width: 0; /* Prevents grid overflow */
}

.legal-body section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 6rem;
  padding: 2rem;
  background: linear-gradient(145deg, rgba(30,30,45,0.4), rgba(20,20,30,0.2));
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 1.25rem;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.legal-body section:hover {
  border-color: rgba(167,139,250,0.15);
  background: linear-gradient(145deg, rgba(30,30,45,0.5), rgba(20,20,30,0.3));
}

.legal-body section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, #c4b5fd, #a78bfa);
  transition: height 0.4s ease;
  border-radius: 4px;
}

.legal-body section:hover::before {
  height: 100%;
}

.legal-body h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: white;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(167,139,250,0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.01em;
}

.legal-body h2::before {
  content: '';
  width: 6px;
  height: 24px;
  background: linear-gradient(180deg, #c4b5fd, #a78bfa);
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(167,139,250,0.5);
}

.legal-body p {
  color: #ccc;
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

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

.legal-body ul {
  padding-left: 0;
  margin-bottom: 1rem;
  list-style: none;
}

.legal-body ul li {
  color: #ccc;
  line-height: 1.8;
  margin-bottom: 0.65rem;
  padding-left: 1.75rem;
  position: relative;
  transition: color 0.3s ease;
}

.legal-body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #c4b5fd, #a78bfa);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(167,139,250,0.5);
}

.legal-body ul li:hover {
  color: #fff;
}

.legal-body strong {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(120deg, transparent 0%, rgba(167,139,250,0.1) 100%);
  padding: 0 4px;
  border-radius: 3px;
}

.legal-body a {
  color: #c4b5fd;
  text-decoration: none;
  border-bottom: 1px solid rgba(167,139,250,0.3);
  transition: all 0.3s ease;
  padding-bottom: 1px;
}

.legal-body a:hover {
  color: #ddd6fe;
  border-bottom-color: #c4b5fd;
}

/* ============ HIGHLIGHT BOX (Enhanced) ============ */
.highlight-box {
  background: linear-gradient(135deg, rgba(167,139,250,0.12), rgba(139,92,246,0.06));
  border-left: 4px solid #a78bfa;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  color: #ddd;
  position: relative;
  box-shadow: 0 4px 20px rgba(167,139,250,0.1);
  transition: all 0.3s ease;
}

.highlight-box:hover {
  transform: translateX(4px);
  box-shadow: 0 6px 25px rgba(167,139,250,0.2);
  background: linear-gradient(135deg, rgba(167,139,250,0.18), rgba(139,92,246,0.08));
}

.highlight-box::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle at top right, rgba(167,139,250,0.15), transparent 70%);
  border-radius: 0.75rem;
  pointer-events: none;
}

.highlight-box strong {
  background: none;
  color: #c4b5fd;
  padding: 0;
}

/* ============ CONTACT INFO BLOCK (Enhanced) ============ */
.contact-info {
  background: linear-gradient(145deg, rgba(88,28,135,0.2), rgba(30,30,45,0.4));
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: 1rem;
  padding: 1.75rem;
  margin-top: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(167,139,250,0.1);
}

.contact-info::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(167,139,250,0.15), transparent 70%);
  pointer-events: none;
}

.contact-info p {
  margin-bottom: 0.75rem;
  color: #ddd;
  position: relative;
  z-index: 1;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: all 0.3s ease;
}

.contact-info p:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.contact-info p:hover {
  color: #fff;
  padding-left: 0.5rem;
}

.contact-info strong {
  background: none;
  color: #c4b5fd;
  padding: 0;
  margin-right: 0.5rem;
}

/* ============ SECTION NUMBER BADGES ============ */
.legal-body section h2 {
  position: relative;
}

/* Add subtle animation to sections on scroll */
.legal-body section {
  opacity: 0;
  transform: translateY(20px);
  animation: sectionFadeIn 0.6s ease forwards;
}

.legal-body section:nth-child(1) { animation-delay: 0.1s; }
.legal-body section:nth-child(2) { animation-delay: 0.2s; }
.legal-body section:nth-child(3) { animation-delay: 0.3s; }
.legal-body section:nth-child(4) { animation-delay: 0.4s; }
.legal-body section:nth-child(5) { animation-delay: 0.5s; }
.legal-body section:nth-child(6) { animation-delay: 0.6s; }

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

/* ============ READING PROGRESS BAR (Optional) ============ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #c4b5fd, #a78bfa, #8b5cf6);
  z-index: 1000;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(167,139,250,0.5);
}

/* ============ BACK TO TOP BUTTON ============ */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #c4b5fd, #a78bfa);
  color: black;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(167,139,250,0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 15px 40px rgba(167,139,250,0.6);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .legal-content {
    grid-template-columns: 260px 1fr;
    gap: 2rem;
  }
}

@media (max-width: 1024px) {
  .legal-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 3rem 3rem;
  }

  .legal-toc {
    position: relative;
    top: 0;
    max-height: none;
    margin-bottom: 1rem;
  }

  .legal-toc h3 {
    cursor: pointer;
  }

  .legal-body section {
    padding: 1.75rem;
  }
}

@media (max-width: 767px) {
  .legal-header {
    padding: 3rem 1.5rem 2rem;
  }

  .legal-content {
    padding: 1.5rem;
  }

  .legal-body section {
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
  }

  .legal-body h2 {
    font-size: 1.35rem;
  }

  .legal-body h2::before {
    width: 4px;
    height: 20px;
  }

  .legal-body p {
    font-size: 0.95rem;
  }

  .legal-body ul li {
    padding-left: 1.5rem;
    font-size: 0.9rem;
  }

  .highlight-box,
  .contact-info {
    padding: 1.25rem;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .legal-toc {
    padding: 1.25rem;
  }

  .legal-toc h3 {
    font-size: 0.85rem;
  }

  .legal-toc a {
    font-size: 0.8rem;
    padding: 0.5rem 0.5rem;
  }

  .legal-body section {
    padding: 1.25rem;
  }

  .legal-body h2 {
    font-size: 1.25rem;
  }

  .highlight-box::before {
    display: none;
  }

  .contact-info::before {
    display: none;
  }
}

/* ============ PRINT STYLES ============ */
@media print {
  .navbar,
  footer,
  .back-to-top,
  .legal-toc,
  .reading-progress {
    display: none !important;
  }

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

  .legal-body section {
    background: white;
    color: black;
    border: 1px solid #ddd;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .legal-body p,
  .legal-body li {
    color: black;
  }

  .legal-body h2 {
    color: black;
  }
}