/* =====================
   CSS Variables & Reset
   ===================== */
:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface-2: #1e1e1e;
  --border: #2a2a2a;
  --accent: #c8f060;
  --accent-dim: rgba(200, 240, 96, 0.12);
  --text: #f0f0f0;
  --text-muted: #666;
  --text-dim: #999;
  --high: #ff6b6b;
  --low: #6bb5ff;
  --radius: 10px;
  --sidebar-w: 240px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =====================
   Install Banner
   ===================== */
.install-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--accent);
  color: #0d0d0d;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
}
.install-banner span { flex: 1; }
.install-banner button {
  background: #0d0d0d;
  color: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: opacity var(--transition);
}
.install-banner #dismiss-btn {
  background: transparent;
  color: #0d0d0d;
  padding: 4px 8px;
  opacity: 0.7;
}
.install-banner button:hover { opacity: 0.8; }
.hidden { display: none !important; }

/* =====================
   App Shell Layout
   ===================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* =====================
   Sidebar
   ===================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px 24px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  padding: 0 4px;
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  color: #0d0d0d;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  position: relative;
}
.filter-btn:hover { background: var(--surface-2); color: var(--text); }
.filter-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.filter-icon { font-size: 0.75rem; }
.badge {
  margin-left: auto;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}
.filter-btn.active .badge { background: var(--accent); color: #0d0d0d; }

.sidebar-footer {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.offline-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.online { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.status-dot.offline { background: #f87171; }

.ghost-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

/* =====================
   Main Content
   ===================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  padding: 36px 40px;
}

.top-bar {
  margin-bottom: 28px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.task-stats {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* =====================
   Input Area
   ===================== */
.input-area {
  margin-bottom: 28px;
}
.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 4px 4px 14px;
  gap: 8px;
  transition: border-color var(--transition);
}
.input-wrapper:focus-within { border-color: var(--accent); }

.input-icon {
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

#task-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 0;
}
#task-input::placeholder { color: var(--text-muted); }

#priority-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 6px 8px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

#add-btn {
  background: var(--accent);
  color: #0d0d0d;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--transition), transform var(--transition);
}
#add-btn:hover { opacity: 0.85; }
#add-btn:active { transform: scale(0.97); }

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

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: all var(--transition);
  animation: slide-in 0.25s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.task-item:hover { border-color: #3a3a3a; background: var(--surface-2); }
.task-item.completed { opacity: 0.45; }

/* Priority indicator */
.priority-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.priority-dot.high { background: var(--high); box-shadow: 0 0 6px rgba(255,107,107,0.4); }
.priority-dot.low  { background: var(--low);  box-shadow: 0 0 6px rgba(107,181,255,0.4); }
.priority-dot.normal { background: var(--accent); }

/* Custom checkbox */
.task-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition);
}
.task-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.task-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 5px; height: 8px;
  border: 2px solid #0d0d0d;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.task-text {
  flex: 1;
  font-size: 0.9rem;
  transition: all var(--transition);
  word-break: break-word;
}
.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-date {
  font-size: 0.67rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.task-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 5px;
  opacity: 0;
  transition: all var(--transition);
  flex-shrink: 0;
}
.task-item:hover .task-delete { opacity: 1; }
.task-delete:hover { background: rgba(255,107,107,0.15); color: var(--high); }

/* =====================
   Empty State
   ===================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}
.empty-icon {
  font-size: 2.5rem;
  color: var(--border);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 0.9; transform: scale(1.1); }
}
.empty-state p { font-size: 0.9rem; line-height: 1.7; }
.hidden { display: none !important; }

/* =====================
   Responsive — Mobile
   ===================== */
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 24px 20px;
  }

  .page-title { font-size: 1.6rem; }

  .input-wrapper { flex-wrap: wrap; gap: 6px; }
  #priority-select { order: 3; }
  #add-btn { order: 4; }

  /* Mobile bottom nav */
  body { padding-bottom: 72px; }

  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 10px 20px 20px;
    gap: 4px;
    z-index: 10;
  }

  .mobile-nav .filter-btn {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 0.7rem;
    padding: 8px 4px;
    text-align: center;
  }
  .mobile-nav .filter-btn .badge { margin: 0 auto; }
  .mobile-nav .filter-btn .filter-icon { font-size: 1rem; }
}
.mobile-nav { display: none; }

/* =====================
   Scrollbar
   ===================== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
