/* Spiny Component Studio — Official Dark Theme Stylesheet (Matching SpinyRC & spiny.com.tr) */

:root {
  /* Spiny Official Dark Palette (Claude/Replit/Nothing style) */
  --bg-main: #111110;
  --bg-surface: #181816;
  --bg-surface-hover: #1f1f1d;
  --bg-elevated: #1e1e1e;

  --border-subtle: #2a2a28;
  --border-focus: #40403d;

  --text-primary: #ededeb;
  --text-secondary: #a0a09c;
  --text-tertiary: #6e6e6a;

  --accent-spiny: #eab308;
  --accent-hover: #facc15;
  --accent-bg: #2a2202;

  /* Typography - Nothing / Spiny Official Style */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-dot: 'Space Mono', monospace;
  --font-mono: 'JetBrains Mono', monospace;
  --font-spiny: 'Chakra Petch', sans-serif;
  --font-brand: 'Bitcount Single', system-ui;

  /* VSCode Compat */
  --vscode-bg: var(--bg-main);
  --vscode-sidebar: var(--bg-surface);
  --vscode-header: var(--bg-surface);
  --vscode-tab-active: var(--bg-main);
  --vscode-tab-inactive: var(--bg-surface);
  --vscode-border: var(--border-subtle);
  --vscode-border-light: var(--border-focus);
  --vscode-input-bg: var(--bg-main);
  --vscode-accent: var(--accent-spiny);
  --vscode-accent-hover: var(--accent-hover);
  --vscode-text: var(--text-primary);
  --vscode-text-muted: var(--text-secondary);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  user-select: none;
  overflow: hidden;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

.font-dot {
  font-family: var(--font-dot);
}

.font-mono {
  font-family: var(--font-mono);
}

.font-brand {
  font-family: var(--font-brand);
}

/* CAD Blueprint Grid */
.cad-grid {
  background-color: var(--bg-main);
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to right, rgba(234, 179, 8, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(234, 179, 8, 0.05) 1px, transparent 1px);
  background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
}

/* Authentic CAD Electronic Hardware Pins & Solder Pads (Matching CodeEditor hardware scale & style) */
.solder-pad {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #eab308;
  border: 0.8px solid #ca8a04;
  box-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  pointer-events: auto;
  position: relative;
}

.solder-pad:hover {
  transform: scale(1.4);
  background: #fde047;
  border-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.9);
}

.solder-pad.selected {
  transform: scale(1.5);
  background: #f59e0b;
  border: 1px solid #000000;
  outline: 1.5px solid #f59e0b;
  outline-offset: 1px;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.9);
}

.solder-pad.power {
  background: #f59e0b;
  border-color: #b45309;
}

.solder-pad.gnd {
  background: #ca8a04;
  border-color: #78350f;
}

.solder-pad-hole {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background-color: #09090b;
  box-shadow: inset 0 0.5px 1px rgba(0, 0, 0, 0.9);
}

.solder-pad.selected .solder-pad-hole {
  background-color: #000000;
}

/* CAD Silk-screen Micro Labels (Clean, compact, no clutter) */
.pin-badge {
  background: rgba(18, 18, 20, 0.94);
  border: 0.8px solid #3f3f46;
  border-radius: 2px;
  padding: 0.5px 3px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 7px;
  line-height: 1;
  color: #e4e4e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.2px;
  z-index: 30;
}

.pin-badge.selected {
  background: #f59e0b;
  border-color: #d97706;
  color: #000000 !important;
  font-weight: 700;
  box-shadow: 0 1px 6px rgba(245, 158, 11, 0.6);
}

.pin-badge.selected span {
  color: #000000 !important;
}

/* Floating CAD Canvas Toolbar (Spiny Aerospace & Nothing style) */
.canvas-toolbar {
  height: 36px !important;
  max-width: calc(100% - 24px) !important;
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 2px !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.8) !important;
  padding: 3px 8px !important;
  gap: 4px !important;
  z-index: 35 !important;
  font-family: var(--font-dot);
}

.canvas-toolbar::-webkit-scrollbar {
  display: none !important;
}

