/* ==========================================
   style.css
   ========================================== */

/* ------------------------------------------
   Global accent color
   ------------------------------------------ */
:root {
  --accent: #cbcccc; /* change this to update all SVGs/buttons */
}

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

body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  overflow-x: auto;
  overflow-y: auto;
}

/* ------------------------------------------
   Canvas Container
   ------------------------------------------ */
.container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.canvas-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 0;
  overflow: hidden;
  background: #f5f5f5;
}

.image-stack {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Each layer’s <canvas> */
.overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  transition: filter 0.3s ease; /* remove transform transition by default */
}
@-moz-document url-prefix() {
  .overlay-canvas {
    transition: filter 0.3s ease, transform 0.5s ease;
  }
}
.layer-container {
  position: absolute;
  top: 0;
  left: 0;
}

.loading-message {
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}
.loading-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #333;
}

/* Progress bar background */
#progressBarContainer {
  width: 300px;
  height: 10px;
  background: #ddd;
  border-radius: 5px;
  margin: 10px auto;
  overflow: hidden;
}

.vertical-divider {
  width: 2px;
  background-color: var(--accent);
  margin: 0 6px;
}

/* Progress bar fill */
#progressBarFill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 5px;
}
/* ------------------------------------------
   Palette Toolbar (above the color manager)
   ------------------------------------------ */
#paletteToolbar {
  position: fixed;
  top: 20px;    /* moved to top */
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 8px 25px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1001; /* above the controls */
  display: flex;
  align-items: center;
  gap: 12px;
}

#paletteToolbar .palette-title {
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin-right: 8px;
}

#paletteToolbar .palette-colors {
  display: flex;
  gap: 8px;
}

/* Each palette swatch is just a square with no border.
   Use title="" for the hover tooltip. */
#paletteToolbar .palette-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
#paletteToolbar .palette-color:hover {
  transform: scale(1.1);
}
#paletteToolbar .palette-color.selected {
  outline: 2px solid var(--accent);
}

/* ------------------------------------------
   Bottom‐Left Toolbar (Color Layers + HSL sliders)
   ------------------------------------------ */
.controls {
  position: fixed;
  bottom: 20px;
  left: 20px;

  display: flex;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 8px 25px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  gap: 20px;
}

/* Section containing just the layer rows */
.layers-section {
  display: flex;
  flex-direction: column;
}

/* one row per Color layer */
.layer-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px; /* gap between rows */
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.2s ease;
  cursor: default;
}

.layer-row.selected {
  background-color: #f0f0f0;
}

.layer-row:last-child {
  margin-bottom: 0;
}

/* Replace pop-up color input with:
   - .color-display square (no border)
   - .hex-input text box for hex codes */
.layer-row .color-display {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: #000; /* JS will override */
  margin-right: 10px;
  cursor: pointer;
}

.layer-row .hex-input {
  width: 70px;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--accent);
  font-family: monospace;
  font-size: 14px;
  color: #333;
  margin-right: 10px;
  padding: 2px 4px;
}

/* Visibility toggle button */
.layer-row .toggle-visibility {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Rotate buttons */
.layer-row .rotate-left,
.layer-row .rotate-right {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Accent color for SVG paths inside buttons */
.layer-row svg path {
  fill: var(--accent);
}

.layer-row .toggle-visibility:hover,
.layer-row .rotate-left:hover,
.layer-row .rotate-right:hover {
  opacity: 0.8;
}

/* ------------------------------------------
   HSL Slider Section (to the right of layers)
   ------------------------------------------ */
.hsl-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

/* Each HSL control block */
.hsl-picker .slider-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Label */
.hsl-picker label {
  opacity: 0.4;
  font-size: 12px;
  color: #333;
  margin-bottom: 2px;
    

}

/* Sliders themselves */
.hsl-picker input[type="range"] {
  margin-top: 5px;
  -webkit-appearance: none;
  width: 150px;
  height: 8px;
  background: #ddd;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
    

}

/* Thumb */
.hsl-picker input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
    

}

.hsl-picker input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4b4b4b;
  cursor: pointer;
  border: none;
    

}
#toggleUIBtn svg {
  width: 32px;
  height: 32px;
  fill: var(--accent);
  transition: transform 0.2s ease;
}

#toggleUIBtn:hover svg {
  transform: scale(1.1);
}

/* Above each slider, show a gradient “preview bar” */
.hsl-picker .preview-bar {
  width: 150px;
  height: 6px;
  border-radius: 3px;
  background: #eee;
}
/* Allow the controls and palette toolbars to shrink and wrap */
#paletteToolbar,
.controls {
  display: flex;
  flex-wrap: wrap;
}


/* Blend-mode toggle switch styling */
.blend-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
}

.blend-toggle input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Scale down on narrower viewports */
@media (max-width: 800px) {
  #paletteToolbar{
    transform: scale(0.8);
    transform-origin: top left;
  }
  .controls {
    transform: scale(0.8);
    transform-origin: bottom left;
    width: min-content;
    bottom:0;
    left:0;
    flex-wrap: nowrap;
  }
  .hex-input {
    display: none;
  }
  .hsl-picker input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
}

.hsl-picker input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
}
}
