:root {
  --primary-color: #0A5C36; /* Forest Green */
  --primary-hover: #084a2c; 
  --accent-color: #C0C0C0; /* Silver */
  --bg-gradient-start: #f8fafc;
  --bg-gradient-end: #f1f5f9;
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(255, 255, 255, 0.5);
  --text-main: #0F172A;
  --text-muted: #64748B;
  --danger: #EF4444;
  --success: #10B981;
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: #E2E8F0;
  --body-bg: #f8fafc;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 50px -12px rgba(10, 92, 54, 0.1);
  
  --radius: 20px;
  --max-width: 1280px;
}

/* Premium Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-gradient-start: #0F172A;
  --bg-gradient-end: #1E293B;
  --card-bg: rgba(30, 41, 59, 0.8);
  --card-border: rgba(51, 65, 85, 0.6);
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --input-bg: rgba(30, 41, 59, 0.9);
  --input-border: #334155;
  --body-bg: #0F172A;
  --accent-color: #475569;
}

/* Community Progress Bar */
.community-goal-section {
  max-width: var(--max-width);
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

.goal-card {
  background: var(--card-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent-color);
  box-shadow: var(--shadow-md);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.goal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.goal-stats {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary-color);
}

.progress-track {
  width: 100%;
  height: 16px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), #147a4a);
  width: 0%;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shine 2s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 2rem;
  position: relative;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Animated Mesh Background */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1;
  background: 
    radial-gradient(at 0% 0%, rgba(10, 92, 54, 0.05) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.05) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0, transparent 50%),
    radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.05) 0, transparent 50%);
  animation: bgAnimation 20s infinite alternate ease-in-out;
}

@keyframes bgAnimation {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

header {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo-link {
  text-decoration: none;
  -webkit-text-fill-color: transparent;
}

header h1 {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--primary-color), #8B5CF6, #10B981, var(--primary-color));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--card-bg);
  border-color: var(--card-border);
}

.nav-link.active {
  color: var(--primary-color);
  background: var(--card-bg);
  border-color: var(--card-border);
}

.nav-link.focus-trigger {
  color: #8B5CF6;
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.05);
}

.nav-link.focus-trigger:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.5);
}

/* Dark Mode Toggle */
.dark-mode-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.dark-mode-btn:hover {
  color: var(--primary-color);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 0.25rem;
}

main {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  flex: 1;
}

/* Glassmorphism Container Utility */
.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 2.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.03);
  transition: background 0.4s, border-color 0.4s;
}

/* Form Styles */
.submit-section {
  max-width: var(--max-width);
  margin: 0 auto 1.5rem;
  padding: 1.5rem 2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submit-section:focus-within {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.submit-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.input-group-grow {
  flex: 1;
}

.input-group-select {
  flex: 0 0 200px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.form-actions .btn-submit {
  padding: 0.75rem 2rem;
  flex-shrink: 0;
}

/* Two-Column Main Grid */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  align-items: start;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-label {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

input[type="text"],
select {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
  background-color: var(--input-bg);
  color: var(--text-main);
  appearance: none;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(10, 92, 54, 0.15);
}

input[type="text"]::placeholder {
  color: #94A3B8;
}

.btn-submit {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-submit:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 1rem;
}

.sidebar-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: background 0.4s, border-color 0.4s;
}

.sidebar-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.chart-container-sidebar {
  position: relative;
  height: 160px;
  width: 100%;
}

/* Daily Mission Card */

.mission-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(248, 250, 252, 0.4));
  border: 1px solid rgba(10, 92, 54, 0.2);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.mission-card::before {
  content: 'DAILY MISSION';
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--primary-color);
  opacity: 0.4;
}

.mission-icon {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.mission-content h3 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  color: var(--text-main);
}

.mission-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.feed-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.feed-grid {
  column-count: 2;
  column-gap: 1.25rem;
}

@media (max-width: 640px) {
  .feed-grid {
    column-count: 1;
  }
}

.feed-card {
  break-inside: avoid-column;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  padding-left: 1.25rem;
  border-radius: 20px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--card-border);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: cardAppear 0.5s ease-out backwards;
}

