/* css/task-block.css - タスク進捗表示スタイル */

/* ===== コンテナ ===== */
.task-block {
  background: #12122a;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 13px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  max-width: 480px;
}

/* ===== ヘッダー ===== */
.task-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.task-block-title {
  font-weight: 600;
  color: #a0a0c8;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-block-toggle {
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  transition: transform 0.2s;
  color: #5a5a8a;
}

.task-block.expanded .task-block-toggle {
  transform: rotate(90deg);
}

.task-block-count {
  font-size: 11px;
  color: #5a5a8a;
}

.count-completed {
  color: #4ade80;
  font-weight: 600;
}

/* ===== プログレスバー ===== */
.task-progress-bar {
  height: 3px;
  background: #2a2a4a;
  border-radius: 2px;
  margin-bottom: 10px;
  overflow: hidden;
}

.task-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22d3ee);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ===== タスクリスト ===== */
.task-block-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* コンパクトモード: リストは折りたたみ */
.task-block.compact .task-block-list {
  display: none;
}

.task-block.compact.expanded .task-block-list {
  display: flex;
}

/* ===== タスクアイテム共通 ===== */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1.4;
  transition: background 0.15s;
}

.task-item:hover {
  background: #1e1e3a;
}

/* サブタスクインデント */
.task-item.subtask {
  margin-left: 20px;
  font-size: 12px;
}

/* ===== アイコン ===== */
.task-icon {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  font-size: 13px;
  margin-top: 1px;
}

/* CSSスピナー */
.task-icon.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #1e3a5f;
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: task-spin 0.8s linear infinite;
  flex-shrink: 0;
  margin-top: 3px;
}

@keyframes task-spin {
  to { transform: rotate(360deg); }
}

/* ===== ステータス別スタイル ===== */

/* pending */
.task-item.task-pending {
  color: #8a8ab0;
}

.task-item.task-pending .task-icon {
  color: #4a4a6a;
}

/* in_progress */
.task-item.task-in_progress {
  color: #e0e8ff;
  background: #0d1f3a;
}

.task-item.task-in_progress:hover {
  background: #122040;
}

/* completed */
.task-item.task-completed {
  color: #5a5a7a;
  opacity: 0.65;
}

.task-item.task-completed .task-icon {
  color: #4ade80;
}

.task-item.task-completed .task-subject s {
  text-decoration: line-through;
  text-decoration-color: #4a4a6a;
}

/* failed */
.task-item.task-failed {
  color: #f87171;
  opacity: 0.8;
}

.task-item.task-failed .task-icon {
  color: #f87171;
}

/* cancelled */
.task-item.task-cancelled {
  color: #4a4a6a;
  opacity: 0.5;
}

.task-item.task-cancelled .task-subject s {
  text-decoration: line-through;
}

/* ===== subject ===== */
.task-subject {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

/* ===== blocked by バッジ ===== */
.task-blocked-by {
  font-size: 10px;
  color: #5a5a8a;
  white-space: nowrap;
  margin-top: 2px;
}

/* ===== アニメーション ===== */

/* スライドイン（新規タスク） */
@keyframes task-enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-enter {
  animation: task-enter 0.25s ease-out;
}

/* 完了フラッシュ */
@keyframes task-complete-flash {
  0%   { background: #0d3a1f; }
  50%  { background: #1a5a30; }
  100% { background: transparent; }
}

.animate-complete {
  animation: task-complete-flash 0.5s ease-out;
}

/* 失敗シェイク */
@keyframes task-fail-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-4px); }
  40%       { transform: translateX(4px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}

.animate-fail {
  animation: task-fail-shake 0.4s ease-out;
}

/* ===== レスポンシブ ===== */
@media (max-width: 480px) {
  .task-block {
    font-size: 12px;
    padding: 10px 12px;
  }

  .task-item.subtask {
    margin-left: 14px;
  }
}
