/* Ninjapear Custom Styles for MkDocs */

/* CRITICAL: Reset Material's 125% base font scaling */
html {
  font-size: 100% !important; /* Reset to 16px base */
}

/* Restore Material's 125% scaling for main content area only */
.md-main {
  font-size: 125%; /* Scale up content area */
}

/* Override Material's .md-typeset to get Material's intended sizing */
.md-typeset {
  font-size: 1.25rem !important; /* 20px - Material's intended content size (125% of 16px) */
}

/* Increase sidebar font size */
.md-sidebar {
  font-size: 1rem !important; /* 16px - larger, more readable size */
}

/* Ensure sidebar navigation items are properly sized */
.md-nav {
  font-size: 0.875rem !important; /* 14px - good size for navigation items */
}

/* Custom color palette matching Ninjapear */
:root {
  --np-purple-600: #9333ea;
  --np-purple-700: #7e22ce;
  --np-zinc-100: #f4f4f5;
  --np-zinc-200: #e4e4e7;
  --np-zinc-400: #a1a1aa;
  --np-zinc-500: #71717a;
  --np-zinc-600: #52525b;
  --np-zinc-700: #3f3f46;
  --np-zinc-800: #27272a;
  --np-zinc-900: #18181b;
  --np-zinc-950: #09090b;

  /* Override Material theme colors */
  --md-primary-fg-color: var(--np-purple-600);
  --md-primary-fg-color--light: var(--np-purple-600);
  --md-primary-fg-color--dark: var(--np-purple-700);
  --md-accent-fg-color: var(--np-purple-600);
}

/* Reset Material theme defaults completely */
.md-header {
  position: static !important;
  box-shadow: none !important;
  background: transparent !important;
  color: inherit !important;
  height: auto !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
}

.md-header__inner {
  display: none !important;
}

/* Ninjapear Navigation Styles */
.np-nav {
  border-bottom: 1px solid var(--np-zinc-200);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.np-nav__container {
  max-width: 80rem;
  margin: 0 auto;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.np-nav__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 0.75rem;
}

.np-nav__logo img {
  height: 2rem;
  width: auto;
}

.np-nav__logo-text {
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.75rem;
  color: var(--np-zinc-900);
}

.np-nav__menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.np-nav__link {
  color: var(--np-zinc-600);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 400;
  transition: color 0.2s;
}

.np-nav__link:hover {
  color: var(--np-purple-600);
}

.np-nav__link--active {
  color: var(--np-purple-600);
}

.np-nav__dropdown {
  position: relative;
}

.np-nav__dropdown-button {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--np-zinc-600);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.5rem;
  padding: 0;
  transition: color 0.2s;
}

.np-nav__dropdown-button:hover {
  color: var(--np-purple-600);
}

.np-nav__dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  width: 16rem;
  background: white;
  border: 1px solid var(--np-zinc-200);
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 30;
}

.np-nav__dropdown:hover .np-nav__dropdown-menu {
  opacity: 1;
  visibility: visible;
}

.np-nav__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.np-nav__login {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--np-zinc-600);
  text-decoration: none;
  transition: color 0.2s;
}

.np-nav__login:hover {
  color: var(--np-purple-600);
}

.np-nav__cta {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: white;
  background-color: var(--np-purple-600);
  border-radius: 0.375rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.2s;
}

.np-nav__cta:hover {
  background-color: var(--np-purple-700);
}

/* Hide on mobile */
@media (max-width: 768px) {
  .np-nav__menu,
  .np-nav__actions {
    display: none;
  }
}

/* Show mobile menu button */
.np-nav__mobile-button {
  display: none;
  padding: 0.5rem;
  color: var(--np-zinc-500);
  background: none;
  border: none;
  cursor: pointer;
}

@media (max-width: 768px) {
  .np-nav__mobile-button {
    display: block;
  }
}

/* Responsive display utilities for navigation */
@media (min-width: 768px) {
  .md-header .md\:flex {
    display: flex !important;
  }
  .md-header .hidden.md\:flex {
    display: flex !important;
  }
}

/* Adjust main content to account for custom header */

.md-main__inner {
  margin-top: 0 !important;
}

/* Dropdown menu hover functionality */
.group:hover .group-hover\:opacity-100 {
  opacity: 1 !important;
}

.group:hover .group-hover\:visible {
  visibility: visible !important;
}

/* Hover colors */
.md-header a:hover,
.md-header button:hover {
  color: var(--np-purple-600) !important;
}

/* Mobile menu toggle button styling */
#mobile-menu-button {
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
}

#mobile-menu-button:focus {
  outline: 2px solid var(--np-purple-600);
  outline-offset: 2px;
}

