/* src/css/diagram.css */
.diagram-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 180px);
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
  }

.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: auto;
    flex: 1;
  }
  
  .diagram-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    cursor: crosshair;
  }
  
  .drawing-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    z-index: 1000;
  }
  
  .drawing-toolbar button {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
  }
  
  .drawing-toolbar button:hover {
    background: #f0f0f0;
  }
  
  .drawing-toolbar button.active {
    background: #e3f2fd;
    border-color: #2196f3;
  }
  
  .shapes-submenu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 0.5rem;
    display: none;
    gap: 0.5rem;
    z-index: 1100;
  }
  
  .shapes-submenu button {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
  }
  
  .shapes-submenu button:hover {
    background: #f0f0f0;
  }

  .text-input {
    position: absolute;
    border: 1px solid #2196f3;
    background: white;
    padding: 4px;
    min-width: 100px;
    min-height: 24px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    resize: both;
    overflow: hidden;
    z-index: 1000;
    outline: none;
    caret-color: #2196f3;
    animation: blink-caret 1s infinite;
  }
  
  @keyframes blink-caret {
    from, to { caret-color: transparent }
    50% { caret-color: #2196f3 }
  }
  
  .bottom-bar {
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    padding: 1rem;
    height: 100px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  
  .tech-list {
    display: flex;
    gap: 1rem;
    flex-wrap: nowrap;
    height: 100%;
  }
  
  .tech-list .tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: grab;
    min-width: 80px;
    height: 100%;
  }
  
  .tech-list .tech-item:active {
    cursor: grabbing;
  }
  
  .tech-list .tech-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
  }
  
  .tech-list .tech-item span {
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  
  .resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border: 1px solid #2196f3;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
  }
  
  .resize-handle.nw { cursor: nw-resize; }
  .resize-handle.ne { cursor: ne-resize; }
  .resize-handle.se { cursor: se-resize; }
  .resize-handle.sw { cursor: sw-resize; }
  
  .element-selected {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
  }
  
  .diagram-canvas[data-tool="select"] {
    cursor: default;
  }
  
  .diagram-canvas[data-tool="square"],
  .diagram-canvas[data-tool="rectangle"],
  .diagram-canvas[data-tool="circle"] {
    cursor: crosshair;
  }
  
  .diagram-canvas[data-tool="arrow"] {
    cursor: crosshair;
  }
  
  .diagram-canvas[data-tool="text"] {
    cursor: text;
  }
  
  /* 드래그 오버 상태 스타일 */
  .diagram-canvas.dragover {
    background-color: #f8f9fa;
    border: 2px dashed #2196f3;
  }
  
  /* 키보드 단축키 힌트 */
  .tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1000;
  }
  
  /* 실행 취소/��시 실행 버튼 비활성화 상태 */
  .drawing-toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* src/css/diagram.css */

/* 추가된 스타일 */
.arrows-submenu {
  position: absolute;
  display: none;
  flex-direction: column;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 1000;
  padding: 4px;
}

.arrows-submenu button {
  padding: 8px;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.arrows-submenu button:hover {
  background-color: #f0f0f0;
}
/* src/css/diagram.css에 추가 */
.tech-stack-panel {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
}

.tech-stack-item {
  width: 48px;
  height: 48px;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: grab;
  transition: all 0.2s ease;
  background: white;
}

.tech-stack-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tech-stack-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tech-stack-item.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.diagram-canvas.drag-over {
  outline: 2px dashed #2196f3;
  outline-offset: -2px;
}

.tech-stack-item:active {
  cursor: grabbing;
  transform: scale(0.95);
}

@media (max-width: 1200px) {
  .tech-stack-panel {
    left: 10px;
  }
}

.drag-tooltip {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(33, 150, 243, 0.9);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 2000;
  animation: fadeInOut 3s ease-in-out;
  pointer-events: none;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -20px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  90% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -20px); }
}

.drawing-toolbar button[data-tool="cut"] {
  margin-left: 10px;
  border-left: 1px solid #ccc;
  padding-left: 10px;
}

.os-stack-panel {
  position: fixed;
  left: 90px;  /* tech-stack-panel 옆에 위치 */
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
}

.common-stack-panel {
  position: fixed;
  left: 160px;  /* os-stack-panel 옆에 위치 */
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
}

.os-stack-item,
.common-stack-item {
  width: 48px;
  height: 48px;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: grab;
  transition: all 0.2s ease;
  background: white;
}

.os-stack-item:hover,
.common-stack-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.os-stack-item img,
.common-stack-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.os-stack-item.dragging,
.common-stack-item.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.toolbar-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 1100;
  text-align: center;
  line-height: 1.4;
  max-width: 250px;
  white-space: normal;
  animation: tooltipFadeIn 0.2s ease-in-out;
}

.toolbar-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent rgba(0, 0, 0, 0.8) transparent;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media screen and (max-width: 768px) {
  .drawing-toolbar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .tech-stack-panel,
  .os-stack-panel,
  .common-stack-panel {
    position: static;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }

  .diagram-container {
    margin-top: 1rem;
  }

  .canvas-container {
    width: 100%;
    overflow-x: auto;
  }
}

@media screen and (max-width: 480px) {
  .drawing-toolbar button {
    padding: 0.5rem;
  }

  .tech-stack-panel,
  .os-stack-panel,
  .common-stack-panel {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }
}