/* ==========================================================================
   ZenTask Ultra Modern Mobile UI & Stream Timeline (No Ugly Lines)
   ========================================================================== */

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

/* Safe area for mobile */
.safe-area-bottom {
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 9999px;
}

/* ==========================================================================
   MODERN TIMELINE SECTION HEADERS (CLEAN & SLEEK)
   ========================================================================== */

.timeline-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  margin-bottom: 0.65rem;
  backdrop-blur: 12px;
}

.timeline-header-urgent {
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.12) 0%, rgba(244, 63, 94, 0.02) 100%);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #e11d48;
}
.dark .timeline-header-urgent {
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.25) 0%, rgba(225, 29, 72, 0.05) 100%);
  border-color: rgba(225, 29, 72, 0.4);
  color: #fda4af;
}

.timeline-header-normal {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.02) 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
}
.dark .timeline-header-normal {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.timeline-header-nodate {
  background: linear-gradient(90deg, rgba(100, 116, 139, 0.1) 0%, rgba(100, 116, 139, 0.02) 100%);
  border: 1px solid rgba(100, 116, 139, 0.2);
  color: #64748b;
}
.dark .timeline-header-nodate {
  background: linear-gradient(90deg, rgba(100, 116, 139, 0.2) 0%, rgba(100, 116, 139, 0.05) 100%);
  border-color: rgba(100, 116, 139, 0.3);
  color: #94a3b8;
}

/* ==========================================================================
   PREMIUM FULL-COLORED TASK CARDS
   ========================================================================== */

.task-item {
  position: relative;
  border-radius: 1.25rem;
  padding: 1rem 1.1rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
  overflow: hidden;
}

.task-item:active {
  transform: scale(0.985);
}

/* 🔴 RED URGENT CARD (GẦN TỚI HẠN & QUÁ HẠN - HIỆU ỨNG RUNG RUNG) */
.task-urgent-card {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%) !important;
  border: 1.5px solid #fda4af !important;
  box-shadow: 0 8px 20px -6px rgba(244, 63, 94, 0.18), 0 2px 6px rgba(244, 63, 94, 0.08);
  color: #881337;
  animation: deadlineVibrate 3.5s ease-in-out infinite;
  transform-origin: center;
}

/* Hiệu ứng rung rung cảnh báo deadline */
@keyframes deadlineVibrate {
  0% { transform: translateX(0) scale(1); }
  1.5% { transform: translateX(-3px) rotate(-0.4deg); }
  3% { transform: translateX(3px) rotate(0.4deg); }
  4.5% { transform: translateX(-3px) rotate(-0.4deg); }
  6% { transform: translateX(3px) rotate(0.4deg); }
  7.5% { transform: translateX(-2px) rotate(-0.2deg); }
  9% { transform: translateX(2px) rotate(0.2deg); }
  10.5% { transform: translateX(0) scale(1); }
  100% { transform: translateX(0) scale(1); }
}

.task-urgent-card .task-title {
  color: #9f1239 !important;
  font-weight: 800 !important;
}

.task-urgent-card .custom-checkbox {
  border-color: #f43f5e !important;
  background-color: rgba(255, 255, 255, 0.85);
}

.task-urgent-card .time-pill {
  background-color: #ffe4e6;
  color: #be123c;
  border: 1px solid #fecdd3;
  font-weight: 800;
}

/* Dark Mode Red Card */
.dark .task-urgent-card {
  background: linear-gradient(135deg, #3f0713 0%, #1f040a 100%) !important;
  border: 1.5px solid #9f1239 !important;
  box-shadow: 0 8px 24px -6px rgba(225, 29, 72, 0.35);
  color: #fecdd3;
}

.dark .task-urgent-card .task-title {
  color: #ffe4e6 !important;
}

.dark .task-urgent-card .custom-checkbox {
  border-color: #fb7185 !important;
  background-color: rgba(0, 0, 0, 0.35);
}

.dark .task-urgent-card .time-pill {
  background-color: rgba(244, 63, 94, 0.25);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.45);
}

/* 🟢 GREEN NORMAL CARD (BÌNH THƯỜNG / CÒN THỜI GIAN) */
.task-normal-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
  border: 1.5px solid #86efac !important;
  box-shadow: 0 8px 20px -6px rgba(16, 185, 129, 0.12), 0 2px 6px rgba(16, 185, 129, 0.05);
  color: #064e3b;
}

.task-normal-card .task-title {
  color: #14532d !important;
  font-weight: 800 !important;
}

.task-normal-card .custom-checkbox {
  border-color: #10b981 !important;
  background-color: rgba(255, 255, 255, 0.85);
}

.task-normal-card .time-pill {
  background-color: #dcfce7;
  color: #047857;
  border: 1px solid #bbf7d0;
  font-weight: 800;
}

/* Dark Mode Green Card */
.dark .task-normal-card {
  background: linear-gradient(135deg, #022c22 0%, #064e3b 100%) !important;
  border: 1.5px solid #059669 !important;
  box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.dark .task-normal-card .task-title {
  color: #ecfdf5 !important;
}

.dark .task-normal-card .custom-checkbox {
  border-color: #34d399 !important;
  background-color: rgba(0, 0, 0, 0.35);
}

.dark .task-normal-card .time-pill {
  background-color: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

/* ⚪ NO DATE CARD */
.task-nodate-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}
.dark .task-nodate-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  border: 1.5px solid #334155 !important;
}

/* Checkbox */
.custom-checkbox {
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  border-width: 2.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
}

.custom-checkbox:active {
  transform: scale(1.2);
}

.custom-checkbox.checked {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  animation: checkboxPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes checkboxPop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.custom-checkbox .check-icon {
  display: none;
  color: white;
  width: 15px;
  height: 15px;
}

.custom-checkbox.checked .check-icon {
  display: block;
}

/* Animating out */
.task-item.task-completing {
  transform: scale(0.95) translateX(30px);
  opacity: 0;
  max-height: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden;
  border-width: 0 !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Bottom Nav */
.bottom-nav-item {
  color: #94a3b8;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item.active {
  color: #4f46e5;
  transform: translateY(-2px);
}
.dark .bottom-nav-item.active {
  color: #818cf8;
}

/* Modals */
.modal-active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-active .modal-content,
.modal-active .history-modal-content {
  transform: translateY(0) scale(1) !important;
  opacity: 1 !important;
}

.modal-active .reminder-content,
.modal-active .confirm-content {
  transform: scale(1) !important;
  opacity: 1 !important;
}

/* Toast */
.toast-bubble {
  animation: toastSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.2);
}

.toast-bubble.hiding {
  animation: toastSlideUp 0.2s ease-in forwards;
}

@keyframes toastSlideDown {
  from {
    transform: translateY(-24px) scale(0.92);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes toastSlideUp {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateY(-20px) scale(0.92);
    opacity: 0;
  }
}
