/* =========================================================
   DataKook – Documentation Site Styles
   Matching DataKook brand: primary #00489a
   ========================================================= */

:root {
  --primary:        #00489a;
  --primary-light:  #e7f3ff;
  --primary-dark:   #003370;
  --accent:         #0070d8;
  --text:           #1a1a2e;
  --text-light:     #555;
  --text-muted:     #888;
  --bg-light:       #f7f9fc;
  --bg-white:       #ffffff;
  --border:         #dde4ee;
  --sidebar-width:  280px;
  --topbar-height:  58px;
  --radius:         8px;
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.09);
  --transition:     all 0.25s ease;
  --code-bg:        #f0f4f8;
  --code-border:    #cdd6e4;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 24px);
}

body {
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg-light);
  line-height: 1.7;
  font-size: 15px;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { opacity: 0.8; }

img { max-width: 100%; height: auto; display: block; }

ul, ol { padding-left: 1.4em; }
li { margin-bottom: 6px; }

/* ── Top Bar ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}

.topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  gap: 20px;
}

.topbar-logo img {
  height: 34px;
  width: auto;
}

.topbar-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.01em;
  flex: 1;
}

/* ── Layout ─────────────────────────────────────────────── */
.layout {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 24px 0 40px;
  transition: transform 0.3s ease;
  z-index: 900;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-nav {
  padding: 0 0 20px;
}

/* ── Sidebar Search ──────────────────────────────────────── */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 14px 6px;
  padding: 6px 10px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: var(--transition);
}

.sidebar-search:focus-within {
  border-color: var(--primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(0, 72, 154, 0.1);
}

.sidebar-search-icon {
  font-size: 0.75rem;
  opacity: 0.5;
  flex-shrink: 0;
  user-select: none;
}

.sidebar-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
  min-width: 0;
  font-family: inherit;
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0 2px;
  line-height: 1;
  display: none;
  flex-shrink: 0;
}

.sidebar-search-clear:hover {
  color: var(--primary);
}

.sidebar-search-clear.visible {
  display: block;
}

.nav-no-results {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 20px;
  display: none;
}

.nav-no-results.visible {
  display: block;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 20px 20px 6px;
}

.sidebar-nav > ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav ul ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-link {
  display: block;
  padding: 7px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-light);
  border-left: 3px solid transparent;
  transition: var(--transition);
  line-height: 1.4;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
  opacity: 1;
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-sub {
  padding-left: 36px;
  font-size: 0.82rem;
  font-weight: 400;
}

/* ── Main Content ─────────────────────────────────────────── */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 48px 60px 80px;
  max-width: 1200px;
}

/* ── Chapter Divider ──────────────────────────────────────── */
.chapter-divider {
  display: flex;
  align-items: center;
  margin: 56px 0 0;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.chapter-divider::before,
.chapter-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Doc Sections ─────────────────────────────────────────── */
.doc-section {
  padding-top: 48px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.doc-section:last-of-type {
  border-bottom: none;
}

.doc-subsection {
  margin-top: 36px;
  padding-top: 4px;
}

.section-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 20px;
  padding: 3px 12px;
  margin-bottom: 14px;
}

/* ── Typography ──────────────────────────────────────────── */
h1 {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.25;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 10px;
  margin-top: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  margin-top: 20px;
}

.lead {
  font-size: 1.08rem;
  color: var(--text-light);
  margin-bottom: 20px;
  line-height: 1.8;
}

p {
  margin-bottom: 16px;
  color: var(--text-light);
}

ul, ol {
  margin-bottom: 16px;
}

ul li, ol li {
  color: var(--text-light);
}

strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Info / Warning Boxes ────────────────────────────────── */
.info-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--text);
  margin: 20px 0;
  line-height: 1.6;
}

.warning-box {
  background: #fff8e7;
  border-left: 4px solid #f59e0b;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: #6b4c11;
  margin: 20px 0;
  line-height: 1.6;
}

/* ── Code Blocks ─────────────────────────────────────────── */
.code-block {
  background: #1e2a3a;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 18px 0;
  box-shadow: var(--shadow-sm);
}

.code-label {
  background: #162030;
  color: #7aa2cc;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 7px 16px;
  border-bottom: 1px solid #0d1a28;
}

.code-block pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
}

.code-block code {
  font-family: "Cascadia Code", "Fira Code", "Consolas", "Menlo", monospace;
  font-size: 0.83rem;
  color: #c9d8ea;
  line-height: 1.7;
  white-space: pre;
}

code {
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
  font-size: 0.85em;
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--primary-dark);
}

/* ── Response Table ──────────────────────────────────────── */
.response-table {
  overflow-x: auto;
  margin: 18px 0;
}

.response-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.response-table th {
  background: var(--bg-light);
  color: var(--text);
  font-weight: 700;
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.response-table td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--text-light);
}

.response-table tbody tr:nth-child(even) {
  background: var(--bg-light);
}


.screenshot {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.video {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

/* ── Role Cards ──────────────────────────────────────────── */
.role-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 16px 0;
  background: var(--bg-white);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.role-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.role-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.role-user     { color: #16a34a; }
.role-technical { color: #d97706; }
.role-admin    { color: var(--primary); }

/* ── Sidebar Toggle (mobile) ─────────────────────────────── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
  margin-left: auto;
}

/* ── Doc Footer ──────────────────────────────────────────── */
.doc-footer {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .content {
    padding: 36px 36px 60px;
  }
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.1rem; }

  .code-block code {
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 16px 14px 48px;
  }
}

/* ── Chapter Cards (Overview page) ──────────────────────── */
.chapter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 32px 0 8px;
}

.chapter-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.chapter-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 18px rgba(0, 72, 154, 0.13);
  transform: translateY(-2px);
}

.chapter-card-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.chapter-card-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 6px;
}

.chapter-card-body p {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0;
  line-height: 1.5;
}
