/*
 * Developer Friend — shadcn/ui–inspired design system (zinc palette, minimal chrome).
 * Tokens & patterns follow https://ui.shadcn.com/themes — use the shadcn MCP in Cursor for registry/docs.
 */

/* -------------------------------------------------------------------------- */
/* Dark (default) — zinc 950 / 900 / 800                                         */
/* -------------------------------------------------------------------------- */

html:not([data-theme]),
[data-theme="dark"] {
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-tertiary: #27272a;
  --bg-hover: #3f3f46;
  --border: #27272a;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --accent: #fafafa;
  --accent-hover: #e4e4e7;
  --accent-foreground: #18181b;
  --success: #22c55e;
  --error: #f87171;
  --warning: #eab308;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --sidebar-width: 248px;
  --header-height: 56px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --scrollbar-thumb: rgba(255, 255, 255, 0.1);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
}

html:not([data-theme])::selection,
[data-theme="dark"]::selection,
html:not([data-theme]) ::selection,
[data-theme="dark"] ::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--text);
}

/* -------------------------------------------------------------------------- */
/* Light — zinc surfaces (overrides themes.css when this file loads last)      */
/* -------------------------------------------------------------------------- */

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f4f4f5;
  --bg-hover: #e4e4e7;
  --border: #e4e4e7;
  --text: #18181b;
  --text-muted: #71717a;
  --accent: #18181b;
  --accent-hover: #27272a;
  --accent-foreground: #fafafa;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #ca8a04;
  --scrollbar-thumb: rgba(0, 0, 0, 0.12);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.12);
}

[data-theme="light"]::selection,
[data-theme="light"] ::selection {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
}

/* -------------------------------------------------------------------------- */
/* App shell                                                                    */
/* -------------------------------------------------------------------------- */

html:not([data-theme]) .header,
[data-theme="dark"] .header,
[data-theme="light"] .header {
  background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  box-shadow: var(--shadow-sm);
  padding: 0 18px;
}

html:not([data-theme]) .sidebar,
[data-theme="dark"] .sidebar,
[data-theme="light"] .sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
}

html:not([data-theme]) .main-panel,
[data-theme="dark"] .main-panel,
[data-theme="light"] .main-panel {
  background: var(--bg-primary);
}

/* Workspace: subtle depth + ambient light (award-page polish) */
html:not([data-theme]) .workspace,
[data-theme="dark"] .workspace,
[data-theme="light"] .workspace {
  position: relative;
  z-index: 0;
  padding: 28px 32px 40px;
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -30%, rgba(250, 250, 250, 0.07), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(99, 102, 241, 0.09), transparent 50%),
    radial-gradient(ellipse 50% 40% at 0% 20%, rgba(34, 197, 94, 0.04), transparent 45%);
}

[data-theme="light"] .workspace {
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -25%, rgba(24, 24, 27, 0.04), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(99, 102, 241, 0.06), transparent 50%);
}

html:not([data-theme]) .tabs-bar,
[data-theme="dark"] .tabs-bar,
[data-theme="light"] .tabs-bar {
  background: color-mix(in srgb, var(--bg-secondary) 94%, var(--bg-primary));
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
  min-height: 42px;
  height: auto;
  gap: 4px;
}

html:not([data-theme]) .tab,
[data-theme="dark"] .tab,
[data-theme="light"] .tab {
  padding: 8px 14px;
  margin: 6px 0;
  border-radius: 999px;
  border-bottom: none;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.18s ease, color 0.18s ease;
}

html:not([data-theme]) .tab:hover,
[data-theme="dark"] .tab:hover,
[data-theme="light"] .tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

html:not([data-theme]) .tab.active,
[data-theme="dark"] .tab.active,
[data-theme="light"] .tab.active {
  color: var(--text);
  font-weight: 600;
  /* Distinct from bar (--bg-secondary): avoids invisible “active” when --accent matches --text (zinc dark). */
  background: var(--bg-tertiary);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 42%, var(--border)),
    0 1px 3px rgba(0, 0, 0, 0.22);
}

html:not([data-theme]) .panel-tool-chrome,
[data-theme="dark"] .panel-tool-chrome,
[data-theme="light"] .panel-tool-chrome {
  background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
  border-bottom-color: var(--border);
  padding: 10px 24px 12px;
}

