/* imagePosition.css | for Vの輪 Factory Image Editor */

body {
  margin: 0;
  padding: 0;
  font-family: 'Share Tech Mono', monospace;
  background-color: #000;
  color: #00ff88;
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

h1, h4, label, p, select, input, textarea {
  color: #00ff88;
}

h1 {
  text-align: center;
  font-size: 1.8rem;
  padding: 10px 0;
  border-bottom: 2px solid #00ff88;
  background-color: #111;
  margin: 0;
}

/* Top Panel */
#topPanel {
  background: #111;
  padding: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  border-bottom: 1px solid #00ff88;
}

#topPanel input[type="number"],
#topPanel input[type="text"],
#topPanel select,
textarea {
  background: #000;
  color: #00ff88;
  border: 1px solid #00ff88;
  padding: 4px;
}

#topPanel input[type="number"] {
  width: 80px;
}

#topPanel button {
  background: #00ff88;
  color: #000;
  border: none;
  padding: 6px 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.3s;
}

#topPanel button:hover {
  background: #33ffaa;
}

/* Workspace */
#workspace {
  flex: 1;
  display: flex;
  background: #0c0c0c;
  overflow: hidden;
}

/* Layer List */
#layerList {
  width: 600px;
  background: #111;
  color: #00ff88;
  padding: 10px;
  border-right: 2px solid #00ff88;
  overflow-y: auto;
}

#layerList h4 {
  margin-top: 0;
  font-size: 1rem;
  border-bottom: 1px solid #00ff88;
  padding-bottom: 5px;
}

.layer-item {
  margin-bottom: 8px;
  padding: 5px;
  background: #222;
  border: 1px solid #00ff88;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.layer-item.dragging {
  opacity: 0.8;
  transform: scale(1.05);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 255, 136, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.layer-item.dragover {
  background-color: rgba(0, 255, 136, 0.1);
  outline: 2px dashed #00ff88;
}

.dragging {
  opacity: 0.5;
}
.dragover {
  background-color: #d0ffd0;
}


.layer-controls button {
  background: #00ff88;
  color: #000;
  border: none;
  padding: 2px 6px;
  margin-left: 4px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
}

/* Canvas Area */
#canvasWrapper {
  position: relative;
  background-image: 
    linear-gradient(45deg, #d4f4dd 25%, transparent 25%, transparent 75%, #d4f4dd 75%, #d4f4dd),
    linear-gradient(45deg, #d4f4dd 25%, transparent 25%, transparent 75%, #d4f4dd 75%, #d4f4dd);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  background-color: white;
}

canvas {
  display: block;
  position: relative;
  z-index: 1;
  max-width: 100%;
  height: auto;
}

#editorCanvas {
  border: 2px solid #00ff88;
  box-shadow: 0 0 20px #00ff88;
  background-color: #33333333;
  max-width: 100%;
  height: auto;
}

#editorCanvas {
  cursor: default;
}

#editorCanvas.move-cursor {
  cursor: move; /* または 'grab' / 'grabbing' */
}

/* Bottom Panel */
#bottomPanel {
  background: #111;
  border-top: 2px solid #00ff88;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

#bottomPanel button {
  background: #00ff88;
  color: #000;
  padding: 6px 14px;
  border: none;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
}

#bottomPanel input[type="file"] {
  display: none;
}

#bottomPanel button:hover {
  background: #33ffaa;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #111;
}
::-webkit-scrollbar-thumb {
  background: #00ff88;
  border-radius: 10px;
}

/* Select Panel */
#selectPanel {
  display: block;
  height: 400px;
  overflow-y: auto;


  background: #111;
  padding: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  border-bottom: 1px solid #00ff88;
}

#selectPanel label {
  display: block;
  margin-bottom: 6px;
  max-height: 300px;
  overflow-y: auto;
}

#selectPanel input[type="text"],
#selectPanel input[type="number"],
#selectPanel input[type="range"],
#selectPanel input[type="color"],
#selectPanel select {
  margin-left: 5px;
}

#selectPanel input[type="number"],
#selectPanel input[type="text"],
#selectPanel select,
textarea {
  background: #000;
  color: #00ff88;
  border: 1px solid #00ff88;
  padding: 4px;
}

#selectPanel button {
  background: #00ff88;
  color: #000;
  border: none;
  padding: 6px 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.3s;
}

#selectPanel button:hover {
  background: #33ffaa;
}

#moveLayerButtons button {
  background: #00ff88;
  color: #000;
  border: none;
  padding: 6px 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.3s;
}

#moveLayerButtons button:hover {
  background: #33ffaa;
}

/* 説明セクション用スタイル */
.howtoSection {
  background: #111;
  color: #00ff88;
  padding: 20px;
  border-top: 2px solid #00ff88;
  border-bottom: 2px solid #00ff88;
  font-size: 14px;
  line-height: 1.6;
}

.howtoSection h2, .howtoSection h3 {
  color: #00ff88;
  border-bottom: 1px solid #00ff88;
  padding-bottom: 4px;
  margin-top: 24px;
}

.howtoSection ul {
  padding-left: 20px;
}

.howtoSection ul li {
  margin-bottom: 6px;
  list-style-type: "🟢 ";
  padding-left: 5px;
  color: white;
}

.howtoSection p {
  margin-bottom: 12px;
  color: white;
}

/* モバイル対応 */
@media screen and (max-width: 768px) {
  #workspace {
    flex-direction: column;
  }

  #layerList {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid #00ff88;
    height: 160px;
  }

  #canvasWrapper {
    flex: 1;
    padding: 10px;
  }

  #topPanel {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #topPanel label {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  #bottomPanel {
    flex-direction: column;
    align-items: center;
  }

  #bottomPanel button {
    width: 100%;
    max-width: 300px;
  }

  .layer-item {
    font-size: 14px;
    flex-direction: column;
  }

  .layer-controls button {
    margin: 2px 0;
    width: 100%;
  }

  #selectPanel label {
    display: block;
    margin-bottom: 10px;
  }

  .howtoSection {
    font-size: 13px;
    padding: 16px;
  }

}

@media (pointer: coarse) {
  canvas {
    touch-action: none;
  }
}
