/* Custom hue slider color bar background */
input[type="range"].hue-slider {
  /* Remove default appearance for Chrome/Safari */
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
  outline: none;
}
input[type="range"].hue-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}
input[type="range"].hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #888;
  box-shadow: 0 0 2px #0003;
  cursor: pointer;
  margin-top: -3px;
}
input[type="range"].hue-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #888;
  box-shadow: 0 0 2px #0003;
  cursor: pointer;
}
input[type="range"].hue-slider::-ms-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #888;
  box-shadow: 0 0 2px #0003;
  cursor: pointer;
}
input[type="range"].hue-slider::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}
input[type="range"].hue-slider::-ms-fill-lower,
input[type="range"].hue-slider::-ms-fill-upper {
  background: none;
}
input[type="range"].hue-slider:focus {
  outline: none;
}

/* Gradient toggle button styling */
button.gradient-toggle {
  background: #ededed;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

button.gradient-toggle:hover {
  background: #bdbdbd;
  border-color: #222;
}

button.gradient-toggle.active {
  background: #4CAF50;
  border-color: #45a049;
  color: white;
}

/* Ray Shape Menu */
.ray-shape-menu {
  position: absolute;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  padding: 0px 8px 0px 8px;
  min-width: 0;
  font-size: 14px;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  box-sizing: border-box;
  margin-right: 20px;
}

.ray-shape-menu .ray-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  width: 100%;
}

.ray-shape-menu .ray-label {
  font-weight: bold;
  margin-left: 0px;
  margin-right: 0px;
}

.ray-shape-menu .shape-label,
.ray-shape-menu .slider-label,
.ray-shape-menu .hue-label {
  font-weight: bold;
  margin-right: 6px;
}

.ray-shape-menu .slider-label {
  margin-left: 0px;
}

.ray-shape-menu .hue-label {
  margin-left: 10px;
}

.ray-shape-menu .radius-slider {
  width: 80px;
}

.ray-shape-menu .value-display {
  min-width: 25px;
  font-size: 15px;
}

.ray-shape-menu .hue-input {
  width: 60px;
  padding: 2px 8px;
  margin-left: 2px;
  font-size: 15px;
  box-sizing: border-box;
}

/* Slider Container */
.slider-container {
  position: relative;
  width: 160px;
  height: 20px;
}

.slider-container input[type="range"].background-only {
  pointer-events: none;
  width: 160px;
}

/* Custom Knobs */
.custom-knob {
  position: absolute;
  background-color: #ffffff;
  border: 1px solid #b3b3b3;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  background: linear-gradient(to bottom, #ffffff 0%, #e6e6e6 100%);
}

.custom-knob.knob1.selected,
.custom-knob.knob2.selected {
  z-index: 10;
}

.custom-knob:not(.selected) {
  z-index: 9;
}

/* Single knob slider */
input[type="range"].single-knob {
  width: 160px;
}

/* Gradient Toggle Button */
.gradient-toggle {
  margin-left: 4px;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}

.gradient-toggle.active {
  border: 2px solid #4CAF50;
}

.gradient-toggle:not(.active) {
  border: none;
}

.gradient-icon {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #ff0000, #ff8000, #ffff00, #80ff00, #00ff00, #00ff80, #00ffff);
}

.gradient-icon.enabled {
  border: 2px solid #4CAF50;
}

.gradient-icon.disabled {
  border: none;
  background: none;
}

/* Swatch Button */
.swatch-btn {
  margin-left: 4px;
}

/* Swatch Popup */
.swatch-popup {
  position: absolute;
  z-index: 2000;
  background: #fff;
  border: 1px solid #888;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swatch-popup .swatch {
  width: 24px;
  height: 24px;
  border: 1px solid #888;
  border-radius: 4px;
  cursor: pointer;
}

.swatch-popup .no-colors {
  color: #888;
}

/* Remove Button */
.remove-btn {
  margin-left: 0px;
  font-weight: bold;
  cursor: pointer;
}