/* Sidebar navigation */
html:not([data-theme]) .sidebar-nav-item,
[data-theme="dark"] .sidebar-nav-item,
[data-theme="light"] .sidebar-nav-item {
  border-radius: 0 10px 10px 0;
  margin-right: 10px;
  padding: 9px 14px 9px 16px;
  font-weight: 450;
  letter-spacing: -0.015em;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

html:not([data-theme]) .sidebar-nav-item:hover,
[data-theme="dark"] .sidebar-nav-item:hover,
[data-theme="light"] .sidebar-nav-item:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

html:not([data-theme]) .sidebar-nav-item.active,
[data-theme="dark"] .sidebar-nav-item.active,
[data-theme="light"] .sidebar-nav-item.active {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  border-left-color: var(--accent);
  color: var(--text);
}

html:not([data-theme]) .sidebar-section-header,
[data-theme="dark"] .sidebar-section-header,
[data-theme="light"] .sidebar-section-header {
  letter-spacing: 0.1em;
  font-weight: 650;
  font-size: 10px;
}

/* Header brand + search */
html:not([data-theme]) .header-title,
[data-theme="dark"] .header-title,
[data-theme="light"] .header-title {
  font-weight: 650;
  letter-spacing: -0.04em;
  font-size: 17px;
}

html:not([data-theme]) .header-spotlight-trigger,
[data-theme="dark"] .header-spotlight-trigger,
[data-theme="light"] .header-spotlight-trigger {
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-tertiary) 85%, var(--bg-primary));
  min-height: 36px;
  border: 1px solid color-mix(in srgb, var(--border) 95%, transparent);
  box-shadow: var(--shadow-sm);
}

html:not([data-theme]) .header-tool-btn,
[data-theme="dark"] .header-tool-btn,
[data-theme="light"] .header-tool-btn {
  border-radius: 999px;
  font-weight: 550;
}

/* Theme dropdown */
html:not([data-theme]) .theme-dropdown-panel,
[data-theme="dark"] .theme-dropdown-panel,
[data-theme="light"] .theme-dropdown-panel {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--border) 75%, transparent);
}

html:not([data-theme]) .theme-dropdown-trigger,
[data-theme="dark"] .theme-dropdown-trigger,
[data-theme="light"] .theme-dropdown-trigger {
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-tertiary) 85%, var(--bg-primary));
  min-height: 36px;
  border: 1px solid color-mix(in srgb, var(--border) 95%, transparent);
  box-shadow: var(--shadow-sm);
}

/* Command palette */
html:not([data-theme]) .command-palette-backdrop,
[data-theme="dark"] .command-palette-backdrop,
[data-theme="light"] .command-palette-backdrop {
  background: rgba(0, 0, 0, 0.52);
  /* Lighter blur than modals — full-screen overlay repaints on every open/close */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 10vh 20px 32px;
}

[data-theme="light"] .command-palette-backdrop {
  background: rgba(24, 24, 27, 0.35);
}

html:not([data-theme]) .command-palette,
[data-theme="dark"] .command-palette,
[data-theme="light"] .command-palette {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  overflow: clip;
}

html:not([data-theme]) .command-palette-item.is-active,
[data-theme="dark"] .command-palette-item.is-active,
[data-theme="light"] .command-palette-item.is-active,
html:not([data-theme]) .command-palette-item:hover,
[data-theme="dark"] .command-palette-item:hover,
[data-theme="light"] .command-palette-item:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-hover));
}

/* Modals */
html:not([data-theme]) .app-modal-backdrop,
[data-theme="dark"] .app-modal-backdrop,
[data-theme="light"] .app-modal-backdrop {
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html:not([data-theme]) .app-modal,
[data-theme="dark"] .app-modal,
[data-theme="light"] .app-modal {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid color-mix(in srgb, var(--border) 92%, transparent);
}

html:not([data-theme]) .auth-oauth-btn,
[data-theme="dark"] .auth-oauth-btn,
[data-theme="light"] .auth-oauth-btn {
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

html:not([data-theme]) .auth-oauth-btn:hover:not(:disabled),
[data-theme="dark"] .auth-oauth-btn:hover:not(:disabled),
[data-theme="light"] .auth-oauth-btn:hover:not(:disabled) {
  box-shadow: var(--shadow-sm);
}

/* Tool I/O cards */
html:not([data-theme]) #workspace .io-area,
[data-theme="dark"] #workspace .io-area,
[data-theme="light"] #workspace .io-area {
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-secondary) 40%, var(--bg-primary));
  border: 1px solid color-mix(in srgb, var(--border) 92%, var(--text) 4%);
  box-shadow: var(--shadow-sm);
}

