/* ==========================================================================
   Smoki's Code — base styles
   Colors come from CSS variables that js/themes.js sets on :root.
   The values below are the "Smoki Dark" defaults so the first paint
   already looks right before any script runs.
   ========================================================================== */

:root {
  /* UI colors */
  --c-bg: #1c1d21;
  --c-fg: #d9d6d0;
  --c-fg-muted: #8d8a86;
  --c-sidebar-bg: #17181b;
  --c-activity-bg: #121315;
  --c-activity-fg: #75726e;
  --c-activity-active: #f1ede6;
  --c-titlebar-bg: #121315;
  --c-tab-bg: #17181b;
  --c-tab-active-bg: #1c1d21;
  --c-tab-active-fg: #f1ede6;
  --c-border: #2a2b30;
  --c-hover: #26272c;
  --c-list-active: #33302d;
  --c-accent: #ff8a4c;
  --c-accent-fg: #1a1208;
  --c-input-bg: #232429;
  --c-widget-bg: #222328;
  --c-line-number: #55535a;
  --c-line-number-active: #c9c5be;
  --c-current-line: #24252a;
  --c-selection: #4a3b30;
  --c-find-match: #6b4a2a;
  --c-cursor: #ff8a4c;
  --c-statusbar-bg: #2a1d16;
  --c-statusbar-fg: #f0c9ad;
  --c-scrollbar: #3a3b41;
  --c-error: #f2685c;
  --c-warning: #e6b450;
  --c-success: #7fc47a;

  /* Syntax token colors */
  --t-text: #d9d6d0;
  --t-comment: #6f6c69;
  --t-string: #d9a46c;
  --t-number: #b8d68b;
  --t-keyword: #6fb3e8;
  --t-control: #d48ec9;
  --t-constant: #6fb3e8;
  --t-function: #f0d488;
  --t-type: #5fcfb8;
  --t-variable: #a8cff0;
  --t-property: #a8cff0;
  --t-operator: #c9c5be;
  --t-punct: #a29f9a;
  --t-tag: #6fb3e8;
  --t-attr: #a8cff0;
  --t-decorator: #e6b450;
  --t-builtin: #5fcfb8;
  --t-regex: #f2685c;

  /* Type */
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-code: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
  --font-size: 14px;
  --line-height: 21px;
  --tab-size: 4;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--c-bg);
  color: var(--c-fg);
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input, select, textarea {
  font: inherit;
  color: var(--c-fg);
}

:focus-visible {
  outline: 1px solid var(--c-accent);
  outline-offset: -1px;
}

/* Icons are injected as inline SVG by js/icons.js */
[data-icon] svg,
.icon svg {
  width: 16px;
  height: 16px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  color: var(--c-fg-muted);
}
.icon-btn:hover { background: var(--c-hover); color: var(--c-fg); }
.icon-btn.active { color: var(--c-accent); }

/* Buttons used in dialogs, welcome page and settings */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 4px;
  background: var(--c-input-bg);
  border: 1px solid var(--c-border);
  color: var(--c-fg);
  line-height: 1.3;
}
.btn:hover { background: var(--c-hover); }
.btn.primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-fg);
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--c-error); }

.text-input {
  width: 100%;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  background: var(--c-input-bg);
  outline: none;
}
.text-input:focus { border-color: var(--c-accent); }

kbd, .kbd {
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--c-border);
  border-bottom-width: 2px;
  background: var(--c-input-bg);
  color: var(--c-fg-muted);
  white-space: nowrap;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--c-scrollbar) transparent;
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-scrollbar);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 8px;
}
::-webkit-scrollbar-corner { background: transparent; }

/* Toast notifications (bottom right) */
.toasts {
  position: fixed;
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  max-width: min(420px, calc(100vw - 24px));
}
.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--c-widget-bg);
  border: 1px solid var(--c-border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  animation: toast-in .18s ease-out;
  line-height: 1.4;
}
.toast .toast-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--c-accent);
}
.toast.warn .toast-dot { background: var(--c-warning); }
.toast.error .toast-dot { background: var(--c-error); }
.toast.success .toast-dot { background: var(--c-success); }
.toast .toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .toast-close { color: var(--c-fg-muted); }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
