/* ============================================================
   TaskAgent Desktop — Modern Minimal CSS
   ============================================================ */

:root {
  --primary: #2481cc;
  --primary-dark: #1a6bb0;
  --primary-soft: #e8f2fc;
  --danger: #e53935;
  --danger-soft: #fdecea;
  --text: #1a1a2e;
  --text-secondary: #555870;
  --hint: #9a9bb0;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --border: #e4e8f0;
  --shadow-sm: 0 1px 4px rgba(36,129,204,0.07);
  --shadow-md: 0 4px 20px rgba(36,129,204,0.10);
  --shadow-hover: 0 8px 28px rgba(36,129,204,0.14);
  --radius: 14px;
  --radius-sm: 8px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.page { min-height: 100vh; }

#loginPage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #f0f6ff 0%, #e8f0fe 100%);
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: 48px 40px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.3;
}

.login-sub {
  font-size: 14px;
  color: var(--hint);
  margin-bottom: 28px;
}

/* Big Telegram login button */
.btn-tg-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 4px 14px rgba(36,129,204,0.35);
}

.btn-tg-login:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(36,129,204,0.45);
}

.btn-tg-login:active {
  transform: scale(0.98);
}

.btn-icon {
  font-size: 18px;
}

.hint-text {
  font-size: 12px;
  color: var(--hint);
  margin-top: 8px;
  margin-bottom: 0;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--hint);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* QR code */
.qr-wrapper {
  display: flex;
  justify-content: center;
  margin: 16px 0 10px;
}

#qrCode {
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fff;
  display: inline-block;
  line-height: 0;
}

#qrCode img, #qrCode canvas {
  display: block !important;
}

/* Status indicator */
.status-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--hint);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hint);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.dot.success {
  background: #43a047;
  animation: none;
}

/* ============================================================
   HEADER
   ============================================================ */

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  font-size: 22px;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
}

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

.user-pill {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--primary-soft);
  padding: 4px 14px;
  border-radius: 20px;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
  padding: 28px 0 60px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── User block ── */
.user-block {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-details { flex: 1; min-width: 0; }

.user-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}

.user-meta {
  font-size: 13px;
  color: var(--hint);
  margin-top: 3px;
}

/* ── Tasks section ── */
.tasks-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tasks-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.tasks-count {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 700;
}

.tasks-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-action {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.btn-icon-action:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger-soft:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Tasks list ── */
.tasks-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Task card ── */
.task-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.3s;
  animation: slideIn 0.2s ease;
  cursor: default;
}

.task-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.task-card.removing {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

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

.task-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.task-source {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.task-title {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  word-break: break-word;
}

.task-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--hint);
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.task-del:hover {
  color: var(--danger);
}

.task-desc {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  padding-left: 26px;
  margin-top: 5px;
  word-break: break-word;
}

.task-date {
  font-size: 11px;
  color: var(--hint);
  text-align: right;
  margin-top: 8px;
}

/* ── States ── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--hint);
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--hint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state small {
  font-size: 13px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
  .login-card {
    padding: 32px 20px 28px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .container {
    padding: 0 12px;
  }

  .brand-name {
    font-size: 16px;
  }

  .user-pill {
    display: none;
  }

  .tasks-header {
    padding: 14px 16px;
  }
}
