/* ===== 메모 기본 ===== */
.memo {
  position: absolute;
  top: 100px; left: 150px;
  width: 260px; height: 222px;
  min-width: 180px;            /* 최소 크기 보호 */
  min-height: 110px;
  background: #e5e5e5;
  border: none;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.25);
  border-radius: 6px;
  overflow: hidden;
  font-family: "SUIT", sans-serif;
  z-index: 9999; /* 이미지보다 항상 위 */
}

/* 상단 바 */
.memo-header {
  height: 24px;
  background: #c7c7c7;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  user-select: none;
  font-size: 12px;
  position: relative;
  z-index: 1; /* 핸들보다 뒤 */
}


/* 좌측 타이틀(텍스트만 표시) */
.memo-title {
  width: 200px; height: 14px;
  background: none;
  display: inline-block;
  border-radius: 2px;
  color: #222;
  line-height: 14px;
  padding-top: 1px;
}

/* 우측 버튼들 */
.memo-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.memo-buttons button {
  width: 18px; height: 18px;
  border: none;
  background: none;
  font-size: 16px;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
}
.memo-buttons button:hover {
  background: #a2a2a2;
}

/* 본문 */
.memo-content {
  width: 100%; height: calc(100% - 24px);
}
.memo-content textarea {
  width: 100%; height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
  background: transparent;
  color: #000;
  font-family: "SUIT", sans-serif;
}

/* ===== 리사이즈 핸들 ===== */
.resize-handle {
  position: absolute;
  background: transparent;
  z-index: 2;           /* 헤더보다 위 */
  pointer-events: auto; /* 클릭 잡히게 */
}

/* 코너는 최상단 */
.br, .bl, .tr, .tl { z-index: 3; }

/* 코너 핸들: 히트영역 확대 + 살짝 바깥으로 */
.br, .bl, .tr, .tl {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  /* background: rgba(0,0,0,0.06);  보이게 하고 싶으면 주석 해제 */
}

/* 각 코너 위치/커서 (±2px 바깥으로) */
.br { bottom: -2px; right: -2px; cursor: nwse-resize; }
.bl { bottom: -2px; left:  -2px; cursor: nesw-resize; }
.tr { top:    -2px; right: -2px; cursor: nesw-resize; }
.tl { top:    -2px; left:  -2px; cursor: nwse-resize; }

/* 좌우/상하 변 — 코너 16px 비워서 겹침 방지 */
.right { top: 6px;  right: 0; width: 6px;  height: calc(100% - 12px); cursor: ew-resize; }
.left  { top: 6px;  left:  0; width: 6px;  height: calc(100% - 12px); cursor: ew-resize; }
.bottom{ left: 6px; bottom: 0; width: calc(100% - 12px); height: 6px;  cursor: ns-resize; }

/* top 핸들은 헤더(24px) 피하고 좌우 6px 비워주기 */
.top   { left: 6px; top: 24px; width: calc(100% - 12px); height: 6px; cursor: ns-resize; }

/* --- 축소 시 헤더만 남기기(강제 오버라이드) --- */
.memo.minimized {
  height: 24px !important;   /* 헤더 높이만 */
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 6px !important;  /* 모서리 유지 원하면 */
  box-sizing: border-box;
}

/* 헤더를 제외한 모든 자식 숨김 */
.memo.minimized > :not(.memo-header) {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* 혹시 .memo-content가 별도 높이를 먹고 있으면 완전 차단 */
.memo.minimized .memo-content,
.memo.minimized .memo-content * {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* 축소 시 리사이즈 핸들/테두리 여백도 전부 OFF */

@media (max-width: 768px) {
  .memo.minimized .resize-handle {
    display: none !important;
  }

  .memo { 
    box-sizing: border-box; 
    width: 200px;   /* PC 대비 축소 */
    height: 130px;
    font-size: 12px; /* 글자 크기도 조금 줄임 */
  }

  .memo textarea {
    font-size: 12px;
  }
}
