/* ========================================
   TaskFlow — Red & Black Cinematic Theme
   ======================================== */

/* ---------- CSS Variables / Themes ---------- */
:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.2s ease;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --sidebar-width: 260px;
}

[data-theme="dark"] {
  --bg-primary: #050505;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #141414;
  --bg-hover: #1c1c1c;
  --bg-card: #0e0e0e;
  --bg-input: #111111;
  --border: #1e1e1e;
  --border-light: #181818;
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-muted: #5a5a5a;
  --accent: #e63946;
  --accent-hover: #ff4d5a;
  --accent-glow: rgba(230, 57, 70, 0.3);
  --accent-deep: #b91c2c;
  --success: #2ecc71;
  --success-soft: rgba(46, 204, 113, 0.12);
  --warning: #f39c12;
  --warning-soft: rgba(243, 156, 18, 0.12);
  --danger: #e63946;
  --danger-soft: rgba(230, 57, 70, 0.15);
  --info: #e63946;
  --info-soft: rgba(230, 57, 70, 0.12);
  --modal-bg: rgba(0, 0, 0, 0.8);
  --scrollbar-track: #0a0a0a;
  --scrollbar-thumb: #2a2a2a;
  --glow: 0 0 40px rgba(230, 57, 70, 0.15);
}

[data-theme="light"] {
  --bg-primary: #faf5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5eded;
  --bg-hover: #f0e0e0;
  --bg-card: #ffffff;
  --bg-input: #f8f0f0;
  --border: #e8d5d5;
  --border-light: #f0e0e0;
  --text-primary: #1a0a0a;
  --text-secondary: #5a3a3a;
  --text-muted: #9a7a7a;
  --accent: #c1272d;
  --accent-hover: #a01f24;
  --accent-glow: rgba(193, 39, 45, 0.15);
  --accent-deep: #8b1a1f;
  --success: #1a9f4a;
  --success-soft: rgba(26, 159, 74, 0.1);
  --warning: #c87f0a;
  --warning-soft: rgba(200, 127, 10, 0.1);
  --danger: #c1272d;
  --danger-soft: rgba(193, 39, 45, 0.1);
  --info: #c1272d;
  --info-soft: rgba(193, 39, 45, 0.1);
  --modal-bg: rgba(10, 0, 0, 0.5);
  --scrollbar-track: #f5eded;
  --scrollbar-thumb: #d4b4b4;
  --glow: 0 0 30px rgba(193, 39, 45, 0.08);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(
      ellipse at 0% 0%,
      rgba(230, 57, 70, 0.06) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 100% 100%,
      rgba(230, 57, 70, 0.04) 0%,
      transparent 50%
    );
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

input,
select,
textarea,
button {
  font-family: var(--font);
}
button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ---------- Layout ---------- */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 100;
  background-image: linear-gradient(
    180deg,
    rgba(230, 57, 70, 0.03) 0%,
    transparent 40%
  );
}

.sidebar-header {
  padding: 20px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
}

.nav-section {
  margin-bottom: 20px;
}

.nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.nav-badge {
  margin-left: auto;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

.nav-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.add-category-btn {
  color: var(--text-muted) !important;
  border: 1px dashed var(--border);
  margin-top: 4px;
}

.add-category-btn:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

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

[data-theme="dark"] .icon-sun {
  display: inline;
}
[data-theme="dark"] .icon-moon {
  display: none;
}
[data-theme="light"] .icon-sun {
  display: none;
}
[data-theme="light"] .icon-moon {
  display: inline;
}

.keyboard-hint {
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.8;
}

kbd {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.68rem;
  font-family: var(--font);
  color: var(--text-secondary);
}

/* ---------- Sidebar overlay (mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 32px 100px;
  position: relative;
}

/* ---------- Top Bar ---------- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 50;
}

.mobile-menu-btn {
  display: none;
  color: var(--text-secondary);
  padding: 6px;
}

.search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: all var(--transition);
  max-width: 480px;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
}

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

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition);
}

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

/* Sort dropdown */
.sort-dropdown {
  position: relative;
}

.sort-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  padding: 6px;
}

.sort-menu.open {
  display: block;
}

.sort-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: left;
  transition: all var(--transition);
}

.sort-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sort-option.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Stats Strip ---------- */
.stats-grid {
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
}

.stats-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(230, 57, 70, 0.05) 0%,
    transparent 50%,
    rgba(230, 57, 70, 0.03) 100%
  );
  pointer-events: none;
}