/* Category-colored left border accents */
.feed-card[data-category="movement"] { border-left-color: #059669; }
.feed-card[data-category="sleep"] { border-left-color: #2563EB; }
.feed-card[data-category="hydration"] { border-left-color: #16A34A; }
.feed-card[data-category="mindfulness"] { border-left-color: #7C3AED; }
.feed-card[data-category="nutrition"] { border-left-color: #C2410C; }
.feed-card[data-category="digital detox"] { border-left-color: #BE185D; }
.feed-card[data-category="general"] { border-left-color: #B45309; }

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.feed-card:hover {
  transform: translateY(-5px) scale(1.02);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .feed-card:hover {
  background: rgba(51, 65, 85, 0.95);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.3);
  border-color: rgba(99, 102, 241, 0.3);
}

/* Chart card overrides for sidebar */
.chart-card {
  padding-bottom: 0.75rem;
}

.card-header {
  margin-bottom: 0.75rem;
}

.category-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

/* Tag Colors - Premium Capsule Style */
.tag-movement {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.2);
}

.tag-sleep {
  background: rgba(59, 130, 246, 0.08);
  color: #2563EB;
  border-color: rgba(59, 130, 246, 0.2);
}

.tag-hydration {
  background: rgba(34, 197, 94, 0.08);
  color: #16A34A;
  border-color: rgba(34, 197, 94, 0.2);
}

.tag-mindfulness {
  background: rgba(147, 51, 234, 0.08);
  color: #7C3AED;
  border-color: rgba(147, 51, 234, 0.2);
}

.tag-nutrition {
  background: rgba(234, 88, 12, 0.08);
  color: #C2410C;
  border-color: rgba(234, 88, 12, 0.2);
}

.tag-digital-detox {
  background: rgba(219, 39, 119, 0.08);
  color: #BE185D;
  border-color: rgba(219, 39, 119, 0.2);
}

.tag-general {
  background: rgba(245, 158, 11, 0.08);
  color: #B45309;
  border-color: rgba(245, 158, 11, 0.2);
}

/* Filter Menu Styles */
.filter-menu {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--input-bg);
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.error-banner {
  background-color: #FEF2F2;
  border-left: 4px solid #EF4444;
  color: #991B1B;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  font-size: 0.875rem;
  animation: slideIn 0.3s ease-out;
}

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

.habit-text {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  flex: 1;
  color: var(--text-main);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.habit-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.meta-time {
  display: flex;
  align-items: center;
  gap: 6px;
}

.upvote-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.upvote-btn:hover {
  background: #F1F5F9;
  color: var(--primary);
  transform: scale(1.05);
}

.upvote-btn .fa-solid {
  color: var(--primary);
}

.time-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

/* AI Cheer Box inside Feed Cards */
.ai-cheer-box {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(139, 92, 246, 0.03));
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-left: 4px solid #8B5CF6;
  border-radius: 0 16px 16px 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  animation: glowPulse 4s infinite alternate;
}

@keyframes glowPulse {
  from { box-shadow: 0 0 10px rgba(139, 92, 246, 0.05); }
  to { box-shadow: 0 0 20px rgba(139, 92, 246, 0.15); }
}

.ai-cheer-box p {
  font-size: 0.95rem;
  color: #4338CA;
  line-height: 1.5;
  font-style: italic;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.cheer-icon {
  color: #8B5CF6;
  font-size: 1rem;
  margin-top: 2px;
}

/* Custom Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-main);
  cursor: pointer;
  margin-top: -0.5rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  border: 1px dashed #CBD5E1;
}

/* Floating Chat UI */
.floating-chat-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 1000;
  pointer-events: none; /* Prevent the invisible container bounds from blocking grid clicks */
}

.chat-fab {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #2d8a5c);
  color: white;
  border: 2px solid var(--accent-color);
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto; /* Re-enable clicks for the button */
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 35px rgba(10, 92, 54, 0.2);
}

.chat-cta {
  position: absolute;
  bottom: 85px;
  right: 0;
  width: 210px;
  background: white;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.4;
  border: 2px solid var(--accent-color);
  animation: ctaFadeInOut 6s ease-in-out forwards;
  pointer-events: none;
  z-index: 1001;
}

.chat-cta::after {
  content: '';
  position: absolute;
  bottom: -12px;
  right: 22px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid var(--accent-color);
}

@keyframes ctaFadeInOut {
  0% { opacity: 0; transform: translateY(10px); }
  10% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-5px); pointer-events: none; visibility: hidden; }
}

.chat-window {
  position: absolute;
  bottom: 85px; /* Above the FAB */
  right: 0;
  width: 420px;
  height: min(550px, 80vh);
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  transform-origin: bottom right;
  pointer-events: auto;
  z-index: 1002;
}

.chat-window.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9) translateY(20px);
  pointer-events: none;
}

.chat-header {
  background: linear-gradient(135deg, var(--primary-color), #2d8a5c);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-color);
}

.chat-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-header button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-header button:hover {
  opacity: 1;
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #F8FAFC;
}

.chat-message {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  max-width: 85%;
  font-size: 0.9rem;
  line-height: 1.4;
}

.ai-message {
  background: white;
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #E2E8F0;
  width: 100%;
}

.ai-message p {
  margin-bottom: 0.75rem;
}

.ai-message p:last-child {
  margin-bottom: 0;
}

.ai-message h3, .ai-message h4 {
  font-size: 1.05rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary-hover);
}

.ai-message ul, .ai-message ol {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.ai-message li {
  margin-bottom: 0.25rem;
}

/* Typing Indicator Animation */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.user-message {
  background: var(--primary-color);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.error-message {
  background: #FEF2F2;
  color: var(--danger);
  border-color: #FECACA;
}

.chat-form {
  padding: 1rem;
  background: white;
  border-top: 1px solid #E2E8F0;
  display: flex;
  gap: 0.5rem;
}

.chat-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  outline: none;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.chat-form input:focus {
  border-color: var(--primary-color);
}

.chat-form button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s;
}

.chat-form button:hover {
  background: var(--primary-hover);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  header {
    padding: 2rem 1rem 1rem;
  }
  
  .submit-section {
    padding: 1.25rem;
  }
}

/* Milestone Markers on Progress Bar */
.progress-track {
  position: relative;
}

.milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  background: white;
  border: 2px solid #CBD5E1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  color: #94A3B8;
  z-index: 2;
  transition: all 0.4s ease;
  cursor: default;
}

.milestone::before {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.milestone:hover::before {
  opacity: 1;
}

.milestone.reached {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 8px rgba(10, 92, 54, 0.4);
}

.milestone.reached::before {
  color: var(--primary-color);
}

.milestone-final {
  width: 22px;
  height: 22px;
}

/* Dark Mode Overrides */
[data-theme="dark"] body::before {
  background: 
    radial-gradient(at 0% 0%, rgba(10, 92, 54, 0.1) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.08) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0, transparent 50%),
    radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.08) 0, transparent 50%);
}

