/**
 * チバリヨ - S4 タスク一覧 (Phase 2-B-3)
 *
 * 注: 末尾に mobile-s4-create.js 編集モード用の
 *     削除ボタン (.s4c-danger-zone / .s4c-btn-delete) のスタイルも同梱。
 *     (mobile-s4-create.css を触らずに済ませるため。CSS はグローバルなので動作は同じ)
 */

.s4t-root {
  padding: 12px 12px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- ページヘッダー ---------- */
.s4t-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.s4t-page-title {
  font-size: 20px;
  font-weight: 700;
  color: #1F2937;
  margin: 0;
}

.s4t-refresh {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.s4t-refresh:active {
  background: #E5E7EB;
}

.s4t-refresh svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #6B7280;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 状態表示 ---------- */
.s4t-loading {
  text-align: center;
  color: #9CA3AF;
  padding: 40px 0;
  font-size: 14px;
}

.s4t-error {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.s4t-empty {
  text-align: center;
  padding: 56px 16px 32px;
}

.s4t-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #E1F5EE;
  display: flex;
  align-items: center;
  justify-content: center;
}

.s4t-empty-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #1D9E75;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.s4t-empty-text {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

.s4t-empty-sub {
  margin-top: 6px;
  font-size: 13px;
  color: #9CA3AF;
}

/* ---------- グループ ---------- */
.s4t-group {
  margin-top: 16px;
}

.s4t-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 6px;
}

.s4t-group-label {
  font-size: 13px;
  font-weight: 700;
  color: #6B7280;
  letter-spacing: 0.03em;
}

.s4t-group-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #E5E7EB;
  color: #6B7280;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.s4t-group-overdue .s4t-group-label { color: #B91C1C; }
.s4t-group-overdue .s4t-group-count { background: #FEE2E2; color: #B91C1C; }

.s4t-group-today .s4t-group-label { color: #0F6E56; }
.s4t-group-today .s4t-group-count { background: #E1F5EE; color: #0F6E56; }

/* ---------- カード (スワイプ対応) ---------- */
.s4t-card-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
  background: #F3F4F6;
}

/* スワイプ時に背後に見えるアクション層 */
.s4t-action {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.s4t-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.s4t-action-complete {
  left: 0;
  background: #1D9E75;
  border-radius: 12px 0 0 12px;
}

.s4t-action-edit {
  right: 0;
  background: #64748B;
  border-radius: 0 12px 12px 0;
}

.s4t-card-wrap.is-swiping-right .s4t-action-complete { opacity: 1; }
.s4t-card-wrap.is-swiping-left .s4t-action-edit { opacity: 1; }

.s4t-card-wrap.is-swiping-right { background: #1D9E75; }
.s4t-card-wrap.is-swiping-left { background: #64748B; }

.s4t-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  transition: transform 0.18s ease;
  touch-action: pan-y;
}

/* ---------- 完了チェック ---------- */
.s4t-check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 2px solid #D1D5DB;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.s4t-check:active {
  border-color: #1D9E75;
  background: #E1F5EE;
}

.s4t-check.is-checked {
  border-color: #1D9E75;
  background: #1D9E75;
}

.s4t-check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 本文 ---------- */
.s4t-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.s4t-title {
  font-size: 15px;
  font-weight: 600;
  color: #1F2937;
  line-height: 1.4;
  word-break: break-word;
}

.s4t-meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: #6B7280;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.s4t-meta-sep {
  color: #D1D5DB;
  margin: 0 2px;
}

.s4t-due-overdue {
  color: #B91C1C;
  font-weight: 700;
}

.s4t-group-today .s4t-due {
  color: #0F6E56;
  font-weight: 700;
}

.s4t-client {
  word-break: break-all;
}

.s4t-note {
  margin-top: 4px;
  font-size: 12.5px;
  color: #9CA3AF;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 完了済みセクション ---------- */
.s4t-done-section {
  margin-top: 24px;
  border-top: 1px solid #E5E7EB;
  padding-top: 8px;
}

.s4t-done-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.s4t-done-toggle-label {
  font-size: 13px;
  font-weight: 700;
  color: #6B7280;
}

.s4t-done-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #E5E7EB;
  color: #6B7280;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.s4t-done-chevron {
  width: 18px;
  height: 18px;
  margin-left: auto;
  fill: none;
  stroke: #9CA3AF;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
}

.s4t-done-chevron.is-open {
  transform: rotate(180deg);
}

.s4t-card-wrap.is-done {
  background: transparent;
}

.s4t-card-wrap.is-done .s4t-card {
  background: #F9FAFB;
  border-color: #F3F4F6;
}

.s4t-card-wrap.is-done .s4t-title {
  color: #9CA3AF;
  text-decoration: line-through;
  font-weight: 500;
}

.s4t-card-wrap.is-done .s4t-meta {
  color: #B9BFC9;
}

.s4t-card-wrap.is-done .s4t-body {
  cursor: default;
}

/* =====================================================================
 * mobile-s4-create.js 編集モード用 (削除ボタン)
 * =================================================================== */

.s4c-danger-zone {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed #FECACA;
  text-align: center;
}

.s4c-btn-delete {
  border: 1px solid #FCA5A5;
  background: #fff;
  color: #B91C1C;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.s4c-btn-delete:active {
  background: #FEF2F2;
}

.s4c-btn-delete:disabled {
  opacity: 0.5;
  cursor: default;
}
