:root {
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-color: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7);
  --success-color: #10b981;
  --danger-color: #ef4444;
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-quick: all 0.15s ease;
}

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

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 540px;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

header {
  text-align: center;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.input-form {
  display: flex;
  gap: 12px;
}

.input-wrapper {
  position: relative;
  flex: 1;
}

.todo-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 1rem;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-normal);
}

.todo-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background-color: rgba(15, 23, 42, 0.8);
}

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

.add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 16px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.add-btn:active {
  transform: translateY(1px);
}

.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 24px;
}

.todo-list::-webkit-scrollbar {
  width: 6px;
}
.todo-list::-webkit-scrollbar-track {
  background: transparent;
}
.todo-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.todo-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 2.5rem;
  opacity: 0.5;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  transition: var(--transition-normal);
  animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  cursor: grab;
}

.todo-item:hover {
  background-color: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.todo-item:active {
  cursor: grabbing;
}

.todo-item.dragging {
  opacity: 0.5;
  background-color: rgba(30, 41, 59, 0.2);
  border: 1px dashed var(--accent-color);
  transform: scale(0.98);
}

.todo-item.editing {
  cursor: default;
}

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

.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: relative;
  height: 24px;
  width: 24px;
  background-color: rgba(15, 23, 42, 0.6);
  border: 2px solid var(--text-muted);
  border-radius: 8px;
  transition: var(--transition-normal);
  flex-shrink: 0;
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--accent-color);
}

.checkbox-container input:checked ~ .checkmark {
  background: var(--accent-gradient);
  border-color: transparent;
  transform: scale(1.05);
}

.checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 8px;
  top: 4px;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark::after {
  display: block;
  animation: checkScale 0.2s ease-in-out forwards;
}

@keyframes checkScale {
  from {
    transform: scale(0) rotate(45deg);
  }
  to {
    transform: scale(1) rotate(45deg);
  }
}

.todo-text {
  font-size: 1rem;
  color: var(--text-primary);
  transition: var(--transition-normal);
  word-break: break-all;
  line-height: 1.5;
  flex: 1;
  margin-left: 16px;
}

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

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-muted);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

.delete-btn:hover {
  color: var(--danger-color);
  background-color: rgba(239, 68, 68, 0.1);
  transform: scale(1.1);
}

.delete-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.clear-completed {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-quick);
  font-size: 0.85rem;
}

.clear-completed:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

@media (max-width: 480px) {
  body {
    padding: 20px 12px;
  }
  
  .app-container {
    padding: 24px 16px;
    border-radius: 20px;
    gap: 20px;
  }
  
  h1 {
    font-size: 1.7rem;
  }
  
  .todo-input {
    padding: 14px 16px;
  }
  
  .add-btn {
    padding: 0 16px;
  }
}

.edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
  margin-left: auto;
}

.edit-btn:hover {
  color: var(--accent-color);
  background-color: rgba(99, 102, 241, 0.1);
  transform: scale(1.1);
}

.edit-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.edit-input {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 12px;
  background-color: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-normal);
  width: 100%;
}

.edit-input:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.todo-item.editing .checkbox-container,
.todo-item.editing .todo-text,
.todo-item.editing .checklist-title,
.todo-item.editing .progress-badge,
.todo-item.editing .edit-btn,
.todo-item.editing .delete-btn {
  display: none;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

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

.header-nav {
  display: flex;
  margin-bottom: 16px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: var(--transition-normal);
}

.back-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.back-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.progress-badge {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 99px;
  background-color: rgba(99, 102, 241, 0.15);
  color: var(--accent-color);
  font-weight: 600;
  margin-left: 12px;
}

.checklist-group-item {
  cursor: pointer;
}

.checklist-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

