/* ShopBot Labs - V-Engraver App Styles */

:root {
  /* Fallback values — overridden by theme tokens via bridge */
  --primary: #171b60;
  --accent: #e04080;
  --accent-hover: #c73870;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #e8e8ed;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --border-color: #d2d2d7;

  --sidebar-width: 300px;
}

* {
  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, unit toggle, theme toggle handled by sb-* classes from components.css */

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

/* 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(224, 64, 128, 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);
}

/* Text Input Area */
.text-input-area {
  margin-top: 0.75rem;
}

.text-input-area textarea {
  width: 100%;
  min-height: 60px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
}

.text-input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.text-input-row label {
  font-size: 0.8rem;
  white-space: nowrap;
}

.text-input-row input {
  width: 4rem;
}

.text-input-row button {
  flex-shrink: 0;
}

.text-input-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.text-input-divider::before,
.text-input-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border-color);
}

.clipart-area select {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
}

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

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

input[type="number"]:disabled {
  opacity: 0.4;
}

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

/* Info Blocks */
.info-block {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border-radius: 6px;
  font-size: 0.8rem;
}

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

.info-block div {
  display: flex;
  justify-content: space-between;
  padding: 0.15rem 0;
}

.info-block span {
  font-weight: 500;
}

/* Canvas Container */
#canvasContainer {
  position: fixed;
  left: var(--sidebar-width);
  top: 0;
  right: 0;
  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;
}

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