/* components.css — reusable cards, badges, panels */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 10px; font-size: 16px; }
.card .muted { color: var(--ink-soft); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge.leaf { background: var(--leaf-soft); color: var(--leaf); border-color: var(--leaf); }
.badge.star { background: #fff4d4; color: #8a6d10; border-color: var(--star); }
.badge.flame { background: #fde6cb; color: var(--flame); border-color: var(--flame); }
.badge.sage { background: #e8f0fa; color: #1e3a8a; border-color: #93c5fd; }
.badge.keeper { background: #f7e6ff; color: #6b21a8; border-color: #c084fc; }

.panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 18px 0 8px;
}

.crumb {
  font-size: 14px;
  color: var(--ink-soft);
}
.crumb b { color: var(--ink); }

.btn {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--leaf); color: white; border-color: var(--leaf); }
.btn.primary:hover { background: #25613e; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--ink-soft); }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .title { flex: 1; font-weight: 500; }
.list-row .meta { font-size: 12px; color: var(--ink-soft); }

.empty {
  padding: 30px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.pdsa-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.pdsa-cell {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--leaf);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
}
.pdsa-cell h4 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--leaf);
}
.pdsa-cell.tried   { border-left-color: var(--flame); }
.pdsa-cell.tried h4 { color: var(--flame); }
.pdsa-cell.solved  { border-left-color: var(--leaf); }
.pdsa-cell.solved h4 { color: var(--leaf); }
.pdsa-cell.remain  { border-left-color: #9333ea; }
.pdsa-cell.remain h4 { color: #9333ea; }
.pdsa-cell.learn   { border-left-color: var(--star); }
.pdsa-cell.learn h4 { color: #8a6d10; }
.pdsa-cell ul { margin: 4px 0 0 16px; padding: 0; }
.pdsa-cell li { margin-bottom: 4px; }

.tag-chip {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border-radius: 4px;
  border: 1px solid var(--line);
  margin-right: 4px;
}

.banner {
  background: linear-gradient(120deg, #fff8e6 0%, #f7f1d9 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 18px;
}
.banner h2 { margin: 0 0 8px; font-size: 20px; }
.banner p { margin: 6px 0; }

table.simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.simple th, table.simple td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
table.simple th {
  background: var(--bg-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
table.simple tr:hover td { background: var(--bg-soft); }

/* ──────────────────────────────────────────────────────────────────────── */
/* md-modal — .md 팝업 뷰어 (치즈모리 mdview)                              */
/* ──────────────────────────────────────────────────────────────────────── */

body.mdmodal-open { overflow: hidden; }

.mdmodal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: mdmodalIn 120ms ease-out;
}
@keyframes mdmodalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.mdmodal-dialog {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 980px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
}

.mdmodal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(120deg, #fff8e6 0%, #f3ecd8 100%);
  border-bottom: 1px solid var(--line);
}
.mdmodal-title { font-size: 15px; line-height: 1.4; min-width: 0; }
.mdmodal-title strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
}
.mdmodal-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.mdmodal-actions .btn { padding: 4px 10px; font-size: 12px; }
.mdmodal-close { font-weight: bold; }

.mdmodal-crumb {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--ink-soft);
  padding: 6px 18px;
  background: var(--bg-soft);
  border-bottom: 1px dashed var(--line);
}

.mdmodal-body {
  padding: 16px 18px 24px;
  overflow-y: auto;
  flex: 1;
}
.mdmodal-md { border: none; box-shadow: none; padding: 4px 4px 16px; }

.mdmodal-loading,
.mdmodal-error {
  padding: 30px 20px;
  text-align: center;
  color: var(--ink-soft);
}
.mdmodal-error p:first-child { color: var(--ink); font-weight: 600; }

@media (max-width: 760px) {
  .mdmodal-overlay { padding: 8px; }
  .mdmodal-dialog { max-height: calc(100vh - 16px); border-radius: 10px; }
  .mdmodal-head { padding: 10px 12px; }
  .mdmodal-actions .btn { padding: 4px 7px; }
}

/* ──────────────────────────────────────────────────────────────────────── */
/* wikilinks                                                                */
/* ──────────────────────────────────────────────────────────────────────── */

a.wikilink {
  color: var(--leaf);
  border-bottom: 1px dashed var(--leaf-soft);
  text-decoration: none;
  cursor: pointer;
}
a.wikilink:hover {
  background: var(--leaf-soft);
  border-bottom-style: solid;
}
.wikilink-broken {
  color: #b45309;
  background: #fef3c7;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 0.92em;
}

/* ──────────────────────────────────────────────────────────────────────── */
/* mermaid                                                                  */
/* ──────────────────────────────────────────────────────────────────────── */

.mermaid {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  overflow-x: auto;
  text-align: center;
}
.mermaid svg { max-width: 100%; height: auto; }