/* Plus Button */
.plus-btn {
  margin-left: 0px;
  margin-right: 0px;
  font-weight: bold;
  cursor: pointer;
}

body, html {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f4f4f4;
}

.main-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.title-row {
  background: #222;
  color: #fafafa;
  padding: 12px 0 12px 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.title-row h1 {
  margin: 0;
  font-size: 2.2rem;
  letter-spacing: 1px;
}

.content-row {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: #ededed;
}

.sidebar {
  width: 200px;
  background: #e0e0e0;
  border-right: 1px solid #bdbdbd;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  min-width: 150px;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px 12px;
  background: #fafafa;
  border-radius: 8px;
  margin: 12px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.toolbar > p {
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  margin: 0 0 0 0;
  padding: 0;
  color: inherit;
}

.toolbar button {
  padding: 5px 0;
  cursor: pointer;
  border: 1px solid #bdbdbd;
  background: #ededed;
  border-radius: 4px;
  font-size: 1rem;
  transition: all 0.2s;
}

.toolbar button:hover {
  background: #bdbdbd;
  border-color: #222;
  color: #222;
}

.workspace-area {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 12px 24px 12px 24px;
  min-width: 0;
}

.canvas-toolbar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: left;
  margin-bottom: 10px;
  background: #fafafa;
  padding: 1px 10px;
  border-radius: 8px;
  /* box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  gap: 0; */
}

.toolbar-left, .toolbar-right {
  display: flex;
  flex-direction: row;
  padding: 5px 0px;
  gap: 5px;
  align-items: center; /* Vertically center children */
}

.canvas-toolbar button {
  padding: 5px 5px;
  font-size: 1rem;
  border: 1px solid #bdbdbd;
  background: #ededed;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap; /* Prevent text from wrapping */
}

.canvas-toolbar button:hover {
  background: #bdbdbd;
  border-color: #222;
  color: #222;
}

.toolbar-label {
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  margin: 0 8px 0 0;
  padding: 0;
  color: inherit;
  display: inline-block;
  line-height: 1;
  white-space: nowrap; /* Prevent text from wrapping */
}

.toolbar-title {
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  margin: 0 0 12px 0;
  padding: 0;
  color: inherit;
  display: inline-block;
  line-height: 1;
  text-align: center;
}

.canvas-container {
  flex: 1 1 auto;
  position: relative;
  display: block;
  /* align-items: center; */
  /* justify-content: center; */
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  padding: 0px 0px;
  min-height: 400px;
  min-width: 0;
  max-height: 70vh;
}


#canvas {
  width: 100%;
  /* height: 800px; */
  max-width: 100%;
  max-height: 100%;
  /* aspect-ratio: 3 / 1; */
  display: block;
  /* background: #ffffff; */
  border: 1px solid #bdbdbd;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  box-sizing: border-box;
  cursor: default;
}

.component {
  cursor: move;
}

.component:hover path,
.component:hover rect,
.component:hover line,
.component:hover ellipse {
  stroke: #555;
  stroke-width: 2.5;
}

/* Selection area for components */
.component-hit-area {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.gallery-instructions-row {
  display:flex; 
  gap:0.5vw; 
  justify-content:flex-start; 
  align-items:flex-start; 
  margin:0em 0; 
  width:100vw; 
  max-width:100vw;
  padding: 5px 0px;
  background: #dcdcdc;
}

.gallery-row, .instructions-row {
  background: #f8f8f8;
  color: #222;
  padding: 32px 28px 32px 28px;
  border-radius: 14px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1.08rem;
  line-height: 1.7;
  margin: 0;
}

.gallery-row h2, .instructions-row h2 {
  margin-top: 0;
  margin-bottom: 18px;
  color: #333;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-family: inherit;
  text-align: center;
}

.instructions-row ol {
  margin: 0;
  padding-left: 22px;
  font-size: 1.08rem;
  line-height: 1.7;
  font-family: inherit;
}

.gallery-row img {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  background: #fff;
  object-fit: contain;
  font-family: inherit;
}
