/* Custom CSS for FastAPI-like appearance */

:root {
  --md-primary-fg-color: #009688;
  --md-primary-fg-color--light: #26a69a;
  --md-primary-fg-color--dark: #00796b;
  --md-accent-fg-color: #00bcd4;
  --md-code-bg-color: #f5f5f5;
  --md-code-fg-color: #37474f;
}

/* FastAPI-style homepage */
.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Code blocks - FastAPI style - OVERFLOW FIX */
.md-typeset code {
  background-color: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
  padding: 0.1em 0.4em;
  border-radius: 0.2em;
  font-size: 0.85em;
  font-weight: 400;
}

/* Force horizontal scroll for code blocks */
.md-typeset pre {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-width: 100% !important;
}

.md-typeset pre > code {
  padding: 1em;
  font-size: 0.85em;
  line-height: 1.5;
  display: block !important;
  overflow-x: auto !important;
  white-space: pre !important;
  word-wrap: normal !important;
  word-break: normal !important;
}

/* Fix for code blocks in content area */
.md-content__inner pre {
  max-width: 100% !important;
  overflow-x: auto !important;
}

.md-content__inner pre code {
  white-space: pre !important;
  word-break: normal !important;
  word-wrap: normal !important;
}

/* Highlight/syntax blocks */
.highlight pre {
  overflow-x: auto !important;
  max-width: 100% !important;
}

.highlight pre code {
  white-space: pre !important;
  display: inline-block !important;
  min-width: 100% !important;
}

/* Additional fixes for nested structures */
.md-typeset .highlight,
.md-typeset .highlighttable {
  overflow-x: auto !important;
  max-width: 100% !important;
}