.stat-card {
  flex: 1;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
  position: relative;
  border-right: 1px solid var(--border);
}

.stat-card:last-child {
  border-right: none;
}

.stat-card:hover {
  background: var(--bg-hover);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.total {
  background: rgba(230, 57, 70, 0.12);
  color: var(--accent);
}
.stat-icon.completed {
  background: var(--success-soft);
  color: var(--success);
}
.stat-icon.pending {
  background: var(--warning-soft);
  color: var(--warning);
}
.stat-icon.overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------- Progress Section ---------- */
.progress-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 22px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-text {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.progress-percentage {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}

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

.btn-ghost {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

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

.btn-accent {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  transition: all var(--transition);
}

.btn-accent:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--accent-deep, var(--accent)),
    var(--accent),
    var(--accent-hover)
  );
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ---------- View Header ---------- */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.view-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.view-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Task Card ---------- */
.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: all var(--transition);
  cursor: default;
  animation: fadeSlideIn 0.3s ease forwards;
}

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

.task-card:hover {
  border-color: var(--border);
  border-left-color: var(--accent);
  box-shadow: var(--glow);
  background: var(--bg-hover);
}

.task-card.completed-card {
  opacity: 0.65;
}

.task-card.completed-card:hover {
  opacity: 0.85;
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 2px;
}

.task-checkbox:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
}

.task-checkbox.checked svg {
  display: block;
}

.task-checkbox svg {
  display: none;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
  word-break: break-word;
}

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

.task-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
  word-break: break-word;
}

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

.task-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.tag-priority-urgent {
  background: var(--danger-soft);
  color: var(--danger);
}
.tag-priority-high {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}
.tag-priority-medium {
  background: var(--warning-soft);
  color: var(--warning);
}
.tag-priority-low {
  background: var(--info-soft);
  color: var(--info);
}
.tag-priority-none {
  display: none;
}

.tag-due {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.tag-due.overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-due.today {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag-category {
  color: #fff;
  font-weight: 600;
}

.task-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.task-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  opacity: 0;
}

.task-card:hover .task-action-btn {
  opacity: 1;
}

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

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

/* Subtasks inside task card */
.task-subtasks {
  margin-top: 10px;
  margin-left: 34px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.subtask-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
}

.subtask-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.subtask-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subtask-progress {
  margin-top: 6px;
  margin-left: 34px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

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

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-deep, var(--accent))
  );
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 24px var(--accent-glow),
    0 0 60px rgba(230, 57, 70, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 80;
}

.fab:hover {
  transform: scale(1.12) rotate(90deg);
  box-shadow:
    0 6px 36px var(--accent-glow),
    0 0 80px rgba(230, 57, 70, 0.15);
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
}

/* ---------- Modals ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal.modal-sm {
  max-width: 400px;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

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

.modal-body {
  padding: 20px 22px;
}

.modal-footer {
  padding: 0 22px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.required {
  color: var(--danger);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Subtasks in modal */
.subtasks-input-area {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
}

#subtasks-list-modal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}

.modal-subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.modal-subtask-item span {
  flex: 1;
}

.modal-subtask-item button {
  color: var(--text-muted);
  padding: 2px;
}

.modal-subtask-item button:hover {
  color: var(--danger);
}

.add-subtask-row {
  display: flex;
  gap: 6px;
}

.add-subtask-row input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.add-subtask-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--accent-glow);
}

/* Color picker */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-card);
}

/* Buttons */
.btn-primary {
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-danger {
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--danger);
  transition: all var(--transition);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 2px 12px var(--danger-soft);
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation:
    toastIn 0.3s ease,
    toastOut 0.3s ease 2.5s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  border-left: 3px solid var(--success);
}
.toast.error {
  border-left: 3px solid var(--danger);
}
.toast.info {
  border-left: 3px solid var(--accent);
}

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

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

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stats-grid {
    flex-wrap: wrap;
  }
  .stat-card {
    flex: 1 1 45%;
  }
  .stat-card:nth-child(2) {
    border-right: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .main-content {
    padding: 0 16px 100px;
  }

  .stat-card {
    flex: 1 1 45%;
    padding: 14px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .progress-actions {
    width: 100%;
    justify-content: flex-end;
  }

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

  .task-action-btn {
    opacity: 1;
  }

  .fab {
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  .stat-card {
    flex: 1 1 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .stat-card:last-child {
    border-bottom: none;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
  }

  .search-bar {
    max-width: none;
  }
}