/* Ninjapear Footer Styles */
.np-footer {
  background-color: var(--np-zinc-800);
  color: #a1a1aa; /* zinc-300 */
  padding: 4rem 0 3rem;
  /* Break out of container constraint to span full width */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.np-footer__container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 2rem;
}

.np-footer__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .np-footer__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.np-footer__brand {
  grid-column: span 2;
}

@media (min-width: 768px) {
  .np-footer__brand {
    grid-column: span 1;
  }
}

.np-footer__logo {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.np-footer__logo-img {
  height: 1.75rem;
  width: auto;
  margin-right: 0.5rem;
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.np-footer__logo-text {
  font-weight: 600;
  font-size: 1.125rem;
  color: white;
}

.np-footer__description {
  font-size: 0.875rem;
  color: #71717a; /* zinc-400 */
}

.np-footer__column {
  display: flex;
  flex-direction: column;
}

.np-footer__heading {
  font-weight: 600;
  font-size: 0.875rem;
  color: white;
  margin-bottom: 1rem;
}

.np-footer__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.np-footer__link {
  font-size: 0.875rem;
  color: #71717a; /* zinc-400 */
  text-decoration: none;
  transition: color 0.2s;
}

.np-footer__link:hover {
  color: white;
  text-decoration: underline;
}

.np-footer__copyright {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #3f3f46; /* zinc-700 */
  text-align: center;
}

.np-footer__copyright p {
  font-size: 0.875rem;
  color: #52525b; /* zinc-500 */
  margin: 0;
}

/* Hide Material footer */
.md-footer,
.md-footer-meta {
  display: none !important;
}

/* Fix SVG overflow in sequence diagrams */
.sequence-diagram {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  margin: 1em 0;
  padding: 1rem 0;
}

/* Don't constrain SVG width - let it be its natural size */
.sequence-diagram svg {
  max-width: none !important;
  width: auto !important;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Ensure parent containers don't clip */
.md-typeset .sequence-diagram {
  overflow-x: auto;
  overflow-y: visible;
}

/* Override any inherited overflow hidden */
.md-content__inner {
  overflow-x: visible !important;
}

.md-content {
  overflow-x: visible !important;
}

/* For smaller screens, ensure horizontal scroll works */
@media (max-width: 1200px) {
  .sequence-diagram {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }
}

/* Adjust container widths to match navbar */
.md-container {
  padding-top: 0 !important;
}

@media (min-width: 1220px) {
  .md-grid {
    max-width: 80rem; /* Match navbar container width */
    margin-left: auto;
    margin-right: auto;
  }
}

/* Adjust main content inner to use full width */
@media screen and (min-width: 76.25em) {
  .md-content__inner {
    max-width: none; /* Remove default max-width constraint */
  }
}

/* ===== MOBILE RESPONSIVE FIXES ===== */

/* Fix text content overflow - apply to all viewports */
.md-typeset {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Fix text overflow in paragraphs and headings */
.md-typeset p,
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6,
.md-typeset li {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Handle long links */
.md-typeset a {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Mobile and tablet responsive adjustments */
@media (max-width: 960px) {
  /* Ensure content fits viewport */
  .md-content__inner {
    max-width: 100%;
    padding: 0 1rem;
  }

  /* Adjust typography for mobile */
  .md-typeset {
    font-size: 1rem;
  }
}

/* Handle code blocks - make them scrollable */
.md-typeset pre {
  overflow-x: auto;
  max-width: 100%;
}

/* SVG and Sequence Diagram Responsive Fixes */
.sequence-diagram {
  overflow-x: auto;
  max-width: 100%;
}

.sequence-diagram svg {
  height: auto;
}

/* Tables responsive handling */
.md-typeset table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Images responsive handling */
.md-typeset img {
  max-width: 100%;
  height: auto;
}

/* Add padding to main content area */
.md-content {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* Align sidebars with content - add matching top padding */
.md-sidebar--primary .md-sidebar__scrollwrap,
.md-sidebar--secondary .md-sidebar__scrollwrap {
  padding-top: 2rem;
}

/* ===== MOBILE SIDEBAR IMPROVEMENTS ===== */

/* Mobile Navigation Toggle Button */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  bottom: 2rem;
  left: 1rem;
  z-index: 100;
  width: 3rem;
  height: 3rem;
  background: var(--np-purple-600);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  color: white;
  font-size: 1.5rem;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s, background-color 0.2s;
}

.mobile-nav-toggle:hover {
  background: var(--np-purple-700);
  transform: scale(1.1);
}

.mobile-nav-toggle.active {
  background: var(--np-purple-700);
}

/* Show toggle on mobile/tablet */
@media (max-width: 1219px) {
  .mobile-nav-toggle {
    display: flex;
  }
}

/* Override Material's mobile sidebar hiding - Navigation */
@media (max-width: 1219px) {
  /* Keep navigation sidebar available but off-canvas */
  .md-sidebar--primary {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: -100% !important;
    width: 16rem !important;
    height: 100vh !important;
    background: white !important;
    z-index: 200 !important;
    transition: left 0.3s ease !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1) !important;
    overflow-y: auto !important;
  }

  /* When active, slide in */
  .md-sidebar--primary.active {
    left: 0 !important;
  }

  /* Overlay when sidebar is open */
  .mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
    opacity: 0;
    transition: opacity 0.3s;
  }

  .mobile-sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  /* Hide the default drawer toggle */
  .md-header__button.md-icon--menu {
    display: none !important;
  }
}

/* Mobile Table of Contents - Move to top of content */
@media (max-width: 1219px) {
  /* Remove TOC from sidebar position */
  .md-sidebar--secondary {
    display: none !important;
  }

  /* Create mobile TOC at top of content */
  .mobile-toc {
    display: block !important;
    margin: 0 0 2rem 0;
    padding: 1rem;
    background: var(--np-zinc-100);
    border-radius: 0.5rem;
    border: 1px solid var(--np-zinc-200);
  }

  .mobile-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid var(--np-zinc-200);
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--np-zinc-700);
    transition: background-color 0.2s;
  }

  .mobile-toc-toggle:hover {
    background: var(--np-zinc-50);
  }

  .mobile-toc-toggle-icon {
    transition: transform 0.3s;
  }

  .mobile-toc-toggle.active .mobile-toc-toggle-icon {
    transform: rotate(180deg);
  }

  .mobile-toc-content {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 0.375rem;
    border: 1px solid var(--np-zinc-200);
  }

  .mobile-toc-content.active {
    display: block;
  }

  /* Style TOC links */
  .mobile-toc-content .md-nav__list {
    margin: 0;
    padding: 0;
  }

  .mobile-toc-content .md-nav__item {
    margin: 0.25rem 0;
  }

  .mobile-toc-content .md-nav__link {
    padding: 0.5rem 0.75rem;
    color: var(--np-zinc-600);
    font-size: 0.9rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s, color 0.2s;
  }

  .mobile-toc-content .md-nav__link:hover {
    background: var(--np-purple-50);
    color: var(--np-purple-700);
  }

  .mobile-toc-content .md-nav__link--active {
    background: var(--np-purple-100);
    color: var(--np-purple-700);
    font-weight: 500;
  }
}

/* Desktop: Hide mobile elements */
@media (min-width: 1220px) {
  .mobile-toc,
  .mobile-nav-toggle,
  .mobile-sidebar-overlay {
    display: none !important;
  }
}

/* ===== FIX BULLET POINTS VISIBILITY ===== */

/* Fix bullet points visibility - use important to override Material theme */
.md-typeset ul {
  list-style-type: disc !important;
  list-style-position: outside !important;
  padding-left: 1em !important;
}

.md-typeset ul li {
  display: list-item !important;
  list-style-type: disc !important;
  margin-left: 0 !important;
}

/* Fix nested lists */
.md-typeset ul ul {
  list-style-type: circle !important;
  margin-left: 1.5em !important;
}

.md-typeset ul ul ul {
  list-style-type: square !important;
}

/* Fix ordered lists with nested unordered lists */
.md-typeset ol ul {
  margin-top: 0.5em !important;
  margin-bottom: 0.5em !important;
  list-style-type: disc !important;
}

.md-typeset ol ul li {
  display: list-item !important;
  list-style-type: disc !important;
}

/* Ensure list markers are visible */
.md-typeset ul li::marker {
  color: var(--md-typeset-color) !important;
}

/* Ensure ordered list items show numbers properly */
.md-typeset ol {
  list-style-type: decimal !important;
  list-style-position: outside !important;
  padding-left: 1em !important;
}

.md-typeset ol li {
  display: list-item !important;
  list-style-type: decimal !important;
  margin-left: 0 !important;
}

/* ===== IMAGE STYLING ===== */

/* Add subtle shadow to images (screenshots) in documentation */
.md-typeset img {
  box-shadow: 0 1px 25px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  margin: 1.5em auto;
  display: block;
  max-width: 100%;
  height: auto;
}

/* Remove shadow from small inline images like logos or icons */
.md-typeset img[src*="logo"],
.md-typeset img[src*="icon"],
.md-typeset img[src*="favicon"] {
  box-shadow: none;
  border-radius: 0;
  display: inline-block;
  margin: 0;
}

/* ===== TABLE FONT SIZE FIX ===== */

/* Fix small table font size - increase for better readability */
.md-typeset table {
  font-size: 0.875rem !important; /* 14px - better readability than default ~10px */
}

.md-typeset td, 
.md-typeset th {
  font-size: inherit !important;
  padding: 0.5rem 0.75rem !important; /* Add more padding for better spacing */
}