/* ============================================================
   US Payments Hub — Documentation Stylesheet
   Audience: Internal Bank Operations & Compliance
   Style: Enterprise documentation portal (NICE Actimize / MadCap Flare-inspired)
   ============================================================ */

:root {
  --primary:       #1a3a5c;
  --primary-dark:  #0f2540;
  --accent:        #2e6da4;
  --accent-light:  #e8f0f8;
  --warning:       #b45309;
  --warning-bg:    #fffbeb;
  --warning-border:#f59e0b;
  --success:       #166534;
  --success-bg:    #f0fdf4;
  --danger:        #991b1b;
  --danger-bg:     #fef2f2;
  --text:          #1e293b;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;
  --border:        #cbd5e1;
  --border-light:  #e2e8f0;
  --bg:            #f8fafc;
  --bg-card:       #ffffff;
  --code-bg:       #f1f5f9;
  --nav-width:     260px;
  --header-h:      56px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

/* ── HEADER ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.header-brand {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e2e8f0;
  text-decoration: none;
  white-space: nowrap;
}
.header-brand span { color: #7dd3fc; }
.header-breadcrumb {
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.header-breadcrumb a { color: #93c5fd; text-decoration: none; }
.header-breadcrumb a:hover { text-decoration: underline; }
.header-rail-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.1);
  color: #bfdbfe;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

/* ── SIDEBAR NAV ── */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--nav-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.5rem 0 2rem;
  z-index: 90;
}
.nav-section {
  padding: 0.25rem 1rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 1rem;
}
.nav-section:first-child { margin-top: 0; }
.sidebar a {
  display: block;
  padding: 0.4rem 1.25rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar a:hover  { color: var(--accent); background: var(--accent-light); border-left-color: var(--accent); }
.sidebar a.active { color: var(--accent); background: var(--accent-light); border-left-color: var(--accent); font-weight: 600; }

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--nav-width);
  margin-top: var(--header-h);
  padding: 2.5rem 3rem 4rem;
  max-width: 900px;
}

/* ── TYPOGRAPHY ── */
h1 {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}
h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border-light);
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  margin: 1.75rem 0 0.5rem;
}
h4 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.25rem 0 0.35rem;
}
p { margin-bottom: 1rem; color: var(--text); font-size: 0.925rem; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.35rem; font-size: 0.925rem; color: var(--text); }
a { color: var(--accent); }

/* ── TOPIC META ── */
.topic-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.topic-meta span { display: flex; align-items: center; gap: 0.3rem; }

/* ── ADMONITIONS ── */
.note, .warning, .important, .tip {
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  border-radius: 6px;
  margin: 1.25rem 0;
  font-size: 0.875rem;
  border-left: 4px solid;
}
.note     { background: #eff6ff; border-color: #3b82f6; color: #1e3a5f; }
.warning  { background: var(--warning-bg); border-color: var(--warning-border); color: #78350f; }
.important{ background: #fef2f2; border-color: #ef4444; color: #7f1d1d; }
.tip      { background: var(--success-bg); border-color: #22c55e; color: #14532d; }
.note strong, .warning strong, .important strong, .tip strong {
  display: block; margin-bottom: 0.25rem; font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase;
}

/* ── TABLES ── */
.table-wrap { overflow-x: auto; margin: 1.25rem 0; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { background: var(--primary); color: #fff; }
thead th { padding: 0.65rem 1rem; text-align: left; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.03em; }
tbody tr { border-bottom: 1px solid var(--border-light); }
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--bg); }
tbody td { padding: 0.6rem 1rem; vertical-align: top; }
tbody tr:hover { background: var(--accent-light); }

/* ── CODE ── */
code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #be123c;
}
pre {
  background: var(--primary-dark);
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
}
pre code { background: none; color: inherit; padding: 0; }

/* ── STEP LIST ── */
.step-list { list-style: none; padding: 0; counter-reset: steps; margin: 1rem 0; }
.step-list li {
  counter-increment: steps;
  padding: 0.75rem 0.75rem 0.75rem 3rem;
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  position: relative;
  font-size: 0.9rem;
}
.step-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── STATUS BADGES ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ── RETURN CODE TABLE ── */
.rc-code { font-family: 'Consolas', monospace; font-weight: 700; color: var(--accent); }

/* ── FLOW DIAGRAM ── */
.flow-diagram {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 1.25rem 0;
  padding: 1rem;
  background: var(--accent-light);
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}
.flow-box {
  background: var(--bg-card);
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  min-width: 90px;
}
.flow-arrow {
  color: var(--accent);
  font-size: 1.1rem;
  padding: 0 0.35rem;
  font-weight: 700;
}

/* ── SECTION NAV (prev/next) ── */
.doc-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.doc-nav a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s;
}
.doc-nav a:hover { background: var(--accent-light); border-color: var(--accent); }

/* ── FOOTER ── */
.site-footer {
  margin-left: var(--nav-width);
  padding: 1rem 3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem;
}
.site-footer .copyright { width: 100%; border-top: 1px solid var(--border); padding-top: 0.5rem; margin-top: 0.25rem; font-style: italic; }

/* ── INDEX PAGE GRID ── */
.rail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0; }
.rail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-decoration: none;
  transition: all 0.2s;
  display: block;
}
.rail-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(46,109,164,0.12); transform: translateY(-2px); }
.rail-card-icon  { font-size: 1.5rem; margin-bottom: 0.5rem; }
.rail-card-title { font-size: 0.95rem; font-weight: 700; color: var(--primary); margin-bottom: 0.25rem; }
.rail-card-desc  { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main, .site-footer { margin-left: 0; padding: 1.5rem; }
  .rail-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .rail-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
}

/* ═══════════════════════════════════════════════
   DARK THEME — US Payments Hub
   ═══════════════════════════════════════════════ */
[data-theme="dark"] {
  --primary:       #90caf9;
  --primary-dark:  #0f2540;
  --accent:        #58a6ff;
  --accent-light:  rgba(88,166,255,0.12);
  --warning:       #fbbf24;
  --warning-bg:    rgba(251,191,36,0.12);
  --warning-border:#f59e0b;
  --success:       #4ade80;
  --success-bg:    rgba(74,222,128,0.12);
  --danger:        #f87171;
  --danger-bg:     rgba(248,113,113,0.12);
  --text:          #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #6e7681;
  --border:        #30363d;
  --border-light:  #21262d;
  --bg:            #0d1117;
  --bg-card:       #161b22;
  --code-bg:       #0d1117;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .sidebar { background: var(--bg-card); border-right-color: var(--border); }
[data-theme="dark"] .sidebar a:hover,
[data-theme="dark"] .sidebar a.active { background: var(--accent-light); color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #bfdbfe;
  cursor: pointer;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 13px;
  line-height: 1.5;
  margin-left: auto;
  transition: background 0.2s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.18); }

