/* ================================================================
   ThermoKit Design System — styles.css
   ================================================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

/* ---------- Tokens ---------- */
:root {
  /* Primary */
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;

  /* Neutrals (zinc scale) */
  --zinc-50: #fafafa;
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-300: #d4d4d8;
  --zinc-400: #a1a1aa;
  --zinc-500: #71717a;
  --zinc-600: #52525b;
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --zinc-950: #09090b;

  /* Semantic */
  --green-500: #22c55e;
  --green-700: #15803d;
  --green-800: #166534;
  --green-50: #f0fdf4;
  --green-200: #bbf7d0;

  --red-600: #dc2626;
  --red-800: #991b1b;
  --red-50: #fef2f2;
  --red-200: #fecaca;

  --yellow-600: #a16207;
  --yellow-50: #fefce8;
  --yellow-200: #fde68a;

  --sky-700: #075985;
  --sky-600: #0284c7;
  --sky-50: #f0f9ff;
  --sky-200: #bae6fd;

  /* Surfaces */
  --bg-page: #fafafa;
  --bg-white: #ffffff;
  --border-default: #e4e4e7;
  --border-light: #f4f4f5;

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);

  /* Motion */
  --transition-fast: 150ms;
  --transition-normal: 250ms;
  --transition-slow: 350ms;
  --easing-default: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--zinc-950);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Shell Layout ---------- */
.shell {
  width: 1440px;
  margin: 0 auto;
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  background: var(--bg-white);
  border-right: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 20px 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-lg);
  background: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--zinc-500); margin-top: 1px; }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--zinc-400);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  color: var(--zinc-700);
  cursor: pointer;
  margin: 1px 0;
  transition: background var(--transition-fast) var(--easing-default), color var(--transition-fast) var(--easing-default);
}
.nav-item:hover { background: var(--border-light); }
.nav-item.active { background: var(--border-light); color: var(--zinc-950); font-weight: 500; }
.nav-item.active .dot { background: var(--blue-600); }
.nav-item svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.nav-item .badge {
  margin-left: auto;
  font-size: 10.5px;
  background: var(--border-default);
  color: var(--zinc-600);
  border-radius: var(--radius-md);
  padding: 2px 6px;
  font-weight: 500;
}
.nav-item.inert {
  cursor: default;
  opacity: 0.7;
}
.nav-item.inert:hover {
  background: transparent;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--zinc-500);
}
.sidebar-foot .row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sidebar-foot .status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-500);
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Header ---------- */
.header {
  height: 60px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--zinc-50);
  color: var(--zinc-500);
  font-size: 13px;
  cursor: text;
  transition: border-color var(--transition-fast) var(--easing-default), box-shadow var(--transition-fast) var(--easing-default);
}
.search:focus-within, .search:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  outline: none;
}
.search svg { flex-shrink: 0; }
.search kbd {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: 10.5px;
  background: var(--bg-white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  color: var(--zinc-500);
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--bg-white);
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast) var(--easing-default);
}
.icon-btn:hover { background: var(--border-light); }
.icon-btn svg { width: 16px; height: 16px; stroke: var(--zinc-700); stroke-width: 1.8; fill: none; }
.icon-btn .ping {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  background: var(--blue-600);
  border: 2px solid #fff;
  border-radius: 50%;
}

.btn-primary {
  background: var(--zinc-900);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--zinc-900);
  cursor: pointer;
  transition: background var(--transition-fast) var(--easing-default);
}
.btn-primary:hover { background: var(--zinc-800); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity var(--transition-fast) var(--easing-default);
}
.avatar:hover { opacity: 0.9; }

/* ---------- Content ---------- */
.content {
  padding: 28px 32px 40px;
  flex: 1;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--zinc-500);
  margin-bottom: 12px;
}
.breadcrumbs span.sep { color: var(--zinc-300); }
.breadcrumbs .current { color: var(--zinc-900); font-weight: 500; }

.page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.page-sub {
  font-size: 13.5px;
  color: var(--zinc-500);
  margin-top: 4px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--border-light);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--zinc-700);
  font-weight: 500;
}
.tag .dot {
  width: 6px;
  height: 6px;
  background: var(--green-500);
  border-radius: 50%;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-desc { font-size: 12.5px; color: var(--zinc-500); margin-top: 2px; }
.card-body { padding: 22px; }
.side-card { margin-bottom: 20px; }

/* ---------- Form Elements ---------- */
.field { margin-bottom: 18px; }
.label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--zinc-900);
  margin-bottom: 6px;
}
.label .hint { color: var(--zinc-400); font-weight: 400; font-size: 11.5px; }

.input, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-size: 14px;
  background: var(--bg-white);
  color: var(--zinc-950);
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast) var(--easing-default), box-shadow var(--transition-fast) var(--easing-default);
}
.input:focus, .select:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.input::placeholder { color: var(--zinc-400); }

.input-wrap { position: relative; }
.input-wrap .suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12.5px;
  color: var(--zinc-400);
  font-family: var(--font-mono);
  font-weight: 500;
  pointer-events: none;
}
.input-wrap .input { padding-right: 48px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  gap: 12px;
  align-items: end;
}
.swap-btn {
  width: 44px;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast) var(--easing-default), transform var(--transition-normal) var(--easing-default);
}
.swap-btn:hover { background: var(--border-light); }
.swap-btn svg { width: 16px; height: 16px; stroke: var(--zinc-700); stroke-width: 1.8; fill: none; }

