@import "tailwindcss";

/* Terminal font (JetBrainsMono Nerd Font Mono) */
@font-face {
  font-family: "JetBrainsMono Nerd Font Mono";
  src: url("/fonts/jetbrainsmono-nerd-font/JetBrainsMonoNerdFontMono-Regular.ttf")
    format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrainsMono Nerd Font Mono";
  src: url("/fonts/jetbrainsmono-nerd-font/JetBrainsMonoNerdFontMono-Bold.ttf")
    format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* =========================================================================
   Design System: "Quiet Luxury + Liquid Glass"
   ========================================================================= */

:root {
  /* Backgrounds (dark mode) - No pure black */
  --background: 18 18 20; /* #121214 - primary surface */
  --background-elevated: 28 28 30; /* #1C1C1E - cards, panels */
  --background-tertiary: 44 44 46; /* #2C2C2E - nested elements */

  /* Text Hierarchy */
  --foreground: 255 255 255; /* Primary text - white */
  --foreground-secondary: 160 160 165; /* #A0A0A5 - secondary text */
  --foreground-tertiary: 110 110 115; /* #6E6E73 - tertiary/disabled */
  --foreground-muted: 72 72 77; /* #48484D - very subtle */

  /* Accent (single accent color - Indigo) */
  --accent: 99 102 241; /* Indigo-500 (#6366F1) */

  /* Semantic Colors */
  --success: 34 197 94; /* #22C55E - emerald/green */
  --warning: 234 179 8; /* #EAB308 - amber */
  --error: 239 68 68; /* #EF4444 - red */
  --info: 59 130 246; /* #3B82F6 - blue */

  /* Borders - subtle */
  --border: 255 255 255; /* Used with /0.06 */
  --border-elevated: 255 255 255; /* Used with /0.08 */
}

@theme inline {
  --color-background: rgb(var(--background));
  --color-foreground: rgb(var(--foreground));
  --color-card: rgb(var(--background-elevated));
  --color-card-foreground: rgb(var(--foreground));
  --color-muted: rgb(var(--background-tertiary));
  --color-muted-foreground: rgb(var(--foreground-muted));
  --color-border: rgb(var(--border) / 0.06);
  --color-border-elevated: rgb(var(--border-elevated) / 0.08);

  --color-primary: rgb(var(--accent));
  --color-primary-foreground: #ffffff;

  --color-destructive: rgb(var(--error));
  --color-destructive-foreground: #ffffff;

  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
}

* {
  box-sizing: border-box;
}

/* =========================================================================
   Pointer Cursor for Interactive Elements
   ========================================================================= */
button,
[role="button"],
[type="button"],
[type="submit"],
[type="reset"],
select,
summary,
a[href],
label[for],
input[type="checkbox"],
input[type="radio"],
input[type="file"],
input[type="range"] {
  cursor: pointer;
}

button:disabled,
[disabled] {
  cursor: not-allowed;
}

body {
  background-color: rgb(var(--background));
  color: rgb(var(--foreground));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

/* =========================================================================
   Focus States - subtle background changes, no outlines
   ========================================================================= */
*:focus-visible {
  outline: none;
}

button:focus-visible,
a:focus-visible {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: rgb(var(--accent) / 0.5) !important;
}

::selection {
  background: rgb(var(--accent) / 0.25);
}

/*
 * Override text selection color on colored backgrounds (e.g., indigo message bubbles).
 * The default selection uses indigo/25% which is invisible on indigo-500 backgrounds.
 * Using white/40% provides good contrast on any colored surface.
 */
.selection-light::selection,
.selection-light *::selection {
  background: rgba(255, 255, 255, 0.4);
}

/* =========================================================================
   Scrollbars - minimal, subtle
   ========================================================================= */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgb(var(--foreground-muted));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--foreground-tertiary));
}

/* =========================================================================
   Animations
   ========================================================================= */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-subtle {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes scale-in-simple {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(16px) scale(0.96);
  }
}

.animate-fade-in {
  animation: fade-in 150ms ease-out forwards;
}

.animate-slide-up {
  animation: slide-up 200ms ease-out forwards;
}

.animate-slide-in-right {
  animation: slide-in-right 200ms ease-out forwards;
}

.animate-pulse-subtle {
  animation: pulse-subtle 2s ease-in-out infinite;
}

.animate-scale-in {
  animation: scale-in 200ms ease-out forwards;
}

.animate-scale-in-simple {
  animation: scale-in-simple 200ms ease-out forwards;
}

