/* CSS Variables - Design Tokens */
:root {
  /* Colors */
  --primary: #8b5cf6;
  --primary-light: #a78bfa;
  --secondary: #3b82f6;
  --success: #10b981;
  --destructive: #ef4444;
  --background: #f8fafc;
  --foreground: #1e293b;
  --card: #ffffff;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --input-bg: #f1f5f9;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #8b5cf6, #3b82f6);
  --gradient-bg: linear-gradient(180deg, #f8fafc, #f1f5f9);
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 20px rgba(139, 92, 246, 0.1);
  --shadow-lg: 0 10px 40px rgba(139, 92, 246, 0.2);
  --shadow-glow: 0 0 30px rgba(167, 139, 250, 0.3);
  
  /* Spacing */
  --radius: 12px;
  --radius-lg: 16px;
  
  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gradient-bg);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0rem 1.5rem;
}

/* Header */
header {
  text-align: center;
  animation: fadeIn 0.6s ease-out;
}

header h1 {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-size: 3rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

body.dark {
  --background: #0f172a;
  --foreground: #f1f5f9;
  --card: #1e293b;
  --input-bg: #334155;
  --border: #475569;
  background: var(--background);
  color: var(--foreground);
}

.theme-toggle {
  position: absolute;
  top: 25px;
  right: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  transition: 0.3s;
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: var(--primary-light);
  color: white;
}

header{
  position: relative;
}

header h1 i {
  -webkit-text-fill-color: var(--primary);
  animation: glow 2s ease-in-out infinite;
}

/* Input Section */
.input-section {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  animation: slideUp 0.5s ease-out;
  display: flex;
  gap: 1rem;
}

.input-section input {
  flex: 1;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--foreground);
  transition: var(--transition);
}

.input-section input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.input-section button {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.input-section button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.input-section button:active {
  transform: scale(0.98);
}

/* Stats Section */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  animation: scaleIn 0.4s ease-out;
}

.stats > div {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.stats > div:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stats > div:nth-child(1) {
  color: var(--primary);
}

.stats > div:nth-child(2) {
  color: var(--success);
}

.stats > div:nth-child(3) {
  color: var(--secondary);
}

.stats span {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

/* Clear Button */
.clearbtn {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.4s ease-out;
}

.clearbtn button {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--destructive);
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clearbtn button:hover {
  background: var(--destructive);
  color: white;
  border-color: var(--destructive);
}

/* Tasks Container */
.tasks-container {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  height: 400px;
  overflow-x: scroll;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow-x: hidden;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  color: var(--muted);
  animation: fadeIn 0.6s ease-out;
}

.empty-state i {
  font-size: 6rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state p {
  font-size: 1.125rem;
}

/* Task Item */
.task-item {
  background: rgba(248, 250, 252, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  animation: fadeIn 0.3s ease-out;
}

.task-item:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: var(--shadow-lg);
  transform: translateX(4px);
}

.task-item.checked {
  opacity: 0.7;
}

/* Task Checkbox */
.task-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--success);
  flex-shrink: 0;
}

/* Task Text */
.task-text {
  flex: 1;
  font-size: 1rem;
  word-break: break-word;
  transition: var(--transition);
}

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

/* Task Buttons */
.edit-btn,
.delete-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  flex-shrink: 0;
}

.task-item:hover .edit-btn,
.task-item:hover .delete-btn {
  opacity: 1;
}

.edit-btn {
  color: var(--secondary);
}

.edit-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--secondary);
}

.delete-btn {
  color: var(--destructive);
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--destructive);
}

/* Footer */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  animation: fadeIn 0.6s ease-out;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glow {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.5));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(167, 139, 250, 0.8));
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 2rem 1rem;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .input-section {
    flex-direction: column;
    padding: 1.5rem;
  }
  
  .input-section button {
    width: 100%;
    justify-content: center;
  }
  
  .stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .task-item {
    padding: 0.875rem 1rem;
  }
  
  .edit-btn,
  .delete-btn {
    opacity: 1;
  }

  .theme-toggle {
    top: 5px;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--background);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}