/* note_viewer.css — Phong cách hiển thị Note Markdown hiện đại cho AwD và AwM */

.note-viewer-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #f8fafc;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

/* Toolbar phía trên */
.note-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.note-meta-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
  flex-wrap: wrap;
}

.note-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  font-weight: 500;
}

.note-badge.highlight {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.note-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.note-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.note-tool-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.note-tool-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* Khung hiển thị nội dung */
.note-content-wrapper {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px;
  display: flex;
  justify-content: center;
}

.note-sheet {
  width: 100%;
  max-width: 860px;
  background: #ffffff;
  padding: 32px 40px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #e2e8f0;
  line-height: 1.7;
  font-size: 15px;
  transition: font-size 0.15s ease;
  min-height: calc(100% - 20px);
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .note-content-wrapper {
    padding: 8px;
  }
  .note-sheet {
    padding: 18px 16px;
    border-radius: 8px;
    font-size: 14px;
  }
}

/* Các cỡ chữ phóng to / thu nhỏ */
.note-sheet.font-sm { font-size: 13px; }
.note-sheet.font-md { font-size: 15px; }
.note-sheet.font-lg { font-size: 17px; }
.note-sheet.font-xl { font-size: 19px; }

/* Định dạng Markdown */
.note-markdown {
  word-break: break-word;
}

.note-markdown h1,
.note-markdown h2,
.note-markdown h3,
.note-markdown h4,
.note-markdown h5,
.note-markdown h6 {
  color: #0f172a;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

.note-markdown h1:first-child,
.note-markdown h2:first-child {
  margin-top: 0;
}

.note-markdown h1 { font-size: 1.8em; border-bottom: 2px solid #e2e8f0; padding-bottom: 0.3em; }
.note-markdown h2 { font-size: 1.45em; border-bottom: 1px solid #f1f5f9; padding-bottom: 0.25em; }
.note-markdown h3 { font-size: 1.25em; }
.note-markdown h4 { font-size: 1.1em; }
.note-markdown h5 { font-size: 1em; }
.note-markdown h6 { font-size: 0.9em; color: #64748b; }

.note-markdown p {
  margin-top: 0;
  margin-bottom: 1em;
}

.note-markdown a {
  color: #0284c7;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.note-markdown a:hover {
  color: #0369a1;
}

.note-markdown strong { font-weight: 700; color: #0f172a; }
.note-markdown em { font-style: italic; }
.note-markdown del { text-decoration: line-through; color: #94a3b8; }
.note-markdown mark { background: #fef08a; padding: 1px 4px; border-radius: 3px; }

.note-markdown hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 1.8em 0;
}

/* Danh sách */
.note-markdown ul,
.note-markdown ol {
  padding-left: 24px;
  margin-top: 0;
  margin-bottom: 1em;
}

.note-markdown li {
  margin-bottom: 0.35em;
}

.note-markdown li > p {
  margin-bottom: 0.35em;
}

/* Checklists */
.note-markdown .task-list-item {
  list-style-type: none;
  margin-left: -20px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.note-markdown .task-checkbox {
  cursor: default;
  margin-top: 3px;
}

/* Code block & Inline code */
.note-markdown code.inline-code {
  background: #f1f5f9;
  color: #0f172a;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88em;
  border: 1px solid #e2e8f0;
}

.note-code-wrapper {
  position: relative;
  margin: 1.2em 0;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
}

.note-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #1e293b;
  color: #94a3b8;
  font-size: 11px;
  font-family: monospace;
}

.note-code-copy-btn {
  background: #334155;
  color: #f8fafc;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}

.note-code-copy-btn:hover {
  background: #475569;
}

.note-markdown pre {
  margin: 0;
  padding: 12px 16px;
  background: #0f172a;
  color: #f8fafc;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Blockquote */
.note-markdown blockquote {
  margin: 1.2em 0;
  padding: 8px 16px;
  border-left: 4px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  border-radius: 0 6px 6px 0;
}

/* GitHub Callouts / Alerts */
.note-callout {
  margin: 1.2em 0;
  padding: 12px 16px;
  border-left: 4px solid #cbd5e1;
  border-radius: 0 8px 8px 0;
  background: #f8fafc;
}

.note-callout-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.92em;
  margin-bottom: 6px;
}

.note-callout-note {
  border-left-color: #3b82f6;
  background: #eff6ff;
  color: #1e3a8a;
}
.note-callout-note .note-callout-header { color: #1d4ed8; }

.note-callout-tip {
  border-left-color: #10b981;
  background: #ecfdf5;
  color: #064e3b;
}
.note-callout-tip .note-callout-header { color: #047857; }

.note-callout-important {
  border-left-color: #8b5cf6;
  background: #f5f3ff;
  color: #4c1d95;
}
.note-callout-important .note-callout-header { color: #6d28d9; }

.note-callout-warning {
  border-left-color: #f59e0b;
  background: #fffbeb;
  color: #78350f;
}
.note-callout-warning .note-callout-header { color: #b45309; }

.note-callout-caution {
  border-left-color: #ef4444;
  background: #fef2f2;
  color: #7f1d1d;
}
.note-callout-caution .note-callout-header { color: #b91c1c; }

/* Bảng */
.note-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 1.2em 0;
}

.note-markdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  text-align: left;
}

.note-markdown th,
.note-markdown td {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
}

.note-markdown th {
  background: #f1f5f9;
  font-weight: 600;
  color: #0f172a;
}

.note-markdown tr:nth-child(even) td {
  background: #f8fafc;
}

/* Raw Editor / Source mode */
.note-raw-textarea {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 400px;
  padding: 16px;
  background: #0f172a;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid #334155;
  border-radius: 8px;
  resize: none;
  box-sizing: border-box;
}

.note-raw-textarea:focus {
  outline: none;
  border-color: #38bdf8;
}
