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

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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #22263a;
  --border: #2e3250;
  --accent: #6c63ff;
  --accent-dark: #5550d4;
  --accent-glow: rgba(108, 99, 255, 0.3);
  --text: #e8eaf6;
  --text-muted: #8b8fa8;
  --success: #4caf8a;
  --error: #f06292;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.navbar .logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.3rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 0 18px var(--accent-glow);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn-full {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: 10px;
}

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

/* ── Auth Card (Login / Signup) ───────────────────────── */
.auth-wrapper {
  min-height: calc(100vh - 65px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.auth-card .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ── Form ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

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

.form-group input::placeholder {
  color: var(--text-muted);
}

/* ── Alert messages ───────────────────────────────────── */
.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: rgba(240, 98, 146, 0.1);
  border: 1px solid rgba(240, 98, 146, 0.3);
  color: var(--error);
}

.alert-success {
  background: rgba(76, 175, 138, 0.1);
  border: 1px solid rgba(76, 175, 138, 0.3);
  color: var(--success);
}

/* ── Auth footer link ─────────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ── Home Hero ────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100vh - 65px);
  padding: 2rem;
}

.hero-badge {
  display: inline-block;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -1px;
  margin-bottom: 1.2rem;
  max-width: 650px;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 480px;
  margin-bottom: 2.5rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Features ─────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 3rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.feature-card .icon {
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Spinner ──────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Dashboard ────────────────────────────────────────── */
.dashboard {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.dashboard-header h1 span {
  color: var(--accent);
}

/* ── Stats bar ────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stat strong {
  color: var(--text);
  font-size: 1rem;
}

/* ── Add task row ─────────────────────────────────────── */
.add-task-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}

.add-task-row {
  display: flex;
  gap: 0.6rem;
}

.add-task-row input[type="text"] {
  flex: 1;
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.add-task-row input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.add-task-row input::placeholder { color: var(--text-muted); }

.add-task-extras {
  display: none;
  gap: 0.6rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.add-task-extras.open { display: flex; }

.add-task-extras input {
  flex: 1;
  min-width: 160px;
  padding: 0.55rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.add-task-extras input:focus {
  border-color: var(--accent);
}

.add-task-extras input::placeholder { color: var(--text-muted); }

/* ── Filter tabs ──────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.filter-tab {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover { color: var(--text); border-color: var(--accent); }

.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Task list ────────────────────────────────────────── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  transition: border-color 0.2s, opacity 0.2s;
  animation: fadeIn 0.2s ease;
}

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

.task-item:hover { border-color: var(--accent); }

.task-item.done {
  opacity: 0.55;
}

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

/* custom checkbox */
.task-check {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: background 0.2s, border-color 0.2s;
  font-size: 0.7rem;
}

.task-item.done .task-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.task-title {
  font-size: 0.95rem;
  font-weight: 500;
  word-break: break-word;
}

.task-meta {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.task-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.task-due {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
}

.task-due.overdue { color: var(--error); }

.task-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
  margin-top: 1px;
}

.task-delete:hover {
  color: var(--error);
  background: rgba(240, 98, 146, 0.1);
}

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* ── Task actions (edit + delete group) ───────────────── */
.task-actions {
  display: flex;
  gap: 0.2rem;
  align-items: flex-start;
  margin-top: 1px;
}

.task-edit {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

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

/* ── Inline edit form ─────────────────────────────────── */
.task-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.edit-title-input {
  width: 100%;
  padding: 0.5rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
}

.edit-extras {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.edit-desc-input,
.edit-due-input {
  flex: 1;
  min-width: 130px;
  padding: 0.4rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.edit-desc-input:focus,
.edit-due-input:focus {
  border-color: var(--accent);
}

.edit-desc-input::placeholder { color: var(--text-muted); }

.edit-actions {
  display: flex;
  gap: 0.4rem;
}