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

:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-glass: rgba(255, 255, 255, 0.25);
  --bg-glass-strong: rgba(255, 255, 255, 0.4);
  --border-glass: rgba(255, 255, 255, 0.18);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.3s ease;
}

[data-theme="dark"] {
  --bg-glass: rgba(20, 24, 35, 0.4);
  --bg-glass-strong: rgba(20, 24, 35, 0.6);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--primary-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.background-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-gradient);
  z-index: -1;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Header */
.header {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  padding: 30px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideDown 0.6s ease-out;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  color: white;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-hover);
}

.header h1 {
  font-size: 2em;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 5px;
}

.header p {
  color: var(--text-secondary);
  font-size: 1.1em;
  font-weight: 500;
}

.theme-toggle {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.theme-icon {
  font-size: 1.5em;
}

/* Stats Section */
.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  animation: slideUp 0.6s ease-out 0.1s both;
}

.stat-card {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  font-size: 2.5em;
}

.stat-number {
  font-size: 2.2em;
  font-weight: 700;
  color: var(--text-primary);
  transition: var(--transition);
}

.stat-label {
  font-size: 0.9em;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Input Section */
.input-section {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  padding: 30px;
  margin-bottom: 20px;
  animation: slideUp 0.6s ease-out 0.2s both;
}

.input-header {
  margin-bottom: 20px;
}

.input-header h2 {
  color: var(--text-primary);
  font-size: 1.5em;
  font-weight: 700;
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.task-input {
  width: 100%;
  padding: 18px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-size: 1.1em;
  background: rgba(255, 255, 255, 0.9);
  transition: var(--transition);
  color: var(--text-primary);
  font-weight: 500;
}

.task-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.char-counter {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85em;
  color: var(--text-secondary);
  font-weight: 600;
}

.input-controls {
  display: flex;
  gap: 15px;
  align-items: flex-end;
}

.priority-group {
  flex: 1;
}

.priority-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.priority-select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid rgba(209, 213, 219, 0.3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.priority-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
  padding: 12px 30px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-add {
  background: var(--primary-gradient);
  color: white;
}

.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.btn-export {
  background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
  color: white;
}

.btn-export:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(81, 207, 102, 0.4);
}

.btn-import {
  background: linear-gradient(135deg, #339af0 0%, #228be6 100%);
  color: white;
}

.btn-import:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(51, 154, 240, 0.4);
}

/* Filters Section */
.filters-section {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  animation: slideUp 0.6s ease-out 0.3s both;
}

.filter-label {
  font-size: 0.9em;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 15px;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 600;
  transition: var(--transition);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
}

.filter-btn.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-hover);
}

/* Tasks Section */
.tasks-section {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  padding: 30px;
  margin-bottom: 20px;
  animation: slideUp 0.6s ease-out 0.4s both;
}

.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid rgba(209, 213, 219, 0.3);
}

.tasks-header h2 {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text-primary);
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
}

.task-item {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(209, 213, 219, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: var(--transition);
  animation: taskSlide 0.4s ease-out;
  position: relative;
}

.task-item:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-hover);
  background: rgba(255, 255, 255, 0.95);
}

.task-item.completed {
  opacity: 0.7;
  background: rgba(34, 197, 94, 0.1);
}

.task-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.task-checkbox.checked {
  background: linear-gradient(135deg, #51cf66, #40c057);
  border-color: transparent;
  color: white;
  font-weight: 700;
}

.priority-indicator {
  width: 4px;
  height: 50px;
  border-radius: 4px;
}

.priority-high { background: #ff6b6b; }
.priority-medium { background: #ffa94d; }
.priority-low { background: #51cf66; }

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.task-text {
  font-size: 1.05em;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

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

.task-meta {
  font-size: 0.85em;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
}

.priority-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
}

.priority-badge.priority-high {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.priority-badge.priority-medium {
  background: rgba(255, 169, 77, 0.2);
  color: #ffa94d;
}

.priority-badge.priority-low {
  background: rgba(81, 207, 102, 0.2);
  color: #51cf66;
}

.task-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 1.2em;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: scale(1.1);
}

.complete-btn { color: #51cf66; }
.edit-btn { color: #339af0; }
.delete-btn { color: #ff6b6b; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 4em;
  margin-bottom: 20px;
}

.empty-state h3 {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 1.05em;
}

/* Tools Section */
.tools-section {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 25px;
  animation: slideUp 0.6s ease-out 0.5s both;
}

.tools-section h3 {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.tool-buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

/* Notifications */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-left: 4px solid;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-glass);
  min-width: 300px;
  animation: slideIn 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 12px;
}

.notification.success { border-left-color: #51cf66; }
.notification.warning { border-left-color: #ffa94d; }
.notification.error { border-left-color: #ff6b6b; }
.notification.info { border-left-color: #339af0; }

.notification-icon {
  font-size: 1.3em;
}

.notification-message {
  font-weight: 600;
  color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

.loading-overlay p {
  color: white;
  font-size: 1.2em;
  font-weight: 600;
}

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

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

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

@keyframes taskSlide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hidden { display: none !important; }

/* Responsive */
@media(max-width:768px){
  .container { padding: 15px; }
  .header { flex-direction: column; gap: 20px; }
  .header-left { flex-direction: column; text-align: center; }
  .stats-section { grid-template-columns: 1fr; }
  .input-controls { flex-direction: column; }
  .btn { width: 100%; }
  .filter-buttons { justify-content: center; }
  .tasks-header { flex-direction: column; gap: 15px; align-items: stretch; }
  .task-item { flex-wrap: wrap; }
  .task-actions { width: 100%; justify-content: flex-end; }
  .notification-container { left: 15px; right: 15px; }
  .notification { min-width: auto; }
}