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

:root {
  --bg: #060814;
  --bg-grid: #0b0f22;
  --panel: rgba(18, 22, 41, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --cyan: #00f6ff;
  --magenta: #ff2fd0;
  --violet: #9b5cff;
  --green: #39ff9d;
  --amber: #ffcb47;
  --text: #eaf6ff;
  --text-dim: #8aa0c9;
  --danger: #ff4d6d;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(0, 246, 255, 0.12), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(255, 47, 208, 0.12), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(155, 92, 255, 0.14), transparent 50%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, auto, auto, 42px 42px, 42px 42px;
  background-position: 0 0;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Orbitron', sans-serif; letter-spacing: 0.5px; margin: 0; }

a { color: var(--cyan); }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ---------- Login screen ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 36px 32px;
  backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px rgba(0, 246, 255, 0.08), 0 0 40px rgba(0, 246, 255, 0.12), 0 20px 60px rgba(0,0,0,0.5);
  text-align: center;
}

.login-glyph {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(0, 246, 255, 0.65), inset 0 0 12px rgba(0, 246, 255, 0.35);
}
.login-glyph span {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan);
}

.login-card h1 {
  font-size: 22px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}

.login-card p.sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 26px;
}

.field {
  text-align: left;
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: rgba(6, 8, 20, 0.75);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 246, 255, 0.15), 0 0 16px rgba(0, 246, 255, 0.25);
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  transition: transform .12s ease, box-shadow .18s ease, opacity .12s ease;
}
.btn:active { transform: translateY(1px); }

.btn-neon {
  width: 100%;
  color: #04121a;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 18px rgba(0, 246, 255, 0.45), 0 0 36px rgba(155, 92, 255, 0.25);
}
.btn-neon:hover { box-shadow: 0 0 26px rgba(0, 246, 255, 0.65), 0 0 50px rgba(155, 92, 255, 0.4); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

.error-box {
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.4);
  color: #ff8fa3;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 18px;
  text-align: left;
}

/* ---------- App shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

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

.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan), 0 0 18px var(--cyan);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

.brand h1 {
  font-size: 21px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logout-link {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  border-radius: 8px;
  transition: all .15s ease;
}
.logout-link:hover { color: var(--danger); border-color: var(--danger); }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card .num {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 800;
}
.stat-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-top: 4px;
}
.stat-card.total .num { color: var(--cyan); text-shadow: 0 0 12px rgba(0,246,255,0.6); }
.stat-card.active .num { color: var(--amber); text-shadow: 0 0 12px rgba(255,203,71,0.6); }
.stat-card.done .num { color: var(--green); text-shadow: 0 0 12px rgba(57,255,157,0.6); }

.progress-track {
  height: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin-bottom: 26px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
  box-shadow: 0 0 10px rgba(0,246,255,0.6);
  transition: width .3s ease;
}

/* Add form */
.add-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 22px;
}
.add-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.add-row input[type="text"] { flex: 1; }
.add-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
}

/* Filters */
.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 5px;
}
.filter-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.filter-btn.active {
  color: #04121a;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 14px rgba(0,246,255,0.4);
}

/* Todo list */
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--violet);
  border-radius: 12px;
  padding: 14px 16px;
  animation: fadeIn .25s ease;
}
.todo-item[data-priority="high"] { border-left-color: var(--magenta); }
.todo-item[data-priority="medium"] { border-left-color: var(--amber); }
.todo-item[data-priority="low"] { border-left-color: var(--green); }

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

.todo-item.done { opacity: 0.5; }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--text-dim); }

.check {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 6px;
  border: 2px solid var(--panel-border);
  margin-top: 2px;
  cursor: pointer;
  position: relative;
  transition: all .15s ease;
}
.check:hover { border-color: var(--cyan); }
.check:checked {
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(57,255,157,0.6);
}
.check:checked::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #04121a;
  border-width: 0 2px 2px 0;
  transform: rotate(40deg);
}

.todo-body { flex: 1; min-width: 0; }
.todo-title {
  font-size: 14.5px;
  font-weight: 500;
  word-break: break-word;
}
.todo-meta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.badge {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}
.badge.due { color: var(--cyan); border-color: rgba(0,246,255,0.3); }
.badge.overdue { color: var(--danger); border-color: rgba(255,77,109,0.4); }
.badge.high { color: var(--magenta); }
.badge.medium { color: var(--amber); }
.badge.low { color: var(--green); }

.todo-actions {
  display: flex;
  gap: 6px;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.icon-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
}
.empty-state .glyph {
  font-size: 30px;
  margin-bottom: 10px;
  opacity: 0.6;
}

.footer-row {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* Toasts */
#toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--cyan);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideIn .2s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--green); }

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

@media (max-width: 480px) {
  .add-row-2 { grid-template-columns: 1fr 1fr; }
  .add-row-2 .btn { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
