/* Base Variables & Reset */
:root {
  /* Color Palette */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #10b981;
  --accent: #f59e0b;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;

  /* Neutrals */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-sidebar-light: #334155;

  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-on-dark: #f1f5f9;
  --text-on-dark-light: #cbd5e1;

  /* Borders & Shadows */
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Spacing & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 280px;
  --detail-width: 320px;
}

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

html,
body {
  height: 100%;
  font-family:
    "Poppins",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Oxygen,
    Ubuntu,
    sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
}

/* App Container */
.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  position: relative;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}

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

.menu-toggle:active {
  transform: translateY(0);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, #1a2332 100%);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  transition: transform var(--transition-base);
  z-index: 999;
  height: 100vh;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.app-tagline {
  color: var(--text-on-dark-light);
  font-size: 14px;
  opacity: 0.8;
}

/* User Profile */
.user-profile {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-info p {
  font-size: 13px;
  color: var(--text-on-dark-light);
  opacity: 0.8;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.nav-section {
  padding: 0 20px;
}

.nav-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-on-dark-light);
  opacity: 0.6;
  margin-bottom: 12px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-on-dark-light);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  margin-bottom: 4px;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-on-dark);
  transform: translateX(4px);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-on-dark);
  border-left: 3px solid var(--primary);
}

.nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item span:not(.nav-count):not(.category-color) {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
}

