/* ═══════════════════════════════════════════
   Hermes Agent FA - Persian Documentation
   Dark/Light Theme with RTL + LTR Mixed
   ═══════════════════════════════════════════ */

/* ═══ Dark Theme ═══ */
[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: #16162a;
  --bg-hover: #1e1e3a;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6a6a82;
  --accent-1: #6c5ce7;
  --accent-2: #a29bfe;
  --accent-3: #00cec9;
  --gradient-1: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  --border: rgba(108, 92, 231, 0.15);
  --border-hover: rgba(108, 92, 231, 0.35);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.15);
  --code-bg: #0d0d14;
  --nav-bg: rgba(10, 10, 15, 0.88);
}

/* ═══ Light Theme ═══ */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f7fb;
  --bg-tertiary: #ecedf3;
  --bg-card: #f0f1f7;
  --bg-hover: #e6e7ef;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8888a8;
  --accent-1: #6c5ce7;
  --accent-2: #5a4bd1;
  --accent-3: #009e99;
  --gradient-1: linear-gradient(135deg, #6c5ce7 0%, #5a4bd1 100%);
  --border: rgba(108, 92, 231, 0.12);
  --border-hover: rgba(108, 92, 231, 0.3);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.08);
  --code-bg: #f0f1f7;
  --nav-bg: rgba(255, 255, 255, 0.88);
}

:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 280px;
  --nav-height: 52px;
  --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  direction: rtl;
  transition: background 0.3s ease, color 0.3s ease;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent-1); border-radius: 3px; }
::selection { background: rgba(108, 92, 231, 0.3); }

/* ═══ Top Navigation ═══ */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.nav-brand a {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-primary);
  font-weight: 700; font-size: 15px;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.nav-links a:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* GitHub link */
.github-link {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border);
  font-weight: 600 !important;
}
.github-link:hover { border-color: var(--border-hover); }
.gh-stars { font-size: 12px; }

/* ═══ Theme Toggle - Slider ═══ */
.theme-toggle {
  position: relative;
  width: 52px; height: 28px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  overflow: hidden;
}
.theme-toggle:hover { border-color: var(--border-hover); }
.theme-toggle .slider {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  background: var(--accent-1);
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  line-height: 1;
}
[data-theme="light"] .theme-toggle .slider {
  transform: translateX(-24px);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 12px;
  transition: opacity 0.3s;
}
.theme-toggle .icon-sun { left: 6px; }
.theme-toggle .icon-moon { right: 6px; }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0.3; }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 0.3; }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; }

/* ═══ Sidebar ═══ */
.docs-container {
  display: flex;
  margin-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
}
.sidebar {
  position: fixed;
  top: var(--nav-height); right: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--nav-height));
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 50;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.sidebar-section { margin-bottom: 2px; }
.sidebar-section-title {
  display: block;
  padding: 8px 20px;
  color: var(--text-muted);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  cursor: pointer;
  transition: color 0.2s;
}
.sidebar-section-title:hover { color: var(--accent-2); }
.sidebar-section.collapsed .sidebar-links { display: none; }
.sidebar-section.collapsed .sidebar-section-title::after { content: ''; }
.sidebar-links a.active { color: var(--accent-2); border-right-color: var(--accent-1); background: rgba(108,92,231,0.08); font-weight: 500; }
.sidebar-links { list-style: none; padding: 0; }
.sidebar-links a {
  display: block;
  padding: 5px 20px 5px 32px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px; font-weight: 400;
  transition: var(--transition);
  border-right: 2px solid transparent;
}
.sidebar-links a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-right-color: var(--accent-1);
}

/* ═══ Main Content ═══ */
.docs-content {
  margin-right: var(--sidebar-width);
  flex: 1;
  max-width: 840px;
  padding: 40px 48px;
  margin-left: auto;
}

/* ═══ Typography (RTL) ═══ */
h1 { font-size: 2.2em; font-weight: 800; margin-bottom: 16px; line-height: 1.3; }
h2 { font-size: 1.55em; font-weight: 700; margin-top: 40px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.25em; font-weight: 600; margin-top: 32px; margin-bottom: 12px; }
h4 { font-size: 1.05em; font-weight: 600; margin-top: 24px; margin-bottom: 8px; }
p { margin-bottom: 16px; color: var(--text-secondary); line-height: 1.85; }
a { color: var(--accent-2); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-3); }

/* ═══════════════════════════════════════════
   LTR: Code blocks & inline code
   ═══════════════════════════════════════════ */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--code-bg);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--accent-3);
  border: 1px solid var(--border);
  display: inline;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  overflow-x: auto;
  margin-bottom: 18px;
  text-align: left;
  direction: ltr;
}
pre code {
  background: none; padding: 0; border: none;
  color: var(--text-primary);
  font-size: 13px; line-height: 1.7;
  text-align: left;
}
p code, li code, blockquote code { display: inline; }
td code, th code { text-align: left; }

/* ═══ Lists ═══ */
ul, ol { margin-bottom: 16px; padding-right: 24px; }
li { margin-bottom: 8px; color: var(--text-secondary); line-height: 1.8; }
li strong { color: var(--text-primary); }

/* ═══ Tables ═══ */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
th {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  font-weight: 600; color: var(--text-primary);
  text-align: right; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 16px;
  color: var(--text-secondary);
  text-align: right; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
td code, th code { direction: ltr; unicode-bidi: isolate-override; text-align: left; }

/* ═══ Blockquotes ═══ */
blockquote {
  border-right: 3px solid var(--accent-1);
  padding: 14px 20px;
  margin-bottom: 18px;
  background: var(--bg-tertiary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: background 0.3s ease;
}
blockquote p { color: var(--text-secondary); margin-bottom: 0; }

hr { border: none; height: 1px; background: var(--border); margin: 28px 0; }

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .docs-content { margin-right: 0; padding: 28px 20px; }
}
@media (max-width: 600px) {
  .top-nav { padding: 0 12px; }
  .docs-content { padding: 20px 14px; }
  h1 { font-size: 1.7em; }
  .nav-links a { font-size: 12px; padding: 4px 8px; }
}
