/*
  노드 편집 우측 호버 칼럼 (Studio_bada 디자인 시스템)
  - 캔버스 위에 떠 있는 우측 도킹 패널 (배경 딤 없음 = 캔버스 계속 조작 가능)
  - 검정 테두리 2px, radius 1rem (모달 컴포넌트와 동일 토큰)
  - 우측에서 슬라이드-인
*/

.node-panel {
  position: fixed;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: 400px;
  max-width: calc(100vw - 2rem);
  background-color: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.node-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* 최상단 제목: 기존 패널 타이틀 크기로 직접 입력 */
.node-panel-title-input {
  width: 100%;
  border: none;
  background-color: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
}

.node-panel-title-input::placeholder {
  color: var(--muted);
}

.node-panel-title-input:focus {
  outline: none;
}

/* 닫기 버튼: 칼럼 최상단(제목 위) 좌측 (아이콘) */
.node-panel-close {
  align-self: flex-start;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background-color: var(--background);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  color: var(--foreground);
  cursor: pointer;
}

.node-panel-close:hover {
  background-color: var(--border);
}

.node-panel-body {
  display: flex;
  flex-direction: column;
}

/* 내용 입력칸: 텍스트 양에 맞춰 자동으로 높이 조절 */
.node-panel .form-field[data-canvas-target="fieldContentGroup"] .form-textarea {
  resize: none;
  overflow: hidden;
  min-height: 4rem;
}

/* 편집 패널 입력 필드: 보더 제거 + 옅은 배경으로 영역 구분 */
.node-panel .form-input,
.node-panel .form-textarea,
.node-panel .form-select {
  border: none;
  background-color: var(--background);
}

/* ===== 이모지 선택기 ===== */
.node-panel .form-field[data-controller="emoji-picker"] {
  position: relative;
}

.emoji-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 6px;
  padding: 0;
  background-color: var(--background);
  font-family: inherit;
  cursor: pointer;
}

.emoji-trigger:hover {
  background-color: var(--background);
}

.emoji-trigger-preview {
  font-size: 1.25rem;
  line-height: 1;
}

.emoji-trigger.is-empty .emoji-trigger-preview {
  opacity: 0.4;
}

.emoji-trigger-hint {
  display: none;
}

.emoji-pop {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  z-index: 100;
}

.emoji-pop emoji-picker {
  --background: #fff;
  --border-size: 0;
  --border-radius: 10px;
  --button-active-background: var(--background);
  --button-hover-background: var(--background);
  --indicator-color: var(--primary);
  --num-columns: 8;
  width: 300px;
  height: 340px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  border-radius: 10px;
}

.panel-hint {
  margin: 0;
  padding: 0.875rem;
  font-size: 0.8125rem;
  color: var(--muted);
  background-color: var(--background);
  border-radius: 8px;
  line-height: 1.5;
}

.photo-upload {
  display: block;
  width: 100%;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  background-color: var(--background);
}

.photo-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
  transition: background-color 0.15s ease;
}

.photo-upload:hover .photo-upload-prompt {
  background-color: var(--border);
}

.photo-upload-prompt i {
  font-size: 1.5rem;
}

.photo-upload-preview {
  display: block;
}

.photo-upload-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
}

/* ===== 파일(폴더) 내용 목록 ===== */
.file-contents-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-contents-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--background);
  cursor: grab;
  user-select: none;
}

.file-contents-item:hover {
  background: var(--border);
}

.file-contents-item:active {
  cursor: grabbing;
}

.file-item-emoji {
  flex: 0 0 auto;
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
}

.file-item-name {
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.875rem;
  color: var(--foreground);
}

.file-contents-empty,
.file-contents-hint {
  margin: 10px 2px 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .node-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 1rem 1rem 0 0;
    border-bottom: none;
    max-height: 70vh;
    transform: translateY(100%);
  }

  .node-panel.is-open {
    transform: translateY(0);
  }
}
