/* =========================================================
   KOTAKALAT DESIGN SYSTEM (PRECISION STUDIO WORKBENCH)
   Inspired by Linear, Raycast, and Swiss Utilitarian Design
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.012em;
  background-color: #f8fafc;
  color: #0f172a;
}

code, kbd, samp, pre, .font-mono, [data-mono] {
  font-family: var(--font-mono) !important;
  letter-spacing: -0.025em;
  font-feature-settings: "tnum" 1, "zero" 1;
}

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

/* ==========================================
   THEME: CRISP LIGHT MODE (DEFAULT)
   ========================================== */
html:not(.dark) body {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html:not(.dark) header {
  background-color: rgba(255, 255, 255, 0.92) !important;
  border-color: #e2e8f0 !important;
}

html:not(.dark) .surface-card,
html:not(.dark) .tool-card {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .surface-card-subtle {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

html:not(.dark) .tool-card:hover {
  border-color: #3b82f6 !important;
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  transform: translateY(-2px);
}

html:not(.dark) input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html:not(.dark) select,
html:not(.dark) textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html:not(.dark) input:focus,
html:not(.dark) select:focus,
html:not(.dark) textarea:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

html:not(.dark) footer {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
}

/* Light mode overrides for container backgrounds and text */
html:not(.dark) .bg-slate-950:not(.keep-dark),
html:not(.dark) .bg-slate-900:not(.keep-dark),
html:not(.dark) .bg-slate-900\/80:not(.keep-dark),
html:not(.dark) .bg-slate-900\/70:not(.keep-dark),
html:not(.dark) .bg-slate-900\/60:not(.keep-dark),
html:not(.dark) .bg-slate-900\/40:not(.keep-dark) {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

html:not(.dark) .border-slate-800,
html:not(.dark) .border-slate-800\/80,
html:not(.dark) .border-white\/10,
html:not(.dark) .border-white\/20,
html:not(.dark) .border-white\/\[0\.08\],
html:not(.dark) .border-white\/\[0\.06\] {
  border-color: #e2e8f0 !important;
}

html:not(.dark) .text-slate-100,
html:not(.dark) .text-slate-200 {
  color: #0f172a !important;
}

html:not(.dark) h1.text-white,
html:not(.dark) h2.text-white,
html:not(.dark) h3.text-white,
html:not(.dark) a.text-white:not(.btn-primary):not([class*="bg-blue"]):not([class*="bg-emerald"]):not([class*="bg-indigo"]):not([class*="bg-purple"]),
html:not(.dark) span.text-white:not([class*="bg-"]):not(.keep-white) {
  color: #0f172a !important;
}

html:not(.dark) .text-slate-400 {
  color: #64748b !important;
}

/* Modal light styling */
html:not(.dark) #search-modal > div,
html:not(.dark) #modal-byok > div {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
html:not(.dark) #searchModalInput {
  color: #0f172a !important;
}

/* ==========================================
   THEME: OBSIDIAN DARK MODE (html.dark)
   ========================================== */
html.dark {
  color-scheme: dark;
}

html.dark body {
  background-color: #07090e !important;
  color: #f1f5f9 !important;
}

html.dark header {
  background-color: rgba(11, 15, 25, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .surface-card,
html.dark .bg-white {
  background-color: #0e1320 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
}

html.dark .tool-card {
  background-color: #0e1320 !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #f8fafc !important;
}

html.dark .surface-card-subtle,
html.dark .bg-slate-50,
html.dark .bg-slate-100 {
  background-color: #141b2d !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .tool-card:hover {
  border-color: rgba(96, 165, 250, 0.75) !important;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7), 0 0 20px -5px rgba(59, 130, 246, 0.3) !important;
  transform: translateY(-2px);
}

html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html.dark select,
html.dark textarea {
  background-color: #080b12 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: #3b82f6 !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

html.dark footer {
  background-color: #07090e !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .text-slate-900,
html.dark .text-slate-800,
html.dark .text-slate-700 {
  color: #f1f5f9 !important;
}

html.dark .text-slate-600,
html.dark .text-slate-500 {
  color: #94a3b8 !important;
}

html.dark .text-slate-400 {
  color: #64748b !important;
}

/* ==========================================
   WORKBENCH SPLIT-PANE ARCHITECTURE
   ========================================== */
.workbench-shell {
  max-width: 1380px;
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem 1rem;
}

@media (min-width: 1024px) {
  .workbench-layout {
    display: grid;
    grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
  }

  .workbench-sidebar {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
  }

  .workbench-canvas {
    min-width: 0;
  }
}

/* Luminous Category Accent Tokens */
.accent-emerald {
  --accent-color: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.2);
}
.accent-indigo {
  --accent-color: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.2);
}
.accent-violet {
  --accent-color: #a855f7;
  --accent-glow: rgba(168, 85, 247, 0.2);
}
.accent-amber {
  --accent-color: #f59e0b;
  --accent-glow: rgba(245, 158, 11, 0.2);
}
.accent-rose {
  --accent-color: #f43f5e;
  --accent-glow: rgba(244, 63, 94, 0.2);
}
.accent-cyan {
  --accent-color: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.2);
}
.accent-teal {
  --accent-color: #14b8a6;
  --accent-glow: rgba(20, 184, 166, 0.2);
}

/* Micro-Interactions & Transitions */
button, .btn-interactive {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

button:active, .btn-interactive:active {
  transform: scale(0.97);
}

/* Hardware-Accelerated Animations */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.animate-view-in {
  animation: viewFadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Custom Ultra-Sleek Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

/* Glassmorphism Navbar */
.glass-nav {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
