/* Main Stylesheet - tích. Minimalist Aesthetic Theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500&display=swap');

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow-x: hidden;
}

/* Confetti canvas */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

/* Main Container Card */
.tich-card {
  width: 100%;
  max-width: 780px;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-card);
  padding: 36px 42px 28px 42px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: relative;
  transition: transform 0.3s ease;
}

/* =========================================================================
   TOP BAR
   ========================================================================= */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.25);
}

.brand-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #1e1b4b;
}

.date-weather {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
}

.date-weather .sun-icon {
  font-size: 1.05rem;
}

/* =========================================================================
   HEADER SECTION: TITLE & LIVE CLOCK
   ========================================================================= */
.header-section {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.title-wrap h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-title);
  line-height: 1.1;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 0.94rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Clock Widget */
.clock-widget {
  display: flex;
  align-items: center;
  gap: 16px;
}

.clock-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.clock-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.digital-clock {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-title);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Analog Clock SVG */
.analog-clock {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clock-svg {
  width: 100%;
  height: 100%;
}

.clock-hand {
  transform-origin: 50% 50%;
  transition: transform 0.2s cubic-bezier(0.4, 2.08, 0.55, 0.44);
}

.hour-hand {
  stroke: #475569;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.minute-hand {
  stroke: #7c3aed;
  stroke-width: 2;
  stroke-linecap: round;
}

.clock-center-dot {
  fill: #7c3aed;
}

/* =========================================================================
   QUICK ADD INPUT PILL
   ========================================================================= */
.input-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-pill);
  padding: 8px 10px 8px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.input-pill:focus-within {
  border-color: #c084fc;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.input-plus-icon {
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.task-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.98rem;
  color: var(--text-main);
}

.task-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

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

/* Time Picker Pill Button */
.time-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.time-pill-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.time-pill-btn.active {
  background: #f5f3ff;
  border-color: #c084fc;
  color: var(--primary);
  font-weight: 600;
}

.clear-time-icon {
  font-size: 1.1rem;
  line-height: 1;
  color: #94a3b8;
  margin-left: 2px;
  border-radius: 50%;
  padding: 0 4px;
  transition: all 0.15s ease;
}

.clear-time-icon:hover {
  color: #f43f5e;
  background: #fee2e2;
}

/* =========================================================================
   DATETIME POPOVER
   ========================================================================= */
.datetime-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 20px 45px -10px rgba(124, 58, 237, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 18px 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.popover-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.popover-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.popover-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.popover-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.popover-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  text-transform: uppercase;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.chip:hover {
  border-color: #cbd5e1;
  color: #0f172a;
}

.chip.active {
  background: #f5f3ff;
  border-color: #c084fc;
  color: var(--primary);
  font-weight: 600;
}

.popover-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: all 0.15s ease;
}

.popover-input:focus {
  border-color: #c084fc;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.btn-text {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-text:hover {
  color: #ef4444;
}

.btn-popover-apply {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

.btn-popover-apply:hover {
  background: var(--primary-hover);
}

.add-submit-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.add-submit-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.06);
}

/* =========================================================================
   COLUMN LABELS
   ========================================================================= */
.column-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* =========================================================================
   TASK LIST
   ========================================================================= */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 220px;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: var(--radius-item);
  border: 1px solid transparent;
  background: #ffffff;
  transition: all 0.2s ease;
  cursor: pointer;
}

.task-row:hover {
  background: var(--bg-row-hover);
}

/* Highlighted/Active Row (like "Hoàn thiện tài liệu" in screenshot) */
.task-row.highlighted {
  border-color: #c084fc;
  background: #fbfaff;
}

.task-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

/* Checkbox */
.checkbox-btn {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-check);
  border: 2px solid var(--checkbox-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.checkbox-btn:hover {
  border-color: var(--primary);
}

.checkbox-btn.checked {
  background: var(--checkbox-bg-checked);
  border-color: var(--checkbox-bg-checked);
  color: #ffffff;
  transform: scale(1.05);
}

.checkbox-btn svg {
  transform: scale(0);
  transition: transform 0.2s ease;
}

.checkbox-btn.checked svg {
  transform: scale(1);
}

/* Squircle Emoji Container */
.emoji-squircle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Text */
.task-text {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.2s ease;
  word-break: break-word;
}

.task-row.completed .task-text {
  color: var(--completed-text);
  text-decoration: line-through;
  font-weight: 500;
}

/* Right Group: Time Badge & Actions */
.task-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.time-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 500;
  background: #f8fafc;
  border: 1px solid var(--border-input);
  font-variant-numeric: tabular-nums;
  transition: all 0.2s ease;
  cursor: pointer;
}

.time-badge:hover {
  border-color: #c084fc;
  background: #f5f3ff;
  color: var(--primary);
  transform: translateY(-1px);
}

.task-row.highlighted .time-badge {
  border-color: #c084fc;
  background: #f5f3ff;
  color: var(--primary);
  font-weight: 600;
}

.task-row.completed .time-badge {
  color: #cbd5e1;
  background: #f8fafc;
  border-color: #f1f5f9;
}

/* Inline Delete button (subtle on hover) */
.delete-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.task-row:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* Empty state */
.empty-placeholder {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.footer-note {
  text-align: center;
  font-style: italic;
  font-size: 0.88rem;
  color: var(--text-faint);
  padding-top: 8px;
}

/* Cloudflare Sync Badge in corner */
.cf-badge {
  position: absolute;
  bottom: 12px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.cf-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* =========================================================================
   RESPONSIVE DESIGN
   ========================================================================= */
@media (max-width: 640px) {
  body {
    padding: 16px 8px;
  }
  .tich-card {
    padding: 24px 20px 20px 20px;
    border-radius: 20px;
    gap: 20px;
  }
  .header-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .clock-widget {
    align-self: flex-start;
  }
  .title-wrap h1 {
    font-size: 2rem;
  }
  .digital-clock {
    font-size: 1.8rem;
  }
  .task-row {
    padding: 8px 10px;
  }
  .emoji-squircle {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
  .task-text {
    font-size: 0.9rem;
  }
}
