:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --light-bg: #f8fafc;
  --dark-bg: #0f172a;
  --card-bg: #ffffff;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #f1f5f9;
  --border-color: #e2e8f0;
  --transition-normal: all 0.3s ease;
  --transition-fast: all 0.15s ease;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --font-primary: 'Montserrat', sans-serif;
  --font-secondary: 'Open Sans', sans-serif;
}

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

body {
  font-family: var(--font-secondary);
  background-color: var(--light-bg);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  transition: var(--transition-normal);
}

body.dark-mode {
  --light-bg: #0f172a;
  --dark-bg: #1e293b;
  --card-bg: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --border-color: #334155;
}

button {
  cursor: pointer;
  font-family: var(--font-primary);
}

input[type="text"], input[type="search"] {
  font-family: var(--font-secondary);
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Styles */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--card-bg);
  box-shadow: var(--card-shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.75rem;
  color: var(--primary-color);
}

.app-header h1 {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--primary-color);
  background-color: var(--border-color);
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  flex: 1;
  height: calc(100vh - 4rem);
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: var(--card-bg);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.user-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.avatar {
  width: 60px;
  height: 60px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.user-profile p {
  font-weight: 600;
  color: var(--text-secondary);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition-fast);
  text-align: left;
}

.nav-item:hover {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
}

.nav-item.active {
  background-color: var(--primary-color);
  color: white;
}

.task-stats {
  margin-top: auto;
}

.stat-card {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  color: white;
  text-align: center;
}

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-card p {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Main Task Board */
.task-board {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.board-header h2 {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 1.5rem;
}

.task-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.search-container {
  position: relative;
}

.search-container i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

#search-tasks {
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 250px;
  background-color: var(--card-bg);
  color: var(--text-primary);
  transition: var(--transition-fast);
}

#search-tasks:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.add-task-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: var(--transition-fast);
}

.add-task-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.task-input-panel {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  transition: var(--transition-normal);
  transform-origin: top center;
}

.task-input-panel.hidden {
  display: none;
  opacity: 0;
  transform: scaleY(0.8);
}

#new-task {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background-color: var(--card-bg);
  color: var(--text-primary);
  margin-bottom: 1rem;
}

#new-task:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.task-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

#cancel-add {
  padding: 0.625rem 1.25rem;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
}

#add-button {
  padding: 0.625rem 1.25rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
}

/* Task Grid */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.task-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  transition: var(--transition-normal);
  position: relative;
  animation: fade-in 0.3s ease-out forwards;
}

.task-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.task-card.completed {
  border-left: 4px solid var(--success-color);
}

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

.task-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.task-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-right: 0.75rem;
  position: relative;
  cursor: pointer;
  transition: var(--transition-fast);
}

.task-checkbox:checked {
  background-color: var(--success-color);
  border-color: var(--success-color);
}

.task-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.75rem;
}

.task-text {
  font-weight: 500;
  font-size: 1.125rem;
  line-height: 1.4;
  word-break: break-word;
  margin-bottom: 0.5rem;
  transition: var(--transition-normal);
}

.task-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.task-card-actions button {
  background: none;
  border: none;
  font-size: 1rem;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.task-card-actions button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.task-card-actions .edit-btn:hover {
  color: var(--primary-color);
}

.task-card-actions .delete-btn:hover {
  color: var(--danger-color);
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
    height: auto;
  }
  
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
  }
  
  .user-profile {
    flex-direction: row;
    gap: 1rem;
    padding-bottom: 1rem;
  }
  
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  
  .nav-item {
    flex-shrink: 0;
  }
  
  .task-stats {
    margin-top: 1rem;
  }
  
  .board-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .task-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .search-container, #search-tasks {
    width: 100%;
  }
  
  .add-task-btn {
    width: 100%;
    justify-content: center;
  }
  
  .task-grid {
    grid-template-columns: 1fr;
  }
}
