/* ===== Note Detail Modal ===== */
.note-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 150ms ease;
}

.note-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: calc(80vh - env(keyboard-inset-height, 0px));
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  animation: slideUp 200ms ease;
  transition: max-height 200ms ease;
}

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

.note-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.note-modal-title-input {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-family);
}

.note-modal-pdf {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.note-modal-pdf:hover {
  background: var(--accent);
  color: #fff;
}

.note-modal-pdf:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.note-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.note-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.note-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* ===== 공용 마크다운 렌더링 스타일 ===== */
.md-rendered {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}
.md-rendered p { margin: 0 0 8px; }
.md-rendered p:last-child { margin-bottom: 0; }
.md-rendered h1, .md-rendered h2, .md-rendered h3 {
  margin: 16px 0 8px; font-weight: 600;
}
.md-rendered h1 { font-size: 20px; }
.md-rendered h2 { font-size: 17px; }
.md-rendered h3 { font-size: 15px; }
.md-rendered ul, .md-rendered ol {
  padding-left: 20px; margin: 4px 0;
}
.md-rendered li { margin: 2px 0; }
.md-rendered code {
  background: var(--bg-hover); padding: 2px 5px; border-radius: 4px; font-size: 13px;
}
.md-rendered pre {
  background: var(--bg-hover); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0;
}
.md-rendered pre code { background: none; padding: 0; }
.md-rendered blockquote {
  border-left: 3px solid var(--accent); padding-left: 12px; margin: 8px 0; color: var(--text-secondary);
}
.md-rendered a { color: var(--accent); text-decoration: underline; }
.md-rendered hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.md-rendered strong { font-weight: 600; }
.md-rendered table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.md-rendered th, .md-rendered td {
  border: 1px solid var(--border); padding: 6px 10px; text-align: left;
}
.md-rendered th { background: var(--bg-hover); font-weight: 600; }
.md-rendered input[type="checkbox"] { margin-right: 6px; }

/* Inbox 모달 렌더링 (공용 상속) */
.note-modal-rendered {
  padding: 16px 20px;
  min-height: 300px;
  cursor: text;
}
.note-modal-rendered:empty::before {
  content: "내용이 없습니다";
  color: var(--text-tertiary);
}

.note-modal-editor {
  width: 100%;
  min-height: 300px;
  padding: 16px 20px;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 1.7;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: transparent;
}

.note-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

.note-modal-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-modal-status {
  font-size: 12px;
  color: var(--text-muted);
}

.note-modal-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-family);
  transition: all 150ms ease;
}

.note-modal-save {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.note-modal-save:hover {
  background: var(--accent-hover);
}

.note-modal-delete {
  background: none;
  color: #DC2626;
  border-color: #EF4444;
}

.note-modal-delete:hover {
  background: #FEF2F2;
}

/* Note modal mobile */
@media (max-width: 767px) {
  .note-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .note-modal {
    max-width: 100%;
    max-height: calc(90vh - env(keyboard-inset-height, 0px));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}