/* Syntax highlighting - FastAPI colors */
.highlight .k { color: #0000ff; } /* keyword */
.highlight .kd { color: #0000ff; } /* keyword declaration */
.highlight .s { color: #008000; } /* string */
.highlight .s2 { color: #008000; } /* string double quote */
.highlight .mi { color: #098658; } /* number */
.highlight .n { color: #000000; } /* name */
.highlight .na { color: #ff0000; } /* name attribute */
.highlight .nc { color: #2b91af; } /* name class */
.highlight .nf { color: #000000; } /* name function */
.highlight .c1 { color: #008000; font-style: italic; } /* comment */

/* Admonitions - FastAPI style */
.md-typeset .admonition,
.md-typeset details {
  border-left: 0.2rem solid;
  border-radius: 0.2rem;
  box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,.05);
  margin: 1.5em 0;
  padding: 0 0.6rem;
}

.md-typeset .admonition.note {
  border-color: #448aff;
}

.md-typeset .admonition.tip {
  border-color: #00bfa5;
}

.md-typeset .admonition.warning {
  border-color: #ff9100;
}

.md-typeset .admonition.danger {
  border-color: #ff5252;
}

.md-typeset .admonition.success {
  border-color: #00c853;
}

/* Code tabs - like FastAPI */
.tabbed-set {
  margin: 1em 0;
}

.tabbed-labels {
  display: flex;
  gap: 0.5em;
  margin-bottom: 0;
}

.tabbed-labels > label {
  background-color: #f5f5f5;
  border-radius: 0.2rem 0.2rem 0 0;
  padding: 0.5em 1em;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
  color: #666;
}

.tabbed-labels > label:hover {
  background-color: #e0e0e0;
}

.tabbed-content {
  border: 1px solid #e0e0e0;
  border-radius: 0 0.2rem 0.2rem 0.2rem;
  padding: 1em;
}

/* Navigation tabs - FastAPI style */
.md-tabs {
  background-color: var(--md-primary-fg-color);
  box-shadow: 0 0 0.2rem rgba(0,0,0,.1), 0 0.2rem 0.4rem rgba(0,0,0,.2);
}

.md-tabs__link {
  font-weight: 500;
  opacity: 0.7;
}

.md-tabs__link--active {
  opacity: 1;
  font-weight: 600;
}

/* Search box - FastAPI style */
.md-search__form {
  background-color: rgba(255,255,255,0.12);
  border-radius: 0.2rem;
}

.md-search__input {
  background-color: transparent;
  color: #fff;
}

.md-search__input::placeholder {
  color: rgba(255,255,255,0.54);
}

/* Table of contents - FastAPI style */
.md-sidebar--secondary {
  border-left: 1px solid rgba(0,0,0,.07);
}

.md-nav__link--active {
  color: var(--md-primary-fg-color);
  font-weight: 600;
}

/* Copy button on code blocks - FastAPI feature */
.md-clipboard {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  width: 1.5em;
  height: 1.5em;
  border-radius: 0.2rem;
  background-color: rgba(0,0,0,.07);
  color: rgba(0,0,0,.54);
  cursor: pointer;
  transition: background-color .25s, color .25s;
}

.md-clipboard:hover {
  background-color: rgba(0,0,0,.12);
  color: rgba(0,0,0,.87);
}

/* Footer - FastAPI style */
.md-footer {
  background-color: var(--md-primary-fg-color--dark);
}

.md-footer-meta {
  background-color: rgba(0,0,0,.12);
}

/* Inline code in headers */
.md-typeset h1 code,
.md-typeset h2 code,
.md-typeset h3 code {
  background-color: rgba(0,0,0,.07);
  padding: 0.1em 0.3em;
  border-radius: 0.2rem;
}

/* Emoji support */
.md-typeset .twemoji {
  width: 1.2em;
  height: 1.2em;
  vertical-align: text-bottom;
}

/* Progress indicators */
.progress-bar {
  width: 100%;
  height: 0.5rem;
  background-color: #e0e0e0;
  border-radius: 0.25rem;
  overflow: hidden;
  margin: 1em 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--md-primary-fg-color), var(--md-accent-fg-color));
  transition: width 0.3s ease;
}

/* Tutorial navigation - like FastAPI */
.tutorial-nav {
  display: flex;
  justify-content: space-between;
  margin: 2em 0;
  padding: 1em 0;
  border-top: 1px solid rgba(0,0,0,.07);
}

.tutorial-nav a {
  display: flex;
  align-items: center;
  padding: 0.5em 1em;
  border-radius: 0.2rem;
  background-color: var(--md-primary-fg-color);
  color: white;
  text-decoration: none;
  transition: background-color 0.25s;
}

.tutorial-nav a:hover {
  background-color: var(--md-primary-fg-color--dark);
}

/* Keyboard keys */
.md-typeset kbd {
  background-color: #fafafa;
  border: 1px solid #d4d4d4;
  border-bottom-color: #b4b4b4;
  border-radius: 0.2rem;
  box-shadow: inset 0 -1px 0 #b4b4d4;
  color: #444d56;
  display: inline-block;
  font-family: var(--md-code-font-family);
  font-size: 0.85em;
  padding: 0.1em 0.4em;
  vertical-align: middle;
}

/* Annotations */
.md-annotation {
  background-color: var(--md-accent-fg-color);
  border-radius: 50%;
  color: white;
  font-size: 0.7em;
  font-weight: 700;
  height: 1.6em;
  line-height: 1.6em;
  text-align: center;
  width: 1.6em;
}

/* Cards for features */
.feature-card {
  background-color: #fff;
  border-radius: 0.2rem;
  box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,.05);
  padding: 1.5em;
  margin: 1em 0;
  transition: box-shadow 0.25s;
}

.feature-card:hover {
  box-shadow: 0 0.4rem 1rem rgba(0,0,0,.1);
}

.feature-card h3 {
  margin-top: 0;
  color: var(--md-primary-fg-color);
}

/* Responsive typography */
@media screen and (max-width: 76.1875em) {
  .md-typeset {
    font-size: 0.9rem;
  }
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] {
  --md-code-bg-color: #2d2d2d;
  --md-code-fg-color: #f8f8f2;
}

[data-md-color-scheme="slate"] .md-typeset code {
  background-color: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
}

[data-md-color-scheme="slate"] .highlight .k { color: #66d9ef; }
[data-md-color-scheme="slate"] .highlight .s { color: #a6e22e; }
[data-md-color-scheme="slate"] .highlight .mi { color: #ae81ff; }
[data-md-color-scheme="slate"] .highlight .c1 { color: #75715e; }

/* Step-by-step guide styling */
.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps > li {
  counter-increment: step;
  margin: 2em 0;
  padding-left: 3em;
  position: relative;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  background-color: var(--md-primary-fg-color);
  color: white;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1em;
}

/* Checkbox lists */
.task-list-item {
  list-style-type: none;
}

.task-list-item input[type="checkbox"] {
  margin-right: 0.5em;
}

/* Difficulty badges */
.difficulty-beginner {
  background-color: #00c853;
}

.difficulty-intermediate {
  background-color: #ff9100;
}

.difficulty-advanced {
  background-color: #ff5252;
}

/* Version selector - FastAPI style */
.md-version {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Print styles */
@media print {
  .md-header,
  .md-tabs,
  .md-footer,
  .md-sidebar {
    display: none;
  }
  
  .md-content {
    max-width: 100%;
  }
}
