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

:root {
  /* Colors */
  --lime-primary: #9CFF2E;
  --lime-dark: #70CC14;
  --lime-soft: #E8FAD7;
  --black: #111111;
  --dark-card: #1E1E1E;
  --gray-card: #FAFAFA;
  --white: #FFFFFF;
  --gray-text: #888888;
  --placeholder: #C7C7C7;
  --progress-track: #333333;
  --bg-page: #f5f5f7; /* Cool-grey page as requested for soft structure */

  /* Spacing (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-18: 72px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px; /* Cards */
  --radius-full: 999px; /* Pills/Buttons */

  /* Typography */
  --font-family: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--black);
  color: var(--white);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Mobile App Container */
.app-container {
  width: 100%;
  max-width: 414px; /* Typical mobile width */
  height: 100vh;
  background-color: var(--black);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0,0,0,0.1);
}

/* Scrollable Content Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6) var(--sp-5);
  padding-bottom: 100px; /* Space for bottom nav */
}

.content-area::-webkit-scrollbar {
  display: none;
}
.content-area {
  -ms-overflow-style: none;  
  scrollbar-width: none;  
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.3s ease-out;
}
.view.active {
  display: block;
}

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

/* Typography Utilities */
.t-h1 { font-size: 32px; font-weight: 700; line-height: 1.2; letter-spacing: -1px; }
.t-h2 { font-size: 24px; font-weight: 700; line-height: 1.3; }
.t-h3 { font-size: 20px; font-weight: 600; line-height: 1.4; }
.t-body-lg { font-size: 16px; font-weight: 400; line-height: 1.5; }
.t-body { font-size: 14px; font-weight: 400; line-height: 1.5; }
.t-body-md { font-size: 14px; font-weight: 500; line-height: 1.5; }
.t-caption { font-size: 12px; font-weight: 500; line-height: 1.5; color: var(--gray-text); }
.t-micro { font-size: 11px; font-weight: 400; line-height: 1.5; }

/* Colors Utilities */
.c-gray { color: var(--gray-text); }
.c-white { color: var(--white); }
.c-lime { color: var(--lime-primary); }
.c-black { color: var(--black); }

/* Spacing Utilities */
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-7 { margin-bottom: var(--sp-7); }
.mb-8 { margin-bottom: var(--sp-8); }
.mt-4 { margin-top: var(--sp-4); }
.mr-2 { margin-right: var(--sp-2); }
.ml-2 { margin-left: var(--sp-2); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* Flex Utilities */
.flex { display: flex; }
.col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.wrap { flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--white);
  color: var(--black);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-4);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.card.compact {
  padding: var(--sp-4);
  border-radius: var(--radius-lg);
}
.card.dark {
  background: var(--dark-card);
  color: var(--white);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.card.lime {
  background: var(--lime-primary);
  color: var(--black);
}

/* Badges / Pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px var(--sp-3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.badge.lime {
  background: var(--lime-primary);
  color: var(--black);
}
.badge.dark {
  background: var(--progress-track);
  color: var(--white);
}
.badge.soft {
  background: var(--lime-soft);
  color: var(--lime-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}
.btn:active {
  transform: scale(0.96);
}
.btn.primary {
  background: var(--lime-primary);
  color: var(--black);
}
.btn.dark {
  background: var(--black);
  color: var(--white);
}
.btn.ghost {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--placeholder);
}
.btn.subtle {
  background: var(--gray-card);
  color: var(--black);
}

/* Avatars */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background-color: var(--placeholder);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

/* Bottom Nav */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--dark-card);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--sp-4);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--gray-text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  gap: var(--sp-1);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  stroke: var(--gray-text);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s;
}

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

.nav-item.active svg {
  stroke: var(--lime-primary);
  /* Optionally fill some icons */
}

/* Custom Components for specific screens */

/* Progress Bar */
.progress-container {
  width: 100%;
  height: 8px;
  background: var(--lime-soft);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--sp-2);
}
.card.dark .progress-container {
  background: var(--progress-track);
}
.progress-bar {
  height: 100%;
  background: var(--lime-primary);
  border-radius: var(--radius-full);
}

/* Bar Chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 100px;
  padding-top: var(--sp-4);
  gap: var(--sp-2);
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
}
.bar {
  width: 100%;
  background: var(--progress-track);
  border-radius: var(--radius-sm);
  transition: height 0.5s ease-out;
}
.bar.active {
  background: var(--lime-primary);
}
.bar-label {
  font-size: 10px;
  color: var(--gray-text);
}

/* Overlapping Avatars */
.avatar-group {
  display: flex;
}
.avatar-group .avatar {
  border: 2px solid var(--white);
  margin-left: -12px;
}
.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* Line Graph SVG Container */
.line-graph {
  width: 100%;
  height: 60px;
  margin-top: var(--sp-2);
}

/* Checklist */
.check-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.check-item.done .check-text {
  text-decoration: line-through;
  color: var(--gray-text);
}
.checkbox {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
}
.check-item.done .checkbox {
  background: var(--lime-primary);
  border-color: var(--lime-primary);
}

/* Settings List */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--gray-card);
}
.card.dark .setting-row {
  border-bottom: 1px solid var(--progress-track);
}
.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}
.setting-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* Calendar Timeline */
.timeline-row {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.timeline-time {
  width: 45px;
  text-align: right;
  font-size: 12px;
  color: var(--gray-text);
  font-weight: 500;
}
.timeline-card {
  flex: 1;
  background: var(--white);
  color: var(--black);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--lime-primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

/* Horizontal Date Picker */
.date-picker {
  display: flex;
  overflow-x: auto;
  gap: var(--sp-3);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.date-picker::-webkit-scrollbar { display: none; }
.date-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--black);
  cursor: pointer;
}
.date-col.active {
  background: var(--lime-primary);
}
.date-col .day-name {
  font-size: 12px;
  color: var(--gray-text);
}
.date-col.active .day-name {
  color: var(--black);
}
.date-col .day-num {
  font-size: 16px;
  font-weight: 700;
}

/* Calendar Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--sp-2);
  text-align: center;
  margin-bottom: var(--sp-6);
}
.cal-head {
  font-size: 11px;
  color: var(--gray-text);
  margin-bottom: var(--sp-2);
}
.cal-cell {
  font-size: 14px;
  font-weight: 500;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  border-radius: var(--radius-full);
}
.cal-cell.active {
  background: var(--lime-primary);
  color: var(--black);
}
.cal-cell.muted {
  color: var(--placeholder);
}

/* Chat UI */
.view.chat-container {
  display: none;
}
.view.active.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  padding-bottom: var(--sp-4);
  padding-top: var(--sp-4);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
}
.chat-messages::-webkit-scrollbar { display: none; }
.message {
  max-width: 80%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-xl);
  font-size: 14px;
  line-height: 1.5;
}
.message.received {
  align-self: flex-start;
  background: var(--dark-card);
  color: var(--white);
  border-bottom-left-radius: 4px;
}
.message.sent {
  align-self: flex-end;
  background: var(--lime-primary);
  color: var(--black);
  border-bottom-right-radius: 4px;
}
.chat-input-area {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  background: var(--dark-card);
  border-radius: var(--radius-full);
  margin-bottom: var(--sp-4);
  margin-top: auto;
}
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--white);
  outline: none;
  font-family: var(--font-family);
  font-size: 14px;
}
.chat-input::placeholder {
  color: var(--gray-text);
}
.send-btn {
  background: var(--lime-primary);
  color: var(--black);
  border: none;
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
