/* --- Base --- */
.postit-root { position: relative; }

/* --- Launcher --- */
.postit-launcher {
  position: fixed;
  left: 20px; bottom: 20px;
  z-index: 100000;
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: #333;
  border-radius: 999px; padding: 10px 16px;
  box-shadow: 0 8px 25px rgba(0,0,0,.15);
  border: 1px solid #eee;
  cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all .2s ease-out;
}
.postit-launcher:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.postit-launcher .dot { width: 10px; height: 10px; background: #ffc107; border-radius: 50%; }

/* --- Note --- */
.postit-note {
  position: fixed;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 28px rgba(0,0,0,.2), 0 2px 4px rgba(0,0,0,.1);
  border-radius: 6px;
  transform: rotate(-1.5deg);
  overflow: visible; /* For pin */
  z-index: 2147483647 !important;
  will-change: transform, opacity;
  transition: transform 0.25s ease-out, opacity 0.2s ease, box-shadow 0.25s ease-out;
}
.postit-note:hover {
  transform: translateY(-5px) scale(1.02) rotate(0deg);
  box-shadow: 0 18px 40px rgba(0,0,0,.25), 0 4px 8px rgba(0,0,0,.15);
  z-index: 2147483647 !important;
}
.postit-note.is-dragging {
  transform: scale(1.05) rotate(2deg);
  transition-duration: .1s;
  cursor: grabbing;
}

/* --- Pin --- */
.postit-pin {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 24px; height: 24px;
  cursor: move;
}
.postit-pin::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  background: #ff4757;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
  border: 1px solid rgba(0,0,0,.1);
}
.postit-pin::after {
  content: '';
  position: absolute;
  top: 13px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: #f1f2f6;
  border: 1px solid #ced6e0;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}


/* --- Header --- */
.postit-header {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 8px 8px 4px 8px; gap: 6px; user-select: none;
  background: rgba(0,0,0,.04);
  border-bottom: 1px solid rgba(0,0,0,.06);
}

/* --- Actions --- */
.postit-actions { display: flex; gap: 4px; }
.postit-icon {
  border: 0;
  background: transparent;
  padding: 4px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  box-sizing: border-box;
  color: #555;
  transition: background .15s ease, color .15s ease;
}
.postit-icon:hover { background: rgba(0,0,0,.1); color: #000; }
.postit-icon svg { width: 18px; height: 18px; }
.postit-icon.btn-fold { transition: transform .2s ease-out; }

/* --- Body --- */
.postit-body {
  flex: 1;
  display: block;
  padding: 8px 12px 12px 12px;
}
.postit-textarea {
  width: 100%; height: 100%;
  resize: none; border: 0;
  background: transparent;
  outline: none;
  font-family: 'NanumSquareRound', 'Malgun Gothic', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  caret-color: #222;
}

/* --- Colors --- */
.postit-note.yellow { background-color: #fffbe6; }
.postit-note.green  { background-color: #f0fff0; }
.postit-note.blue   { background-color: #eef8ff; }
.postit-note.pink   { background-color: #fff0f1; }
.postit-note.purple { background-color: #f8f4ff; }
.postit-note.gray   { background-color: #fafafa; }
.postit-note.white  { background-color: #ffffff; }

/* --- Collapsed (minimized) --- */
.postit-note.is-collapsed { height: 42px !important; }
.postit-note.is-collapsed .postit-body { display:none; }
.postit-note.is-collapsed .postit-icon.btn-fold { transform: rotate(180deg); }
.postit-note.is-collapsed:hover { transform: translateY(-3px) rotate(0deg); }

/* --- Resize handle --- */
.postit-resize {
  position: absolute; right: 0; bottom: 0;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  opacity: .5;
  transition: opacity .2s;
}
.postit-resize:hover { opacity: 1; }
.postit-resize::before {
  content: '';
  position: absolute;
  right: 3px; bottom: 7px;
  width: 8px; height: 2px;
  background: rgba(0,0,0,.4);
  transform: rotate(135deg);
}
.postit-resize::after {
  content: '';
  position: absolute;
  right: 4px; bottom: 4px;
  width: 5px; height: 2px;
  background: rgba(0,0,0,.4);
  transform: rotate(135deg);
}


/* --- Dropdown menu --- */
.postit-menu {
  position: absolute;
  right: 6px; top: 40px;
  min-width: 170px; background: #fff; border: 1px solid #e5e5e5;
  border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15);
  z-index: 100002; display: none;
  animation: pop-up .15s ease-out;
}
@keyframes pop-up { from { transform: translateY(-5px); opacity: 0; } }

.postit-menu.open { display: block; }
.postit-menu button {
  width: 100%; text-align: left; padding: 8px 12px; border: 0; background: transparent;
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.postit-menu button:hover { background: #f5f5f5; }
.postit-menu button svg { width: 14px; height: 14px; color: #666; }
.postit-menu .colors { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 8px 10px; }
.postit-menu .c {
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s ease;
}
.postit-menu .c:hover { transform: scale(1.1); }
.postit-menu .c.active { border-color: #fff; box-shadow: 0 0 0 2px #0984e3; }

/* --- Toast --- */
.postit-toast {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%);
  padding: 10px 16px; background: rgba(0,0,0,.8); backdrop-filter: blur(5px);
  color: #fff; border-radius: 8px; font-size: 13px;
  z-index: 100010;
  animation: fade-in-down .3s ease-out;
}
@keyframes fade-in-down { from { transform: translate(-50%, -10px); opacity: 0; } }

/* --- Modal --- */
.postit-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100050;
}
.postit-modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #fff; width: min(520px, 92vw); max-height: 70vh;
  border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.25);
  z-index: 100051; display: flex; flex-direction: column;
  animation: postit-pop .18s ease-out;
}
@keyframes postit-pop { from { transform: translate(-50%,-50%) scale(.96); opacity: .0; } to { transform: translate(-50%,-50%) scale(1); opacity: 1; } }
.postit-modal header { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid #eee; }
.postit-modal .postit-modal-body { padding: 12px 16px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.postit-modal .postit-row { display: flex; align-items: center; justify-content: space-between; border: 1px solid #eee; border-radius: 8px; padding: 8px 10px; }
.postit-row .title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }
.postit-modal footer { padding: 12px 16px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 8px; }