/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #202124;
  background: #f8f9fa;
  line-height: 1.5;
  min-height: 100vh;
}

/* === Landing Page === */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.landing-container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}
.landing-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 36px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.landing-icon { color: #6366f1; margin-bottom: 16px; }
.landing-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}
.landing-subtitle {
  color: #5f6368;
  margin-bottom: 32px;
  font-size: 15px;
}
.landing-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.landing-card input {
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.landing-card input:focus { border-color: #6366f1; }
.landing-card button {
  padding: 14px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.landing-card button:hover { background: #4f46e5; }
.landing-card button:disabled { opacity: 0.6; cursor: not-allowed; }
.landing-note {
  color: #9aa0a6;
  font-size: 12px;
  margin-top: 20px;
}

/* === App Layout === */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* === Header === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  gap: 16px;
}
.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.header-left h1 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}
.header-center {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.header-members {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.header-avatar:hover { transform: scale(1.1); }
.header-avatar.active { border-color: #202124; }
.header-avatar.add-member {
  background: #fff !important;
  color: #5f6368;
  border: 2px dashed #dadce0;
  font-size: 18px;
  font-weight: 400;
}
.header-avatar.add-member:hover { border-color: #6366f1; color: #6366f1; }
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.filter-select {
  padding: 6px 10px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #202124;
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: #6366f1; }
.filter-clear {
  padding: 6px 12px;
  background: none;
  border: none;
  color: #6366f1;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.filter-clear:hover { text-decoration: underline; }

/* === Board Container (Kanban) === */
.board-container {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-start;
}
.board-container .loading {
  text-align: center;
  color: #9aa0a6;
  padding: 40px;
  width: 100%;
}

/* === Kanban Column === */
.kanban-column {
  width: 290px;
  min-width: 290px;
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: hidden;
}
.column-header {
  padding: 12px 14px 10px;
  border-top: 3px solid #888;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.column-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.column-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.column-count {
  font-size: 12px;
  color: #9aa0a6;
  background: #f1f3f4;
  padding: 1px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}
.column-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: none;
  color: #9aa0a6;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.column-menu-btn:hover { background: #f1f3f4; color: #5f6368; }

/* Column body (scrollable task area) */
.column-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* === Kanban Card === */
.kanban-card {
  padding: 10px 12px;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-color: #d0d0d0; }
.kanban-card.overdue { border-left: 3px solid #ef4444; }
.kanban-card.due-today { border-left: 3px solid #f97316; }
.kanban-card.due-soon { border-left: 3px solid #eab308; }

.kanban-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.kanban-card .task-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #dadce0;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.kanban-card .task-checkbox:hover { border-color: #6366f1; }
.kanban-card .task-checkbox.checked {
  background: #6366f1;
  border-color: #6366f1;
}
.kanban-card .task-checkbox.checked::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
  flex: 1;
  line-height: 1.4;
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  margin-left: 26px;
  font-size: 11px;
  color: #5f6368;
  flex-wrap: wrap;
}
.kanban-card-meta .meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #eef0f2;
  white-space: nowrap;
}
.kanban-card-meta .meta-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 9px;
  font-weight: 600;
}
.kanban-card-meta .meta-status {
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.kanban-card-meta .meta-status.status-todo { background: #f1f3f4; color: #5f6368; }
.kanban-card-meta .meta-status.status-in_progress { background: #e0f2fe; color: #0284c7; }
.kanban-card-meta .meta-due { display: inline-flex; align-items: center; gap: 3px; }
.kanban-card-meta .meta-due.overdue { color: #ef4444; font-weight: 600; }
.kanban-card-meta .meta-due.today { color: #f97316; font-weight: 500; }
.kanban-card-meta .meta-due.soon { color: #ca8a04; }
.kanban-card-meta .meta-priority-urgent { background: #fef2f2; color: #dc2626; font-weight: 600; }
.kanban-card-meta .meta-priority-high { background: #fff7ed; color: #ea580c; font-weight: 500; }

/* === Add Task in Column === */
.column-add-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #9aa0a6;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.column-add-btn:hover { background: #f1f3f4; color: #5f6368; }

/* === Completed Section (Google To-Do style) === */
.completed-section {
  flex-shrink: 0;
  border-top: 1px solid #e8eaed;
}
.completed-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: #5f6368;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.completed-toggle:hover { background: #f1f3f4; }
.completed-toggle .toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}
.completed-toggle .toggle-arrow.expanded { transform: rotate(90deg); }
.completed-tasks {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.completed-tasks .kanban-card {
  opacity: 0.55;
}
.completed-tasks .kanban-card .kanban-card-title {
  text-decoration: line-through;
}

/* === Add Project Column === */
.add-project-column {
  width: 290px;
  min-width: 290px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  flex-shrink: 0;
}
.add-project-btn {
  width: 100%;
  padding: 14px;
  background: none;
  border: 2px dashed #dadce0;
  border-radius: 12px;
  color: #9aa0a6;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.add-project-btn:hover { border-color: #6366f1; color: #6366f1; background: #fafafe; }

/* === Column Context Menu === */
.column-context-menu {
  position: fixed;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 150;
  min-width: 160px;
  padding: 4px 0;
}
.column-context-menu button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  color: #202124;
  transition: background 0.1s;
}
.column-context-menu button:hover { background: #f1f3f4; }
.column-context-menu button.danger { color: #dc2626; }
.column-context-menu button.danger:hover { background: #fef2f2; }

/* === Detail Panel === */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 100;
}
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.detail-panel.open { transform: translateX(0); }
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
}
.detail-header h3 { font-size: 16px; font-weight: 600; }
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #5f6368;
  margin-bottom: 4px;
}
.detail-input, .detail-textarea, .detail-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.detail-input:focus, .detail-textarea:focus, .detail-select:focus { border-color: #6366f1; }
.detail-textarea { resize: vertical; min-height: 60px; }
.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.detail-footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid #e0e0e0;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.16);
  z-index: 201;
  width: 360px;
  max-width: 90vw;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-body input, .modal-body select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}
.modal-body input:focus, .modal-body select:focus { border-color: #6366f1; }
.modal-body label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #5f6368;
  margin-bottom: 4px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #e0e0e0;
}

/* === Buttons === */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-save { background: #6366f1; color: #fff; }
.btn-save:hover { background: #4f46e5; }
.btn-secondary { background: #f1f3f4; color: #5f6368; }
.btn-secondary:hover { background: #e0e0e0; }
.btn-danger { background: #fef2f2; color: #dc2626; }
.btn-danger:hover { background: #fee2e2; }
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: none;
  color: #5f6368;
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: #f1f3f4; }

/* === Color Picker (for modal) === */
.color-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 12px;
}
.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}
.color-option.selected { border-color: #202124; }
.color-option:hover { border-color: #9aa0a6; }

/* === Empty state === */
.loading {
  text-align: center;
  color: #9aa0a6;
  padding: 40px;
}
.empty-state {
  text-align: center;
  color: #9aa0a6;
  padding: 60px 20px;
}
.empty-state svg { margin-bottom: 12px; color: #dadce0; }
.empty-state p { font-size: 14px; }

/* === Responsive === */
@media (max-width: 768px) {
  .header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .header-center { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .header-right { flex-wrap: wrap; }
  .detail-panel { width: 100vw; }
  .kanban-column { width: 260px; min-width: 260px; }
  .add-project-column { width: 260px; min-width: 260px; }
  .board-container { padding: 12px; gap: 12px; }
}
