/* Ziggy User Guide — Stylesheet */

:root {
  --sidebar-w: 220px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cdd8e3;
  --sidebar-heading: #e2e8f0;
  --sidebar-active-bg: #1e3a5f;
  --sidebar-active-text: #60a5fa;
  --sidebar-hover-bg: #1e293b;
  --sidebar-divider: #1e293b;

  --content-bg: #ffffff;
  --content-text: #334155;
  --heading-color: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --link: #3b82f6;

  --info-bg: #eff6ff;
  --info-border: #3b82f6;
  --tip-bg: #f0fdf4;
  --tip-border: #22c55e;
  --warning-bg: #fffbeb;
  --warning-border: #f59e0b;

  --placeholder-bg: #f8fafc;
  --placeholder-border: #94a3b8;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

  --radius: 8px;
  --radius-sm: 4px;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font);
  color: var(--content-text);
  background: var(--content-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===================== Layout ===================== */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ===================== Sidebar ===================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--sidebar-divider);
  flex-shrink: 0;
}

.sidebar-logo {
  text-decoration: none;
  display: block;
}

.sidebar-logo:hover { text-decoration: none; }

.logo-text {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.logo-subtitle {
  display: block;
  font-size: 13px;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.sidebar-sections {
  flex: 1;
  padding: 12px 0 24px;
  overflow-y: auto;
}

/* Scrollbar styling for sidebar */
.sidebar-sections::-webkit-scrollbar { width: 4px; }
.sidebar-sections::-webkit-scrollbar-track { background: transparent; }
.sidebar-sections::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

/* Collapsible sections using <details> */
.sidebar-section {
  padding: 2px 0;
}

.sidebar-section > summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-heading);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.sidebar-section > summary::-webkit-details-marker { display: none; }
.sidebar-section > summary::-moz-list-bullet { list-style-type: none; }

.sidebar-section > summary::after {
  content: '\25B8';
  font-size: 20px;
  line-height: 1;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-section[open] > summary::after {
  transform: rotate(90deg);
}

.sidebar-section-links {
  display: flex;
  flex-direction: column;
  padding-bottom: 4px;
}

.sidebar-link {
  display: block;
  padding: 5px 20px 5px 28px;
  font-size: 13.5px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: #e2e8f0;
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--sidebar-active-text);
  font-weight: 500;
}

.sidebar-link-sub {
  padding-left: 40px;
  font-size: 13px;
  opacity: 0.85;
}

.sidebar-link-sub.active {
  opacity: 1;
}

.sidebar-divider {
  height: 1px;
  background: var(--sidebar-divider);
  margin: 6px 20px;
}

/* ===================== Content ===================== */

.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 40px 60px 80px;
  max-width: calc(var(--sidebar-w) + 900px);
}

/* Breadcrumb */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

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

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

.breadcrumb .sep {
  margin: 0 8px;
  opacity: 0.5;
}

/* ===================== Typography ===================== */

h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--heading-color);
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.page-description {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 36px;
  line-height: 1.5;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--heading-color);
  margin-top: 40px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--heading-color);
  margin-top: 28px;
  margin-bottom: 12px;
}

h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--heading-color);
  margin-top: 20px;
  margin-bottom: 8px;
}

p { margin-bottom: 16px; }

strong { color: var(--heading-color); }

/* Lists */
ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

li { margin-bottom: 6px; }

li > ul, li > ol {
  margin-top: 6px;
  margin-bottom: 0;
}

/* Links */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: #0f172a;
}

/* ===================== Tables ===================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--heading-color);
}

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

tr:hover td { background: #f8fafc; }

/* ===================== Callout Boxes ===================== */

.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 20px 0;
  border-left: 4px solid;
  font-size: 14px;
}

.callout-info {
  background: var(--info-bg);
  border-color: var(--info-border);
}

.callout-tip {
  background: var(--tip-bg);
  border-color: var(--tip-border);
}

.callout-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.callout-title {
  font-weight: 600;
  margin-bottom: 4px;
}

/* ===================== Screenshots ===================== */

