:root {
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-tertiary: #27272a;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
  --border: #3f3f46;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout */
.app-header {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-container {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  overflow: hidden;
}

/* Sidebar & Panels */
.panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.panel-right {
  border-right: none;
  border-left: 1px solid var(--border);
}

.panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

/* Canvas Area */
.canvas-area {
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.canvas-container {
  position: relative;
  box-shadow: 0 0 100px rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  max-width: 90%;
  max-height: 90%;
  background-color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-placeholder {
  width: 800px;
  height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 16px;
}

/* Toolbars */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-group {
  margin-bottom: 24px;
}

.tool-group-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  width: 100%;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-ghost.active {
  background: var(--bg-tertiary);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Components */
.card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.measurement-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.measurement-item:last-child {
  border-bottom: none;
}

.measurement-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.measurement-value {
  font-weight: 600;
  font-family: monospace;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.05);
}

.placeholder-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  color: var(--text-muted);
}

/* Floating controls */
.floating-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 40px;
  display: flex;
  gap: 8px;
  box-shadow: var(--shadow);
}

.control-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.control-btn.active {
  background: var(--accent);
  color: white;
}

/* Overlays on Canvas */
.point {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.line {
  position: absolute;
  height: 2px;
  background: var(--accent);
  transform-origin: 0 0;
  z-index: 5;
}

.dimension-text {
  position: absolute;
  background: var(--bg-secondary);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
}
