/* Base Element Overrides */
a:hover {
  cursor: pointer;
}

/* Typography */
code {
  font-size: 14px;
}

pre {
  white-space: pre-wrap;
}

/* Raw JSON Viewer Styles */
.raw-json-viewer {
  --vjs-font-size: 0.75rem;
  --vjs-line-height: 1.5;
  /* Light theme colors (GitHub-inspired) */
  --vjs-key-color: #0550ae;
  --vjs-string-color: #0a3069;
  --vjs-number-color: #0550ae;
  --vjs-boolean-color: #cf222e;
  --vjs-null-color: #6e7781;
  --vjs-brackets-color: #57606a;
  --vjs-icon-color: #57606a;
  --vjs-hover-bg-color: rgba(175, 184, 193, 0.2);
}

/* Dark theme colors */
.dark .raw-json-viewer {
  --vjs-key-color: #79c0ff;
  --vjs-string-color: #a5d6ff;
  --vjs-number-color: #79c0ff;
  --vjs-boolean-color: #ff7b72;
  --vjs-null-color: #8b949e;
  --vjs-brackets-color: #8b949e;
  --vjs-icon-color: #8b949e;
  --vjs-hover-bg-color: rgba(110, 118, 129, 0.1);
}

.raw-json-viewer .vjs-tree {
  font-family: var(--default-mono-font-family);
}

.raw-json-viewer .vjs-carets {
  top: 3px;
  right: 1px;
}

.raw-json-viewer .vjs-node-index {
  padding-right: 4px;
}

.raw-json-viewer .vjs-key {
  color: var(--vjs-key-color);
}

.raw-json-viewer .vjs-tree-node:hover {
  background: var(--vjs-hover-bg-color);
  border-radius: 0.25rem;
}

.raw-json-viewer .vjs-value-string {
  color: var(--vjs-string-color);
}

.raw-json-viewer .vjs-value-number {
  color: var(--vjs-number-color);
}

.raw-json-viewer .vjs-value-boolean {
  color: var(--vjs-boolean-color);
}

.raw-json-viewer .vjs-value-null {
  color: var(--vjs-null-color);
}

/* Markdown Content - Formatted (word-wrapping for readable text) */
.markdown-wrapper {
  background: none;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.markdown-content {
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  line-height: 1.6;
  color: var(--foreground);
}

/* Headings */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin-top: 0.75em;
  margin-bottom: 0.5em;
  font-weight: 600;
  line-height: 1.25;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child,
.markdown-content h4:first-child,
.markdown-content h5:first-child,
.markdown-content h6:first-child {
  margin-top: 0;
}

.markdown-content h1 {
  font-size: 1.875rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
}

.markdown-content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
}

.markdown-content h3 {
  font-size: 1.25rem;
}

.markdown-content h4 {
  font-size: 1.125rem;
}

.markdown-content h5 {
  font-size: 1rem;
}

.markdown-content h6 {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Links */
.markdown-content a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-underline-offset: 2px;
}

.markdown-content a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Lists */
.markdown-content ul,
.markdown-content ol {
  margin-top: 0;
  margin-bottom: 1em;
  padding-left: 2em;
}

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

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

.markdown-content li {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

.markdown-content li > p {
  margin-bottom: 0.5em;
}

.markdown-content ul ul,
.markdown-content ul ol,
.markdown-content ol ul,
.markdown-content ol ol {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Nested list styles */
.markdown-content ul ul {
  list-style-type: circle;
}

.markdown-content ul ul ul {
  list-style-type: square;
}

/* Blockquotes */
.markdown-content blockquote {
  margin: 1em 0;
  padding: 0 1em;
  border-left: 4px solid var(--border);
  color: var(--muted-foreground);
}

.markdown-content blockquote > :first-child {
  margin-top: 0;
}

.markdown-content blockquote > :last-child {
  margin-bottom: 0;
}

/* Code */
.markdown-content code {
  font-family: var(--default-mono-font-family);
  font-size: 0.875em;
  background: var(--muted);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
}

.markdown-content pre {
  margin: 0.25em 0;
  overflow-x: auto;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.markdown-content .hljs {
  margin: 10px 0 10px 0;
  border-radius: 10px;
  background: var(--code);
  border: 1px solid var(--border);
}

/* Light theme code highlighting (GitHub-inspired, matching raw-json-viewer) */
:root:not(.dark) .markdown-content .hljs {
  color: #24292f;
}

:root:not(.dark) .markdown-content .hljs-keyword,
:root:not(.dark) .markdown-content .hljs-selector-tag,
:root:not(.dark) .markdown-content .hljs-built_in,
:root:not(.dark) .markdown-content .hljs-type {
  color: #cf222e;
}

:root:not(.dark) .markdown-content .hljs-string,
:root:not(.dark) .markdown-content .hljs-doctag,
:root:not(.dark) .markdown-content .hljs-attr {
  color: #0a3069;
}

:root:not(.dark) .markdown-content .hljs-number,
:root:not(.dark) .markdown-content .hljs-literal {
  color: #0550ae;
}

:root:not(.dark) .markdown-content .hljs-comment {
  color: #6e7781;
}

:root:not(.dark) .markdown-content .hljs-title,
:root:not(.dark) .markdown-content .hljs-function {
  color: #8250df;
}

:root:not(.dark) .markdown-content .hljs-variable,
:root:not(.dark) .markdown-content .hljs-template-variable {
  color: #953800;
}

:root:not(.dark) .markdown-content .hljs-name,
:root:not(.dark) .markdown-content .hljs-selector-class {
  color: #116329;
}

/* Tables */
.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  overflow: auto;
  display: block;
}

.markdown-content table thead {
  background: var(--muted);
}

.markdown-content table th,
.markdown-content table td {
  padding: 0.5em 1em;
  border: 1px solid var(--border);
  text-align: left;
}

.markdown-content table th {
  font-weight: 600;
}

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

/* Horizontal Rule */
.markdown-content hr {
  height: 1px;
  padding: 0;
  margin: 1.5em 0;
  background-color: var(--border);
  border: 0;
}

/* Strong and Emphasis */
.markdown-content strong {
  font-weight: 600;
}

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

/* Images */
.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* Task Lists */
.markdown-content input[type='checkbox'] {
  margin-right: 0.5em;
}

.markdown-content * {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* Scrollbar Styling */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--muted-foreground);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Icon Switch Transition (used for copy button animations) */
.icon-switch-enter-active,
.icon-switch-leave-active {
  transition: all 150ms ease;
}

.icon-switch-enter-from,
.icon-switch-leave-to {
  opacity: 0;
  transform: scale(0.8);
}

/* Easter Egg Logo Swap Animation */
.logo-flip-container {
  overflow: visible;
}

.logo-flip-front,
.logo-flip-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-flip-back {
  opacity: 0;
  transform: translate(100%, -100%);
}

.logo-flip-inner.flipped .logo-flip-front {
  animation: logo-out 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.logo-flip-inner.flipped .logo-flip-back {
  animation: gem-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
}

@keyframes logo-out {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-100%, 100%) scale(0.8);
    opacity: 0;
  }
}

@keyframes gem-in {
  0% {
    transform: translate(100%, -100%) scale(0.6);
    opacity: 0;
  }
  60% {
    transform: translate(-8%, 8%) scale(1.15);
    opacity: 1;
  }
  80% {
    transform: translate(3%, -3%) scale(0.95);
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
}
