/* ─────────────────────────────────────────────
   Tasks — Django styles
   ───────────────────────────────────────────── */

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

:root {
  --purple:  #8b5cf6;
  --blue:    #3b82f6;
  --pink:    #ec4899;
  --teal:    #14b8a6;
  --bg:      #03010a;
  --border:  rgba(255,255,255,0.08);
  --text:    #fff;
  --muted:   rgba(255,255,255,0.5);
  --dim:     rgba(255,255,255,0.3);
  --danger:  #f87171;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple); text-decoration: none; }
a:hover { color: #a78bfa; }

#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#cursor-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(139,92,246,0.10) 0%, transparent 65%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

.view { position: relative; z-index: 3; min-height: 100vh; }

/* ── Brand ── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(139,92,246,0.45);
  color: #fff;
}

.brand-name { font-size: 1.05rem; }

/* ── Auth view ── */
.view-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  border-radius: 24px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 32px 80px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.10);
  animation: fadeUp 0.6s cubic-bezier(0.16,1,0.3,1) both;
}

.auth-card .brand { margin-bottom: 1.75rem; }

.auth-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  text-decoration: none;
}

.auth-tab:hover { color: #fff; }

.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 4px 16px rgba(139,92,246,0.4);
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

/* Google button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-google:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(139,92,246,0.4);
  transform: translateY(-1px);
}

.btn-google:active { transform: translateY(0) scale(0.98); }

.btn-google svg { flex-shrink: 0; }

/* "or" divider between social and form */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.field { display: block; margin-bottom: 1rem; }

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 0.4rem;
}

.field input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: #fff;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder { color: rgba(255,255,255,0.25); }

.field input:focus {
  border-color: rgba(139,92,246,0.6);
  background: rgba(139,92,246,0.06);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

.field-error {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--danger);
}

.auth-error {
  min-height: 1.2rem;
  font-size: 0.82rem;
  color: var(--danger);
  margin-bottom: 0.5rem;
}

.auth-note {
  margin-top: 1.25rem;
  font-size: 0.78rem;
  text-align: center;
  color: var(--dim);
}
.auth-note a { color: var(--purple); }

/* ── App view ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(3,1,10,0.5);
  position: sticky;
  top: 0;
  z-index: 10;
}

.user-menu { display: flex; align-items: center; gap: 0.75rem; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(139,92,246,0.4);
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: #fff;
  border-color: rgba(139,92,246,0.5);
  background: rgba(139,92,246,0.08);
}

.app-main {
  position: relative;
  z-index: 3;
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  animation: fadeUp 0.5s ease both;
}

.app-hero { margin-bottom: 2.25rem; }

.greeting {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--purple);
  margin-bottom: 0.4rem;
}

.app-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #fff;
}

.todo-input-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.todo-input-row input[type="text"] {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  color: #fff;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.todo-input-row input::placeholder { color: rgba(255,255,255,0.3); }

.todo-input-row input:focus {
  border-color: rgba(139,92,246,0.6);
  background: rgba(139,92,246,0.06);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  color: #fff;
}

.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 4px 24px rgba(139,92,246,0.4);
}
.btn-primary:hover { box-shadow: 0 8px 32px rgba(139,92,246,0.6); }

.btn-block { width: 100%; padding: 0.95rem; border-radius: 12px; }

.link-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s ease;
}
.link-btn:hover { color: var(--danger); }

.todo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.filters {
  display: flex;
  gap: 0.25rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.filter {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.filter:hover { color: #fff; }

.filter.active {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 4px 12px rgba(139,92,246,0.4);
}

.count { font-size: 0.8rem; color: var(--dim); }
.count #count-num { color: var(--purple); font-weight: 700; }

.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.todo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  animation: slideIn 0.3s cubic-bezier(0.16,1,0.3,1) both;
}

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

.todo:hover {
  border-color: rgba(139,92,246,0.3);
  background: rgba(139,92,246,0.04);
}

/* The toggle button (no native checkbox; uses a form per task) */
.todo-check-form { display: flex; }

.todo-check {
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.checkmark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,0.25);
  display: grid;
  place-items: center;
  color: transparent;
  transition: all 0.2s ease;
}

