:root {
  
  --primary: #5dafae;       
  --primary-light: #e6f4f3; 
  --secondary: #f0a3a3;    
  --bg-color: #f7f9fa;      
  --card-bg: #ffffff;
  --text-main: #333d45;    
  --text-muted: #8898a3;    
  --border-light: #eaeef1;
  --success: #67c296;

  --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
  --shadow-md: 0 8px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 16px 32px rgba(50, 60, 70, 0.1);
  
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-full: 9999px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden; /* App container handles scrolling */
}

/* App Container acting as a mobile boundary on desktop */
#app {
  width: 100%;
  max-width: 480px; 
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  background-color: var(--bg-color);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Core Screens */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  padding-bottom: 90px; 
}

.screen {
  display: none;
  padding: 0 20px 20px 20px;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

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

/* Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 16px 0;
  position: sticky;
  top: 0;
  background-color: rgba(247, 249, 250, 0.85); /* Slightly transparent matches var(--bg-color) */
  backdrop-filter: blur(12px);
  z-index: 10;
}

.top-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.icon-btn:active {
  transform: scale(0.95);
  background: var(--border-light);
}

/* Calendar */
.calendar-container {
  margin: 10px -20px 24px -20px; /* Bleed to edges */
  padding: 0 20px;
}

.calendar-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}
.calendar-track::-webkit-scrollbar {
  display: none;
}

.day-card {
  min-width: 60px;
  height: 63px;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  border: 1.5px solid transparent;
}
.day-card .day-name {
  font-size: 8px;
  color: var(--text-muted);
  font-weight: 500;
}
.day-card .day-num {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}
.day-card.selected {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(93, 175, 174, 0.3);
}
.day-card.selected .day-name, .day-card.selected .day-num {
  color: #fff;
}
.day-card.has-data::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  background-color: var(--secondary);
  border-radius: 50%;
  margin-top: 2px;
}
.day-card.selected.has-data::after {
  background-color: #fff;
}

/* Lists and Cards */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.section-title h2 {
  font-size: 18px;
  font-weight: 600;
}

.summary-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.log-entry-card {
  display: flex;
  align-items: center;
  gap: 16px;
}
.log-icon {
  width:  ৪৮px; /* Fixed typo 48px soon */
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.log-details {
  flex: 1;
}
.log-details h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.log-details p {
  font-size: 14px;
  color: var(--text-muted);
}
.log-intensity {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--secondary);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Insights Layout */
.insights-scroll {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.smart-insight-card p {
  font-size: 15px;
  line-height: 1.5;
  margin-top: 8px;
}
.chart-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
}

/* Bottom Nav */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 72px;
  background: var(--card-bg);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.03);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  flex: 1;
}

.nav-item i {
  font-size: 24px;
}
.nav-item span {
  font-size: 11px;
  font-weight: 500;
}
.nav-item.active {
  color: var(--primary);
}

/* FAB Track Button */
.fab {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(93, 175, 174, 0.4);
  cursor: pointer;
  z-index: 60;
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab:active {
  transform: translateX(-50%) scale(0.95);
  box-shadow: 0 4px 12px rgba(93, 175, 174, 0.3);
}

/* Tracking Modal Styles */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  z-index: 100;
  transform: translateY(100%); /* Hidden initially */
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
}
.modal.open {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 20px 16px 20px;
}
.step-indicator {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.modal-body {
  flex: 1;
  position: relative;
  overflow: hidden; /* For sliding steps */
}

.step-pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0 24px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateX(50px);
  transition: all 0.3s ease;
}
.step-pane.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
.step-pane.prev {
  transform: translateX(-50px);
}

.step-pane h2 {
  font-size: 26px;
  margin-bottom: 8px;
}
.step-pane .subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Location step specific */
.location-tabs {
  display: flex;
  background: var(--border-light);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: 24px;
  margin-top: 16px;
}
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
}
.tab-btn.active {
  background: #fff;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.list-options-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 24px;
}
.list-options-container.hidden {
  display: none;
}
.location-group h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-btn {
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  border: 2px solid var(--border-light);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}
.chip-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Option Grids */
.grid-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid-options.hidden {
  display: none;
}
.option-card {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.option-card i {
  font-size: 32px;
  color: var(--primary);
}
.option-card span {
  font-size: 14px;
  font-weight: 500;
}
.option-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.type-grid {
  margin-top: 24px;
}
.type-grid .option-card {
  padding: 16px;
}

/* Intensity Grid */
.intensity-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.circle-btn {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  background: var(--card-bg);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}
.circle-btn.selected {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(240, 163, 163, 0.4);
}

/* List Options */
.list-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.list-btn {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 18px;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.list-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Emotion Grid */
.emotion-grid {
  margin-top: 24px;
}
.emotion-card {
  padding: 16px;
}
.emotion-card .emoji {
  font-size: 32px;
}

/* Success View */
.success-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}
.success-icon i {
  font-size: 80px;
  color: var(--success);
}
.success-content h2 {
  margin-bottom: 0;
}

/* Modal Footer */
.modal-footer {
  padding: 20px 24px 34px 24px;
  background: var(--bg-color);
  display: flex;
  gap: 12px;
}
.btn {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(93, 175, 174, 0.3);
}
.btn.secondary {
  background: var(--border-light);
  color: var(--text-main);
}
.btn.hidden {
  display: none;
}
