/* ============================================
   Contextune - Modern Documentation Styles
   ============================================ */

:root {
  /* Brand Colors */
  --ctx-primary: #1f6feb;       /* deep blue */
  --ctx-primary-light: #4ea8de; /* bright blue */
  --ctx-primary-dark: #143d7a;  /* navy */
  --ctx-accent: #1abc9c;        /* teal accent */
  --ctx-success: #2dce89;
  --ctx-warning: #fb6340;
  --ctx-gradient: linear-gradient(135deg, #1f6feb 0%, #1abc9c 100%);
  --ctx-gradient-alt: linear-gradient(135deg, #0ba5ec 0%, #23d3a1 100%);

  /* Spacing */
  --ctx-space-xs: 0.5rem;
  --ctx-space-sm: 1rem;
  --ctx-space-md: 2rem;
  --ctx-space-lg: 4rem;

  /* Shadows */
  --ctx-shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --ctx-shadow-md: 0 4px 12px rgba(0,0,0,0.15);
  --ctx-shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
  --ctx-shadow-glow: 0 0 20px rgba(31, 111, 235, 0.3);
}

/* ============================================
   Logo & Navigation Bar Enhancements
   ============================================ */

/* Make logo bigger and more prominent */
.md-header__button.md-logo {
  padding: 0.2rem;
}

.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 3rem !important;
  width: auto !important;
  max-width: none !important;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Enhanced navigation tabs */
.md-tabs {
  background: linear-gradient(90deg, rgba(31, 111, 235, 0.98) 0%, rgba(26, 188, 156, 0.98) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  overflow-x: auto;
  overflow-y: visible;
}

.md-tabs__list {
  white-space: nowrap;
  padding: 0;
  margin: 0;
}

.md-tabs__link {
  font-weight: 500;
  font-size: 0.85rem;
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
  opacity: 0.9;
  white-space: nowrap;
  display: inline-block;
}

.md-tabs__link:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.md-tabs__link--active {
  opacity: 1;
  font-weight: 600;
  border-bottom: 2px solid rgba(255, 255, 255, 0.9);
}

/* Improve header bar */
.md-header {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Better spacing for header title */
.md-header__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* Fix search bar overlap with GitHub link */
.md-search {
  max-width: 300px;
  margin-right: 1rem;
}

@media screen and (max-width: 76.1875em) {
  .md-search {
    max-width: 250px;
  }
}

@media screen and (max-width: 60em) {
  .md-search {
    max-width: 200px;
  }
}

/* Ensure proper spacing for header items */
.md-header__inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.md-header__source {
  margin-left: auto;
  flex-shrink: 0;
}

/* ============================================
   Hero Section - Modern Gradient Header
   ============================================ */

.md-typeset h1:first-of-type {
  font-size: 3.5rem;
  font-weight: 800;
  background: var(--ctx-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Hero subtitle */
.md-typeset h1:first-of-type + blockquote {
  border-left: none;
  padding: 0;
  margin: 0 0 2rem 0;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--md-default-fg-color--light);
  background: none;
}

.md-typeset h1:first-of-type + blockquote p {
  margin: 0;
  font-style: normal;
}

/* Badge container */
.md-typeset p:has(img[alt*="Version"]) {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.md-typeset p:has(img[alt*="Version"]) img {
  height: 24px;
  border-radius: 4px;
  transition: transform 0.2s ease;
}

.md-typeset p:has(img[alt*="Version"]) img:hover {
  transform: translateY(-2px);
  box-shadow: var(--ctx-shadow-md);
}

/* ============================================
   Feature Cards - Modern Card Design
   ============================================ */

/* Target the feature list */
.md-typeset h3 + p:has(strong) {
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.05) 0%, rgba(26, 188, 156, 0.05) 100%);
  border-left: 4px solid var(--ctx-primary);
  padding: 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  box-shadow: var(--ctx-shadow-sm);
  transition: all 0.3s ease;
}

.md-typeset h3 + p:has(strong):hover {
  box-shadow: var(--ctx-shadow-md);
  transform: translateY(-2px);
  border-left-color: var(--ctx-accent);
}

/* Feature headings with icons */
.md-typeset h3:has(+ p strong) {
  font-size: 1.5rem;
  color: var(--ctx-primary);
  margin-top: 3rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Add icon before feature headings */
.md-typeset h3:has(+ p strong)::before {
  content: "✨";
  font-size: 1.75rem;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ============================================
   Code Blocks - Enhanced Styling
   ============================================ */

.md-typeset pre > code {
  border-radius: 8px;
  box-shadow: var(--ctx-shadow-md);
}

.md-typeset .highlight {
  margin: 1.5rem 0;
}

/* ============================================
   Tables - Modern Design
   ============================================ */

.md-typeset table:not([class]) {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--ctx-shadow-sm);
  font-size: 0.9rem;
}

.md-typeset table:not([class]) thead {
  background: var(--ctx-gradient);
}

.md-typeset table:not([class]) th {
  color: white !important;
  font-weight: 600;
  padding: 1rem;
}

.md-typeset table:not([class]) tr:hover {
  background-color: rgba(31, 111, 235, 0.08);
}

.md-typeset table:not([class]) td {
  padding: 1rem;
}

/* ============================================
   Buttons & CTAs
   ============================================ */

.md-typeset a.md-button {
  background: var(--ctx-gradient);
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  box-shadow: var(--ctx-shadow-md);
  transition: all 0.3s ease;
}

.md-typeset a.md-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--ctx-shadow-lg), var(--ctx-shadow-glow);
}

/* ============================================
   Navigation - Enhanced Header
   ============================================ */

.md-header {
  background: linear-gradient(120deg, rgba(3, 15, 32, 0.97) 0%, rgba(8, 33, 47, 0.97) 55%, rgba(10, 65, 63, 0.95) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 10px 25px rgba(2, 8, 20, 0.65);
  backdrop-filter: blur(14px);
}

.md-header__inner {
  align-items: center;
  gap: 1.25rem;
  padding-block: 0.35rem;
}

.md-header__title {
  font-weight: 700;
  letter-spacing: 0.05em;
}

.md-header__button {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  padding: 0.4rem;
  transition: background 0.2s ease, border 0.2s ease;
}

.md-header__button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.md-search__form {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.05);
  min-width: 16rem;
}

.md-search__input {
  color: #f1f5f9;
}

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

.md-search__icon {
  color: rgba(255, 255, 255, 0.8);
}

.md-header__source {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding-inline: 0.9rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* ============================================
   Sidebar - Modern Navigation
   ============================================ */

.md-nav__item--active > .md-nav__link {
  color: var(--ctx-primary);
  font-weight: 600;
  border-left: 3px solid var(--ctx-primary);
  padding-left: calc(0.6rem - 3px);
}

.md-nav__link:hover {
  color: var(--ctx-accent);
}

/* ============================================
   Top Tabs - Streamlined Primary Nav
   ============================================ */

.md-tabs {
  background: transparent;
  border: none;
  box-shadow: none;
  padding-block: 0.3rem 0.6rem;
  margin-top: -0.35rem;
}

.md-tabs__item {
  margin: 0 0.3rem;
}

.md-tabs__link {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
}

.md-tabs__item--active .md-tabs__link {
  color: #ecfdf5;
  background: rgba(26, 188, 156, 0.18);
  border-color: rgba(26, 188, 156, 0.5);
  box-shadow: 0 12px 28px rgba(2, 8, 20, 0.45);
}

.md-tabs__link:focus-visible,
.md-tabs__link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ============================================
   Admonitions - Enhanced Callouts
   ============================================ */

.md-typeset .admonition {
  border-radius: 8px;
  box-shadow: var(--ctx-shadow-sm);
  border-left-width: 4px;
}

.md-typeset .admonition.tip {
  border-left-color: var(--ctx-success);
}

.md-typeset .admonition.warning {
  border-left-color: var(--ctx-warning);
}

.md-typeset .admonition.info {
  border-left-color: var(--ctx-accent);
}

/* ============================================
   ROI Section - Special Styling
   ============================================ */

.md-typeset h2:contains("ROI") + p {
  font-size: 1.1rem;
  line-height: 1.8;
}

/* Highlight metrics */
.md-typeset strong {
  color: var(--ctx-primary);
  font-weight: 600;
}

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

@media screen and (max-width: 76.1875em) {
  .md-typeset h1:first-of-type {
    font-size: 2.5rem;
  }

  .md-typeset h1:first-of-type + blockquote {
    font-size: 1.2rem;
  }
}

@media screen and (max-width: 44.9375em) {
  .md-typeset h1:first-of-type {
    font-size: 2rem;
  }

  .md-typeset h1:first-of-type + blockquote {
    font-size: 1rem;
  }
}

/* ============================================
   Dark Mode Adjustments
   ============================================ */

[data-md-color-scheme="slate"] {
  --ctx-gradient: linear-gradient(135deg, #0a3d62 0%, #13c4a3 100%);
}

[data-md-color-scheme="slate"] .md-header {
  background: linear-gradient(90deg, rgba(20, 61, 122, 0.6) 0%, rgba(19, 196, 163, 0.6) 100%);
  backdrop-filter: blur(10px);
}

[data-md-color-scheme="slate"] .md-typeset h3 + p:has(strong) {
  background: linear-gradient(135deg, rgba(20, 61, 122, 0.15) 0%, rgba(19, 196, 163, 0.15) 100%);
}

/* ============================================
   Custom Animations
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.md-content {
  animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   Stats & Metrics - Visual Enhancement
   ============================================ */

.md-typeset code {
  background-color: rgba(31, 111, 235, 0.08);
  border: 1px solid rgba(31, 111, 235, 0.2);
  border-radius: 4px;
  padding: 0.2em 0.4em;
  font-weight: 600;
  color: var(--ctx-primary);
}

/* Highlight percentage improvements */
.md-typeset :not(pre) > code:contains("%") {
  background: linear-gradient(135deg, rgba(45, 206, 137, 0.15) 0%, rgba(45, 206, 137, 0.05) 100%);
  border-color: var(--ctx-success);
  color: var(--ctx-success);
  font-weight: 700;
}