.todo-check:hover .checkmark { border-color: var(--purple); }

.todo.done .checkmark {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(139,92,246,0.5);
}

.todo-text {
  flex: 1;
  font-size: 0.95rem;
  color: #fff;
  word-break: break-word;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.todo.done .todo-text {
  color: var(--dim);
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.25);
}

.todo-delete-form { display: flex; }

.todo-delete {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--dim);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}

.todo:hover .todo-delete { opacity: 1; }

.todo-delete:hover {
  background: rgba(248,113,113,0.12);
  color: var(--danger);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--purple);
  opacity: 0.5;
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.3rem;
}

.empty-sub { font-size: 0.9rem; color: var(--muted); }

.todo-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

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

/* ─────────────────────────────────────────────
   CHATBOT
   ───────────────────────────────────────────── */
#chat-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border: none;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 30px rgba(139,92,246,0.5), 0 0 0 1px rgba(255,255,255,0.08);
  z-index: 20;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 40px rgba(139,92,246,0.7);
}

.chat-fab-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

#chat-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: min(380px, calc(100vw - 3rem));
  height: min(560px, calc(100vh - 3rem));
  background: rgba(15,8,30,0.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  z-index: 21;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), opacity 0.2s ease;
}

#chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-title { display: flex; align-items: center; gap: 0.75rem; }

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(139,92,246,0.4);
  color: #fff;
}

.chat-name { font-size: 0.95rem; font-weight: 700; }

.chat-status {
  font-size: 0.7rem;
  color: var(--dim);
  letter-spacing: 0.04em;
}

.chat-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-close:hover {
  color: #fff;
  border-color: rgba(248,113,113,0.4);
  background: rgba(248,113,113,0.08);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
}

.chat-msg {
  display: flex;
  animation: chat-in 0.25s cubic-bezier(0.16,1,0.3,1) both;
}

.chat-msg.user      { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }

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

.chat-bubble {
  max-width: 82%;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(139,92,246,0.35);
}

.chat-msg.assistant .chat-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.chat-suggestions {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

.chat-suggestions li { margin-top: 0.2rem; }

/* Typing dots */
.chat-dots { display: inline-flex; gap: 4px; padding: 0.15rem 0; }
.chat-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.chat-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  font-family: inherit;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#chat-input::placeholder { color: rgba(255,255,255,0.3); }

#chat-input:focus {
  border-color: rgba(139,92,246,0.6);
  background: rgba(139,92,246,0.06);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

#chat-input:disabled { opacity: 0.6; cursor: not-allowed; }

.chat-send {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 4px 16px rgba(139,92,246,0.4);
}

.chat-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139,92,246,0.6);
}

.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Voice input mic button ── */
.mic-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  position: relative;
}

.mic-btn:hover {
  color: #fff;
  background: rgba(139,92,246,0.10);
  border-color: rgba(139,92,246,0.45);
}

.mic-btn:active { transform: scale(0.95); }

/* Chat row uses a smaller mic to match the smaller send button */
.chat-input-row .mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

/* Listening state — pulsing red */
.mic-btn.listening {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(239,68,68,0.5);
  animation: mic-pulse 1.4s ease-in-out infinite;
}

.mic-btn.listening:hover {
  background: linear-gradient(135deg, #dc2626, #ea580c);
}

.mic-btn.listening::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(239,68,68,0.5);
  animation: mic-ring 1.4s ease-out infinite;
  pointer-events: none;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(239,68,68,0.5); }
  50%       { box-shadow: 0 4px 24px rgba(239,68,68,0.85); }
}

@keyframes mic-ring {
  0%   { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0; }
}

@media (max-width: 540px) {
  .auth-card { padding: 2rem 1.5rem; }
  .app-header { padding: 1rem 1.25rem; }
  .user-name { display: none; }
  .todo-delete { opacity: 1; }
  .todo-toolbar { flex-direction: column; gap: 0.75rem; align-items: stretch; }
  .count { text-align: center; }

  #chat-panel {
    right: 0.75rem;
    bottom: 0.75rem;
    width: calc(100vw - 1.5rem);
    height: calc(100vh - 1.5rem);
  }
  #chat-fab { bottom: 1rem; right: 1rem; }
}
