/* CareLoop — Warm, family-friendly design */
:root {
  --bg: #f8f6f3;
  --sidebar-bg: #2d2a3e;
  --sidebar-text: #e0dce8;
  --card-bg: #ffffff;
  --text-primary: #2d2a3e;
  --text-secondary: #6b6580;
  --text-muted: #9e97ad;
  --accent: #6c63ff;
  --accent-light: #eeedff;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #e74c3c;
  --border: #e8e4ef;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(45, 42, 62, 0.08);
  --shadow-hover: 0 4px 20px rgba(45, 42, 62, 0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 8px;
}

.brand-icon { font-size: 28px; }

.sidebar-brand h1 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.care-circle {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 24px;
}

.circle-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.circle-parent {
  display: flex;
  align-items: center;
  gap: 10px;
}

.parent-avatar { font-size: 32px; }

.parent-name {
  font-weight: 600;
  color: #fff;
  display: block;
}

.parent-status {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: auto;
}

.nav-item {
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover { background: rgba(255,255,255,0.08); }

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.nav-icon { font-size: 16px; }

.sidebar-members {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.members-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 900px;
  overflow-y: auto;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.tab-header h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.tab-date {
  color: var(--text-muted);
  font-size: 14px;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary:hover { background: #5a52e0; transform: translateY(-1px); }

.btn-secondary {
  background: var(--accent-light);
  color: var(--accent);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: #dddaff; }

/* Check-in Card */
.checkin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 2px solid var(--accent-light);
}

.checkin-prompt {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.checkin-moods {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.15s;
}

.mood-btn span { font-size: 11px; color: var(--text-secondary); }
.mood-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.mood-btn.selected { border-color: var(--accent); background: var(--accent-light); }

.checkin-note {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.checkin-note:focus { outline: none; border-color: var(--accent); }

/* Feed */
.feed { display: flex; flex-direction: column; gap: 16px; }

.feed-item {
  display: flex;
  gap: 14px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}
.feed-item:hover { box-shadow: var(--shadow-hover); }

.feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.feed-body { flex: 1; }

.feed-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.feed-time { color: var(--text-muted); font-size: 12px; }

.feed-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.med-badge { background: #fff3e0; color: #e65100; }

.feed-mood {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--accent);
}

.feed-body p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.feed-actions { display: flex; gap: 12px; }

.feed-react {
  background: none;
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
}
.feed-react:hover { background: var(--accent-light); border-color: var(--accent); }
.feed-react.reacted { background: #fff0f0; border-color: #ffcdd2; }

/* Medications */
.med-schedule { display: flex; flex-direction: column; gap: 24px; }

.med-time-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.time-label { font-size: 16px; font-weight: 600; }

.time-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.time-status.done { background: #e8f5e9; color: #2e7d32; }
.time-status.pending { background: #fff3e0; color: #e65100; }

.med-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-left: 4px solid var(--border);
  transition: all 0.15s;
}

.med-card.done { border-left-color: var(--success); opacity: 0.85; }
.med-card.pending { border-left-color: var(--warning); }

.med-name { font-weight: 600; font-size: 15px; }
.med-detail { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.confirmed-by { font-size: 12px; color: var(--success); font-weight: 500; }

.btn-confirm {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-confirm:hover { background: #388e3c; }

/* Appointments */
.appointments { display: flex; flex-direction: column; gap: 16px; }

.appt-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 20px;
  align-items: flex-start;
  transition: box-shadow 0.15s;
}
.appt-card:hover { box-shadow: var(--shadow-hover); }

.appt-card.upcoming { border: 2px solid var(--accent-light); }

.appt-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--accent-light);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  min-width: 60px;
}

.appt-day { font-size: 24px; font-weight: 800; color: var(--accent); line-height: 1; }
.appt-month { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; }

.appt-info { flex: 1; }
.appt-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.appt-detail { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.appt-notes { font-size: 13px; color: var(--text-secondary); font-style: italic; }

.appt-claim {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.claimed-by {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.claim-text { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

.btn-claim {
  background: var(--accent-light);
  color: var(--accent);
  border: 2px dashed var(--accent);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-claim:hover { background: var(--accent); color: #fff; }

/* Tasks Board */
.tasks-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.task-column {
  background: rgba(0,0,0,0.02);
  border-radius: var(--radius);
  padding: 16px;
}

.column-header {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.column-header .count {
  background: var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  margin-left: 4px;
}

.task-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  transition: all 0.15s;
}
.task-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }

.task-card.completed { opacity: 0.6; }
.task-card.completed .task-title { text-decoration: line-through; }

.task-priority {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.task-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.task-detail { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

.task-assignee {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.assignee-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.btn-take {
  background: none;
  border: 1px dashed var(--accent);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-take:hover { background: var(--accent); color: #fff; }

/* Care Journal */
.journal-note {
  background: #fff8e1;
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #5d4037;
}

.journal-entries { display: flex; flex-direction: column; gap: 16px; }

.journal-entry {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}

.entry-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.entry-tags { display: flex; gap: 6px; margin-bottom: 10px; }

.tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.tag-symptom { background: #fce4ec; color: #c62828; }
.tag-mobility { background: #fff3e0; color: #e65100; }
.tag-mood { background: #e8eaf6; color: #283593; }
.tag-positive { background: #e8f5e9; color: #2e7d32; }
.tag-concern { background: #fce4ec; color: #c62828; }

.entry-body { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.entry-body strong { color: var(--text-primary); }

.entry-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.author-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Fairness Dashboard */
.fairness-note {
  background: #e8eaf6;
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #283593;
}

.fairness-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

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

.member-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.member-name { font-weight: 700; font-size: 15px; }
.member-role { font-size: 12px; color: var(--text-muted); }

.fairness-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: 11px; color: var(--text-muted); }

.contribution-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.contribution-pct {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.nudge-hint {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff8e1;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #5d4037;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--sidebar-bg);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
  .tasks-board { grid-template-columns: 1fr; }
  .fairness-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    padding: 16px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .sidebar-members { display: none; }
  .care-circle { display: none; }
  .main-content { padding: 20px; }
  .checkin-moods { flex-wrap: wrap; }
  .appt-card { flex-direction: column; }
  .appt-claim { margin-top: 8px; }
}
