/* === FLOURISH APP STYLES === */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --sage: #7A8B6F;
  --sage-light: #A3B18A;
  --sage-pale: #DAD7CD;
  --cream: #FEFAE0;
  --warm: #DDA15E;
  --earth: #BC6C25;
  --dark: #283618;
  --text: #344E41;
  --white: #FAFAF5;
  --error: #c0392b;
  --success: #27ae60;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--white);
  color: var(--text);
  min-height: 100vh;
}

/* === APP NAV === */
.app-nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: rgba(250, 250, 245, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(122, 139, 111, 0.15);
}

.app-nav .logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--dark);
  text-decoration: none;
}

.app-nav .logo span { color: var(--sage); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: all 0.2s;
  opacity: 0.7;
}

.nav-links a:hover, .nav-links a.active {
  opacity: 1;
  background: rgba(122, 139, 111, 0.08);
  color: var(--dark);
}

/* === MAIN CONTENT === */
.app-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
}

/* === PAGE HEADERS === */
.page-header {
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 2.2rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 1rem;
  opacity: 0.7;
  line-height: 1.6;
}

/* === CARDS === */
.card {
  background: var(--white);
  border: 1px solid rgba(122, 139, 111, 0.12);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(40, 54, 24, 0.06);
}

.card h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--dark);
  margin-bottom: 1rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

/* === FORMS === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.4rem;
}

.form-group .hint {
  font-size: 0.78rem;
  opacity: 0.6;
  margin-bottom: 0.35rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

input[type="text"], input[type="email"], input[type="number"],
select, textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--sage-pale);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(122, 139, 111, 0.12);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* === CHIP SELECTORS === */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border: 1.5px solid var(--sage-pale);
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  background: var(--white);
}

.chip:hover {
  border-color: var(--sage-light);
  background: rgba(163, 177, 138, 0.08);
}

.chip.selected {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--sage);
  color: white;
}

.btn-primary:hover {
  background: var(--dark);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-warm {
  background: var(--warm);
  color: white;
}

.btn-warm:hover {
  background: var(--earth);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--sage-pale);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--sage);
  background: rgba(122, 139, 111, 0.05);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
  border-radius: 12px;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
}

/* === STAT CARDS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid rgba(122, 139, 111, 0.12);
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: var(--dark);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--sage);
  font-weight: 500;
  margin-top: 0.35rem;
}

/* === MEAL PLAN === */
.day-card {
  background: var(--white);
  border: 1px solid rgba(122, 139, 111, 0.12);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.day-card h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--dark);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--sage-pale);
}

.meal-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(218, 215, 205, 0.4);
}

.meal-row:last-child {
  border-bottom: none;
}

.meal-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sage);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 110px;
  padding-top: 2px;
}

.meal-info {
  flex: 1;
}

.meal-info .meal-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--dark);
}

.meal-info .meal-desc {
  font-size: 0.82rem;
  opacity: 0.65;
  margin-top: 2px;
}

.meal-cals {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--warm);
  min-width: 60px;
  text-align: right;
  padding-top: 2px;
}

/* === SLIDER RATING === */
.rating-group {
  margin-bottom: 1.25rem;
}

.rating-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.rating-buttons {
  display: flex;
  gap: 0.5rem;
}

.rating-btn {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--sage-pale);
  border-radius: 12px;
  background: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rating-btn:hover {
  border-color: var(--sage);
  background: rgba(122, 139, 111, 0.06);
}

.rating-btn.selected {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}

/* === FEEDBACK CARD === */
.feedback-card {
  background: linear-gradient(135deg, rgba(163, 177, 138, 0.1), rgba(218, 215, 205, 0.15));
  border: 1px solid rgba(122, 139, 111, 0.15);
  border-radius: 14px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.feedback-card h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 0.75rem;
}

.feedback-card p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
}

/* === CHART === */
.chart-container {
  position: relative;
  height: 200px;
  margin: 1rem 0;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 160px;
  padding: 0 0.5rem;
  border-bottom: 1px solid var(--sage-pale);
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 4px;
}

.chart-bar {
  width: 24px;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  min-height: 2px;
}

.chart-bar.energy { background: var(--sage); }
.chart-bar.mood { background: var(--warm); }
.chart-bar.sleep { background: var(--sage-light); }

.chart-label {
  font-size: 0.7rem;
  color: var(--sage);
  margin-top: 6px;
  text-align: center;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.8;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* === LOADING === */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--sage-pale);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.9rem;
  color: var(--sage);
  font-weight: 500;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.empty-state p {
  opacity: 0.65;
  margin-bottom: 1.5rem;
}

/* === SHOPPING LIST === */
.shopping-list {
  columns: 2;
  gap: 0.5rem;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.88rem;
  break-inside: avoid;
}

.shopping-item::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--sage-light);
  border-radius: 50%;
  flex-shrink: 0;
}

/* === PRINCIPLES TAG === */
.principle-tag {
  display: inline-block;
  background: rgba(122, 139, 111, 0.08);
  color: var(--sage);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0.25rem 0.25rem 0 0;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--dark);
  color: var(--cream);
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(40, 54, 24, 0.2);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === SESSION BANNER === */
.session-banner {
  background: linear-gradient(135deg, var(--sage) 0%, var(--dark) 100%);
  color: var(--cream);
  padding: 1rem 1.5rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-banner .greeting {
  font-family: 'DM Serif Display', serif;
  font-size: 1.3rem;
}

.session-banner .profile-id {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .app-nav { padding: 0.85rem 1rem; }
  .nav-links a { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  .app-content { padding: 5rem 1rem 3rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .meal-row { flex-direction: column; gap: 0.3rem; }
  .meal-time { min-width: auto; }
  .meal-cals { text-align: left; }
  .shopping-list { columns: 1; }
  .page-header h1 { font-size: 1.8rem; }
}

/* === HIDDEN UTILITY === */
.hidden { display: none !important; }

/* === SECTION DIVIDER === */
.section-divider {
  height: 1px;
  background: var(--sage-pale);
  margin: 2rem 0;
}

/* === PROFILE SELECTOR === */
.profile-selector {
  background: var(--white);
  border: 1px solid rgba(122, 139, 111, 0.12);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.profile-item:hover {
  background: rgba(122, 139, 111, 0.05);
}

.profile-item.active {
  background: rgba(122, 139, 111, 0.08);
  border-color: var(--sage-light);
}

.profile-item .name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--dark);
}

.profile-item .goals-preview {
  font-size: 0.78rem;
  opacity: 0.6;
  margin-top: 2px;
}

.profile-item .date {
  font-size: 0.78rem;
  color: var(--sage);
}
