/* ==========================================================================
   AFF WING - LEGAL & COMPLIANCE PAGES STYLESHEET
   High-performance cyber aesthetic, glassmorphism, responsive TOC, animations
   ========================================================================== */

:root {
  --aff-cyan: #00f2fe;
  --aff-cyan-rgb: 0, 242, 254;
  --aff-blue: #0067ff;
  --aff-blue-rgb: 0, 103, 255;
  --aff-dark-bg: #070614;
  --aff-card-bg: rgba(14, 23, 42, 0.75);
  --aff-card-border: rgba(0, 242, 254, 0.18);
  --aff-card-hover: rgba(0, 242, 254, 0.35);
  --aff-text-primary: #f8fafc;
  --aff-text-secondary: #94a3b8;
  --aff-text-muted: #64748b;
  --aff-accent-glow: rgba(0, 103, 255, 0.25);
  --aff-gold: #f59e0b;
}

/* Reading Progress Bar */
#legalProgressBar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, #00f2fe 0%, #0067ff 50%, #4facfe 100%);
  z-index: 999999;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.8);
  transition: width 0.1s ease-out;
}

/* Page Shell */
.aff-legal-page {
  background-color: var(--aff-dark-bg);
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(0, 103, 255, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(0, 242, 254, 0.08) 0%, transparent 40%),
    linear-gradient(to bottom, #070614 0%, #0a0e1f 100%);
  color: var(--aff-text-primary);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
  padding: 40px 0 80px 0;
  min-height: 100vh;
}

.aff-legal-container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero Banner */
.legal-hero {
  text-align: center;
  padding: 48px 24px 40px;
  margin-bottom: 40px;
  position: relative;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(16, 24, 54, 0.8) 0%, rgba(10, 15, 34, 0.95) 100%);
  border: 1px solid var(--aff-card-border);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 103, 255, 0.15);
  backdrop-filter: blur(20px);
  animation: legalFadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--aff-cyan);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.legal-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aff-cyan);
  box-shadow: 0 0 10px var(--aff-cyan);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.legal-hero-title {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 16px 0;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.legal-hero-subtitle {
  font-size: 1.12rem;
  color: var(--aff-text-secondary);
  max-width: 760px;
  margin: 0 auto 32px;
}

/* Metadata Pills Grid */
.legal-meta-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.meta-chip svg {
  color: var(--aff-cyan);
  flex-shrink: 0;
}

.meta-chip strong {
  color: #ffffff;
  font-weight: 600;
}

/* Hero Actions */
.legal-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.btn-legal-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-legal-primary {
  background: linear-gradient(135deg, #00f2fe 0%, #0067ff 100%);
  color: #ffffff !important;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 103, 255, 0.4);
}

.btn-legal-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 242, 254, 0.5);
  color: #ffffff !important;
}

.btn-legal-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-legal-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--aff-cyan);
  color: var(--aff-cyan) !important;
  transform: translateY(-2px);
}

/* Two-Column Layout */
.legal-body-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 36px;
  align-items: start;
}

@media (max-width: 992px) {
  .legal-body-grid {
    grid-template-columns: 1fr;
  }
}

/* Sticky Sidebar */
.legal-sidebar {
  position: sticky;
  top: 90px;
  background: var(--aff-card-bg);
  border: 1px solid var(--aff-card-border);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

@media (max-width: 992px) {
  .legal-sidebar {
    position: relative;
    top: 0;
    max-height: none;
    margin-bottom: 24px;
  }
}

.sidebar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-title svg {
  color: var(--aff-cyan);
}

/* Search Box in Sidebar */
.sidebar-search {
  position: relative;
  margin-bottom: 16px;
}

.sidebar-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #ffffff;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}

.sidebar-search input:focus {
  border-color: var(--aff-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

.sidebar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--aff-text-muted);
  pointer-events: none;
}

/* TOC Scrollable List */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  padding-right: 6px;
}

.toc-list::-webkit-scrollbar {
  width: 5px;
}

.toc-list::-webkit-scrollbar-thumb {
  background: rgba(0, 242, 254, 0.2);
  border-radius: 4px;
}

.toc-item {
  margin-bottom: 4px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--aff-text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1.4;
  border-left: 3px solid transparent;
}

.toc-num {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--aff-text-muted);
  flex-shrink: 0;
}

.toc-link:hover {
  color: #ffffff;
  background: rgba(0, 242, 254, 0.08);
}

.toc-link.active {
  color: var(--aff-cyan);
  background: rgba(0, 242, 254, 0.12);
  border-left-color: var(--aff-cyan);
  font-weight: 600;
}

.toc-link.active .toc-num {
  background: var(--aff-cyan);
  color: #070614;
}

