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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

.container {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 32px 24px 24px;
  color: white;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.9rem;
  opacity: 0.85;
}

.version-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

.input-section {
  padding: 24px;
  border-bottom: 1px solid #f0f0f0;
}

.input-wrapper {
  display: flex;
  gap: 10px;
}

input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: #667eea;
}

#addBtn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}

#addBtn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

#addBtn:active {
  transform: translateY(0);
}

.filters {
  display: flex;
  gap: 8px;
  padding: 16px 24px 0;
}

.filter-btn {
  padding: 6px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  background: white;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #666;
}

.filter-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.filter-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  font-size: 0.85rem;
  color: #999;
}

.clear-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.clear-btn:hover {
  color: #e74c3c;
  background: #ffeaea;
}

.todo-list {
  list-style: none;
  padding: 0 24px 24px;
  max-height: 400px;
  overflow-y: auto;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
  animation: slideIn 0.2s ease;
}

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

.todo-item:last-child {
  border-bottom: none;
}

.todo-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid #ddd;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.todo-checkbox:hover {
  border-color: #667eea;
}

.todo-checkbox.checked {
  background: #667eea;
  border-color: #667eea;
}

.todo-checkbox.checked::after {
  content: '✓';
  color: white;
  font-size: 13px;
  font-weight: bold;
}

.todo-text {
  flex: 1;
  font-size: 1rem;
  color: #333;
  word-break: break-word;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}

.todo-text:hover {
  background: #f5f5f5;
}

.todo-text.completed {
  text-decoration: line-through;
  color: #bbb;
}

.todo-text.editing {
  outline: 2px solid #667eea;
  background: #f8f8ff;
}

.delete-btn {
  background: none;
  border: none;
  color: #ddd;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.delete-btn:hover {
  color: #e74c3c;
  background: #ffeaea;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: #999;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #f0f0f0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error {
  margin: 0 24px 16px;
  padding: 12px 16px;
  background: #ffeaea;
  border: 1px solid #ffcccc;
  border-radius: 8px;
  color: #e74c3c;
  font-size: 0.9rem;
}

.empty {
  text-align: center;
  padding: 32px;
  color: #bbb;
  font-size: 0.95rem;
}

/* Scrollbar styling */
.todo-list::-webkit-scrollbar {
  width: 4px;
}
.todo-list::-webkit-scrollbar-track {
  background: #f5f5f5;
}
.todo-list::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}
