/* ========================================
   λÆS Documentation - Custom Theme
   Modern, Clean, Professional
   ======================================== */

/* CSS Variables */
:root {
  /* Light theme colors */
  --primary-color: #3B82F6;
  --primary-hover: #2563EB;
  --bg-color: #FFFFFF;
  --surface-color: #F9FAFB;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --border-color: #E5E7EB;
  --code-bg: #F3F4F6;
  --code-border: #D1D5DB;
  --sidebar-bg: #FFFFFF;
  --sidebar-border: #E5E7EB;
  --link-color: #3B82F6;
  --link-hover: #2563EB;

  /* Syntax highlighting - Light */
  --syntax-keyword: #D73A49;
  --syntax-string: #032F62;
  --syntax-number: #005CC5;
  --syntax-function: #6F42C1;
  --syntax-comment: #6A737D;
}

[data-theme="dark"] {
  /* Dark theme colors */
  --primary-color: #60A5FA;
  --primary-hover: #3B82F6;
  --bg-color: #0F172A;
  --surface-color: #1E293B;
  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --border-color: #334155;
  --code-bg: #1E293B;
  --code-border: #475569;
  --sidebar-bg: #1E293B;
  --sidebar-border: #334155;
  --link-color: #60A5FA;
  --link-hover: #93C5FD;

  /* Syntax highlighting - Dark */
  --syntax-keyword: #FF7B72;
  --syntax-string: #A5D6FF;
  --syntax-number: #79C0FF;
  --syntax-function: #D2A8FF;
  --syntax-comment: #8B949E;
}

/* ========================================
   Global Styles
   ======================================== */

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================
   Sidebar Styling
   ======================================== */

.sidebar {
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-nav {
  padding: 0 1rem 2rem;
}

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

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  font-size: 1.5rem;
}

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

.sidebar-nav a.active {
  color: var(--primary-color);
  background-color: var(--surface-color);
  font-weight: 500;
}

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

/* Sidebar sections (Effects, etc.) */
.sidebar-nav > ul > li > strong {
  display: block;
  padding: 1rem 1rem 0.5rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Nested items under sections */
.sidebar-nav ul ul {
  padding-left: 0.75rem;
}

/* ========================================
   Theme Toggle Button
   ======================================== */

.theme-toggle-btn {
  position: fixed;
  bottom: 2rem;
  left: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--surface-color);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  transform: scale(1.1);
}

/* ========================================
   Main Content Styling
   ======================================== */

.content {
  padding: 2rem 3rem;
  max-width: 900px;
  margin: 0 auto;
}

.markdown-section {
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 1rem;
}

/* Headings */
.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4,
.markdown-section h5,
.markdown-section h6 {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.markdown-section h1 {
  font-size: 2.25rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-top: 0;
}

.markdown-section h2 {
  font-size: 1.875rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.375rem;
}

.markdown-section h3 {
  font-size: 1.5rem;
}

.markdown-section h4 {
  font-size: 1.25rem;
}

/* Links */
.markdown-section a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ========================================
   Code Blocks
   ======================================== */

/* Inline code */
.markdown-section code {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  color: var(--text-primary);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

/* Code blocks */
.markdown-section pre {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  overflow-x: auto;
  line-height: 1.5;
  position: relative;
}

.markdown-section pre > code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Copy code button */
.docsify-copy-code-button {
  background-color: var(--primary-color) !important;
  color: white !important;
  border-radius: 0.375rem !important;
  font-size: 0.75rem !important;
  padding: 0.375rem 0.75rem !important;
}

.docsify-copy-code-button:hover {
  background-color: var(--primary-hover) !important;
}

/* Syntax highlighting - GitHub style */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--syntax-comment);
  font-style: italic;
}

.token.namespace {
  opacity: 0.7;
}

.token.string,
.token.attr-value {
  color: var(--syntax-string);
}

.token.punctuation,
.token.operator {
  color: var(--text-primary);
}

.token.entity,
.token.url,
.token.symbol,
.token.number,
.token.boolean,
.token.variable,
.token.constant,
.token.property,
.token.regex,
.token.inserted {
  color: var(--syntax-number);
}

.token.atrule,
.token.keyword,
.token.attr-name,
.language-autohotkey .token.selector {
  color: var(--syntax-keyword);
}

.token.function,
.token.deleted,
.language-autohotkey .token.tag {
  color: var(--syntax-function);
}

.token.tag,
.token.selector,
.language-autohotkey .token.keyword {
  color: var(--syntax-keyword);
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.class-name {
  color: var(--syntax-function);
}

.token.builtin {
  color: var(--syntax-keyword);
}

/* ========================================
   Tables
   ======================================== */

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

.markdown-section thead {
  background-color: var(--surface-color);
}

.markdown-section th,
.markdown-section td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-color);
}

.markdown-section th:last-child,
.markdown-section td:last-child {
  border-right: none;
}

.markdown-section th {
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--surface-color);
}

.markdown-section tbody tr:nth-child(even) {
  background-color: var(--surface-color);
}

.markdown-section tbody tr:nth-child(even) td {
  background-color: var(--surface-color);
}

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

/* ========================================
   Blockquotes & Alerts
   ======================================== */

.markdown-section blockquote {
  border-left: 4px solid var(--primary-color);
  background-color: var(--surface-color);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 0.375rem 0.375rem 0;
}

.markdown-section blockquote p {
  margin: 0;
  color: var(--text-secondary);
}

/* ========================================
   Badges & Images
   ======================================== */

.markdown-section img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* Images with explicit height/width attributes should respect them */
.markdown-section img[height],
.markdown-section img[width] {
  height: auto;
  max-height: attr(height);
}

/* Right-aligned images (like badges) */
.markdown-section img[align="right"] {
  float: right;
  margin: 0 0 1rem 1rem;
  max-width: 200px;
}

/* Badge styling for Maven Central, etc. */
.markdown-section img[alt*="badge"],
.markdown-section img[src*="shields.io"],
.markdown-section img[src*="maven-central"],
.markdown-section img[src*="javadoc.io"] {
  display: inline-block;
  margin: 0.25rem 0.25rem 0.25rem 0;
  border-radius: 0.25rem;
  vertical-align: middle;
}

/* Links containing badges should not add extra spacing */
.markdown-section a:has(img[src*="shields.io"]),
.markdown-section a:has(img[src*="maven-central"]),
.markdown-section a:has(img[src*="javadoc.io"]) {
  display: inline-block;
  line-height: 0;
}

/* ========================================
   Search Box
   ======================================== */

.search input {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  width: 100%;
  transition: all 0.2s ease;
}

.search input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search .results-panel {
  background-color: var(--sidebar-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search .matching-post {
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  transition: background-color 0.2s ease;
}

.search .matching-post:hover {
  background-color: var(--surface-color);
}

/* ========================================
   Pagination
   ======================================== */

.pagination-item {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  transition: all 0.2s ease;
}

.pagination-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pagination-item a {
  color: var(--link-color);
  text-decoration: none;
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media screen and (max-width: 768px) {
  .content {
    padding: 1rem;
  }

  .markdown-section h1 {
    font-size: 1.875rem;
  }

  .markdown-section h2 {
    font-size: 1.5rem;
  }

  .theme-toggle-btn {
    bottom: 1rem;
    left: 1rem;
  }

  .sidebar-logo img {
    max-width: 140px;
  }
}

/* ========================================
   Smooth Transitions
   ======================================== */

* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
