@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #10b981;
  --accent: #3b82f6;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f0f4ff;
  --card: rgba(255, 255, 255, 0.85);
  --text: #1e293b;
  --text-muted: #64748b;
  --border: rgba(99, 102, 241, 0.15);
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-green: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-warm: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-emerald: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
}

* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Glass morphism card */
.glass-card {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.08);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.glass-card:hover {
  box-shadow: 0 8px 40px rgba(99, 102, 241, 0.15);
}

/* Gradient hero */
.hero-gradient {
  background: var(--gradient);
}

/* Streak counter animation */
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
  100% { transform: scale(1); opacity: 1; }
}

.streak-badge {
  animation: pulse-ring 3s ease-in-out infinite;
}

/* Breathing animation for relapse support */
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.4); opacity: 1; }
}

.breathing-circle {
  animation: breathe 4s ease-in-out infinite;
}

/* Slide up animation */
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.slide-up {
  animation: slideUp 0.5s ease forwards;
}

/* Stagger children */
.stagger > * {
  opacity: 0;
  animation: slideUp 0.5s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.1s; }
.stagger > *:nth-child(2) { animation-delay: 0.2s; }
.stagger > *:nth-child(3) { animation-delay: 0.3s; }
.stagger > *:nth-child(4) { animation-delay: 0.4s; }
.stagger > *:nth-child(5) { animation-delay: 0.5s; }
.stagger > *:nth-child(6) { animation-delay: 0.6s; }

/* Checkmark task item */
.task-item {
  transition: all 0.3s ease;
}

.task-item.completed {
  opacity: 0.7;
}

.task-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.task-check.done {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
}

/* Progress ring */
.progress-ring-circle {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Mood button */
.mood-btn {
  font-size: 2rem;
  padding: 0.75rem;
  border-radius: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.mood-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.mood-btn.selected {
  border-color: var(--primary);
  background: #eef2ff;
  transform: scale(1.1);
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
}

/* Desktop sidebar */
.sidebar {
  width: 260px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.sidebar-item:hover {
  background: #eef2ff;
  color: var(--primary);
}

.sidebar-item.active {
  background: linear-gradient(135deg, #eef2ff, #ede9fe);
  color: var(--primary);
  font-weight: 600;
}

/* Main content with sidebar */
@media (min-width: 768px) {
  .with-sidebar {
    margin-left: 260px;
  }
  .bottom-nav {
    display: none;
  }
}

/* Chat bubble */
.chat-bubble-user {
  background: var(--gradient);
  color: white;
  border-radius: 20px 20px 4px 20px;
  padding: 12px 16px;
  max-width: 75%;
  word-break: break-word;
}

.chat-bubble-ai {
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px 20px 20px 4px;
  padding: 12px 16px;
  max-width: 75%;
  word-break: break-word;
}

/* Typing indicator */
@keyframes bounce-dot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce-dot 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Relapse support overlay */
.relapse-overlay {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

/* Input styles */
.app-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  background: white;
  color: var(--text);
  outline: none;
}

.app-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Buttons */
.btn-primary {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--border);
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: #eef2ff;
  border-color: var(--primary);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Category badges */
.category-body { background: #dcfce7; color: #166534; }
.category-mind { background: #ede9fe; color: #5b21b6; }
.category-home { background: #fef3c7; color: #92400e; }
.category-purpose { background: #dbeafe; color: #1e40af; }
.category-people { background: #fce7f3; color: #9d174d; }

/* Toast notification */
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast {
  animation: toast-in 0.3s ease forwards;
}

/* Confetti burst (CSS only) */
@keyframes confetti-fall {
  to { transform: translateY(120vh) rotate(720deg); opacity: 0; }
}

/* Quote card gradient border */
.quote-card {
  background: white;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}

.quote-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* === COMPASS App Design System v2 === */
.page-hero {
  background: linear-gradient(135deg, #f97316 0%, #fbbf24 50%, #34d399 100%);
  padding: 32px 20px 40px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  top: -70px; right: -70px;
  filter: blur(50px);
}
.hero-card {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 16px 20px;
  backdrop-filter: blur(10px);
}
.warm-card {
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  border: 1px solid #fed7aa;
  border-radius: 24px;
  padding: 20px;
}
.emerald-card {
  background: linear-gradient(135deg, #ecfdf5, #ffffff);
  border: 1px solid #a7f3d0;
  border-radius: 24px;
  padding: 20px;
}
.amber-card {
  background: linear-gradient(135deg, #fefce8, #ffffff);
  border: 1px solid #fde68a;
  border-radius: 24px;
  padding: 20px;
}
.blue-card {
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid #bfdbfe;
  border-radius: 24px;
  padding: 20px;
}
.violet-card {
  background: linear-gradient(135deg, #f5f3ff, #ffffff);
  border: 1px solid #ddd6fe;
  border-radius: 24px;
  padding: 20px;
}
.red-card {
  background: linear-gradient(135deg, #fff1f2, #ffffff);
  border: 1px solid #fecdd3;
  border-radius: 24px;
  padding: 20px;
}
.insp-band {
  background: linear-gradient(135deg, #fef3c7, #d1fae5, #bfdbfe);
  border-radius: 24px;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
  margin: 20px 0;
}
.card-lift {
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.card-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.10);
}
@keyframes float-hero { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.float-hero { animation: float-hero 5s ease-in-out infinite; }
