/* Custom Docsify Theme - Integrated with HMT Network Design */
:root {
  /* Color Variables - Matching HMT Network Green Theme */
  --bg-color: #050505;
  --card-bg: #0f0f0f;
  --border-color: #27272a;
  --text-main: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent-primary: #10b981; /* Vibrant green */
  --accent-secondary: #8b5cf6; /* Purple */
  --font-main: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  
  /* Spacing & Sizes */
  --header-height: 70px;
  --border-radius: 12px;
  --transition-speed: 0.3s;
  
  /* Docsify Specific Variables */
  --base-background-color: var(--bg-color);
  --base-color: var(--text-main);
  --base-font-family: var(--font-main);
  --base-font-size: 16px;
  --base-line-height: 1.7;
  --sidebar-width: 280px;
  --sidebar-background: var(--card-bg);
  --sidebar-border-color: var(--border-color);
  --sidebar-border-width: 0 1px 0 0;
  --sidebar-padding: 0 20px;
  --code-font-family: var(--font-mono);
  --code-font-size: calc(var(--base-font-size) * 0.95);
  --code-inline-background: var(--border-color);
  --code-inline-color: var(--text-main);
  --code-block-background: var(--card-bg);
  --code-block-color: var(--text-main);
  --code-theme-background: var(--card-bg);
  --code-theme-text: var(--text-main);
  --code-theme-comment: #6e8090;
  --code-theme-function: #f07178;
  --code-theme-keyword: #c2e78c;
  --code-theme-operator: #ffcb6b;
  --code-theme-punctuation: #89ddff;
  --code-theme-selector: #ffcb6b;
  --code-theme-tag: #f07178;
  --code-theme-variable: #ffcb6b;
  --heading-color: #fff;
  --heading-h1-color: var(--accent-primary);
  --heading-h2-color: var(--accent-primary);
  --heading-h3-color: var(--accent-secondary);
  --link-color: var(--accent-primary);
  --link-color--hover: #059669;
  --blockquote-background: rgba(16, 185, 129, 0.1);
  --blockquote-border-color: var(--accent-primary);
  --blockquote-color: var(--text-main);
  --table-cell-border-color: var(--border-color);
  --table-row-odd-background: var(--card-bg);
  --table-row-even-background: var(--bg-color);
  --navbar-root-color: var(--text-main);
  --navbar-root-color--hover: var(--accent-primary);
  --navbar-root-color--active: var(--accent-primary);
  --search-input-background-color: var(--card-bg);
  --search-input-border-color: var(--border-color);
  --search-input-color: var(--text-main);
  --search-result-heading-color: var(--accent-primary);
  --search-result-item-color: var(--text-main);
  --search-result-keyword-background: rgba(16, 185, 129, 0.3);
  --search-result-keyword-color: var(--text-main);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  background-color: var(--base-background-color);
  color: var(--base-color);
  font-family: var(--base-font-family);
  font-size: var(--base-font-size);
  line-height: var(--base-line-height);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Background Grid Effect */
.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: 
    linear-gradient(to right, #1a1a1a 1px, transparent 1px),
    linear-gradient(to bottom, #1a1a1a 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  opacity: 0.6;
}

/* Hide Docsify's default app navigation which causes the strange line */
.app-nav {
  display: none !important;
}

/* Main Content Area */
.content {
  padding-top: 30px;
  padding-left: calc(var(--sidebar-width) + 20px);
  padding-right: 20px;
  padding-bottom: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.markdown-section {
  max-width: 100%;
  padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  color: var(--heading-color);
  margin-top: 1.5em;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  color: var(--heading-h1-color);
  margin-top: 0;
  position: relative;
  padding-bottom: 0.5rem;
}

h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 3px;
}

h2 {
  font-size: 2rem;
  color: var(--heading-h2-color);
  margin-top: 2em;
}

h3 {
  font-size: 1.5rem;
  color: var(--heading-h3-color);
}

p {
  color: var(--text-main);
  margin-bottom: 1rem;
  line-height: 1.7;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-speed);
}

a:hover {
  color: var(--link-color--hover);
  text-decoration: underline;
}

/* Code Blocks */
.markdown-section code {
  font-family: var(--code-font-family);
  font-size: var(--code-font-size);
  background: var(--code-inline-background);
  color: var(--code-inline-color);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  margin: 0 0.2em;
}

.markdown-section pre {
  background: var(--code-block-background);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  overflow: auto;
  margin: 1.5rem 0;
  font-family: var(--code-font-family);
  font-size: var(--code-font-size);
  line-height: 1.5;
}

.markdown-section pre code {
  background: transparent;
  color: var(--code-block-color);
  padding: 0;
  margin: 0;
  border-radius: 0;
}

/* Blockquotes */
.markdown-section blockquote {
  background: var(--blockquote-background);
  border-left: 4px solid var(--blockquote-border-color);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  color: var(--blockquote-color);
}

.markdown-section blockquote p {
  margin: 0;
}

/* Lists */
.markdown-section ul, .markdown-section ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.markdown-section li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

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

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

/* Tables */
.markdown-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.markdown-section th {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.markdown-section td {
  padding: 1rem;
  border-bottom: 1px solid var(--table-cell-border-color);
  color: var(--text-main);
}

.markdown-section tr:nth-child(even) {
  background: var(--table-row-even-background);
}

.markdown-section tr:nth-child(odd) {
  background: var(--table-row-odd-background);
}

.markdown-section tr:last-child td {
  border-bottom: none;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar-background);
  border-right: var(--sidebar-border-width) solid var(--sidebar-border-color);
  padding: var(--sidebar-padding);
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 10;
  margin-top: 20px;
  height: calc(100vh - 20px);
}

.sidebar > h1 {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--accent-primary);
  text-align: left;
  margin: 1rem 0 2rem;
  padding: 0;
}