html:not([data-theme]) #workspace .io-area .io-label-row,
[data-theme="dark"] #workspace .io-area .io-label-row,
[data-theme="light"] #workspace .io-area .io-label-row {
  background: color-mix(in srgb, var(--bg-tertiary) 45%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

html:not([data-theme]) #workspace .io-area textarea.input,
html:not([data-theme]) #workspace .io-area pre.io-content,
[data-theme="dark"] #workspace .io-area textarea.input,
[data-theme="dark"] #workspace .io-area pre.io-content,
[data-theme="light"] #workspace .io-area textarea.input,
[data-theme="light"] #workspace .io-area pre.io-content {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Tool headers */
html:not([data-theme]) .tool-title,
[data-theme="dark"] .tool-title,
[data-theme="light"] .tool-title {
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

html:not([data-theme]) .tool-page-header .tool-title.tool-title--inline,
[data-theme="dark"] .tool-page-header .tool-title.tool-title--inline,
[data-theme="light"] .tool-page-header .tool-title.tool-title--inline {
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-weight: 650;
}

/* Home */
html:not([data-theme]) .home-page,
[data-theme="dark"] .home-page,
[data-theme="light"] .home-page {
  max-width: 1120px;
}

html:not([data-theme]) .home-hero,
[data-theme="dark"] .home-hero,
[data-theme="light"] .home-hero {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  text-align: center;
}

html:not([data-theme]) .home-hero-title,
[data-theme="dark"] .home-hero-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
  margin: 0 0 16px;
  background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="light"] .home-hero-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
  margin: 0 0 16px;
  background: linear-gradient(135deg, #18181b 0%, #52525b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html:not([data-theme]) .home-hero-desc,
[data-theme="dark"] .home-hero-desc,
[data-theme="light"] .home-hero-desc {
  font-size: 15px;
  line-height: 1.65;
  max-width: 52ch;
}

html:not([data-theme]) .home-tool-card,
[data-theme="dark"] .home-tool-card,
[data-theme="light"] .home-tool-card {
  border-radius: var(--radius-xl);
  padding: 16px 18px;
  min-height: 108px;
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  background: color-mix(in srgb, var(--bg-secondary) 88%, var(--bg-primary));
  box-shadow: var(--shadow-sm);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.25s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

html:not([data-theme]) .home-tool-card:hover,
[data-theme="dark"] .home-tool-card:hover,
[data-theme="light"] .home-tool-card:hover {
  border-color: color-mix(in srgb, var(--text-muted) 35%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

html:not([data-theme]) .home-tool-card .home-tool-name,
[data-theme="dark"] .home-tool-card .home-tool-name,
[data-theme="light"] .home-tool-card .home-tool-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

html:not([data-theme]) .home-category-title,
[data-theme="dark"] .home-category-title,
[data-theme="light"] .home-category-title {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Category pages */
html:not([data-theme]) .category-tool-card,
[data-theme="dark"] .category-tool-card,
[data-theme="light"] .category-tool-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

html:not([data-theme]) .category-tool-card:hover,
[data-theme="dark"] .category-tool-card:hover,
[data-theme="light"] .category-tool-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

html:not([data-theme]) .category-page-title,
[data-theme="dark"] .category-page-title,
[data-theme="light"] .category-page-title {
  letter-spacing: -0.03em;
}

/* Footer stack */
html:not([data-theme]) .site-footer-stack,
[data-theme="dark"] .site-footer-stack,
[data-theme="light"] .site-footer-stack {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-secondary) 94%, var(--bg-primary));
}

html:not([data-theme]) .site-seo-footer,
[data-theme="dark"] .site-seo-footer,
[data-theme="light"] .site-seo-footer {
  min-height: 44px;
  font-size: 12px;
  padding: 0 20px;
}

/* Alerts */
html:not([data-theme]) .app-alert,
[data-theme="dark"] .app-alert,
[data-theme="light"] .app-alert {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Pricing */
html:not([data-theme]) .pricing-page .tool-title,
[data-theme="dark"] .pricing-page .tool-title,
[data-theme="light"] .pricing-page .tool-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
}

html:not([data-theme]) .pricing-plan-card,
[data-theme="dark"] .pricing-plan-card,
[data-theme="light"] .pricing-plan-card {
  border-radius: var(--radius-xl);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-sm);
}

html:not([data-theme]) .pricing-plan-card--pro,
[data-theme="dark"] .pricing-plan-card--pro,
[data-theme="light"] .pricing-plan-card--pro {
  box-shadow: var(--shadow-md);
}

html:not([data-theme]) .pricing-addon-card,
[data-theme="dark"] .pricing-addon-card,
[data-theme="light"] .pricing-addon-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  html:not([data-theme]) .workspace,
  [data-theme="dark"] .workspace,
  [data-theme="light"] .workspace {
    padding: 18px 16px 28px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:not([data-theme]) .home-tool-card,
  [data-theme="dark"] .home-tool-card,
  [data-theme="light"] .home-tool-card,
  html:not([data-theme]) .category-tool-card,
  [data-theme="dark"] .category-tool-card,
  [data-theme="light"] .category-tool-card {
    transition: none;
  }

  html:not([data-theme]) .home-tool-card:hover,
  [data-theme="dark"] .home-tool-card:hover,
  [data-theme="light"] .home-tool-card:hover,
  html:not([data-theme]) .category-tool-card:hover,
  [data-theme="dark"] .category-tool-card:hover,
  [data-theme="light"] .category-tool-card:hover {
    transform: none;
  }
}
