/* ============================================
   TERMS OF SERVICE PAGE STYLES
   Professional, modern design for legal pages
   Adapted for DDD Community
   ============================================ */

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* ========== HERO SECTION ========== */
.hero {
  position: relative;
  padding: 5rem 0 6rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-background) 0%, var(--color-surface) 50%, var(--color-background) 100%);
  z-index: -1;
}

.hero-pattern {
  position: absolute;
  inset: 0;
  background-image: 
    /* Large circles */
    radial-gradient(circle at 20% 30%, rgba(0, 123, 189, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(121, 200, 224, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 60% 20%, rgba(248, 180, 0, 0.1) 0%, transparent 35%),
    
    /* Rectangles */
    linear-gradient(45deg, transparent 0%, rgba(0, 123, 189, 0.08) 25%, transparent 50%),
    linear-gradient(-30deg, transparent 0%, rgba(121, 200, 224, 0.06) 30%, transparent 60%),
    
    /* Lines */
    repeating-linear-gradient(90deg, transparent 0%, transparent 40px, rgba(0, 123, 189, 0.05) 40px, rgba(0, 123, 189, 0.05) 42px),
    repeating-linear-gradient(0deg, transparent 0%, transparent 60px, rgba(121, 200, 224, 0.04) 60px, rgba(121, 200, 224, 0.04) 62px),
    
    /* Diagonal lines */
    repeating-linear-gradient(45deg, transparent 0%, transparent 80px, rgba(248, 180, 0, 0.04) 80px, rgba(248, 180, 0, 0.04) 82px),
    repeating-linear-gradient(-45deg, transparent 0%, transparent 100px, rgba(0, 123, 189, 0.03) 100px, rgba(0, 123, 189, 0.03) 102px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  background-repeat: no-repeat;
}

.hero-gradient {
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 150%;
  background: radial-gradient(circle, rgba(121, 200, 224, 0.3) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
}

/* Additional Geometric Shapes */
.hero-bg::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 5%;
  width: 120px;
  height: 80px;
  background: linear-gradient(45deg, rgba(0, 123, 189, 0.2), rgba(121, 200, 224, 0.1));
  border-radius: 20px;
  transform: rotate(-15deg);
  animation: floatShape 8s ease-in-out infinite;
}

.hero-bg::after {
  content: '';
  position: absolute;
  bottom: 20%;
  right: 10%;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(248, 180, 0, 0.15), transparent);
  border-radius: 50%;
  animation: floatShape 6s ease-in-out infinite reverse;
}

/* Additional shapes using pseudo-elements on hero-pattern */
.hero-pattern::before {
  content: '';
  position: absolute;
  top: 30%;
  right: 15%;
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, transparent, rgba(0, 123, 189, 0.5), transparent);
  transform: rotate(25deg);
  animation: lineMove 10s ease-in-out infinite;
}

.hero-pattern::after {
  content: '';
  position: absolute;
  bottom: 40%;
  left: 20%;
  width: 80px;
  height: 80px;
  border: 2px solid rgba(121, 200, 224, 0.3);
  border-radius: 50%;
  animation: circlePulse 7s ease-in-out infinite;
}

/* Additional geometric elements on hero */
.hero::before {
  content: '';
  position: absolute;
  top: 60%;
  left: 70%;
  width: 40px;
  height: 40px;
  background: rgba(248, 180, 0, 0.15);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  animation: triangleFloat 9s ease-in-out infinite;
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  top: 20%;
  right: 30%;
  width: 60px;
  height: 30px;
  background: linear-gradient(135deg, rgba(0, 123, 189, 0.18), rgba(121, 200, 224, 0.1));
  border-radius: 15px;
  transform: rotate(45deg);
  animation: rectangleRotate 12s linear infinite;
  z-index: 0;
}

/* Animations for shapes */
@keyframes floatShape {
  0%, 100% { 
    transform: translateY(0px) rotate(-15deg); 
  }
  50% { 
    transform: translateY(-20px) rotate(-10deg); 
  }
}

@keyframes lineMove {
  0%, 100% { 
    transform: rotate(25deg) translateX(0px); 
    opacity: 0.5;
  }
  50% { 
    transform: rotate(30deg) translateX(10px); 
    opacity: 0.8;
  }
}

@keyframes circlePulse {
  0%, 100% { 
    transform: scale(1); 
    opacity: 0.3;
  }
  50% { 
    transform: scale(1.2); 
    opacity: 0.6;
  }
}

@keyframes triangleFloat {
  0%, 100% { 
    transform: translateY(0px) rotate(0deg); 
  }
  50% { 
    transform: translateY(-15px) rotate(180deg); 
  }
}

@keyframes rectangleRotate {
  0% { 
    transform: rotate(45deg); 
  }
  100% { 
    transform: rotate(405deg); 
  }
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hero-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--color-text-primary);
  
}

.gradient-text {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  line-height: 1.8;
}

/* ========== MAIN CONTAINER ========== */
.legal-page {
  min-height: 100vh;
  background: var(--color-background);
  padding-top: 0;
}

.legal-page .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== CONTENT SECTION ========== */
.legal-content {
  padding: 0 0 80px 0;
}

.company-info {
  background: var(--color-surface);
  padding: 25px 35px;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-medium);
  margin-bottom: 40px;
  border-left: 4px solid var(--color-primary);
}