[data-theme="dark"] .goal-card {
  background: var(--card-bg);
  border-color: var(--card-border);
}

[data-theme="dark"] .progress-track {
  background: #1E293B;
}

[data-theme="dark"] .milestone {
  background: #1E293B;
  border-color: #475569;
  color: #64748B;
}

[data-theme="dark"] .milestone.reached {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

[data-theme="dark"] .feed-card:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .chat-window {
  background: #1E293B;
}

[data-theme="dark"] .chat-messages {
  background: #0F172A;
}

[data-theme="dark"] .ai-message {
  background: #1E293B;
  border-color: #334155;
  color: var(--text-main);
}

[data-theme="dark"] .chat-form {
  background: #1E293B;
  border-color: #334155;
}

[data-theme="dark"] .chat-form input {
  background: #0F172A;
  border-color: #334155;
  color: var(--text-main);
}

[data-theme="dark"] .chat-cta {
  background: #1E293B;
  border-color: #475569;
  color: var(--primary-color);
}

[data-theme="dark"] .empty-state {
  background: var(--card-bg);
  border-color: #334155;
  color: var(--text-muted);
}

[data-theme="dark"] .error-banner {
  background: rgba(239, 68, 68, 0.1);
  color: #FCA5A5;
}

[data-theme="dark"] .ai-cheer-box {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
  border-color: rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .ai-cheer-box p {
  color: #A5B4FC;
}

[data-theme="dark"] .mission-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.4));
  border-color: rgba(10, 92, 54, 0.3);
}

/* ========================================= */
/*           FOCUS MODE OVERLAY              */
/* ========================================= */
.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: linear-gradient(135deg, #0F172A 0%, #1a1a2e 30%, #16213e 60%, #0F172A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

.focus-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.focus-exit {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  padding: 0.5rem 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.focus-exit:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}

.focus-content {
  text-align: center;
  position: relative;
  z-index: 2;
}

/* Breathing Ring Animation */
.breathing-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 2px solid rgba(139, 92, 246, 0.15);
  animation: breathe 6s ease-in-out infinite;
  z-index: 0;
}

.focusing .breathing-ring {
  border-color: rgba(16, 185, 129, 0.2);
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.3;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0.7;
  }
}

/* Timer Display */
.focus-timer-display {
  font-size: 7rem;
  font-weight: 800;
  color: white;
  letter-spacing: -4px;
  line-height: 1;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

.timer-colon {
  opacity: 0.4;
  margin: 0 0.1em;
}

.focus-label {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  margin-bottom: 2rem;
  min-height: 1.5em;
  transition: color 0.3s ease;
}

/* Focus Buttons */
.focus-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2rem;
  position: relative;
  z-index: 10;
}