/* Sidebar Help Box */
.sidebar-help {
  margin-top: 18px;
  padding: 16px;
  background: rgba(0, 103, 255, 0.1);
  border: 1px solid rgba(0, 103, 255, 0.25);
  border-radius: 12px;
  font-size: 0.84rem;
}

.sidebar-help h4 {
  margin: 0 0 6px 0;
  font-size: 0.92rem;
  color: #ffffff;
  font-weight: 600;
}

.sidebar-help p {
  margin: 0 0 10px 0;
  color: var(--aff-text-secondary);
}

.sidebar-help a {
  color: var(--aff-cyan);
  text-decoration: none;
  font-weight: 600;
}

.sidebar-help a:hover {
  text-decoration: underline;
}

/* Main Content Section Cards */
.legal-main {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.legal-section-card {
  background: var(--aff-card-bg);
  border: 1px solid var(--aff-card-border);
  border-radius: 20px;
  padding: 36px 40px;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  scroll-margin-top: 100px;
  position: relative;
  overflow: hidden;
}

.legal-section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 242, 254, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.legal-section-card:hover {
  border-color: var(--aff-card-hover);
  box-shadow: 0 16px 40px -10px rgba(0, 103, 255, 0.25);
  transform: translateY(-2px);
}

.legal-section-card:hover::before {
  opacity: 1;
}

@media (max-width: 768px) {
  .legal-section-card {
    padding: 24px 20px;
  }
}

/* Card Header */
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-number-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15) 0%, rgba(0, 103, 255, 0.2) 100%);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--aff-cyan);
  font-size: 1.15rem;
  font-weight: 800;
  flex-shrink: 0;
}

.section-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

@media (max-width: 768px) {
  .section-title {
    font-size: 1.25rem;
  }
}

/* Body Text Styling */
.section-body {
  color: #cbd5e1;
  font-size: 0.98rem;
  line-height: 1.75;
}

.section-body p {
  margin-top: 0;
  margin-bottom: 18px;
}

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

.section-body strong {
  color: #ffffff;
}

.section-body ul, .section-body ol {
  padding-left: 24px;
  margin-bottom: 20px;
}

.section-body li {
  margin-bottom: 10px;
}

.section-body li::marker {
  color: var(--aff-cyan);
}

/* Sub-clauses */
.clause-block {
  margin-bottom: 18px;
  padding-left: 16px;
  border-left: 2px solid rgba(0, 242, 254, 0.2);
  transition: border-color 0.2s ease;
}

.clause-block:hover {
  border-left-color: var(--aff-cyan);
}

.clause-label {
  font-weight: 700;
  color: #e2e8f0;
  margin-right: 6px;
}

/* Highlight Alert Boxes */
.legal-highlight-box {
  margin: 24px 0;
  padding: 20px 24px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(0, 242, 254, 0.25);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.legal-highlight-box.primary {
  background: linear-gradient(135deg, rgba(0, 103, 255, 0.12) 0%, rgba(0, 242, 254, 0.08) 100%);
  border-color: rgba(0, 242, 254, 0.35);
}

.legal-highlight-box.warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
}

.legal-highlight-box.warning .box-icon {
  color: var(--aff-gold);
}

.box-icon {
  color: var(--aff-cyan);
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.box-content h5 {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.box-content p {
  margin: 0;
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.6;
}

/* Payout Grid / Badges */
.term-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}

.term-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.term-pill.accent {
  background: rgba(0, 242, 254, 0.1);
  border-color: rgba(0, 242, 254, 0.3);
  color: var(--aff-cyan);
}

/* Contact Footer Card */
.contact-legal-card {
  background: linear-gradient(135deg, rgba(16, 24, 54, 0.95) 0%, rgba(10, 15, 34, 0.98) 100%);
  border: 1px solid var(--aff-cyan);
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.15);
}

.contact-legal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.contact-item-box {
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.contact-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--aff-cyan);
  flex-shrink: 0;
}

.contact-item-details {
  display: flex;
  flex-direction: column;
}

.contact-label {
  font-size: 0.78rem;
  color: var(--aff-text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.contact-value {
  font-size: 0.94rem;
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
}

.contact-value a {
  color: var(--aff-cyan);
  text-decoration: none;
}

.contact-value a:hover {
  text-decoration: underline;
}

/* Animations */
@keyframes legalFadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.legal-section-card {
  animation: legalFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Print Styles */
@media print {
  #legalProgressBar,
  .legal-sidebar,
  .legal-hero-actions,
  header,
  footer,
  .site-footer,
  .ekit-template-content-header,
  .ekit-template-content-footer {
    display: none !important;
  }
  
  .aff-legal-page {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }
  
  .legal-body-grid {
    display: block !important;
  }
  
  .legal-section-card {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 20px;
  }
  
  .section-title, .section-body strong {
    color: #000000 !important;
  }
  
  .section-body {
    color: #333333 !important;
  }
}
