/* MoodGym Legal Documents - Stylesheet
   Palette synced with AppTheme (lib/core/theme/app_theme.dart) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* AppTheme: darkSurface #121212 */
  --bg: #121212;
  /* AppTheme: darkCard #1E1E1E */
  --bg-card: #1E1E1E;
  --bg-card-hover: #252525;
  /* AppTheme: white / gray300 / gray700 */
  --text-primary: #FFFFFF;
  --text-secondary: #BBBBBB;
  --text-muted: #5E5E5E;
  /* AppTheme: darkGray100 #3A3A3A */
  --border: #3A3A3A;
  /* AppTheme: accent #0E8345 */
  --accent: #0E8345;
  --accent-dark: #0A6B38;
  /* AppTheme: error #DE1135 */
  --error: #DE1135;
  /* Neutral grays from AppTheme */
  --gray50: #F3F3F3;
  --gray100: #E8E8E8;
  --gray200: #D4D4D4;
  --gray300: #BBBBBB;
  --gray700: #5E5E5E;
  --gray800: #4B4B4B;
  --darkGray50: #2A2A2A;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.55);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

/* Subtle background accent glow */
body::before {
  content: '';
  position: fixed;
  top: -40%;
  left: -40%;
  width: 180%;
  height: 180%;
  background: radial-gradient(circle at 25% 15%, rgba(14, 131, 69, 0.06) 0%, transparent 55%),
              radial-gradient(circle at 75% 85%, rgba(14, 131, 69, 0.04) 0%, transparent 55%);
  z-index: -1;
  animation: bgShift 25s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-3%, -3%); }
}

/* ─── Container ─── */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ─── Header ─── */
.header {
  text-align: center;
  margin-bottom: 48px;
  padding: 48px 0 40px;
  position: relative;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* Logo image */
.logo-img {
  height: 42px;
  width: auto;
  margin-bottom: 20px;
  /* Invert the black SVG to white for dark background */
  filter: invert(1);
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.header .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.badge {
  display: inline-block;
  background: var(--accent);
  color: #FFFFFF;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ─── Table of Contents ─── */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}

.toc h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc ul {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toc ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: block;
  transition: all 0.2s ease;
}

.toc ul li a:hover {
  color: var(--accent);
  background: rgba(14, 131, 69, 0.08);
  transform: translateX(4px);
}

/* ─── Sections ─── */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.section:hover {
  border-color: rgba(14, 131, 69, 0.35);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.section:hover::before {
  opacity: 1;
}

.section h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section h2 .icon {
  font-size: 22px;
  line-height: 1;
}

.section p,
.section .content {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-line;
}

/* Lists inside sections */
.section ul {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}

.section ul li {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
  padding: 4px 0 4px 24px;
  position: relative;
}

.section ul li::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 14px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* Highlight box */
.highlight-box {
  background: rgba(14, 131, 69, 0.06);
  border: 1px solid rgba(14, 131, 69, 0.18);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 12px 0;
}

.highlight-box p {
  color: var(--text-secondary) !important;
  font-size: 13px !important;
}

.highlight-box.danger-box {
  border-color: rgba(222, 17, 53, 0.3);
  background: rgba(222, 17, 53, 0.06);
}

/* Category labels */
.category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin: 12px 0 6px;
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 40px 0;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}

.footer p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--accent-dark);
}

/* ─── Language switcher ─── */
.lang-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.lang-switch a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* ─── Back to top ─── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 99;
}

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

.back-to-top:hover {
  background: var(--accent-dark);
  transform: translateY(-3px);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .container {
    padding: 20px 16px 60px;
  }

  .header {
    padding: 32px 0 32px;
    margin-bottom: 32px;
  }

  .header h1 {
    font-size: 22px;
  }

  .logo-img {
    height: 34px;
    margin-bottom: 16px;
  }

  .section {
    padding: 24px 20px;
  }

  .toc ul {
    grid-template-columns: 1fr;
  }

  .lang-switch {
    top: 12px;
    right: 12px;
  }

  .lang-switch a {
    padding: 8px 14px;
    font-size: 12px;
  }
}

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

.section {
  animation: fadeInUp 0.5s ease forwards;
}

.section:nth-child(2) { animation-delay: 0.05s; }
.section:nth-child(3) { animation-delay: 0.1s; }
.section:nth-child(4) { animation-delay: 0.15s; }
.section:nth-child(5) { animation-delay: 0.2s; }
.section:nth-child(6) { animation-delay: 0.25s; }
.section:nth-child(7) { animation-delay: 0.3s; }
.section:nth-child(8) { animation-delay: 0.35s; }
.section:nth-child(9) { animation-delay: 0.4s; }
.section:nth-child(10) { animation-delay: 0.45s; }
.section:nth-child(11) { animation-delay: 0.5s; }
.section:nth-child(12) { animation-delay: 0.55s; }