.focus-btn {
  padding: 0.75rem 2rem;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  border: none;
}

.focus-btn-primary {
  background: linear-gradient(135deg, #10B981, #0A5C36);
  color: white;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.focus-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
}

.focus-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.focus-btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.focus-btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.focus-btn-ghost:hover:not(:disabled) {
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

.focus-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Mode Chips */
.focus-mode-selector {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 10;
}

.mode-chip {
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.mode-chip.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
  color: #A78BFA;
}

/* Session Counter */
.session-counter {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 1.5rem;
}

.session-counter span {
  color: #10B981;
  font-weight: 700;
  font-size: 1rem;
}

/* Focus Quote */
.focus-quote {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.2);
  font-style: italic;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ========================================= */
/*           RESOURCE HUB PAGE               */
/* ========================================= */
.resources-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.resources-page h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.resources-page .page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.resource-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 1.75rem;
  transition: all 0.3s ease;
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.resource-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: white;
}

.resource-card-icon.green { background: linear-gradient(135deg, #10B981, #0A5C36); }
.resource-card-icon.purple { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.resource-card-icon.blue { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.resource-card-icon.red { background: linear-gradient(135deg, #EF4444, #DC2626); }
.resource-card-icon.amber { background: linear-gradient(135deg, #F59E0B, #D97706); }
.resource-card-icon.teal { background: linear-gradient(135deg, #14B8A6, #0D9488); }

.resource-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.resource-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.resource-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.resource-card ul li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resource-card ul li:last-child {
  border-bottom: none;
}

.resource-card ul li i {
  color: var(--primary-color);
  font-size: 0.75rem;
}

.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: gap 0.2s ease;
}

.resource-link:hover {
  gap: 0.7rem;
}

/* ========================================= */
/*        RESPONSIVE DESIGN BREAKPOINTS      */
/* ========================================= */

/* Laptops & small desktops (1024px and below) */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
  }

  .glass-panel {
    padding: 1.75rem;
  }

  .submit-section {
    padding: 1.25rem 1.5rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .feed-card {
    padding: 1.25rem;
  }
}

/* Tablets & small laptops (900px and below) */
@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
  }

  .submit-form {
    align-items: center;
  }

  .form-row {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 1.25rem;
  }

  .input-group,
  .input-group-grow,
  .input-group-select {
    width: 100%;
    max-width: 600px;
    flex: none;
  }

  .input-label {
    text-align: left;
    width: 100%;
  }

  .submit-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .form-actions {
    width: 100%;
    max-width: 600px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .feed-grid {
    column-count: 2;
  }
}

/* Tablets portrait (768px and below) */
@media (max-width: 768px) {
  .header-top {
    flex-direction: column;
    gap: 0.75rem;
  }

  .header-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  header h1 {
    font-size: 1.4rem;
  }

  header p {
    font-size: 0.8rem;
  }

  .glass-panel {
    padding: 1.5rem;
    border-radius: 20px;
  }

  .focus-timer-display {
    font-size: 4.5rem;
  }

  .breathing-ring {
    width: 220px;
    height: 220px;
  }

  .focus-controls {
    flex-wrap: wrap;
  }

  .focus-mode-selector {
    flex-wrap: wrap;
  }

  /* Chat goes full-screen on mobile */
  .chat-window {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    z-index: 9999;
  }

  .chat-window.hidden {
    transform: translateY(100%);
  }

  .chat-cta {
    display: none;
  }

  /* Resource Hub responsive */
  .resource-grid {
    grid-template-columns: 1fr;
  }
}

/* Phones (480px and below) */
@media (max-width: 480px) {
  body {
    padding-bottom: 1rem;
  }

  main {
    padding: 0 0.5rem;
  }

  header {
    padding: 1rem 0.5rem 0.75rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  .nav-link {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }

  .glass-panel {
    padding: 1rem;
    border-radius: 16px;
  }

  .submit-section {
    padding: 1rem;
  }

  .feed-grid {
    column-count: 1;
  }

  .feed-card {
    padding: 1rem;
    border-radius: 16px;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .focus-timer-display {
    font-size: 3.5rem;
  }

  .breathing-ring {
    width: 180px;
    height: 180px;
  }

  .focus-btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
  }

  .focus-quote {
    font-size: 0.75rem;
    max-width: 300px;
  }

  .btn-submit {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
}