.animate-toast-in {
  animation: toast-in 200ms ease-out forwards;
}

.animate-toast-out {
  animation: toast-out 200ms ease-out forwards;
}

/* =========================================================================
   Glass Panels
   ========================================================================= */
.glass-panel {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass {
  background: rgb(var(--background-elevated) / 0.7);
  backdrop-filter: blur(20px) saturate(180%);
}

/* =========================================================================
   Cards - elevation via color, not shadows
   ========================================================================= */
.card {
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}

.card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.card-interactive {
  cursor: pointer;
}

/* =========================================================================
   Stat Panels
   ========================================================================= */
.stat-panel {
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(var(--accent));
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 300;
  color: white;
  font-variant-numeric: tabular-nums;
}

.stat-suffix {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 0.125rem;
}

/* =========================================================================
   Toggle Switches
   ========================================================================= */
.toggle {
  position: relative;
  height: 1.25rem;
  width: 2.25rem;
  border-radius: 9999px;
  transition: background-color 150ms ease-out;
  cursor: pointer;
}

.toggle-off {
  background: rgba(255, 255, 255, 0.1);
}

.toggle-on {
  background: rgb(var(--success));
}

.toggle-thumb {
  position: absolute;
  top: 0.125rem;
  height: 1rem;
  width: 1rem;
  border-radius: 9999px;
  background: white;
  transition: transform 150ms ease-out;
}

.toggle-off .toggle-thumb {
  left: 0.125rem;
}

.toggle-on .toggle-thumb {
  transform: translateX(1rem);
  left: 0.125rem;
}

/* =========================================================================
   Status Indicators
   ========================================================================= */
.status-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
}

.status-connected {
  background: rgb(var(--success));
}
.status-disconnected {
  background: rgb(var(--error));
}
.status-warning {
  background: rgb(var(--warning));
}
.status-info {
  background: rgb(var(--info));
}

/* =========================================================================
   Badges/Tags
   ========================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.tag {
  display: inline-block;
  width: fit-content;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
}

/* =========================================================================
   XTerm Terminal Fixes
   ========================================================================= */
.xterm,
.xterm .xterm-screen,
.xterm .xterm-viewport {
  height: 100%;
}

/* =========================================================================
   Prose styles for markdown
   ========================================================================= */
.prose-glass {
  color: rgba(255, 255, 255, 0.9);
}

.prose-glass strong {
  color: white;
}

.prose-glass a {
  color: rgb(var(--accent));
  text-decoration: underline;
}

.prose-glass code {
  background: rgb(var(--background-tertiary));
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.prose-glass pre {
  background: rgb(var(--background-tertiary));
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
}

.prose-glass pre code {
  background: transparent;
  padding: 0;
}

.prose-glass img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 0.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.prose-glass ul,
.prose-glass ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.prose-glass li {
  margin: 0.25rem 0;
}

.prose-glass blockquote {
  border-left: 3px solid rgb(var(--accent));
  padding-left: 1rem;
  margin: 0.5rem 0;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

.prose-glass h1,
.prose-glass h2,
.prose-glass h3,
.prose-glass h4 {
  color: white;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.prose-glass h1 {
  font-size: 1.5rem;
}

.prose-glass h2 {
  font-size: 1.25rem;
}

.prose-glass h3 {
  font-size: 1.125rem;
}

.prose-glass hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}

.prose-glass table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  display: block;
  overflow-x: auto;
}

.prose-glass th,
.prose-glass td {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
  vertical-align: top;
}

.prose-glass th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
}

/* =========================================================================
   Prism Syntax Highlighting Theme (Dark)
   ========================================================================= */
.init-script-editor {
  caret-color: white;
}

.init-script-editor textarea {
  caret-color: white !important;
}

.init-script-editor textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.config-code-editor {
  caret-color: white;
}

.config-code-editor textarea {
  caret-color: white !important;
}

.config-code-editor textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* Prism tokens */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #6a9955;
}

.token.punctuation {
  color: #d4d4d4;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #b5cea8;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #ce9178;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #d4d4d4;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #c586c0;
}

.token.function,
.token.class-name {
  color: #dcdcaa;
}

.token.regex,
.token.important,
.token.variable {
  color: #d16969;
}

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

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

.token.entity {
  cursor: help;
}

/* Bash specific */
.token.shebang {
  color: #6a9955;
}

.token.shebang .token.important {
  color: #6a9955;
  font-weight: normal;
}

.token.assign-left {
  color: #9cdcfe;
}

.token.environment {
  color: #9cdcfe;
}