.screenshot {
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.screenshot img {
  max-width: 100%;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.screenshot-caption {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

.screenshot-placeholder {
  background: var(--placeholder-bg);
  border: 2px dashed var(--placeholder-border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  margin: 24px 0;
}

.screenshot-placeholder .ph-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.4;
}

.screenshot-placeholder .ph-text {
  font-size: 14px;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.5;
}

.screenshot-placeholder .ph-path {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 10px;
  color: #94a3b8;
  word-break: break-all;
}

/* ===================== Feature Cards (index page) ===================== */

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: #f8fafc;
  transition: all 0.15s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.section-card:hover {
  border-color: var(--accent);
  background: #f1f5f9;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.08);
  text-decoration: none;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.card-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--heading-color);
}

.section-card p {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.4;
}

.card-icon {
  flex-shrink: 0;
}

/* ===================== Role Badge ===================== */

.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: #eff6ff;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.role-badge.admin {
  background: #fef3c7;
  color: #d97706;
}

.role-badge.superadmin {
  background: #fce7f3;
  color: #db2777;
}

/* ===================== Numbered Steps ===================== */

.steps {
  counter-reset: step;
  margin-bottom: 24px;
}

.step {
  position: relative;
  padding-left: 44px;
  margin-bottom: 24px;
  min-height: 28px;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step h3 {
  margin-top: 2px;
  margin-bottom: 8px;
}

/* ===================== Keyboard Shortcuts ===================== */

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  box-shadow: 0 1px 0 #d1d5db;
}

/* ===================== Field Reference Table ===================== */

.field-table th:first-child { width: 160px; }
.field-table td:first-child { font-weight: 500; color: var(--heading-color); }
.field-table .required { color: #ef4444; font-size: 11px; font-weight: 600; }
.field-table .optional { color: var(--muted); font-size: 11px; }

/* ===================== Search ===================== */

.sidebar-search {
  padding: 6px 12px 10px;
}

.sidebar-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-search-btn:hover {
  background: rgba(255,255,255,0.12);
}

.sidebar-search-kbd {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.45;
  font-family: var(--font-mono);
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15,23,42,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.search-modal {
  width: 620px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  overflow: hidden;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-input-row svg {
  flex-shrink: 0;
  color: var(--muted);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--heading-color);
  background: transparent;
  font-family: var(--font);
}

.search-input::placeholder { color: var(--muted); }

.search-results-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
  min-height: 60px;
}

.search-empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.search-result {
  display: block;
  padding: 10px 18px;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.search-result:hover,
.search-result.focused {
  background: #f1f5f9;
  border-left-color: var(--accent);
  text-decoration: none;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 2px;
}

.search-result-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.search-result-snippet {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-snippet mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.search-footer {
  padding: 8px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.search-footer kbd {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  box-shadow: none;
}

/* ===================== Right TOC ===================== */

.page-toc {
  position: fixed;
  top: 40px;
  right: 0;
  width: 200px;
  padding: 24px 20px 40px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: none;
  background: #f8fafc;
  border-left: 1px solid var(--border);
}

.page-toc.visible {
  display: none; /* shown only via media query below */
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 10px;
}

.toc-link {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 0;
  line-height: 1.4;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.toc-link.active {
  color: var(--heading-color);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.toc-link.toc-h3 {
  padding-left: 10px;
  font-size: 12px;
}

/* ===================== Responsive ===================== */

@media (min-width: 1100px) {
  .page-toc.visible { display: block; }
  .content { padding-right: 220px; }
}

@media (max-width: 1024px) {
  .content { padding: 32px 32px 60px; }
}

/* ── Mobile hamburger button ─────────────────────────── */

.hamburger-btn {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border: 1px solid #0a3d39;
  border-radius: 8px;
  background: #0d4f4a;
  color: #e2e8f0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .sidebar {
    display: flex;
    width: 75vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar-link { font-size: 15px; padding: 9px 20px 9px 16px; }
  .sidebar-section > summary { font-size: 13px; padding: 10px 20px; }
  .logo-subtitle { font-size: 14px; }
  .sidebar.sidebar--open {
    transform: translateX(0);
  }
  .sidebar-overlay.sidebar-overlay--open {
    display: block;
  }
  .content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }
  .section-grid {
    grid-template-columns: 1fr;
  }
}
