/* Local variable fonts (Inter + JetBrains Mono, Cyrillic & Latin) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/vendor/fonts/inter-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/vendor/fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

:root,
[data-theme="dark"] {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: dark;
  --background: #09090b;
  --header-bg: rgba(9, 9, 11, 0.78);
  --foreground: #fafafa;
  --card: #0c0c0f;
  --card-foreground: #fafafa;
  --popover: #111115;
  --popover-foreground: #fafafa;
  --primary: #fafafa;
  --primary-foreground: #09090b;
  --secondary: #18181b;
  --secondary-foreground: #e4e4e7;
  --muted: #18181b;
  --muted-foreground: #a1a1aa;
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --input: rgba(255, 255, 255, 0.14);
  --ring: rgba(255, 255, 255, 0.32);

  --status-success: #34d399;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-border: rgba(16, 185, 129, 0.28);
  --status-warning: #fbbf24;
  --status-warning-bg: rgba(245, 158, 11, 0.1);
  --status-warning-border: rgba(245, 158, 11, 0.28);
  --status-error: #fb7185;
  --status-error-bg: rgba(244, 63, 94, 0.1);
  --status-error-border: rgba(244, 63, 94, 0.28);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 16px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, 0.78);
  --shimmer-highlight: rgba(255, 255, 255, 0.75);
}

[data-theme="light"] {
  color-scheme: light;
  --background: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.84);
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --input: #e4e4e7;
  --ring: rgba(24, 24, 27, 0.24);

  --status-success: #059669;
  --status-success-bg: rgba(16, 185, 129, 0.1);
  --status-success-border: rgba(16, 185, 129, 0.28);
  --status-warning: #d97706;
  --status-warning-bg: rgba(245, 158, 11, 0.1);
  --status-warning-border: rgba(245, 158, 11, 0.32);
  --status-error: #e11d48;
  --status-error-bg: rgba(244, 63, 94, 0.08);
  --status-error-border: rgba(244, 63, 94, 0.26);

  --shadow-xs: 0 1px 2px rgba(9, 9, 11, 0.04);
  --shadow-sm: 0 4px 16px -6px rgba(9, 9, 11, 0.08);
  --shadow-lg: 0 24px 64px -16px rgba(9, 9, 11, 0.18);
  --shimmer-highlight: rgba(9, 9, 11, 0.85);
}

html,
body {
  height: 100%;
  height: 100dvh;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

.font-mono,
code,
pre {
  font-family: var(--font-mono);
}

.sh-app-shell {
  height: 100vh;
  height: 100dvh;
}

.sh-header {
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sh-brand-mark {
  background: linear-gradient(135deg, var(--primary) 0%, var(--muted-foreground) 100%);
  color: var(--primary-foreground);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), var(--shadow-xs);
}

.sh-composer-dock {
  background-color: var(--background);
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

.sh-drawer {
  overscroll-behavior: contain;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* shadcn/ui surface primitives */
.sh-card {
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.sh-muted {
  background-color: var(--muted);
  border: 1px solid var(--border);
}

.sh-border {
  border-color: var(--border);
}

.sh-text-muted {
  color: var(--muted-foreground);
}

/* Buttons */
.sh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.sh-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sh-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.sh-btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid transparent;
}

.sh-btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.sh-btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.sh-btn-secondary:hover:not(:disabled) {
  background-color: var(--accent);
  border-color: var(--border-strong);
}

.sh-btn-ghost {
  background-color: transparent;
  color: var(--muted-foreground);
  border: 1px solid transparent;
}

.sh-btn-ghost:hover:not(:disabled) {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.sh-btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.sh-btn-outline:hover:not(:disabled) {
  background-color: var(--accent);
  border-color: var(--border-strong);
}

/* Badges */
.sh-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.1;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.sh-badge-success {
  color: var(--status-success);
  background-color: var(--status-success-bg);
  border-color: var(--status-success-border);
}

.sh-badge-warning {
  color: var(--status-warning);
  background-color: var(--status-warning-bg);
  border-color: var(--status-warning-border);
}

.sh-badge-error {
  color: var(--status-error);
  background-color: var(--status-error-bg);
  border-color: var(--status-error-border);
}

/* Inline Citation (AI Elements style) */
.sh-citation {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.05rem 0.42rem;
  margin: 0 0.1rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  vertical-align: baseline;
  color: var(--foreground);
  background-color: var(--secondary);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.sh-citation:hover {
  background-color: var(--accent);
  border-color: var(--ring);
  transform: translateY(-0.5px);
}

.sh-citation:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Inline code in rendered answers */
.sh-inline-code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 0.1rem 0.35rem;
  border-radius: 0.375rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
}

/* Prompt Input Composer */
.sh-composer {
  background-color: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sh-composer:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring), var(--shadow-sm);
}

/* Shimmer text animation for active reasoning / search step */
.sh-shimmer {
  background: linear-gradient(
    90deg,
    var(--muted-foreground) 0%,
    var(--shimmer-highlight) 50%,
    var(--muted-foreground) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shShimmer 1.8s linear infinite;
}

@keyframes shShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.fade-slide-in {
  animation: fadeSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Native <dialog> styling */
dialog.sh-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 0.875rem;
  background-color: var(--popover);
  color: var(--popover-foreground);
  box-shadow: var(--shadow-lg);
  max-width: min(760px, calc(100vw - 1.5rem));
  width: 100%;
  max-height: min(88dvh, 820px);
  overscroll-behavior: contain;
}

.sh-dropzone {
  border: 1.5px dashed var(--border-strong);
  background-color: var(--muted);
  border-radius: 0.75rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.sh-dropzone-active {
  border-color: var(--ring);
  background-color: var(--accent);
}

dialog.sh-dialog::backdrop {
  background: rgba(9, 9, 11, 0.65);
  backdrop-filter: blur(4px);
}

dialog.sh-dialog[open] {
  animation: dialogPop 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes dialogPop {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Subtle custom scrollbars */
.thin-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(161, 161, 170, 0.22) transparent;
}

.thin-scroll::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.thin-scroll::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.thin-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.thin-scroll::-webkit-scrollbar-thumb {
  background: rgba(161, 161, 170, 0.22);
  border-radius: 9999px;
}

.thin-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(161, 161, 170, 0.42);
}

[x-cloak] {
  display: none !important;
}
