/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Background */
  --bg-body:       #eef2ff;
  --bg-card:       #ffffff;
  --bg-card-hover: #fafbff;
  --bg-input:      #f5f7ff;

  /* Workspace colors */
  --ws-work-color:     #6366f1;
  --ws-work-bg:        #eef2ff;
  --ws-personal-color: #ec4899;
  --ws-personal-bg:    #fdf2f8;

  /* Borders */
  --border:        rgba(100, 116, 200, 0.15);
  --border-focus:  rgba(99, 102, 241, 0.5);

  /* Accent colors */
  --accent-indigo: #6366f1;
  --accent-violet: #8b5cf6;
  --accent-blue:   #3b82f6;
  --accent-pink:   #ec4899;
  --accent-teal:   #0d9488;
  --accent-orange: #f97316;

  /* Text */
  --text-primary:   #1e1b4b;
  --text-secondary: #4338ca;
  --text-body:      #374151;
  --text-muted:     #9ca3af;

  /* Priority */
  --priority-low:    #0891b2;
  --priority-medium: #d97706;
  --priority-high:   #dc2626;

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Shadows */
  --shadow-sm:   0 2px 8px  rgba(99, 102, 241, 0.08);
  --shadow-card: 0 4px 24px rgba(99, 102, 241, 0.10);
  --shadow-lift: 0 8px 32px rgba(99, 102, 241, 0.16);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-body);
  color: var(--text-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== BACKGROUND PATTERN ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(165, 180, 252, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 95% 95%,  rgba(196, 181, 253, 0.30) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%,  rgba(224, 231, 255, 0.20) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== FLOATING ORBS ===== */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.40;
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 14s ease-in-out infinite alternate;
}

.orb-1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, #c7d2fe, transparent 70%);
  top: -160px; left: -120px;
  animation-duration: 16s;
}

.orb-2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, #ddd6fe, transparent 70%);
  bottom: -100px; right: -80px;
  animation-duration: 12s;
}

.orb-3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, #fbcfe8, transparent 70%);
  top: 35%; left: 65%;
  animation-duration: 20s;
}

@keyframes floatOrb {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(24px, 32px) scale(1.08); }
}

/* ===== APP CONTAINER ===== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}

/* ===== WORKSPACE SWITCHER ===== */
.workspace-switcher {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.workspace-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.workspace-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.workspace-btn:hover {
  border-color: var(--ws-work-color);
  color: var(--ws-work-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.workspace-btn[data-workspace="個人"]:hover {
  border-color: var(--ws-personal-color);
  color: var(--ws-personal-color);
}

.workspace-btn.active[data-workspace="仕事"] {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-color: var(--ws-work-color);
  color: var(--ws-work-color);
  box-shadow: 0 4px 20px rgba(99,102,241,0.20);
}

.workspace-btn.active[data-workspace="個人"] {
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
  border-color: var(--ws-personal-color);
  color: var(--ws-personal-color);
  box-shadow: 0 4px 20px rgba(236,72,153,0.20);
}

.ws-icon { font-size: 22px; }

.ws-label { font-size: 17px; font-weight: 800; }

.ws-count {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 100px;
  background: rgba(99,102,241,0.12);
  color: var(--ws-work-color);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.workspace-btn.active[data-workspace="個人"] .ws-count {
  background: rgba(236,72,153,0.12);
  color: var(--ws-personal-color);
}

/* ===== WHITE CARD ===== */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.header-left { display: flex; flex-direction: column; gap: 4px; }

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

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.5));
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 2px  6px rgba(99,102,241,0.5)); }
  50%       { filter: drop-shadow(0 4px 14px rgba(99,102,241,0.8)); }
}

.logo-text {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.header-date {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 38px;
}

/* ===== PROGRESS RING ===== */
.progress-ring-container {
  position: relative;
  width: 60px;
  height: 60px;
  cursor: default;
}

.progress-ring {
  width: 60px;
  height: 60px;
  transform: rotate(-90deg);
}

.progress-ring-track {
  fill: none;
  stroke: #e0e7ff;
  stroke-width: 5;
}

.progress-ring-fill {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 150.8;
  stroke-dashoffset: 150.8;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.6));
}

.progress-ring-container::before {
  content: '';
  display: none;
}

.progress-percent {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-indigo);
  white-space: nowrap;
}

/* ===== STATS BAR ===== */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 32px;
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  transition: all var(--transition);
}

.stat-number.stat-active { color: var(--accent-indigo); }
.stat-number.stat-done   { color: var(--accent-teal);   }

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* ===== ADD TASK CARD ===== */
.add-task-card {
  padding: 28px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.task-input {
  flex: 1;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}

.task-input::placeholder { color: var(--text-muted); }

.task-input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.add-btn {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 300;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  color: white;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}

.add-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.50);
}

