/* ======================== */
/* FF Legal Pages Styles    */
/* Terms, Privacy, Policy   */
/* ======================== */

.legal-page {
  max-width: 100%;
  min-height: 100vh;
  background: var(--bg-app);
  padding-bottom: 40px;
  overflow-y: auto;
}

/* ── Sticky Header ── */
.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.legal-back-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 200ms ease;
}
.legal-back-btn:hover {
  background: var(--bg-sunken);
  transform: translateX(-2px);
}

.legal-header-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Hero Section ── */
.legal-hero {
  text-align: center;
  padding: 40px 24px 32px;
  background: linear-gradient(135deg, rgba(0,0,0,0.03), rgba(0,0,0,0.01));
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .legal-hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.legal-hero-icon {
  font-size: 56px;
  margin-bottom: 12px;
  animation: legal-float 3s ease-in-out infinite;
}

@keyframes legal-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.legal-hero-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.legal-hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.5;
}

.legal-meta-badge {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.legal-meta-badge span {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── Summary Card ── */
.legal-summary-card {
  margin: 20px 16px;
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.legal-summary-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}

.legal-summary-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.legal-summary-icon {
  font-size: 20px;
}

.legal-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.legal-summary-item {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  transition: background 200ms;
}

.legal-summary-item:hover {
  background: var(--bg-sunken);
}

.legal-summary-item:nth-child(2n) {
  border-right: none;
}

.legal-summary-item:nth-last-child(-n+2) {
  border-bottom: none;
}

.legal-kp-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.legal-summary-item strong {
  font-size: 13px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.legal-summary-item p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* ── Main Content ── */
.legal-content {
  padding: 8px 16px;
}

.legal-intro-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  padding: 0 4px;
}

/* ── Sections ── */
.legal-section {
  position: relative;
  background: var(--bg-surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 24px 20px;
  margin-bottom: 16px;
  transition: box-shadow 200ms;
}

.legal-section:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

.legal-section-number {
  position: absolute;
  top: -10px;
  left: 20px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.legal-section h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  font-family: var(--font-display);
}

.legal-section h4,
.legal-subsection {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 16px 0 8px 0;
}

.legal-section p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 12px 0;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

/* ── List ── */
.legal-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
}

.legal-list li {
  position: relative;
  padding: 8px 0 8px 24px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  border-bottom: 1px solid var(--divider);
}

.legal-list li:last-child {
  border-bottom: none;
}

.legal-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 14px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.6;
}

/* ── Callout ── */
.legal-callout {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,0,0,0.03), rgba(0,0,0,0.01));
  border: 1px solid var(--border);
  margin: 16px 0;
}

[data-theme="dark"] .legal-callout {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.legal-callout-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.legal-callout strong {
  font-size: 14px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.legal-callout p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.legal-callout-info {
  background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(99,102,241,0.04));
  border-color: rgba(59,130,246,0.15);
}

.legal-callout-warning {
  background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(239,68,68,0.04));
  border-color: rgba(245,158,11,0.2);
}

/* ── Conduct Grid ── */
.legal-conduct-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.legal-conduct-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.12);
  font-size: 12px;
  color: var(--text-secondary);
}

[data-theme="dark"] .legal-conduct-item {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.15);
}

/* ── Contact Card ── */
.legal-contact-card {
  background: var(--bg-sunken);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.legal-contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--divider);
}

.legal-contact-row:last-child {
  border-bottom: none;
}

/* ── Policy Table ── */
.legal-policy-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal-policy-row {
  background: var(--bg-surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  transition: all 200ms;
}

.legal-policy-row:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.legal-policy-category {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.legal-policy-cat-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: white;
}

.legal-policy-category strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.legal-policy-row p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  padding-left: 42px;
}

/* ── Data Table ── */
.legal-data-table {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.legal-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
}

.legal-data-row:last-child { border-bottom: none; }
.legal-data-row:nth-child(even) { background: var(--bg-sunken); }

.legal-data-type {
  font-weight: 600;
  color: var(--text-primary);
}

.legal-data-retention {
  color: var(--text-muted);
  text-align: right;
  font-size: 12px;
  max-width: 55%;
}

/* ── Rights Grid ── */
.legal-rights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.legal-right-item {
  background: var(--bg-sunken);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 200ms;
}

.legal-right-item:hover {
  border-color: var(--primary);
  background: var(--primary-ghost);
}

.legal-right-item span {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}

.legal-right-item strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

.legal-right-item p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* ── Divider ── */
.legal-divider-full {
  text-align: center;
  padding: 24px 0 20px;
  position: relative;
}

.legal-divider-full::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--border);
}

.legal-divider-text {
  position: relative;
  background: var(--bg-app);
  padding: 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Footer ── */
.legal-footer {
  text-align: center;
  padding: 32px 16px 24px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.legal-footer p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px 0;
}

.legal-footer-links {
  display: flex;
  gap: 8px;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
}

.legal-footer-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.legal-footer-links a:hover {
  text-decoration: underline;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  .legal-summary-grid {
    grid-template-columns: 1fr;
  }
  .legal-summary-item {
    border-right: none !important;
  }
  .legal-summary-item:nth-last-child(1) {
    border-bottom: none;
  }
  .legal-conduct-grid {
    grid-template-columns: 1fr;
  }
  .legal-rights-grid {
    grid-template-columns: 1fr;
  }
  .legal-hero-title {
    font-size: 24px;
  }
  .legal-policy-row p {
    padding-left: 0;
    margin-top: 4px;
  }
}

/* ── Desktop ── */
@media (min-width: 768px) {
  .legal-content {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    padding: 16px 24px;
  }
  .legal-summary-card {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
  .legal-hero {
    padding: 48px 32px 40px;
  }
}