.nav-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* Category Colors */
.category-color,
.category-badge {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.category-color.work,
.category-badge.work {
  background: #3b82f6;
}
.category-color.personal,
.category-badge.personal {
  background: #10b981;
}
.category-color.health,
.category-badge.health {
  background: #ef4444;
}
.category-color.learning,
.category-badge.learning {
  background: #f59e0b;
}
.category-color.other,
.category-badge.other {
  background: #8b5cf6;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 20px;
  margin-top: auto;
}

.btn-upgrade {
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-upgrade:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 1fr var(--detail-width);
  grid-template-rows: auto auto 1fr;
  gap: 0;
}

/* Main Header */
.main-header {
  grid-column: 1 / -1;
  padding: 24px 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.header-left h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.header-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.header-subtitle span {
  color: var(--primary);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.header-stats {
  display: flex;
  gap: 24px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-surface);
  border-color: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
}

.btn-icon .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.btn-primary {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  flex-shrink: 0;
}

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

/* Quick Actions */
.quick-actions {
  grid-column: 1 / -1;
  padding: 20px 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.search-container {
  flex: 1;
  max-width: 400px;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-container i {
  position: absolute;
  left: 16px;
  color: var(--text-light);
  font-size: 16px;
}

.search-container input {
  width: 100%;
  padding: 14px 48px 14px 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.search-container input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 14px;
  transition: color var(--transition-base);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.btn-clear-search:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.quick-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--bg-surface);
  border-color: var(--primary-light);
  color: var(--primary);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.section-wrapper {
  max-height: 76vh;
  overflow-y: auto;
}

/* Task Creator */
.task-creator {
  grid-column: 1;
  margin: 24px 32px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  height: max-content;
}

.task-creator.active {
  display: block;
  animation: slideDown 0.3s ease-out;
}

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

.creator-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.creator-header h3 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.creator-header h3 i {
  color: var(--primary);
}

.btn-close-creator {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.btn-close-creator:hover {
  background: var(--bg-secondary);
  color: var(--danger);
}

.task-form {
  padding: 24px;
}

.task-title-input {
  width: 100%;
  padding: 20px 24px;
  font-size: 18px;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: all var(--transition-base);
  margin-bottom: 24px;
  font-family: inherit;
}

.task-title-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.form-group label i {
  color: var(--primary-light);
}

.form-group input[type="date"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-base);
  font-family: inherit;
}

.form-group input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.priority-selector,
.category-selector,
.quick-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.priority-option,
.category-option,
.quick-action {
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.priority-option:hover,
.category-option:hover,
.quick-action:hover {
  background: var(--bg-surface);
  transform: translateY(-2px);
  border-color: var(--primary-light);
  color: var(--primary);
}

.priority-option.active,
.category-option.active {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-dot.low {
  background: var(--success);
}
.priority-dot.med {
  background: var(--warning);
}
.priority-dot.high {
  background: var(--danger);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.btn-secondary {
  padding: 12px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-submit {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Task List Section */
.task-list-section {
  margin: 32px;
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-header h3 {
  font-size: 20px;
  font-weight: 600;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sort-controls label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.sort-select {
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary);
}

.task-list-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  min-height: 400px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state.hidden {
  display: none;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 32px;
  color: var(--text-light);
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 300px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Task List */
.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition-base);
  cursor: move;
  position: relative;
}

.task-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.task-item.done {
  opacity: 0.7;
  background: var(--bg-secondary);
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-light);
}

.task-item.dragging {
  opacity: 0.5;
  background: var(--bg-secondary);
  border: 2px dashed var(--primary);
}

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

.task-checkbox:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

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

.task-checkbox i {
  font-size: 12px;
}

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.task-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.task-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.task-priority {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.task-priority.high {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.task-priority.med,
.task-priority.medium {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.task-priority.low {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.task-date {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.task-date.overdue {
  color: var(--danger);
  font-weight: 600;
}

.task-category {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.task-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--transition-base);
  flex-shrink: 0;
}

.task-item:hover .task-actions {
  opacity: 1;
}

.task-action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.task-action-btn:hover {
  background: var(--bg-surface);
  border-color: var(--primary-light);
  color: var(--primary);
}

.task-action-btn.delete:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Task Detail */
.task-detail {
  grid-column: 2;
  grid-row: 3 / 5;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: calc(100vh - 200px);
}

.detail-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.btn-close-detail {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.btn-close-detail:hover {
  background: var(--bg-secondary);
  color: var(--danger);
}

.detail-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  text-align: center;
  gap: 16px;
}

.detail-placeholder i {
  font-size: 48px;
  opacity: 0.5;
}

.detail-placeholder p {
  font-size: 14px;
  max-width: 200px;
  line-height: 1.5;
}

/* Task Detail View */
.task-detail-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 16px;
}

.detail-header-row h4 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  word-break: break-word;
}

.task-status {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.task-status.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.task-status.completed {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.detail-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.detail-section h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section h5 i {
  color: var(--primary-light);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.detail-value.overdue {
  color: var(--danger);
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.overdue-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--danger);
  color: white;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-action {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-base);
}

.btn-action:hover {
  background: var(--bg-surface);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-action.delete {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.btn-action.delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

.time-tracking {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.time-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.time-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.time-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  font-family: "Space Grotesk", sans-serif;
}

.time-controls {
  display: flex;
  gap: 12px;
}

.btn-time {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn-time:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--primary-light);
  color: var(--primary);
}

.btn-time.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: var(--primary);
}

.btn-time:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  max-width: 400px;
  pointer-events: none;
}

.toast-container > * {
  pointer-events: auto;
}

.toast {
  min-width: 300px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn 0.3s ease-out;
}

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

.toast.success {
  border-left-color: var(--success);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.danger {
  border-left-color: var(--danger);
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.toast.warning .toast-icon {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.toast.danger .toast-icon {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.toast.info .toast-icon {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color var(--transition-base);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.toast-close:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* Responsive Design */

/* Tablets and smaller desktops */
@media (max-width: 1200px) {
  :root {
    --detail-width: 300px;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .task-detail {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    z-index: 1002;
    box-shadow: var(--shadow-xl);
    transition: right var(--transition-base);
  }

  .btn-close-detail {
    display: flex;
  }

  .task-detail.active {
    right: 0;
  }

  .task-creator,
  .task-list-section {
    grid-column: 1;
  }
}

/* Tablets */
@media (max-width: 992px) {
  .app-container {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    max-width: 300px;
    height: 100%;
    z-index: 999;
    box-shadow: var(--shadow-xl);
    transition: left var(--transition-base);
  }

  .sidebar.active {
    left: 0;
  }

  .main-header,
  .quick-actions,
  .task-creator,
  .task-list-section {
    margin-left: 20px;
    margin-right: 20px;
  }

  .main-header {
    padding: 80px 20px 20px;
  }

  .quick-actions {
    padding: 16px 20px;
  }

  .task-creator {
    margin-top: 16px;
  }

  .task-list-section {
    margin-bottom: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .header-stats {
    gap: 16px;
  }

  .stat-value {
    font-size: 20px;
  }
}

/* Mobile Devices */
@media (max-width: 768px) {
  body {
    overflow: hidden auto;
  }

  .section-wrapper {
    max-height: max-content;
  }

  .main-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-top: 80px;
  }

  .header-left {
    text-align: center;
  }

  .header-left h2 {
    font-size: 24px;
  }

  .header-right {
    flex-direction: column;
    width: 100%;
    gap: 16px;
  }

  .header-stats {
    justify-content: space-around;
    width: 100%;
  }

  .header-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .quick-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-container {
    max-width: 100%;
  }

  .search-container.active {
    display: flex;
  }

  .quick-filters {
    justify-content: center;
    padding-bottom: 8px;
  }

  .filter-chip {
    flex-shrink: 0;
  }

  .task-creator {
    margin: 16px;
  }

  .creator-header {
    padding: 16px;
  }

  .task-form {
    padding: 16px;
  }

  .task-title-input {
    font-size: 16px;
    padding: 16px;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .sort-controls {
    justify-content: space-between;
  }

  .task-list-container {
    padding: 16px;
    min-height: 300px;
  }

  .task-item {
    padding: 16px;
  }

  .task-meta {
    gap: 8px;
  }

  .task-actions {
    opacity: 1;
    position: absolute;
    top: 16px;
    right: 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .time-controls {
    flex-direction: column;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  .toast {
    min-width: 0;
  }
}

/* Small Mobile Devices */
@media (max-width: 576px) {
  .btn-primary .btn-text,
  .btn-icon + .btn-icon {
    display: none;
  }

  .btn-primary {
    padding: 12px 16px;
  }

  .header-stats {
    gap: 12px;
    flex-wrap: wrap;
  }

  .stat-item {
    flex: 1;
    min-width: 80px;
  }

  .stat-value {
    font-size: 18px;
  }

  .stat-label {
    font-size: 10px;
  }

  .sort-controls label {
    display: none;
  }

  .task-item {
    display: block;
  }

  .task-content {
    margin: 16px 0;
    width: 100%;
  }

  .task-checkbox {
    order: 0;
  }

  .task-actions {
    order: 2;
    position: relative;
    top: auto;
    right: auto;
    margin-top: 8px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions button {
    width: 100%;
  }

  .detail-header-row {
    flex-direction: column;
  }

  .task-status {
    align-self: flex-start;
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .menu-toggle,
  .task-creator,
  .quick-actions,
  .task-actions,
  .task-detail,
  .btn-close-detail,
  .toast-container,
  .header-actions,
  .sort-controls {
    display: none !important;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .task-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .task-list-section {
    margin: 0;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border: #000;
    --border-dark: #000;
  }

  .btn-icon,
  .task-item,
  .filter-chip {
    border-width: 2px;
  }
}

/* Dark mode preparation */
@media (prefers-color-scheme: dark) {
  /* Future dark mode styles can be added here */
}

/* ===== Info Popup ===== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9998;
  padding: 20px;
  overflow-y: auto;
}

.popup-overlay.active {
  display: flex;
  animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.popup-content {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: popupSlideUp 0.35s ease;
}

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

.popup-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 32px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  text-align: center;
}

.popup-header h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.popup-subtitle {
  font-size: 1rem;
  opacity: 0.85;
  font-weight: 400;
}

.popup-section {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
}

.popup-section:last-of-type {
  border-bottom: none;
}

.popup-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.popup-section p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.popup-section ul {
  padding-left: 20px;
  margin-top: 8px;
}

.popup-section li {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.popup-section li strong {
  color: var(--text-primary);
}

.highlight-box {
  background: rgba(99, 102, 241, 0.05);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 20px 20px 20px 24px;
  margin-top: 8px;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.tech-tag {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.close-popup-btn {
  display: block;
  margin: 28px auto;
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--secondary), #059669);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
}

.close-popup-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

@media (max-width: 576px) {
  .popup-header {
    padding: 24px 20px;
  }
  .popup-header h2 {
    font-size: 1.5rem;
  }
  .popup-section {
    padding: 20px;
  }
}

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

/* Track */
::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 30px;
}

/* Handle */
::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 30px;
}