.sidebar-nav {
  margin: 0;
  padding: 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav ul li {
  margin: 0.5rem 0;
}

.sidebar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.5rem 0;
  display: block;
  transition: color var(--transition-speed);
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
}

.sidebar-nav a:hover {
  color: var(--accent-primary);
}

.sidebar-nav li.active > a {
  color: var(--accent-primary);
  border-left: 2px solid var(--accent-primary);
  background: rgba(16, 185, 129, 0.1);
  border-radius: 0 4px 4px 0;
}

/* Nested list items */
.sidebar-nav ul ul a {
  padding-left: 1.5rem;
  font-size: 0.9rem;
}

.sidebar-nav ul ul ul a {
  padding-left: 2.25rem;
}

/* Search */
.search {
  margin-bottom: 1.5rem;
  padding: 0;
}

.search input {
  background: var(--search-input-background-color);
  border: 1px solid var(--search-input-border-color);
  border-radius: 6px;
  color: var(--search-input-color);
  font-family: var(--font-main);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  width: 100%;
  transition: border-color var(--transition-speed);
}

.search input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.search .results-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-top: 0.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.search .matching-post {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.search .matching-post:last-child {
  border-bottom: none;
}

.search h2 {
  font-size: 1.1rem;
  color: var(--search-result-heading-color);
  margin: 0 0 0.5rem;
}

.search p {
  color: var(--search-result-item-color);
  margin: 0;
  font-size: 0.9rem;
}

.search .search-keyword {
  background: var(--search-result-keyword-background);
  color: var(--search-result-keyword-color);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-weight: 600;
}

/* Notices/Tips */
.markdown-section .tip,
.markdown-section .warn {
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid var(--accent-primary);
  background: rgba(16, 185, 129, 0.1);
}

.markdown-section .tip::before,
.markdown-section .warn::before {
  content: "ℹ";
  font-weight: bold;
  margin-right: 0.5rem;
  font-size: 1.2rem;
}

.markdown-section .warn {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.markdown-section .warn::before {
  content: "⚠";
  color: #f59e0b;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    margin-top: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .content {
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 20px; /* Reduced padding for mobile */
    margin-top: 0; /* Remove margin-top on mobile since sidebar is above content */
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.7rem;
  }
  
  h3 {
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .content {
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 15px;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Selection */
::selection {
  background: rgba(16, 185, 129, 0.3);
}

/* Loading Spinner */
.progress {
  background: var(--accent-primary);
}

/* Cover Page */
.cover {
  background: var(--bg-color) !important;
  color: var(--text-main);
}

.cover h1 {
  color: var(--accent-primary);
}

.cover a {
  color: var(--accent-primary);
}

.cover a:hover {
  color: var(--link-color--hover);
}

.cover .cover-main > p:last-child a {
  background: var(--accent-primary);
  color: var(--bg-color);
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-speed);
}

.cover .cover-main > p:last-child a:hover {
  background: var(--link-color--hover);
}