/* ============================================
   SGA Help Site — Design System
   ============================================ */

:root {
  --primary: #0f3460;
  --primary-light: #1a4a8a;
  --accent: #e94560;
  --bg: #f0f2f5;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ---- Reset & Base ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

/* ---- Top Navigation ---- */
.site-nav {
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.site-nav .nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 56px;
}

.site-nav .nav-brand {
  font-weight: 700;
  font-size: 1.1em;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
}

.site-nav .nav-brand span {
  color: var(--accent);
}

.site-nav .nav-links {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
}

.site-nav .nav-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.85em;
  padding: 8px 14px;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.2s;
}

.site-nav .nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.site-nav .nav-links a.active {
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  gap: 8px;
}

.btn-pdf {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btn-pdf:hover { opacity: 0.85; }

/* ---- Main Content ---- */
.page-container {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 20px;
}

.content-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 56px;
}

/* ---- Typography ---- */
h1 {
  font-size: 2.2em;
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

h2 {
  font-size: 1.6em;
  color: var(--primary);
  margin-top: 40px;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
  padding-left: 12px;
  scroll-margin-top: 72px;
}

/* ---- TOC Navigation Links ---- */
.toc-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.toc-link:hover {
  border-bottom-color: var(--accent);
  color: var(--primary);
}

.toc-link::after {
  content: ' ↓';
  font-size: 0.75em;
  opacity: 0;
  transition: opacity 0.2s;
}

.toc-link:hover::after {
  opacity: 0.6;
}

h3 {
  font-size: 1.25em;
  color: var(--text);
  margin-top: 28px;
  margin-bottom: 12px;
}

h4 {
  font-size: 1.05em;
  color: var(--primary-light);
  margin-top: 20px;
  margin-bottom: 8px;
}

p { margin-bottom: 14px; }

hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 32px 0;
}

/* ---- Images ---- */
img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #ddd;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  margin: 16px 0;
  transition: transform 0.3s, box-shadow 0.3s;
}

img:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95em;
}

th {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

tr:hover td { background: #f8f9fa; }

/* ---- Lists ---- */
ul, ol { margin: 12px 0 12px 24px; }
li { margin-bottom: 6px; }

/* ---- Emphasis ---- */
strong { color: var(--primary); }

/* ---- Blockquotes ---- */
blockquote {
  border-left: 4px solid var(--accent);
  background: #fff5f5;
  padding: 12px 20px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
}

/* ---- Code ---- */
code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'JetBrains Mono', monospace;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; }

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85em;
  margin-top: 40px;
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* ---- Pagination ---- */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
}

.page-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  background: #f8f9fa;
  transition: all 0.2s;
}

.page-nav a:hover {
  background: var(--primary);
  color: #fff;
}

.page-nav .prev::before { content: '← '; }
.page-nav .next::after { content: ' →'; }

/* ---- Flow Diagrams ---- */
.flow-diagram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  padding: 24px 16px;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f2f5 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.flow-diagram .flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 0.85em;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  min-width: 100px;
  transition: transform 0.2s;
}

.flow-diagram .flow-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.flow-diagram .flow-step .flow-icon {
  font-size: 1.5em;
  line-height: 1;
}

.flow-diagram .flow-step .flow-label {
  font-size: 0.8em;
  color: var(--text-muted);
  font-weight: 400;
}

.flow-diagram .flow-step.flow-accent {
  border-color: var(--accent);
  color: var(--accent);
  background: #fff5f5;
}

.flow-diagram .flow-step.flow-success {
  border-color: #16a34a;
  color: #16a34a;
  background: #f0fdf4;
}

.flow-diagram .flow-arrow {
  font-size: 1.5em;
  color: var(--primary);
  font-weight: 700;
  padding: 0 4px;
}

.flow-diagram .flow-arrow.flow-arrow-down {
  writing-mode: vertical-lr;
}

/* Block Anatomy Diagram */
.block-anatomy {
  display: flex;
  align-items: stretch;
  gap: 24px;
  margin: 20px 0;
  padding: 24px;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f2f5 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.block-anatomy .block-mock {
  background: #2196F3;
  color: #fff;
  border-radius: 8px;
  padding: 16px;
  min-width: 220px;
  position: relative;
  box-shadow: 0 3px 12px rgba(33, 150, 243, 0.3);
}

.block-anatomy .block-mock .block-title {
  font-weight: 700;
  font-size: 1em;
  margin-bottom: 2px;
}

.block-anatomy .block-mock .block-time {
  font-size: 0.85em;
  opacity: 0.9;
}

.block-anatomy .block-mock .block-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
}

.block-anatomy .block-mock .block-actions span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.75em;
  cursor: default;
}

.block-anatomy .block-mock .block-actions .act-delete { background: rgba(255,255,255,0.9); color: #00bcd4; }
.block-anatomy .block-mock .block-actions .act-attend { background: rgba(255,255,255,0.9); color: #ff9800; }
.block-anatomy .block-mock .block-actions .act-incident { background: rgba(255,255,255,0.9); color: #ffc107; }

.block-anatomy .block-legend {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.block-anatomy .block-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9em;
}

.block-anatomy .block-legend .legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.85em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.block-anatomy .block-legend .legend-icon.ic-del { background: #e0f7fa; color: #00bcd4; }
.block-anatomy .block-legend .legend-icon.ic-att { background: #fff3e0; color: #ff9800; }
.block-anatomy .block-legend .legend-icon.ic-inc { background: #fffde7; color: #f57f17; }

/* ---- Print / PDF ---- */
@media print {
  .site-nav,
  .nav-actions,
  .page-nav,
  .site-footer { display: none !important; }

  body {
    background: #fff;
    padding: 0;
  }

  .page-container {
    margin: 0;
    padding: 0;
  }

  .content-card {
    box-shadow: none;
    padding: 20px;
    border-radius: 0;
  }

  img {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  table { break-inside: avoid; }
  h2, h3 { break-after: avoid; }

  @page {
    size: letter;
    margin: 2cm;
  }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .content-card { padding: 24px 20px; }
  h1 { font-size: 1.6em; }
  h2 { font-size: 1.3em; }
  .site-nav .nav-inner { gap: 16px; }
}