.canvas-toolbar button {
  height: 26px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  line-height: 1.2 !important;
  padding: 0 8px !important;
  font-family: var(--font-sans);
  font-size: 11px !important;
  font-weight: 500 !important;
  text-transform: none;
  letter-spacing: normal;
  border-radius: 3px !important;
  border: 1px solid transparent !important;
  background-color: transparent !important;
  color: var(--text-secondary) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.canvas-toolbar button:hover {
  background-color: var(--bg-surface-hover) !important;
  color: #ffffff !important;
}

.canvas-toolbar button.active-tool {
  background-color: var(--accent-spiny) !important;
  color: var(--bg-main) !important;
  font-weight: 700 !important;
  border-color: var(--accent-spiny) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.canvas-toolbar button.active-tool span {
  color: var(--bg-main) !important;
}

.canvas-toolbar button.active-tool svg {
  stroke: var(--bg-main) !important;
  fill: var(--bg-main) !important;
}

.canvas-toolbar button.active-toggle {
  background-color: var(--accent-bg) !important;
  color: var(--accent-spiny) !important;
  border-color: rgba(234, 179, 8, 0.4) !important;
}

.canvas-toolbar button.active-toggle span {
  color: var(--accent-spiny) !important;
}

.canvas-toolbar button.active-toggle svg {
  color: var(--accent-spiny) !important;
}

/* SVG CAD Visual Editor Styles */
.svg-interactive-canvas {
  position: relative;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 16px 16px;
  background-color: #0d0e11;
}

.svg-shape-node {
  cursor: grab;
  transition: outline 0.1s ease;
}

.svg-shape-node:hover {
  outline: 1.5px dashed #f59e0b;
  outline-offset: 2px;
}

.svg-shape-node.selected {
  outline: 2px solid #f59e0b !important;
  outline-offset: 3px;
}

.svg-resize-handle {
  width: 9px;
  height: 9px;
  background-color: #f59e0b;
  border: 1.5px solid #000000;
  border-radius: 2px;
  position: absolute;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.svg-resize-handle.tl { cursor: nwse-resize; top: -5px; left: -5px; }
.svg-resize-handle.tr { cursor: nesw-resize; top: -5px; right: -5px; }
.svg-resize-handle.br { cursor: nwse-resize; bottom: -5px; right: -5px; }
.svg-resize-handle.bl { cursor: nesw-resize; bottom: -5px; left: -5px; }


/* Custom VS Code Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #1e1e1e;
}
::-webkit-scrollbar-thumb {
  background: #3c3c3c;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #4f4f4f;
}

/* Universal Dark Inputs & Controls for Studio (Matching SpinyRC & spiny.com.tr) */
input,
textarea,
select,
.vs-input {
  background-color: var(--bg-main) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-primary) !important;
  border-radius: 2px !important;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  outline: none !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus,
.vs-input:focus {
  border-color: var(--accent-spiny) !important;
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.4) !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary) !important;
}

select option {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
}

/* Refined Clean Buttons (Spiny IDE & VS Code Standard) */
.vs-btn {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  border-radius: 3px !important;
  padding: 4px 9px !important;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.2;
  background-color: transparent;
  color: var(--text-primary);
  border: none !important;
  outline: none;
}

.vs-btn:hover {
  background-color: var(--bg-surface-hover);
  color: #ffffff;
}

.vs-btn-primary,
.btn-primary {
  background-color: var(--accent-spiny) !important;
  color: #000000 !important;
  border: none !important;
  font-weight: 600 !important;
}

.vs-btn-primary:hover,
.btn-primary:hover {
  background-color: #facc15 !important;
  color: #000000 !important;
}

.vs-btn-secondary {
  background-color: transparent !important;
  color: var(--text-primary) !important;
  border: none !important;
}

.vs-btn-secondary:hover {
  background-color: var(--bg-surface-hover) !important;
  color: #ffffff !important;
}

.vs-btn-gold {
  background-color: #26200a !important;
  color: #facc15 !important;
  font-weight: 600 !important;
  border: 1px solid rgba(234, 179, 8, 0.3) !important;
}

.vs-btn-gold:hover {
  background-color: var(--accent-spiny) !important;
  color: #000000 !important;
}

.vs-btn-accent {
  background-color: #1f1f1d !important;
  color: var(--text-primary) !important;
  border: none !important;
  font-weight: 500 !important;
}

.vs-btn-accent:hover {
  background-color: var(--bg-surface-hover) !important;
  color: #ffffff !important;
}

.vs-btn-icon {
  background: transparent;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 3px;
}

.vs-btn-icon:hover {
  background: var(--bg-surface-hover);
  color: #ffffff;
}

/* Spiny Logo Typography */
.spiny-logo-text {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 450;
  font-style: normal;
  font-variation-settings: "slnt" 0, "CRSV" 0.5, "ELSH" 0, "ELXP" 0;
  font-size: 1.35rem;
  color: var(--text-primary);
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: 0.03em;
  padding-top: 2px;
}

.spiny-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--accent-spiny);
  background-color: var(--accent-bg);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 2px;
  padding: 1.5px 5px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Activity Bar Icon Button */
.activity-bar-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background 0.15s;
}

.activity-bar-btn:hover {
  color: #ffffff;
}

.activity-bar-btn.active {
  color: #ffffff;
}

.activity-bar-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--accent-spiny);
}