.add-btn:active { transform: scale(0.95); }
.add-btn-icon { line-height: 1; margin-top: -2px; }

/* ===== META ROW ===== */
.task-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.meta-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ===== PILLS ===== */
.category-pills,
.priority-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  padding: 5px 12px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
  background: #eef2ff;
}

.pill.active {
  background: #eef2ff;
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

.priority-low.active    { background: #ecfeff; border-color: var(--priority-low);    color: var(--priority-low); }
.priority-medium.active { background: #fffbeb; border-color: var(--priority-medium); color: var(--priority-medium); }
.priority-high.active   { background: #fef2f2; border-color: var(--priority-high);   color: var(--priority-high); }

/* ===== DATE INPUT ===== */
.date-input {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--text-body);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
  color-scheme: light;
}

.date-input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.10);
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-tabs {
  display: flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.filter-tab {
  padding: 7px 18px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-tab:hover { color: var(--accent-indigo); }

.filter-tab.active {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  color: white;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

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

.sort-select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--text-body);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
  color-scheme: light;
  box-shadow: var(--shadow-sm);
}

.sort-select:focus { border-color: var(--border-focus); }

.clear-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(220, 38, 38, 0.25);
  background: #fef2f2;
  color: #dc2626;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.clear-btn:hover {
  background: #fee2e2;
  border-color: rgba(220, 38, 38, 0.45);
}

/* ===== TASK LIST ===== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== TASK CARD ===== */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  box-shadow: var(--shadow-sm);
}

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

.task-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.22);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.task-card.completed { opacity: 0.60; }

.task-card.completed .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Priority left border */
.task-card[data-priority="高"] { border-left: 3px solid var(--priority-high); }
.task-card[data-priority="中"] { border-left: 3px solid var(--priority-medium); }
.task-card[data-priority="低"] { border-left: 3px solid var(--priority-low); }

/* ===== CHECKBOX ===== */
.task-checkbox-wrap {
  flex-shrink: 0;
  margin-top: 2px;
}

.task-checkbox { display: none; }

.task-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #c7d2fe;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  background: #fff;
}

.task-checkbox-label:hover {
  border-color: var(--accent-indigo);
  background: #eef2ff;
}

.task-checkbox:checked + .task-checkbox-label {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.40);
}

.task-checkbox:checked + .task-checkbox-label::after {
  content: '✓';
  font-size: 13px;
  color: white;
  font-weight: 700;
}

/* ===== TASK BODY ===== */
.task-body { flex: 1; min-width: 0; }

.task-text-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.task-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
  transition: all var(--transition);
}

.task-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 100px;
  letter-spacing: 0.3px;
}

/* 仕事カテゴリ */
.badge-cat-プロジェクト { background: #ede9fe; color: #7c3aed; }
.badge-cat-会議         { background: #dbeafe; color: #1d4ed8; }
.badge-cat-レポート     { background: #fef3c7; color: #b45309; }
.badge-cat-開発         { background: #d1fae5; color: #047857; }
/* 個人カテゴリ */
.badge-cat-健康   { background: #dcfce7; color: #15803d; }
.badge-cat-学習   { background: #dbeafe; color: #1d4ed8; }
.badge-cat-趣味   { background: #fce7f3; color: #be185d; }
.badge-cat-家事   { background: #fef9c3; color: #a16207; }
/* 共通 */
.badge-cat-その他 { background: #f3f4f6; color: #6b7280; }

.badge-priority-高 { background: #fef2f2; color: #dc2626; }
.badge-priority-中 { background: #fffbeb; color: #d97706; }
.badge-priority-低 { background: #ecfeff; color: #0891b2; }

.task-due {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.task-due.overdue { color: #dc2626; }

/* ===== TASK ACTIONS ===== */
.task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.task-card:hover .task-actions { opacity: 1; }

.task-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.task-action-btn:hover { transform: scale(1.1); }

.task-action-btn.edit-btn:hover   { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.task-action-btn.delete-btn:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

/* ===== EDIT MODE ===== */
.task-edit-input {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--border-focus);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  margin-bottom: 4px;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.10);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 64px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

.empty-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== FOOTER ===== */
.app-footer {
  text-align: center;
  padding-top: 40px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.18);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  opacity: 0;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f4ff; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .app-container { padding: 20px 14px 48px; }
  .workspace-switcher { gap: 8px; }
  .workspace-btn { padding: 14px 12px; font-size: 14px; }
  .ws-label { font-size: 14px; }
  .stats-bar { padding: 12px 16px; }
  .stat-item { padding: 0 16px; }
  .add-task-card { padding: 20px 16px; }
  .task-meta-row { flex-direction: column; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .filter-right { flex-wrap: wrap; }
  .logo-text { font-size: 22px; }
}
