/* ============================================================
   Morgenruf Docs — Shared Design System
   ============================================================ */

/* --- Variables --- */
:root {
  --bg:              #0d1117;
  --bg-sidebar:      #161b22;
  --bg-card:         #161b22;
  --bg-code:         #161b22;
  --bg-hover:        #1c2128;
  --bg-active:       #1f3044;
  --border:          #21262d;
  --border-code:     #30363d;
  --accent:          #58a6ff;
  --accent-dim:      #1f3044;
  --text:            #e6edf3;
  --text-muted:      #8b949e;
  --text-dim:        #6e7681;
  --text-link:       #58a6ff;
  --success:         #3fb950;
  --warning:         #d29922;
  --danger:          #f85149;
  --topbar-height:   56px;
  --sidebar-width:   260px;
  --right-width:     220px;
  --font-sans:       -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-mono:       ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.7;
  min-height: 100vh;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-code); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 200;
  gap: 1rem;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.topbar-logo .logo-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #a371f7 100%);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.05em;
}

.topbar-logo .logo-name { color: var(--text); }
.topbar-logo .logo-docs { color: var(--text-muted); font-weight: 400; margin-left: 2px; }

.topbar-spacer { flex: 1; }

.topbar-back {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.topbar-back:hover {
  color: var(--text);
  border-color: var(--border-code);
  background: var(--bg-hover);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.4rem;
  border: none;
  background: none;
  border-radius: 6px;
}

.hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: all 0.25s;
}

