@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  /* Premium Vibrant Palette */
  --primary: #4f46e5;      /* Vibrant Indigo */
  --primary-hover: #4338ca;
  --secondary: #0f172a;    /* Deep Slate (Sidebar) */
  --accent: #8b5cf6;       /* Vibrant Purple */
  
  --bg-color: #f8fafc;     /* Soft App Background */
  --panel-bg: #ffffff;     /* Pure White Cards */
  --text-main: #1e293b;    /* Dark Slate Text */
  --text-muted: #64748b;   /* Muted Slate */
  --border-color: #e2e8f0; /* Soft Borders */
  
  /* Status Colors */
  --color-green: #10b981;  
  --color-orange: #f59e0b; 
  --color-red: #ef4444;    
  --color-blue: #3b82f6;   
  --color-grey: #94a3b8;   
  --color-purple: #8b5cf6; 
  --color-yellow: #eab308; 
  
  --sidebar-width: 260px;
  --nav-height-mobile: 70px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--primary); transition: all 0.2s; }
a:hover { color: var(--primary-hover); }

/* Typography */
h1, h2, h3, h4 { font-family: 'Outfit', sans-serif; color: var(--secondary); }
.header h2 { font-weight: 800; font-size: 2.2rem; letter-spacing: -0.5px; }

/* Layout */
.layout-wrapper { display: flex; min-height: 100vh; }

/* Sidebar (Dark Premium) */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--secondary);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0,0,0,0.05);
}

.sidebar-header {
  padding: 30px 20px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800; font-size: 1.4rem;
  color: white;
  display: flex; align-items: center; gap: 10px;
}

.sidebar-nav { padding: 10px 15px; flex: 1; }

.sidebar-nav a {
  display: flex; align-items: center;
  padding: 12px 16px; margin-bottom: 6px;
  color: #94a3b8; font-weight: 500; font-size: 1rem;
  border-radius: 12px; transition: all 0.2s;
}

