/* ===== リセット & 変数 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #1e1e2e;
  --surface:  #2a2a3e;
  --surface2: #313148;
  --border:   #3d3d5c;
  --accent:   #7c5cbf;
  --accent2:  #9d7de0;
  --text:     #cdd6f4;
  --text-dim: #6c7086;
  --red:      #f38ba8;
  --green:    #a6e3a1;
  --yellow:   #f9e2af;
  --radius:   10px;
  --header-h: 52px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== ヘッダー ===== */
header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
}
.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent2);
}

/* ===== メインレイアウト ===== */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

/* ===== 左ペイン ===== */
#pane-list {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 録音セクション ===== */
#record-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-record {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
}
.btn-record:hover  { background: var(--accent2); }
.btn-record:active { transform: scale(0.97); }
.btn-record.recording {
  background: var(--red);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.75; }
}

.record-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}
#record-timer { font-variant-numeric: tabular-nums; font-weight: 600; }

/* プログレスバー */
#progress-wrap {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  width: 0%;
  transition: width 0.4s ease;
}
#progress-label { font-size: 12px; color: var(--text-dim); }

/* 結果バナー */
.result-banner {
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.result-banner.success { background: #1e3a2e; color: var(--green); border: 1px solid var(--green); }
.result-banner.error   { background: #3a1e1e; color: var(--red);   border: 1px solid var(--red);   }

/* ===== ノート一覧 ===== */
#note-list-section {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
}
.list-header h2 { font-size: 13px; font-weight: 600; color: var(--text-dim); letter-spacing: .05em; text-transform: uppercase; }

#note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.list-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px 0;
  font-size: 13px;
}

.note-item {
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.note-item:hover   { background: var(--surface2); }
.note-item.active  { background: var(--surface2); border-color: var(--accent); }

.note-item-title   { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item-meta    { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.note-item-date    { font-size: 11px; color: var(--text-dim); }
.note-item-cat     { font-size: 10px; background: var(--surface2); color: var(--accent2); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }

/* ===== 右ペイン ===== */
#pane-detail {
  overflow-y: auto;
  padding: 24px 32px;
  background: var(--bg);
}
#detail-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 15px;
}

#detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.tag  { background: var(--surface2); color: var(--accent2); border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 500; }
.date { color: var(--text-dim); font-size: 12px; }
#detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-tag   { background: var(--surface); color: var(--text-dim); border-radius: 4px; padding: 2px 7px; font-size: 11px; }

/* Markdown スタイル */
.markdown-body { line-height: 1.75; }
.markdown-body h1 { font-size: 22px; font-weight: 700; margin: 0 0 16px; color: var(--accent2); }
.markdown-body h2 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.markdown-body h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.markdown-body p  { margin-bottom: 12px; }
.markdown-body ul, .markdown-body ol { padding-left: 20px; margin-bottom: 12px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-dim); margin: 12px 0; }
.markdown-body code { background: var(--surface2); border-radius: 4px; padding: 1px 5px; font-family: monospace; font-size: 13px; }
.markdown-body pre  { background: var(--surface2); border-radius: var(--radius); padding: 12px; overflow-x: auto; margin-bottom: 12px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ===== 汎用ボタン ===== */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface2); }

.btn-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 8px;
  margin-left: auto;
  transition: color 0.15s, background 0.15s;
}
.btn-delete:hover { color: var(--red); background: rgba(243,139,168,0.1); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent2); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--border); }

/* ===== モーダル ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 360px;
  max-width: 90vw;
}
.modal-box h2 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.modal-box input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 8px 12px;
}
.modal-box input:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== ユーティリティ ===== */
.hidden { display: none !important; }

/* スクロールバー */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