/* Spiny Palette Color Overrides */
.bg-\[\#1e1e1e\],
.bg-\[\#121214\],
.bg-\[\#111113\],
.bg-\[\#0f0f11\] {
  background-color: var(--bg-main) !important;
}

.bg-\[\#18181b\],
.bg-\[\#141416\],
.bg-\[\#1c1c1f\],
.bg-\[\#1a1a1e\],
.bg-\[\#252526\] {
  background-color: var(--bg-surface) !important;
}

.bg-\[\#27272a\],
.bg-\[\#222226\],
.bg-\[\#2a2a2a\] {
  background-color: var(--bg-surface-hover) !important;
}

/* Eliminate all Tailwind #e5e7eb bright white/light-gray borders */
*, *::before, *::after {
  border-color: var(--border-subtle);
}

.border,
.border-t,
.border-b,
.border-l,
.border-r {
  border-color: var(--border-subtle) !important;
}

.border-\[\#333333\],
.border-\[\#2d2d30\],
.border-\[\#3f3f46\],
.border-\[\#2a2a28\],
.border-\[\#27272a\],
.border-\[\#1e1e1e\],
.border-\[\#252526\] {
  border-color: var(--border-subtle) !important;
}

.border-\[\#f59e0b\],
.border-\[\#eab308\],
.border-\[\#f9a825\] {
  border-color: var(--accent-spiny) !important;
}

.border-\[\#f59e0b\]\/50,
.border-\[\#eab308\]\/50,
.border-\[\#f59e0b\]\/40,
.border-\[\#eab308\]\/40,
.border-\[\#f59e0b\]\/30 {
  border-color: rgba(234, 179, 8, 0.35) !important;
}

/* PCB Board on Canvas - Subtle hairline edge instead of white wireframe */
.board-container {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background-color: #121316 !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8) !important;
}

.text-\[\#cccccc\] { color: var(--text-primary) !important; }
.text-\[\#858585\], .text-\[\#71717a\] { color: var(--text-secondary) !important; }
.text-\[\#f9a825\], .text-\[\#f59e0b\] { color: var(--accent-spiny) !important; }
.text-\[\#9cdcfe\] { color: #9cdcfe !important; }
.text-\[\#ce9178\] { color: #ce9178 !important; }
.text-\[\#a78bfa\] { color: #a78bfa !important; }
.text-\[\#f87171\] { color: #f87171 !important; }
.hover\:text-\[\#cccccc\]:hover { color: #cccccc !important; }

/* Font Size Fallbacks for Non-JIT Tailwind */
.text-\[8px\] { font-size: 8px !important; line-height: 11px !important; }
.text-\[9px\] { font-size: 9px !important; line-height: 12px !important; }
.text-\[10px\] { font-size: 10px !important; line-height: 14px !important; }
.text-\[11px\] { font-size: 11px !important; line-height: 15px !important; }
.text-\[12px\] { font-size: 12px !important; line-height: 16px !important; }
.text-\[13px\] { font-size: 13px !important; line-height: 17px !important; }

/* Studio Sidebar Header Standards (Matching SpinyRC & spiny.com.tr) */
.studio-sidebar-header {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
}

.studio-sidebar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-header-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-spiny);
  background-color: var(--accent-bg);
  border: 1px solid rgba(234, 179, 8, 0.3);
  padding: 1px 5px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  text-align: right;
}

/* Canvas Floating HUD */
.canvas-hud {
  animation: hudSlideUp 0.15s ease-out;
}

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

/* Modal Overlays & Dialogs (100% Opacity & Solid Dark Backgrounds) */
.fixed.inset-0 {
  background-color: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

.max-w-2xl,
.max-w-lg,
.max-w-xl,
.w-\[520px\] {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 2px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

.bg-black\/75 { background-color: rgba(0, 0, 0, 0.85) !important; }
.bg-black\/70 { background-color: rgba(0, 0, 0, 0.85) !important; }

/* Studio Custom Context Menu (Matching SpinyRC & spiny.com.tr) */
.studio-context-menu {
  position: fixed;
  z-index: 99999;
  min-width: 210px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.9);
  padding: 4px;
  font-family: var(--font-dot);
  font-size: 11px;
  color: var(--text-primary);
  user-select: none;
  animation: contextMenuFadeIn 0.08s ease-out;
}

@keyframes contextMenuFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.studio-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
  color: var(--text-primary);
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.studio-menu-item:hover {
  background-color: var(--accent-spiny);
  color: var(--bg-main) !important;
  font-weight: 700;
}

.studio-menu-item.danger:hover {
  background-color: #ef4444;
  color: #ffffff !important;
}

.studio-menu-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.studio-menu-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 3px 2px;
}

.studio-menu-header {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 4px 8px 2px;
}



