/* Minimalist Stylesheet for SAP Basis Notes */

/* Clean Markdown typography (balanced compact size, ~0.9rem / 14.4px) */
.markdown-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.72;
  color: #27272a;
}

.dark .markdown-body {
  color: #d4d4d8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 700;
  margin-top: 1.85rem;
  margin-bottom: 0.65rem;
  line-height: 1.3;
  color: #09090b;
}

.dark .markdown-body h1,
.dark .markdown-body h2,
.dark .markdown-body h3,
.dark .markdown-body h4 {
  color: #fafafa;
}

.markdown-body h1 {
  font-size: 1.55rem;
  border-bottom: 1px solid #e4e4e7;
  padding-bottom: 0.35rem;
}
.dark .markdown-body h1 {
  border-bottom-color: #27272a;
}

.markdown-body h2 {
  font-size: 1.28rem;
  border-bottom: 1px solid #f4f4f5;
  padding-bottom: 0.3rem;
  margin-top: 2rem;
}
.dark .markdown-body h2 {
  border-bottom-color: #27272a;
}

.markdown-body h3 {
  font-size: 1.05rem;
  margin-top: 1.35rem;
}

.markdown-body h4 {
  font-size: 0.95rem;
}

.markdown-body p {
  margin-bottom: 0.9rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4rem;
  margin-bottom: 0.9rem;
}

.markdown-body ul {
  list-style-type: disc;
}

.markdown-body ol {
  list-style-type: decimal;
}

.markdown-body li {
  margin-bottom: 0.3rem;
  line-height: 1.7;
}

.markdown-body hr {
  margin: 1.85rem 0;
  border: none;
  border-top: 1px solid #e4e4e7;
}

.dark .markdown-body hr {
  border-top-color: #27272a;
}

.markdown-body blockquote {
  border-left: 3.5px solid #3b82f6;
  background-color: #f8fafc;
  padding: 0.65rem 1.1rem;
  margin: 1.1rem 0;
  border-radius: 0 4px 4px 0;
  color: #334155;
  font-size: 0.85rem;
}

.dark .markdown-body blockquote {
  border-left-color: #3b82f6;
  background-color: #111827;
  color: #94a3b8;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.1rem 0;
  font-size: 0.825rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid #e4e4e7;
  padding: 0.55rem 0.75rem;
  text-align: left;
}

.dark .markdown-body th,
.dark .markdown-body td {
  border-color: #27272a;
}

.markdown-body th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #0f172a;
}

.dark .markdown-body th {
  background-color: #18181b;
  color: #f8fafc;
}

/* Pre & Code */
.markdown-body pre {
  position: relative;
  background-color: #18181b !important;
  color: #f4f4f5;
  padding: 0.9rem 1.1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.1rem 0;
  border: 1px solid #27272a;
  font-size: 0.825rem;
  line-height: 1.58;
}

.markdown-body code:not(pre code) {
  background-color: #f1f5f9;
  color: #0f172a;
  padding: 0.18rem 0.38rem;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: Consolas, Monaco, monospace;
}

.dark .markdown-body code:not(pre code) {
  background-color: #27272a;
  color: #e4e4e7;
}

/* Subtle Copy Button */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: #27272a;
  color: #a1a1aa;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #3f3f46;
  transition: all 0.15s;
}

.copy-btn:hover {
  background-color: #3f3f46;
  color: #ffffff;
}

.copy-btn.copied {
  background-color: #15803d;
  color: #ffffff;
  border-color: #15803d;
}

/* Mobile-only layout adjustments. Desktop keeps the original stylesheet. */
@media (max-width: 1023px) {
  .mobile-library.mobile-library > *, .mobile-reading.mobile-reading > * { min-width: 0; }
  .mobile-filters.mobile-filters {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px; align-items: start;
  }
  body .mobile-filters.mobile-filters > :not([hidden]) { margin-top: 0; min-width: 0; }
  .mobile-author.mobile-author { display: none; }
  .mobile-note.mobile-note > div:first-child > div,
  .mobile-article.mobile-article > div:first-child > div { flex-wrap: wrap; min-width: 0; }
  .mobile-note.mobile-note h2, .mobile-note.mobile-note p,
  .mobile-article.mobile-article { overflow-wrap: anywhere; }
  .mobile-article.mobile-article .markdown-body table { display: block; overflow-x: auto; }
  .mobile-article.mobile-article .markdown-body img { max-width: 100%; height: auto; }
  .mobile-article.mobile-article .markdown-body pre { padding-top: 2.5rem; }
  .mobile-editor-toolbar.mobile-editor-toolbar,
  .mobile-editor-toolbar.mobile-editor-toolbar > div,
  .mobile-form-actions.mobile-form-actions { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 639px) {
  .mobile-header-inner.mobile-header-inner { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .mobile-header-inner.mobile-header-inner > div:first-child { flex: 1; min-width: 0; }
  .mobile-header-inner.mobile-header-inner > div:first-child > a { font-size: 16px; }
  .mobile-header-inner.mobile-header-inner > .header-actions { gap: 6px; }
  .mobile-header-inner.mobile-header-inner a[href='/new'] { padding: 8px; }
  .mobile-header-inner.mobile-header-inner a[href='/new'] span { display: none; }
  .mobile-search.mobile-search { display: block; order: 3; flex: 0 0 100%; max-width: none; }
  .mobile-search.mobile-search input[type='text'] { font-size: 16px; padding-right: 42px; }
  .mobile-search-submit.mobile-search-submit {
    position: absolute; top: 4px; right: 4px;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 4px; color: #52525b;
  }
  .dark .mobile-search-submit.mobile-search-submit { color: #d4d4d8; }
  .mobile-main.mobile-main { padding-top: 16px; padding-bottom: 24px; }
  .mobile-library.mobile-library, .mobile-reading.mobile-reading { gap: 16px; }
  .mobile-filters.mobile-filters { display: flex; flex-direction: column; align-items: stretch; }
  .mobile-categories.mobile-categories, .mobile-tcodes.mobile-tcodes { padding: 12px; }
  .mobile-categories.mobile-categories ul { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .mobile-categories.mobile-categories li { flex-shrink: 0; margin: 0; }
  .mobile-categories.mobile-categories li a { gap: 8px; padding: 8px 10px; border: 1px solid #e4e4e7; font-size: 12px; }
  .dark .mobile-categories.mobile-categories li a { border-color: #3f3f46; }
  .mobile-tcodes.mobile-tcodes > .flex { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .mobile-tcodes.mobile-tcodes > .flex > a { flex-shrink: 0; }
  .mobile-note.mobile-note { padding: 16px; }
  .mobile-article.mobile-article { padding: 20px; }
  .mobile-article.mobile-article .markdown-body h2[id],
  .mobile-article.mobile-article .markdown-body h3[id] { scroll-margin-top: 128px; }
  .mobile-main.mobile-main input:not([type='checkbox']),
  .mobile-main.mobile-main select, .mobile-main.mobile-main textarea { font-size: 16px; }
  .mobile-main.mobile-main #post-content-editor { min-height: 320px; }
  body > footer { margin-top: 24px; padding-top: 16px; padding-bottom: 16px; }
}
