/* ===== 基本設定・カラーパレット ===== */
:root {
  --bg-main: #0c110f;          /* 全体の背景色（漆黒に近いフォレストブラック） */
  --bg-surface: #141d18;       /* カードやヘッダーの背景色 */
  --bg-surface-hover: #1b2721; /* ホバー時の背景色 */
  --bg-input: #0e1511;         /* 入力欄の背景色 */
  
  --border-color: #23372c;     /* 枠線の色（深緑系） */
  --border-focus: #10b981;     /* フォーカス時の強調色 */
  
  --primary: #10b981;          /* メインアクセント（鮮やかなエメラルドグリーン） */
  --primary-hover: #059669;    /* ボタンホバー時 */
  --primary-dark: #047857;     /* 深緑 */
  
  --text-main: #f1f5f9;        /* 主要テキスト（見やすい白） */
  --text-muted: #94a3b8;       /* 補足テキスト（グレー） */
  --text-dim: #64748b;         /* 薄いテキスト */
  
  --danger: #ef4444;           /* 削除・エラー用赤 */
  --danger-hover: #dc2626;
  
  --status-planning: #64748b;    /* 構想中（グレー） */
  --status-in_progress: #3b82f6; /* 進行中（ブルー） */
  --status-completed: #10b981;   /* 完成・公開（グリーン） */
  --status-on_hold: #f59e0b;     /* 保留（アンバー） */

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Meiryo", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== レイアウト共通 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== ヘッダー ===== */
.header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.8rem;
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

/* ===== ボタンスタイル ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #042517;
  font-weight: 700;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid #5c2020;
  color: #f87171;
  padding: 4px 10px;
  font-size: 0.85rem;
}

.btn-danger-outline:hover {
  background-color: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.85rem;
}

/* ===== サマリーバー ===== */
.main-content {
  padding: 28px 0 60px 0;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.summary-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.summary-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

/* ===== プロジェクト一覧 ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-controls label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 入力欄スタイル */
.select-input, .text-input, .textarea-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

.select-input {
  cursor: pointer;
  width: auto;
}

.select-input:focus, .text-input:focus, .textarea-input:focus {
  border-color: var(--border-focus);
}

/* グリッドレイアウト */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

/* ===== プロジェクトカード ===== */
.project-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.project-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.card-badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
}

.badge-category {
  background-color: #172a22;
  color: #34d399;
  border: 1px solid #234637;
}

.badge-status {
  background-color: #1a222f;
  color: #93c5fd;
}
.badge-status.status-planning {
  background-color: #272f3d;
  color: #cbd5e1;
}
.badge-status.status-in_progress {
  background-color: #172b4d;
  color: #60a5fa;
}
.badge-status.status-completed {
  background-color: #113626;
  color: #34d399;
}
.badge-status.status-on_hold {
  background-color: #3b2c12;
  color: #fbbf24;
}

.card-menu {
  display: flex;
  gap: 6px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  word-break: break-word;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 80px;
  overflow-y: auto;
}

/* 進捗バー */
.progress-container {
  margin-bottom: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ToDoセクション */
.todos-section {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: auto;
}

.todos-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.todo-list {
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  gap: 8px;
}

.todo-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

.todo-checkbox {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--text-dim);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.todo-checkbox:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.todo-checkbox:checked::after {
  content: '✓';
  font-size: 11px;
  color: #042517;
  font-weight: 900;
}

.todo-text {
  word-break: break-word;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-dim);
}

.todo-delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 4px;
}

.todo-delete-btn:hover {
  color: var(--danger);
}

/* 新規ToDo入力フォーム */
.add-todo-form {
  display: flex;
  gap: 6px;
}

.add-todo-input {
  flex: 1;
  font-size: 0.85rem;
  padding: 6px 10px;
}

