/* ShopBot Labs - Vacuum Plenum App Styles */

:root {
  --primary: #171b60;
  --accent: #f00069;
  --accent-hover: #d10059;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #e8e8ed;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --border-color: #d2d2d7;
  --sidebar-width: 300px;
}

.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;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}
.sidebar-logo { height: 20px; width: auto; }
.header-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }

.sidebar-header h1 {
  font-size: 1.15rem;
  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;
}

/* Unit Toggle */
.unit-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.unit-btn {
  flex: 1;
  padding: 0.4rem 0;
  border: none;
  border-radius: 0;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.unit-btn + .unit-btn {
  border-left: 1px solid var(--border-color);
}

.unit-btn.active {
  background: var(--primary);
  color: white;
}

/* 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;
}

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

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

.input-with-unit span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  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);
}

label {
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
}

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

.button-row button { flex: 1; }

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;
}

/* Advanced Settings */
details.advanced-settings {
  margin-top: 0.75rem;
}

details.advanced-settings summary {
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem 0;
}

details.advanced-settings .input-grid {
  margin-top: 0.5rem;
}

/* Zone List */
.zone-list {
  margin-top: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.8rem;
}

.zone-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}

.zone-item:nth-child(even) {
  background: var(--bg-tertiary);
}

.zone-color-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.zone-dims {
  color: var(--text-secondary);
  margin-left: auto;
  font-size: 0.75rem;
}

/* Canvas Area */
#canvasContainer {
  position: fixed;
  left: var(--sidebar-width);
  top: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
}

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

/* Status Bar */
#statusBar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

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

#toolpathInfo h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

#toolpathStats div {
  display: flex;
  justify-content: space-between;
  padding: 0.15rem 0;
  color: var(--text-secondary);
}

#toolpathStats span {
  color: var(--text-primary);
  font-weight: 500;
}

/* Loading Overlay */
#loadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: white;
}

#loadingOverlay .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

.hidden { display: none !important; }

/* Scrollbar */
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
