/* ShopBot Labs - STEP Toolpath App Styles */

:root {
  /* ShopBot brand colors */
  --primary: #171b60;
  --accent: #f00069;
  --accent-hover: #d10059;

  /* Light mode */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #e8e8ed;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --border-color: #d2d2d7;

  /* Spacing */
  --sidebar-width: 300px;
  --preview-width: 350px;
}

.dark-mode {
  --bg-primary: #1d1d1f;
  --bg-secondary: #2d2d30;
  --bg-tertiary: #3d3d40;
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --border-color: #424245;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

#themeToggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.light-mode .dark-icon,
.dark-mode .light-icon {
  display: none;
}

/* Control Sections */
.control-section {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.control-section h2 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.control-section h3 {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 1rem 0 0.5rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  background: var(--bg-primary);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(240, 0, 105, 0.05);
}

.drop-zone p {
  margin: 0;
  color: var(--text-secondary);
}

.drop-zone-or {
  font-size: 0.75rem;
  margin: 0.5rem 0 !important;
}

.file-input-label {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s ease;
}

.file-input-label:hover {
  background: var(--accent-hover);
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--bg-primary);
  border-radius: 6px;
  margin-top: 0.5rem;
}

.file-info.hidden {
  display: none;
}

#fileName {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#clearFile {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 0.25rem;
}

#clearFile:hover {
  color: var(--accent);
}

/* Button Rows */
.button-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.button-row button {
  flex: 1;
}

/* Buttons */
button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

button.full-width {
  width: 100%;
}

button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Input Grids */
.input-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.input-row label {
  white-space: nowrap;
}

input[type="number"],
select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

.input-with-unit {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.input-with-unit input {
  flex: 1;
  min-width: 0;
}

.input-with-unit span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Advanced Settings Expandable */
.advanced-settings {
  margin-top: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
}

.advanced-settings summary {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.advanced-settings summary:hover {
  color: var(--text-primary);
}

.advanced-settings[open] summary {
  border-bottom: 1px solid var(--border-color);
}

.advanced-settings .input-grid {
  padding: 0.75rem;
  margin: 0;
}

/* Feature List */
.feature-list {
  max-height: 150px;
  overflow-y: auto;
  background: var(--bg-primary);
  border-radius: 6px;
  padding: 0.5rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.feature-item:hover {
  background: var(--bg-tertiary);
}

.feature-item input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
}

.feature-chip {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.feature-chip.pocket {
  background: #e3f2fd;
  color: #1565c0;
}

.feature-chip.profile {
  background: #f3e5f5;
  color: #7b1fa2;
}

.dark-mode .feature-chip.pocket {
  background: #1565c0;
  color: #e3f2fd;
}

.dark-mode .feature-chip.profile {
  background: #7b1fa2;
  color: #f3e5f5;
}

.feature-depth {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
}

/* Canvas Container */
#canvasContainer {
  position: fixed;
  left: var(--sidebar-width);
  top: 0;
  right: var(--preview-width);
  bottom: 0;
}

#threeCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Status Bar */
#statusBar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.8rem;
}

/* Toolpath Info Overlay */
#toolpathInfo {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 200px;
}

#toolpathInfo.hidden {
  display: none;
}

#toolpathInfo h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Loading Overlay */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#loadingOverlay.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loadingText {
  color: white;
  margin-top: 1rem;
  font-size: 1rem;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Preview Panel (right side) */
#previewPanel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--preview-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.preview-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.preview-header h2 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0;
}

.preview-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

#depthCanvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}