.select-wrap { position: relative; }
.select { appearance: none; padding-right: 32px; cursor: pointer; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--zinc-500);
  border-bottom: 1.5px solid var(--zinc-500);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ---------- Validation ---------- */
.validation {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  font-size: 12.5px;
  line-height: 1.4;
}
.validation svg { flex-shrink: 0; margin-top: 1px; }
.validation-error {
  background: var(--red-50);
  border: 1px solid var(--red-200);
  color: var(--red-800);
}
.validation-error svg { stroke: var(--red-600); }
.validation-tip {
  background: var(--sky-50);
  border: 1px solid var(--sky-200);
  color: var(--sky-700);
}
.validation-info {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  font-size: 12.5px;
  background: var(--sky-50);
  border: 1px solid var(--sky-200);
  color: var(--sky-700);
}

/* ---------- Buttons ---------- */
.actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.btn {
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast) var(--easing-default), color var(--transition-fast) var(--easing-default);
}
.btn svg { width: 14px; height: 14px; }
.btn-solid {
  background: var(--blue-600);
  color: #fff;
  border-color: var(--blue-600);
}
.btn-solid:hover { background: var(--blue-700); }
.btn-outline {
  background: var(--bg-white);
  color: var(--zinc-900);
  border-color: var(--border-default);
}
.btn-outline:hover { background: var(--border-light); }
.btn-ghost {
  background: transparent;
  color: var(--zinc-600);
}
.btn-ghost:hover { background: var(--border-light); }

/* ---------- Result Panel ---------- */
.result {
  background: var(--zinc-50);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-valid {
  border-style: solid;
  border-color: var(--border-default);
}
.result-label {
  font-size: 12px;
  color: var(--zinc-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.result-value {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 600;
  color: var(--zinc-950);
  letter-spacing: -.01em;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-value .unit {
  color: var(--blue-600);
  margin-left: 6px;
  font-weight: 500;
}
.result-meta {
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  color: var(--zinc-500);
  margin-top: 4px;
  flex-wrap: wrap;
}
.result-meta .divider { color: var(--zinc-300); }
.result-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--yellow-600);
  background: var(--yellow-50);
  border: 1px solid var(--yellow-200);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.result-note svg { flex-shrink: 0; margin-top: 1px; }

/* ---------- Side Column ---------- */
.kv {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
}
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--zinc-500); }
.kv .v { color: var(--zinc-900); font-weight: 500; font-family: var(--font-mono); }

.ref-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.ref-cell {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 10px;
  text-align: center;
}
.ref-cell .rt {
  font-size: 11px;
  color: var(--zinc-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  margin-bottom: 4px;
}
.ref-cell .rv {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--zinc-900);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.history-item:last-child { border-bottom: none; }
.history-item .from { color: var(--zinc-500); font-family: var(--font-mono); font-size: 12.5px; }
.history-item .arrow { color: var(--zinc-400); margin: 0 6px; }
.history-item .to { color: var(--zinc-900); font-family: var(--font-mono); font-weight: 600; }
.history-item .time { color: var(--zinc-400); font-size: 11.5px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border-default);
  background: var(--bg-white);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--zinc-500);
}
.footer .links { display: flex; gap: 18px; }
.footer .links a {
  cursor: pointer;
  transition: color var(--transition-fast) var(--easing-default);
}
.footer .links a:hover { color: var(--zinc-900); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  max-width: 380px;
  animation: slideInRight var(--transition-normal) var(--easing-default);
}
.toast-enter {
  opacity: 0;
  transform: translateX(40px);
}
.toast-exit {
  animation: slideOutRight var(--transition-normal) var(--easing-default) forwards;
}
.toast svg { flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}
.toast-close:hover { opacity: 1; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-normal) var(--easing-default);
}
.modal-overlay-enter { opacity: 0; }
.modal-overlay-exit { animation: fadeOut var(--transition-normal) var(--easing-default) forwards; }

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  animation: scaleIn var(--transition-normal) var(--easing-default);
}
.modal-enter {
  opacity: 0;
  transform: scale(0.95);
}
.modal-exit { animation: scaleOut var(--transition-normal) var(--easing-default) forwards; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--zinc-400);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.modal-close-btn:hover {
  color: var(--zinc-700);
  background: var(--border-light);
}
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-light);
}

/* Steps modal content */
.steps-content { font-size: 13.5px; }
.steps-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.steps-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--blue-600);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12.5px;
}
.steps-formula {
  padding: 10px 14px;
  background: var(--zinc-50);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-size: 13px;
  color: var(--zinc-700);
  margin-bottom: 16px;
}
.steps-formula code {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--zinc-900);
}
.steps-detail { display: flex; flex-direction: column; gap: 8px; }
.step-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--zinc-700);
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Motion & Animation ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}
@keyframes highlightPulse {
  0% { background-color: transparent; }
  30% { background-color: rgba(37,99,235,.08); }
  100% { background-color: transparent; }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fadein {
  animation: fadeIn var(--transition-normal) var(--easing-default);
}
.animate-slidedown {
  animation: slideDown var(--transition-normal) var(--easing-default);
}
.animate-card {
  animation: cardFadeIn var(--transition-slow) var(--easing-default) both;
}
.pulse-highlight {
  animation: highlightPulse 400ms var(--easing-default);
  border-radius: var(--radius-lg);
}