.hamburger:hover span { background: var(--text); }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.docs-layout {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 0 2rem;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-section-label {
  padding: 0.75rem 1.25rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.sidebar-section-label:not(:first-child) {
  margin-top: 0.5rem;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  position: relative;
}

.sidebar-nav a .nav-icon {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 500;
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.docs-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-right: var(--right-width);
  min-width: 0;
}

.docs-content {
  max-width: 780px;
  padding: 2.5rem 2.5rem 4rem;
}

/* ============================================================
   RIGHT PANEL — ON THIS PAGE
   ============================================================ */
.on-this-page {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  bottom: 0;
  width: var(--right-width);
  padding: 2rem 1.25rem 2rem 1rem;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

.on-this-page-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.on-this-page nav { list-style: none; }

.on-this-page nav li { padding: 0; }

.on-this-page nav a {
  display: block;
  padding: 0.25rem 0.5rem 0.25rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.5;
}

.on-this-page nav a:hover {
  color: var(--text);
  border-left-color: var(--border-code);
}

.on-this-page nav a.h3 {
  padding-left: 1.5rem;
  font-size: 0.8rem;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.docs-content h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.docs-content .page-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.docs-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.docs-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1.75rem;
  margin-bottom: 0.6rem;
}

.docs-content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

.docs-content p {
  margin-bottom: 1rem;
  color: var(--text);
}

.docs-content a {
  color: var(--text-link);
  text-decoration: none;
}

.docs-content a:hover {
  text-decoration: underline;
}

.docs-content ul, .docs-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.docs-content li { margin-bottom: 0.3rem; }

.docs-content strong { color: var(--text); font-weight: 600; }

.docs-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* --- Inline code --- */
.docs-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: #ffa657;
}

/* --- Code blocks --- */
.docs-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  position: relative;
}

.docs-content pre code {
  font-family: var(--font-mono);
  font-size: 0.845rem;
  line-height: 1.65;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.code-block-wrapper {
  position: relative;
  margin: 1.25rem 0;
}

.code-block-wrapper pre { margin: 0; }

.code-lang {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
}

/* ============================================================
   TABLES
   ============================================================ */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

.docs-content th {
  background: var(--bg-sidebar);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.docs-content td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  line-height: 1.5;
}

.docs-content tr:nth-child(even) td {
  background: rgba(255,255,255,0.018);
}

.docs-content tr:hover td {
  background: var(--bg-hover);
}

.docs-content td code:not(pre code) {
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ============================================================
   CALLOUTS / ALERTS
   ============================================================ */
.callout {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

.callout.info {
  background: rgba(88, 166, 255, 0.07);
  border-color: rgba(88, 166, 255, 0.3);
  color: #79c0ff;
}

.callout.tip {
  background: rgba(63, 185, 80, 0.07);
  border-color: rgba(63, 185, 80, 0.3);
  color: #56d364;
}

.callout.warning {
  background: rgba(210, 153, 34, 0.07);
  border-color: rgba(210, 153, 34, 0.3);
  color: #e3b341;
}

.callout p { margin: 0; color: inherit; }

/* ============================================================
   CARDS GRID
   ============================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-1px);
  text-decoration: none;
}

.card-icon {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  display: block;
}

.card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.4rem;
}

.card p {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ============================================================
   FEATURE LIST
   ============================================================ */
.feature-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 0.5rem;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 0;
}

.feature-list li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

/* ============================================================
   CTA BUTTON
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
}

.btn-primary:hover {
  background: #79c0ff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(88,166,255,0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-code);
  text-decoration: none;
}

.btn-slack {
  background: #4a154b;
  color: #fff;
  border: 1px solid #611f69;
}

.btn-slack:hover {
  background: #611f69;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(74,21,75,0.5);
}

/* ============================================================
   STEPS (numbered procedure)
   ============================================================ */
.steps { list-style: none; padding: 0; margin: 1.25rem 0; counter-reset: step; }

.steps > li {
  counter-increment: step;
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.steps > li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.steps > li .step-content { flex: 1; min-width: 0; }

.steps > li .step-content h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

/* ============================================================
   SLACK-LIKE CHAT UI
   ============================================================ */
.slack-chat {
  background: #1a1d21;
  border: 1px solid #2d3136;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  font-family: "Lato", var(--font-sans);
}

.slack-message {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.slack-message:last-child { margin-bottom: 0; }

.slack-avatar {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.slack-avatar.bot { background: linear-gradient(135deg, var(--accent), #a371f7); }
.slack-avatar.user { background: #2eb67d; }

.slack-body { flex: 1; }

.slack-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.slack-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.slack-name.bot-name { color: var(--accent); }

.slack-time {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.slack-text {
  font-size: 0.875rem;
  color: #d1d2d3;
  line-height: 1.6;
}

.slack-text code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  padding: 0.05em 0.35em;
  color: #e8912d;
}

/* ============================================================
   FAQ ACCORDION
   ============================================================ */
.faq-list { margin: 1rem 0; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg-card);
  user-select: none;
  gap: 1rem;
  transition: background 0.15s;
}

.faq-question:hover { background: var(--bg-hover); }

.faq-chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.faq-item.open .faq-chevron { transform: rotate(180deg); }

.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.faq-item.open .faq-answer { display: block; }
.faq-answer p { margin: 0.75rem 0 0; color: var(--text-muted); }
.faq-answer p:first-child { margin-top: 0.75rem; }

/* ============================================================
   BADGE
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15em 0.55em;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-required {
  background: rgba(248, 81, 73, 0.15);
  color: #ff7b72;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.badge-optional {
  background: rgba(139, 148, 158, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ============================================================
   MOBILE OVERLAY
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  backdrop-filter: blur(2px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .on-this-page { display: none; }
  .docs-main { margin-right: 0; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 280px; }

  .hamburger { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    z-index: 150;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.visible { display: block; }

  .docs-main {
    margin-left: 0;
    margin-right: 0;
  }

  .docs-content {
    padding: 1.75rem 1.25rem 3rem;
  }

  .docs-content h1 { font-size: 1.6rem; }

  .cards-grid { grid-template-columns: 1fr; }

  .topbar-back span { display: none; }
}

@media (max-width: 480px) {
  .docs-content { padding: 1.25rem 1rem 2.5rem; }
}

/* ============================================================
   HIGHLIGHT.JS OVERRIDES
   ============================================================ */
.hljs {
  background: transparent !important;
  padding: 0 !important;
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.mt-0 { margin-top: 0 !important; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.monospace { font-family: var(--font-mono); }
