/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* Typography Utilities */
.font-fantasy {
  font-family: 'Cinzel', serif;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: #0d1117;
  color: #c9d1d9;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #161b22;
}
::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #8b949e;
}

/* Glow Effects */
.glow-amber {
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
}
.glow-indigo {
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}
.glow-cyan {
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25);
}
.glow-red {
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.35);
}
.glow-purple {
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
}
.glow-emerald {
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
}

/* Collapsible Sidebar Styles */
.sidebar-collapsed {
  width: 4.5rem !important;
}
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .sidebar-section-title,
.sidebar-collapsed .sidebar-badge,
.sidebar-collapsed .sidebar-header-full {
  display: none !important;
}
.sidebar-collapsed .sidebar-header-mini {
  display: flex !important;
}
.sidebar-collapsed .sidebar-item {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.sidebar-collapsed .sidebar-item i {
  margin-right: 0 !important;
  font-size: 1.15rem !important;
}

/* Dynamic Auto-Sizing for Textareas */
textarea {
  field-sizing: content;
  min-block-size: 2.5lh;
  max-block-size: 30lh;
}

/* ==============================================================================
   Markdown & Codex Typography Styling
   ============================================================================== */
.markdown-content {
  color: #e6edf3;
  line-height: 1.75;
  font-size: 0.925rem;
}

.markdown-content h1 {
  font-family: 'Cinzel', serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: #f3f4f6;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(168, 85, 247, 0.35);
  letter-spacing: 0.02em;
}

.markdown-content h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #e9d5ff;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(75, 85, 99, 0.4);
}

.markdown-content h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #d8b4fe;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.markdown-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: #c084fc;
  margin-top: 0.75rem;
  margin-bottom: 0.3rem;
}

.markdown-content h5,
.markdown-content h6 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #a855f7;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.markdown-content p {
  margin-top: 0.65rem;
  margin-bottom: 0.65rem;
}

.markdown-content strong {
  color: #f9fafb;
  font-weight: 600;
}

.markdown-content em {
  color: #e5e7eb;
  font-style: italic;
}

.markdown-content blockquote {
  border-left: 3px solid #a855f7;
  background: rgba(88, 28, 135, 0.18);
  padding: 0.75rem 1rem;
  margin: 0.85rem 0;
  border-radius: 0 0.5rem 0.5rem 0;
  color: #d1d5db;
  font-style: italic;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.markdown-content blockquote p {
  margin: 0.25rem 0;
}

.markdown-content ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 0.6rem 0;
}

.markdown-content ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
  margin: 0.6rem 0;
}

.markdown-content li {
  margin: 0.3rem 0;
  line-height: 1.6;
}

.markdown-content li::marker {
  color: #a855f7;
}

.markdown-content code {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #f3e8ff;
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.markdown-content pre {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 0.85rem 0;
  overflow-x: auto;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.markdown-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.825rem;
  line-height: 1.5;
  white-space: pre;
}

.markdown-content hr {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(168, 85, 247, 0.4), transparent);
  margin: 1.5rem 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
  border: 1px solid #30363d;
  border-radius: 0.5rem;
  overflow: hidden;
}

.markdown-content th {
  background: #1c2128;
  color: #f3f4f6;
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: 1px solid #30363d;
}

.markdown-content td {
  padding: 0.55rem 0.85rem;
  border: 1px solid #21262d;
}

.markdown-content tr:nth-child(even) {
  background: rgba(22, 27, 34, 0.6);
}

.markdown-content tr:hover {
  background: rgba(168, 85, 247, 0.08);
}

.markdown-content a {
  color: #c084fc;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.markdown-content a:hover {
  color: #e9d5ff;
}

/* ==============================================================================
   Mermaid Diagrams Styling
   ============================================================================== */
.mermaid-container {
  width: 100%;
  background: #0d1117;
  border-radius: 1rem;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.mermaid {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 80px;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.mermaid svg {
  max-width: 100% !important;
  height: auto !important;
  font-family: 'Inter', sans-serif !important;
}

.mermaid .edgeLabel {
  background-color: #0d1117 !important;
  color: #c9d1d9 !important;
  padding: 2px 4px !important;
  border-radius: 4px !important;
}

/* ==============================================================================
   ASCII Art & Tactical Box-Drawing Matrix Styling
   ============================================================================== */
.ascii-diagram-container {
  margin: 1.25rem 0;
  background: #06090e;
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(6, 182, 212, 0.15);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ascii-diagram-container:hover {
  border-color: rgba(6, 182, 212, 0.55);
  box-shadow: 0 8px 30px rgba(6, 182, 212, 0.12), inset 0 1px 3px rgba(6, 182, 212, 0.2);
}

.ascii-art-pre {
  margin: 0 !important;
  padding: 1.15rem !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  font-size: 0.775rem !important;
  line-height: 1.16 !important;
  letter-spacing: 0 !important;
  white-space: pre !important;
  overflow-x: auto !important;
  box-shadow: none !important;
}

.ascii-art-pre code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: #a5f3fc !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  white-space: pre !important;
  tab-size: 2;
}

/* Markdown Image Figure & Captions */
.markdown-figure {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

.markdown-image-wrapper {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(75, 85, 99, 0.6);
  background: #080c12;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
  transition: all 0.3s ease;
}

.markdown-image-wrapper:hover {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 12px 32px rgba(245, 158, 11, 0.15);
}

.markdown-image-wrapper img {
  max-width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  display: block;
  border-radius: 0.9rem;
  transition: transform 0.3s ease;
}

.markdown-image-wrapper:hover img {
  transform: scale(1.01);
}

.markdown-caption {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  font-style: italic;
  letter-spacing: 0.025em;
}