/* ===== 空の状態表示 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background-color: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin-top: 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

/* ===== モーダル ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-main);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.required {
  color: var(--danger);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 640px) {
  .header-container {
    padding: 12px 16px;
  }
  .logo h1 {
    font-size: 1.15rem;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-controls {
    width: 100%;
    justify-content: space-between;
  }
  .filter-controls .select-input {
    flex: 1;
  }
  .summary-bar {
    grid-template-columns: 1fr;
  }
}

/* ===== プロジェクト詳細ページ ===== */
.detail-view-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: modalFadeIn 0.2s ease-out;
}

.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.back-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.detail-hero-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.detail-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.detail-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.detail-desc {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

@media (max-width: 960px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.detail-section-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.detail-section-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 仕様書（Markdown）関連 */
.md-mode-tabs {
  display: flex;
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border-color);
}

.md-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.md-tab-btn.active {
  background-color: var(--primary-dark);
  color: #ffffff;
}

.spec-editor {
  width: 100%;
  min-height: 320px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 14px;
  resize: vertical;
}

.spec-preview {
  min-height: 320px;
  padding: 16px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow-y: auto;
  line-height: 1.7;
}

/* Markdown表示のスタイリング（深緑トーン） */
.spec-preview h1,
.spec-preview h2,
.spec-preview h3,
.spec-preview h4 {
  color: var(--text-main);
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.spec-preview h1 { font-size: 1.4rem; color: var(--primary); }
.spec-preview h2 { font-size: 1.2rem; }
.spec-preview h3 { font-size: 1.05rem; }

.spec-preview p {
  margin-bottom: 10px;
  color: var(--text-main);
}

.spec-preview ul, .spec-preview ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.spec-preview li {
  margin-bottom: 4px;
}

.spec-preview code {
  background-color: #172a20;
  color: #34d399;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88rem;
  font-family: monospace;
}

.spec-preview pre {
  background-color: #080c0a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.spec-preview pre code {
  background-color: transparent;
  padding: 0;
  color: #a7f3d0;
}

.spec-preview blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
  color: var(--text-muted);
  margin: 12px 0;
  font-style: italic;
}

.spec-preview hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

.spec-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.save-status-msg {
  font-size: 0.85rem;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.save-status-msg.show {
  opacity: 1;
}

/* アイデア・メモ関連 */
.note-input-box {
  margin-bottom: 16px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.note-card {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.note-card:hover {
  border-color: #2e4d3c;
}

.note-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.note-time {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.note-content {
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
}

.note-actions {
  display: flex;
  gap: 6px;
}

.note-edit-area {
  width: 100%;
  margin-bottom: 8px;
}

/* 制作履歴（ログ）関連 */
.log-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  background-color: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.log-form-row {
  display: flex;
  gap: 8px;
}

.log-date-input {
  width: 150px;
}

.logs-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.log-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--bg-input);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
}

.log-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.log-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

.log-text {
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== ヘッダーボタングループ ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== 設定・データ管理モーダル ===== */
.modal-card-large {
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.settings-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 4px 0;
}

/* インポートファイル選択エリア */
.import-file-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.selected-file-name {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  word-break: break-all;
}

/* アラート・エラー表示 */
.import-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-top: 10px;
  line-height: 1.5;
}

.import-alert-error {
  background-color: #2d1215;
  border: 1px solid #7f1d1d;
  color: #fca5a5;
}

/* 事前確認プレビューボックス */
.import-preview-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: modalFadeIn 0.2s ease-out;
}

.import-preview-box h5 {
  font-size: 0.98rem;
  color: var(--primary);
  font-weight: 700;
}

.preview-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  font-weight: 600;
}

.preview-stats span {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

.preview-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preview-projects-list {
  list-style: none;
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-projects-list li {
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.backup-confirm-box {
  background-color: #1a1608;
  border: 1px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.backup-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fde68a;
  cursor: pointer;
}

.backup-checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.warning-text {
  font-size: 0.8rem;
  color: #fbbf24;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}


