/* ===================================
   Legal Pages Styling
   Privacy Policy & Terms of Service
   =================================== */

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 4px 0;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Legal Page Container */
.legal-page {
  background: #f9fafb;
  padding: 0 0 80px;
}

.legal-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Breadcrumb Navigation */
.legal-breadcrumb {
  margin-bottom: 30px;
  padding: 15px 0;
  margin-top: 120px;
}

.legal-breadcrumb nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--body-color);
}

.legal-breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
  transition: opacity 0.3s;
}

.legal-breadcrumb a:hover {
  opacity: 0.7;
}

.legal-breadcrumb span {
  color: var(--body-color);
}

/* Main Grid Layout */
.legal-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  align-items: start;
}

/* Sidebar Table of Contents */
.legal-sidebar {
  position: sticky;
  top: 100px;
  background: white;
  border-radius: 12px;
  padding: 30px 25px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.legal-sidebar::-webkit-scrollbar {
  width: 6px;
}

.legal-sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.legal-sidebar::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

.legal-toc-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
}

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

.legal-toc > li {
  margin-bottom: 12px;
}

.legal-toc a {
  display: block;
  color: var(--body-color);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.6;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s;
  position: relative;
}

.legal-toc a:hover {
  background: rgba(16, 185, 129, 0.08);
  color: var(--primary-color);
  padding-left: 18px;
}

.legal-toc a.active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-color);
  font-weight: 600;
  border-left: 3px solid var(--primary-color);
}

.legal-toc a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--primary-color);
  border-radius: 0 3px 3px 0;
}

/* Mobile TOC Toggle */
.legal-toc-toggle {
  display: none;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  width: 100%;
  align-items: center;
  justify-content: space-between;
}

.legal-toc-toggle i {
  transition: transform 0.3s;
}

.legal-toc-toggle.active i {
  transform: rotate(180deg);
}

/* Main Content Area */
.legal-content {
  background: white;
  border-radius: 12px;
  padding: 60px 50px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.legal-header {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 2px solid #e5e7eb;
}

.legal-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 20px;
  line-height: 1.2;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary-color);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.legal-badge i {
  margin-right: 6px;
}

.legal-description {
  font-size: 18px;
  line-height: 1.8;
  color: var(--body-color);
  margin-top: 20px;
}

/* Content Sections */
.legal-section {
  margin-bottom: 50px;
  scroll-margin-top: 100px;
}

.legal-section h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
  color: var(--heading-color);
}

.legal-section h3 {
  font-size: 24px;
  font-weight: 600;
  margin: 30px 0 20px;
  color: var(--heading-color);
}

.legal-section h4 {
  font-size: 20px;
  font-weight: 600;
  margin: 25px 0 15px;
  color: var(--heading-color);
}

.legal-section h5 {
  font-size: 18px;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--heading-color);
}

.legal-section p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--body-color);
  margin-bottom: 20px;
}

.legal-section ul,
.legal-section ol {
  margin: 20px 0;
  padding-left: 30px;
}

.legal-section li {
  font-size: 16px;
  line-height: 1.8;
  color: var(--body-color);
  margin-bottom: 12px;
}

.legal-section ul li::marker {
  color: var(--primary-color);
}

.legal-section strong {
  color: var(--heading-color);
  font-weight: 600;
}

/* Highlight Boxes */
.legal-highlight {
  background: #f0fdf4;
  border-left: 4px solid var(--primary-color);
  padding: 20px 25px;
  margin: 25px 0;
  border-radius: 8px;
}

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

.legal-warning {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 20px 25px;
  margin: 25px 0;
  border-radius: 8px;
}

.legal-info {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  padding: 20px 25px;
  margin: 25px 0;
  border-radius: 8px;
}

/* Tables */
.legal-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.legal-section th,
.legal-section td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.legal-section th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--heading-color);
}

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

.legal-section tr:hover {
  background: #f9fafb;
}

/* Code/Technical Text */
code,
.legal-code {
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #dc2626;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 99;
}

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

.back-to-top:hover {
  background: var(--heading-color);
  transform: translateY(-5px);
}

/* Print Button */
.print-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 20px;
}

.print-button:hover {
  background: var(--primary-color);
  color: white;
}

/* Responsive Design */
@media (max-width: 1199px) {
  .legal-grid {
    grid-template-columns: 280px 1fr;
    gap: 30px;
  }
  
  .legal-sidebar {
    padding: 25px 20px;
  }
  
  .legal-content {
    padding: 50px 40px;
  }
}

@media (max-width: 991px) {
  .legal-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .legal-sidebar {
    position: static;
    max-height: none;
    margin-bottom: 30px;
    display: none;
  }
  
  .legal-sidebar.show {
    display: block;
  }
  
  .legal-toc-toggle {
    display: flex;
  }
  
  .legal-content {
    padding: 40px 30px;
  }
  
  .legal-title {
    font-size: 32px;
  }
  
  .legal-section h2 {
    font-size: 26px;
  }
  
  .legal-section h3 {
    font-size: 22px;
  }
}

@media (max-width: 767px) {
  .legal-page {
    padding: 20px 0 60px;
  }
  
  .legal-content {
    padding: 30px 20px;
    border-radius: 8px;
  }
  
  .legal-title {
    font-size: 28px;
  }
  
  .legal-meta {
    flex-direction: column;
    gap: 10px;
  }
  
  .legal-section h2 {
    font-size: 24px;
  }
  
  .legal-section h3 {
    font-size: 20px;
  }
  
  .legal-section h4 {
    font-size: 18px;
  }
  
  .legal-section p,
  .legal-section li {
    font-size: 15px;
  }
  
  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
  }
  
  .ud-header,
  .ud-footer,
  .legal-breadcrumb,
  .legal-sidebar,
  .legal-toc-toggle,
  .back-to-top,
  .print-button {
    display: none !important;
  }
  
  .legal-page {
    background: white;
    padding: 0;
  }
  
  .legal-grid {
    grid-template-columns: 1fr;
  }
  
  .legal-content {
    box-shadow: none;
    padding: 0;
    max-width: 100%;
  }
  
  .legal-section {
    page-break-inside: avoid;
  }
  
  .legal-section h2 {
    page-break-after: avoid;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 12px;
    color: #666;
  }
  
  .legal-toc a[href^="#"]::after {
    content: "";
  }
}