.sidebar-nav a:hover { background-color: rgba(255,255,255,0.05); color: white; transform: translateX(4px); }
.sidebar-nav a.active { 
  background: linear-gradient(135deg, var(--primary), var(--accent)); 
  color: white; 
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.main-content {
  flex: 1; margin-left: var(--sidebar-width);
  padding: 40px; max-width: 1200px;
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: calc(var(--nav-height-mobile) + 20px);
  height: auto;
  background: var(--panel-bg);
  border-top: 1px solid var(--border-color);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  padding-bottom: calc(env(safe-area-inset-bottom) + 20px); /* Forces extra space! */
}


.mobile-nav a {
  display: flex; flex-direction: column; align-items: center;
  color: var(--text-muted); font-size: 0.75rem; font-weight: 600; padding: 8px;
  font-family: 'Outfit', sans-serif; transition: all 0.2s;
}
.mobile-nav a.active { color: var(--primary); transform: translateY(-2px); }
.mobile-nav svg { width: 24px; height: 24px; margin-bottom: 4px; }

.floating-add {
  display: none; position: fixed; bottom: calc(var(--nav-height-mobile) + 20px);
  right: 20px; width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; 
  align-items: center; justify-content: center;
  font-size: 32px; font-weight: 300; box-shadow: 0 10px 25px rgba(79, 70, 229, 0.5);
  z-index: 1000; border: none; cursor: pointer; transition: transform 0.2s;
}
.floating-add:active { transform: scale(0.9); }

/* Premium Cards */
.card {
  background: var(--panel-bg);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 10px 30px rgba(0,0,0,0.03);
  transition: transform 0.3s, box-shadow 0.3s;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* Stat Cards inside Grid */
.stat-card-link { text-decoration: none; display: block; color: inherit; transition: transform 0.2s; }
.stat-card-link:hover .card { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(79, 70, 229, 0.1); }
.card h3 { font-size: 1rem; color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }
.card p.stat-value { font-size: 2.5rem; font-weight: 800; font-family: 'Outfit', sans-serif; letter-spacing: -1px; }

/* --- THE NEW TASK LIST DESIGN --- */
.task-list {
  display: flex; flex-direction: column; gap: 12px;
}

.task-item {
  display: flex; align-items: center;
  padding: 16px 20px;
  background: var(--panel-bg);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  gap: 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.task-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 25px rgba(0,0,0,0.05);
}
.task-item.sortable-ghost { opacity: 0.4; background: #f1f5f9; border: 2px dashed var(--primary); }

/* Drag Handle */
.drag-handle {
  color: #cbd5e1; cursor: grab; padding: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s;
}
.drag-handle:hover { color: var(--primary); }
.drag-handle:active { cursor: grabbing; }

/* Custom Circular Checkbox */
.task-checkbox {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.task-checkbox:hover { border-color: var(--primary); transform: scale(1.1); }
.task-checkbox.completed {
  background: linear-gradient(135deg, var(--color-green), #059669);
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}
.task-checkbox.completed::after {
  content: '✓'; color: white; font-size: 16px; font-weight: bold;
}

.task-details { flex: 1; display: flex; align-items: center; justify-content: space-between; min-width: 0; }
.task-title { font-weight: 600; font-size: 1.05rem; color: var(--text-main); word-break: break-word; }
.task-title.completed { text-decoration: line-through; color: var(--text-muted); opacity: 0.7; }

.task-meta {
  font-size: 0.8rem; color: var(--text-muted);
  display: flex; gap: 10px; align-items: center; flex-shrink: 0;
}

/* Subtle Badges */
.status-badge {
  padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: 0.75rem;
  background: #f1f5f9; color: var(--text-muted);
}
.status-badge.red, .status-badge.critical { color: var(--color-red); background: rgba(239, 68, 68, 0.1); }
.status-badge.orange, .status-badge.high { color: var(--color-orange); background: rgba(245, 158, 11, 0.1); }
.status-badge.blue, .status-badge.medium { color: var(--color-blue); background: rgba(59, 130, 246, 0.1); }
.status-badge.low { color: var(--color-grey); background: rgba(148, 163, 184, 0.1); }

/* Forms & Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; border: none; font-family: 'Outfit', sans-serif;
  cursor: pointer; font-weight: 700; font-size: 1rem;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
  transition: all 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(79, 70, 229, 0.35); }
.btn:active { transform: translateY(0); }

.btn-secondary { background: #f1f5f9; color: var(--text-main); box-shadow: none; }
.btn-secondary:hover { background: #e2e8f0; box-shadow: none; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: var(--text-main); }
.form-control {
  width: 100%; padding: 14px 16px;
  border: 2px solid var(--border-color); border-radius: 12px;
  font-family: inherit; font-size: 1rem; background: #f8fafc;
  transition: all 0.2s; color: var(--text-main);
}
.form-control:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }

/* Utilities */
.color-green { background-color: var(--color-green); }
.color-orange { background-color: var(--color-orange); }
.color-red { background-color: var(--color-red); }
.color-blue { background-color: var(--color-blue); }
.color-grey { background-color: var(--color-grey); }
.color-purple { background-color: var(--color-purple); }
.color-yellow { background-color: var(--color-yellow); }

/* Responsive Mobile Magic */
@media (max-width: 1023px) {
  .sidebar { display: none; }
    .main-content {
    margin-left: 0;
    padding: 20px;
    padding-top: calc(env(safe-area-inset-top) + 20px); /* Pushes content down from notch */
    padding-bottom: calc(var(--nav-height-mobile) + 40px);
  }

  .mobile-nav, .floating-add { display: flex; }
}

@media (max-width: 767px) {
  .main-content { padding: 15px; padding-bottom: calc(var(--nav-height-mobile) + 120px); }
  
  .task-item { 
    flex-wrap: wrap; 
    padding: 16px;
    gap: 12px;
  }
  
  /* On mobile, details drop below the drag/check line */
  .task-details { 
    width: 100%; 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 8px;
    padding-left: 0; /* Align with left edge */
  }
  
  .task-title { font-size: 1.1rem; width: 100%; margin-top: 2px; }
  
  .task-meta { 
    width: 100%; 
    justify-content: flex-start; 
    flex-wrap: wrap; 
    gap: 12px; 
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
    margin-top: 6px;
  }
}
