/* === Base === */
body {
  margin: 0;
  background: #111;
  color: #eee;
  font-family: 'Segoe UI', sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* === Sidebar === */
.sidebar {
  width: 340px;
  background: #1a1a1a;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.header {
  padding: 15px;
  background: #222;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h2 {
  margin: 0;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
}

/* === Layer List === */
.layer-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.layer-item {
  background: #2a2a2a;
  border: 1px solid #333;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.layer-item:hover { background: #333; }
.layer-item.active { border-color: #00aaff; background: #253540; }

.layer-name {
  font-size: 13px;
  font-weight: bold;
}

.layer-name-input {
  font-size: 13px;
  font-weight: bold;
  background: #1a1a1a;
  border: 1px solid #00aaff;
  color: #fff;
  padding: 2px 4px;
  border-radius: 3px;
  outline: none;
  width: 120px;
}

.layer-type { font-size: 11px; color: #888; }

.layer-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.layer-actions button {
  flex: none;
  padding: 2px 6px;
  font-size: 10px;
  min-width: auto;
  opacity: 0.6;
}

.layer-actions button:hover { opacity: 1; }

/* === Controls === */
.controls {
  height: 40%;
  border-top: 1px solid #333;
  background: #202020;
  overflow-y: auto;
  padding: 15px;
}

.control-group { margin-bottom: 12px; }

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #aaa;
  margin-bottom: 4px;
}

input[type=range] {
  width: 100%;
  cursor: pointer;
  accent-color: #00aaff;
}

/* === Toolbar === */
.toolbar {
  padding: 10px;
  background: #222;
  border-top: 1px solid #333;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

button {
  background: #333;
  color: #ddd;
  border: 1px solid #444;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  flex: 1;
  transition: 0.2s;
}

button:hover { background: #444; }
button.add { background: #005588; border-color: #006699; }
button.delete { background: #882222; border-color: #993333; flex: 0 0 auto; }
button.duplicate { background: #336633; border-color: #447744; flex: 0 0 auto; }
button.action { background: #444; border-color: #555; }

/* === Main Area === */
.main {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas {
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  max-width: 100%;
  max-height: 100%;
}

/* === Floating Global Settings Panel === */
.global-settings {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(5px);
  border: 1px solid #444;
  border-radius: 8px;
  width: 260px;
  transition: height 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gs-header {
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.gs-content {
  padding: 15px;
  overflow-y: auto;
  max-height: 80vh;
}

.gs-content.collapsed { display: none; }

.section-title {
  font-size: 12px;
  font-weight: bold;
  color: #00aaff;
  margin-top: 15px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
}

.section-title:first-child { margin-top: 0; }

/* === Optimization Indicator === */
.render-quality {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 12px;
}

.render-quality button {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  text-align: center;
}

.render-quality button.active-mode {
  background: #00aaff;
  color: #fff;
  border-color: #00aaff;
}

.quality-hint {
  font-size: 10px;
  color: #666;
  text-align: center;
  margin-bottom: 10px;
}

/* === File Input === */
#fileInput { display: none; }