.company-info p {
  margin: 8px 0;
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.company-info strong {
  color: var(--color-text-primary);
  
}

.company-info a {
  color: var(--color-primary);
  text-decoration: none;
  
}

.company-info a:hover {
  text-decoration: underline;
}

/* ========== LAYOUT: TOC + BODY ========== */
.legal-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
}

/* ========== TABLE OF CONTENTS ========== */
.legal-toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  background: var(--color-surface);
  padding: 30px;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--color-border);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.legal-toc::-webkit-scrollbar {
  display: none;
}

.legal-toc h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  
  color: var(--color-text-primary);
  padding-bottom: 15px;
  border-bottom: 2px solid var(--color-primary);
}

.legal-toc ol {
  list-style: none;
  counter-reset: toc-counter;
  padding: 0;
  margin: 0;
}

.legal-toc li {
  counter-increment: toc-counter;
  margin-bottom: 12px;
}

.legal-toc li a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-medium);
  transition: all 0.3s ease;
  position: relative;
}

.legal-toc li a:before {
  content: counter(toc-counter, decimal-leading-zero);
  
  color: var(--color-primary);
  margin-right: 12px;
  font-size: 13px;
  min-width: 25px;
}

.legal-toc li a:hover {
  background: linear-gradient(135deg, rgba(0, 123, 189, 0.08) 0%, rgba(121, 200, 224, 0.08) 100%);
  color: var(--color-primary);
  transform: translateX(5px);
}

.legal-toc li a:active {
  transform: scale(0.98);
}

/* ========== LEGAL BODY ========== */
.legal-body {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* ========== SECTIONS ========== */
.legal-section {
  scroll-margin-top: 120px;
}

.section-card {
  background: var(--color-surface);
  padding: 40px 45px;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--color-border);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.section-card:hover {
  box-shadow: 0 8px 30px rgba(0, 123, 189, 0.15);
  transform: translateY(-2px);
}

.section-icon {
  font-size: 40px;
  margin-bottom: 20px;
  display: inline-block;
}

.section-card h2 {
  color: var(--color-text-primary);
  font-size: 32px;
  
  margin: 0 0 25px 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 15px;
}

.section-card h3 {
  color: var(--color-text-primary);
  font-size: 22px;
  
  margin: 35px 0 20px 0;
  padding-top: 25px;
  border-top: 2px solid var(--color-border);
}

.section-card h3:first-of-type {
  margin-top: 25px;
}

.section-card h4 {
  color: var(--color-text-primary);
  font-size: 18px;
  
  margin: 25px 0 15px 0;
}

.section-card p {
  color: var(--color-text-secondary);
  font-size: 16px;
  line-height: 1.8;
  margin: 0 0 20px 0;
}

.section-card ul,
.section-card ol {
  color: var(--color-text-secondary);
  font-size: 16px;
  line-height: 1.8;
  margin: 20px 0;
  padding-left: 25px;
}

.section-card li {
  margin: 12px 0;
  padding-left: 10px;
}

.section-card li strong {
  color: var(--color-text-primary);
  
}

.section-card a {
  color: var(--color-primary);
  text-decoration: none;
  
  transition: color 0.2s;
}

.section-card a:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

/* ========== INFO BOXES ========== */
.info-box {
  background: linear-gradient(135deg, rgba(0, 123, 189, 0.1) 0%, rgba(121, 200, 224, 0.1) 100%);
  border-left: 4px solid var(--color-primary);
  padding: 20px 25px;
  border-radius: var(--radius-medium);
  margin: 25px 0;
  font-size: 15px;
  line-height: 1.7;
}

.warning-box {
  background: linear-gradient(135deg, rgba(248, 180, 0, 0.1) 0%, rgba(248, 180, 0, 0.05) 100%);
  border-left: 4px solid var(--color-accent);
  padding: 20px 25px;
  border-radius: var(--radius-medium);
  margin: 25px 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text-primary);
}

.important-notice {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-left: 4px solid var(--color-success, #10B981);
  padding: 20px 25px;
  border-radius: var(--radius-medium);
  margin: 25px 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text-primary);
}

.note {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-top: 15px;
}

.contact-info {
  margin-top: 20px;
}

.contact-info p {
  margin: 10px 0;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1024px) {
  .hero {
    padding: 4rem 0 5rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .legal-layout {
    grid-template-columns: 1fr;
  }

  .legal-toc {
    position: relative;
    top: 0;
    max-width: 100%;
  }

  .legal-toc ol {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 3rem 0 4rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .section-card {
    padding: 30px 25px;
  }

  .section-card h2 {
    font-size: 26px;
  }

  .legal-toc ol {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .legal-page .container {
    padding: 0 15px;
  }

  .hero {
    padding: 2.5rem 0 3rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-description {
    font-size: 0.95rem;
  }

  .section-card {
    padding: 25px 20px;
  }

  .section-card h2 {
    font-size: 22px;
  }

  .legal-toc {
    padding: 20px;
  }

  .company-info {
    padding: 20px;
  }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== PRINT STYLES ========== */
@media print {
  .hero-bg,
  .hero-pattern,
  .hero-gradient,
  .hero::before,
  .hero::after,
  .hero-bg::before,
  .hero-bg::after,
  .hero-pattern::before,
  .hero-pattern::after {
    display: none;
  }

  .legal-toc {
    display: none;
  }

  .legal-layout {
    grid-template-columns: 1fr;
  }

  .section-card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}
