/* =============================================
   VARIÁVEIS E RESET
   ============================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --text: #1e1b4b;
  --text-muted: #6b7280;
  --bg: #f5f5ff;
  --surface: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(79, 70, 229, 0.08);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
}

/* =============================================
   CABEÇALHO
   ============================================= */
.header {
  background: var(--primary);
  color: white;
  padding: 24px 20px 20px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-subtitle {
  font-size: 14px;
  opacity: 0.85;
}

/* Badge online/offline */
.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.3s;
}

.status-badge.offline {
  background: var(--danger);
}

/* =============================================
   ÁREA PRINCIPAL
   ============================================= */
.main {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* =============================================
   FORMULÁRIO
   ============================================= */
.form-container {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.input-tarefa {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}

.input-tarefa:focus {
  border-color: var(--primary);
}

.btn-adicionar {
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-adicionar:hover {
  background: var(--primary-dark);
}

.btn-adicionar:active {
  transform: scale(0.97);
}

/* =============================================
   FILTROS
   ============================================= */
.filtros {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.filtro-btn {
  flex: 1;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filtro-btn.ativo {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* =============================================
   LISTA DE TAREFAS
   ============================================= */
.lista-tarefas {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Item individual */
.tarefa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  animation: entrar 0.2s ease;
  transition: opacity 0.2s, transform 0.2s;
}

@keyframes entrar {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tarefa-item.concluida {
  background: var(--success-light);
  border-color: #bbf7d0;
  opacity: 0.75;
}

/* Checkbox customizado */
.tarefa-check {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--success);
  cursor: pointer;
}

/* Texto da tarefa */
.tarefa-texto {
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.tarefa-item.concluida .tarefa-texto {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Botão excluir */
.btn-excluir {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.btn-excluir:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* =============================================
   LISTA VAZIA
   ============================================= */
.lista-vazia {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 2;
  display: none;
}

.lista-vazia.visivel {
  display: block;
}

/* =============================================
   RODAPÉ DE AÇÕES
   ============================================= */
.acoes-rodape {
  margin-top: 20px;
  text-align: center;
}

.btn-limpar {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-limpar:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-light);
}

/* =============================================
   BANNER DE INSTALAÇÃO
   ============================================= */
.banner-instalacao {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 568px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  animation: subir 0.3s ease;
}

@keyframes subir {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.banner-instalacao[hidden] {
  display: none;
}

.banner-texto {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.banner-texto strong {
  font-size: 14px;
  color: var(--text);
}

.banner-texto span {
  font-size: 12px;
  color: var(--text-muted);
}

.banner-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-instalar {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-instalar:hover {
  background: var(--primary-dark);
}

.btn-fechar-banner {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}