/* KMG Design System - Custom Styles */

/* Content area */
.content-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #344767;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4 {
  color: #344767;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.content-body h1 { font-size: 1.75rem; font-weight: 700; }

/* Hide heading permalink (pilcrow) symbols, show on hover */
.content-body .headerlink {
  visibility: hidden;
  text-decoration: none;
  margin-left: 0.3rem;
  color: #adb5bd;
}

.content-body h1:hover .headerlink,
.content-body h2:hover .headerlink,
.content-body h3:hover .headerlink,
.content-body h4:hover .headerlink {
  visibility: visible;
}
.content-body h2 { font-size: 1.4rem; font-weight: 600; border-bottom: 1px solid #e9ecef; padding-bottom: 0.5rem; }
.content-body h3 { font-size: 1.15rem; font-weight: 600; }

.content-body p {
  margin-bottom: 1rem;
}

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

.content-body li {
  margin-bottom: 0.35rem;
}

/* Code blocks */
.content-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.content-body code {
  font-size: 0.85em;
  color: #e91e8c;
  background: #f8f9fa;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
}

.content-body pre code {
  color: inherit;
  background: none;
  padding: 0;
}

/* Tables */
.content-body table {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
}

.content-body table th,
.content-body table td {
  padding: 0.65rem 0.75rem;
  border: 1px solid #e9ecef;
}

.content-body table th {
  background: #f8f9fa;
  font-weight: 600;
}

/* Component examples */
.component-preview {
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: #fff;
}

.component-code {
  position: relative;
}

.component-code .btn-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
}

/* TOC sidebar */
.toc-sidebar {
  position: sticky;
  top: 1rem;
  font-size: 0.85rem;
}

.toc-sidebar ul {
  list-style: none;
  padding-left: 0;
}

.toc-sidebar ul ul {
  padding-left: 1rem;
}

.toc-sidebar a {
  color: #67748e;
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
}

.toc-sidebar a:hover {
  color: #5e72e4;
}

/* Cards in section listing */
.section-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.section-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

/* Clickable card headings */
.card h5 a.text-dark {
  text-decoration: none;
}

.card h5 a.text-dark:hover {
  color: #5e72e4 !important;
}

/* Color swatch */
.color-swatch {
  width: 100%;
  height: 80px;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid #e9ecef;
}

/* Keyboard shortcut keys */
kbd {
  background: #344767;
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  font-family: monospace;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Blog post list */
.blog-post-card {
  border-left: 3px solid #5e72e4;
}

/* Settings toggles */
.settings-option {
  padding: 1rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.settings-option:last-child {
  border-bottom: none;
}

/* Dark mode overrides */
body.dark-mode {
  background-color: #1a1a2e !important;
}

body.dark-mode .sidenav {
  background-color: #16213e !important;
}

body.dark-mode .card {
  background-color: #1f2937 !important;
  color: #e2e8f0 !important;
}

body.dark-mode .content-body {
  color: #e2e8f0;
}

body.dark-mode .content-body h1,
body.dark-mode .content-body h2,
body.dark-mode .content-body h3,
body.dark-mode .content-body h4 {
  color: #f1f5f9;
}

body.dark-mode .nav-link-text {
  color: #cbd5e1 !important;
}

body.dark-mode .text-muted {
  color: #94a3b8 !important;
}

/* Sandbox editor */
.sandbox-editor {
  border: 2px solid #5e72e4;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.sandbox-toolbar {
  display: flex;
  align-items: center;
  background: #344767;
  padding: 0.4rem 0.75rem;
}

.sandbox-title {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  flex-grow: 1;
}

.sandbox-toolbar .btn-xs {
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
}

.sandbox-split {
  display: flex;
  min-height: 200px;
}

.sandbox-pane-editor {
  flex: 1;
  display: flex;
  border-right: 1px solid #e9ecef;
}

.sandbox-pane-preview {
  flex: 1;
  display: flex;
  background: #fff;
}

.sandbox-textarea {
  width: 100%;
  border: none;
  resize: none;
  padding: 0.75rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  background: #1e293b;
  color: #e2e8f0;
  outline: none;
  tab-size: 2;
}

.sandbox-iframe {
  width: 100%;
  min-height: 80px;
  border: none;
}

@media (max-width: 768px) {
  .sandbox-split {
    flex-direction: column;
  }

  .sandbox-pane-editor {
    border-right: none;
    border-bottom: 1px solid #e9ecef;
    min-height: 150px;
  }

  .sandbox-pane-preview {
    min-height: 150px;
  }
}

/* Changelog timeline */
.changelog-date-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: #5e72e4;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0 0.5rem 2rem;
  margin-top: 0.5rem;
}

.changelog-date-header:first-of-type {
  margin-top: 0;
}

.changelog-entry {
  display: flex;
  position: relative;
  padding: 0 0 0 2rem;
  margin-bottom: 0;
}

.changelog-entry::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e9ecef;
}

.changelog-entry:last-child::before {
  display: none;
}

.changelog-dot {
  position: absolute;
  left: 2px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #5e72e4;
  z-index: 1;
}

.changelog-content {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  flex-grow: 1;
  transition: box-shadow 0.15s ease;
}

.changelog-content:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.changelog-content h6 {
  color: #344767;
}

.changelog-body {
  white-space: pre-line;
}

body.dark-mode .changelog-content {
  background: #2d3748 !important;
  border-color: #4a5568;
}

body.dark-mode .changelog-content h6 {
  color: #f1f5f9;
}

body.dark-mode .changelog-entry::before {
  background: #4a5568;
}

body.dark-mode .changelog-dot {
  background: #1a1a2e;
  border-color: #818cf8;
}

body.dark-mode .changelog-date-header {
  color: #818cf8;
}

/* Highlight.js / Pygments overrides */
.highlight {
  background: #1e293b;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.highlight pre {
  margin: 0;
  background: none;
  padding: 0;
}
