/* ============================================================
   PAGES — section headers, goals, journal week strip, settings, day modal
   Part of Daybook's styles — split from the original styles.css.
   Load ORDER matters (cascade): see the <link> order in app.html.
   ============================================================ */

/* ============================================================
   SECTION HEADERS (shared by Goals + Journal)
   ============================================================ */
.section-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
/* Any control beside the title (e.g. + New goal / + New deck) is centred to the
   title line, while the title itself stays top-aligned so it lands at the same
   vertical position as the titles on the calendar-style pages. */
.section-head > .btn { align-self: center; }
#addGoalBtn { margin-left: auto; } /* stays right now the Goals title is gone */
.section-head h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; font-weight: 700; }

/* ============================================================
   GOALS
   ============================================================ */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 20px;
  position: relative;
  overflow: hidden;
}
/* A slim category-coloured accent along the top of each card. */
.goal-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--goal-accent, var(--border));
}
.goal-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.goal-title { font-weight: 600; font-size: 1.08rem; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.goal-heading-meta { margin: 0 0 6px; }
.goal-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.74rem;
  color: var(--muted);
}

.goal-target {
  font-size: 0.85rem;
  color: var(--text);
  margin: 10px 0 4px;
}
.goal-target-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 4px;
}

/* Progress bar + count */
.goal-progress-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; }
.goal-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.goal-progress-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--goal-accent, var(--sidebar-bg));
  transition: width 0.3s ease;
}
.goal-progress-count { font-size: 0.78rem; color: var(--muted); flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.goal-notes {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.goal-edit {
  flex: 0 0 auto;
  font-size: 0.75rem;
  padding: 4px 8px;
  margin-top: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  align-self: center;
}
.milestones { margin-top: 4px; display: flex; flex-direction: column; gap: 7px; }
.milestone { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; min-width: 0; }
.milestone input[type="checkbox"] { flex: 0 0 auto; }
/* Long single-word milestone names shouldn't stretch the card — clip them. */
.milestone .m-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.milestone.done .m-text { text-decoration: line-through; color: var(--muted); }
.m-date { flex: 0 0 auto; margin-left: auto; color: var(--muted); font-size: 0.75rem; }

/* Milestone editor rows in the goal modal */
.ms-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ms-text, .ms-date {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; font-family: inherit;
}
.ms-text { flex: 1; min-width: 0; }
.ms-date { flex: 0 0 auto; width: 8.4em; }
.ms-del {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.ms-del:hover { background: var(--bg); color: var(--text); }

/* ============================================================
   JOURNAL — week strip
   ============================================================ */
.week-days { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 12px 0 20px; }
.week-day {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; font: inherit; color: var(--text);
}
.week-day:hover { background: #f0f1f3; }
/* Today stands out with a bold border all around, in the menu/sidebar shade.
   The inset ring thickens it without shifting the 1px-border layout. */
.week-day.today {
  border-color: var(--sidebar-bg);
  box-shadow: inset 0 0 0 2px var(--sidebar-bg);
}
.wd-dow { font-size: 0.7rem; text-transform: uppercase; color: var(--muted); }
.wd-num { font-weight: 600; }
.wd-dots { display: flex; gap: 4px; margin-top: 2px; }
.wd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.wd-dot.on { background: #22c55e; }

/* JOURNAL — weekly review card */
#weeklyGoals { margin-bottom: 14px; }
.wk-goal {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.wk-goal:last-child { border-bottom: none; }
.wk-goal-target { color: var(--muted); font-size: 0.8rem; }
.wk-hours-input { width: 56px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }

/* JOURNAL — rants */
.rants-head { margin-top: 8px; }
.rant-composer {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
#rantTitle, #rantText, #rantTags {
  width: 100%; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; font: inherit; box-sizing: border-box;
}
#rantTitle { font-weight: 600; }
#rantText { resize: none; overflow: hidden; line-height: 1.5; min-height: 5rem; }
.rant-composer-actions { display: flex; justify-content: flex-end; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.tag-chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 4px 10px; font-size: 0.78rem; cursor: pointer; color: var(--muted);
}
.tag-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rant-list { display: flex; flex-direction: column; gap: 10px; }
.rant-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  cursor: pointer;
}
.rant-item:hover { border-color: var(--sidebar-bg); background: #f7f9ff; }
.rant-title { font-weight: 600; }
.rant-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.rant-tag { background: #eef2ff; color: #4338ca; border-radius: 999px; padding: 2px 8px; font-size: 0.72rem; }

/* Rant detail (big popup) */
.modal-large { max-width: 640px; width: 92%; }
.rant-modal-meta { color: var(--muted); font-size: 0.8rem; margin-bottom: 14px; }
.rant-modal-body {
  line-height: 1.6;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 18px;
  white-space: normal;
}

/* The 8th box: weekly journal */
.week-day.weekly {
  justify-content: center;
  background: var(--sidebar-bg);
  color: #fff;
  border-color: var(--sidebar-bg);
  font-weight: 600;
  text-align: center;
}
.week-day.weekly:hover { background: var(--sidebar-bg); filter: brightness(1.1); }
.wd-weekly-label { font-size: 0.72rem; line-height: 1.15; }
.week-day.weekly .wd-dot { margin-top: 5px; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 520px;
  margin-top: 12px;
}
.settings-card h4 { margin: 0 0 6px; }
.settings-card .hint { margin: 0 0 12px; }

/* ============================================================
   SETTINGS — grouped rows
   ============================================================ */
.settings-wrap { max-width: 620px; display: flex; flex-direction: column; gap: 28px; }
.settings-group-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px 2px;
}
/* Rows in a group share one rounded card, split by hairlines. */
.settings-group > .set-row {
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--surface);
}
.settings-group > .set-row:first-of-type { border-radius: 12px 12px 0 0; }
.settings-group > .set-row:last-of-type { border-radius: 0 0 12px 12px; border-bottom: 1px solid var(--border); }
.settings-group > .set-row:only-of-type { border-radius: 12px; }

.set-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
}
.set-row[hidden] { display: none; }
.set-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--bg);
  color: var(--sidebar-bg);
}
.set-icon svg { width: 18px; height: 18px; }
.set-body { flex: 1; min-width: 0; }
.set-title { font-weight: 600; font-size: 0.98rem; margin-bottom: 3px; }
.set-desc { color: var(--muted); font-size: 0.85rem; margin: 0; line-height: 1.45; }
.set-control {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding-top: 2px;
}
.set-control-stack { flex-direction: column; gap: 6px; align-items: stretch; }
.set-control-stack .btn { width: 100%; }

.set-inline-field { margin: 10px 0 6px; max-width: 260px; display: block; }
.set-inline-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}

/* Danger row: subtle red accent on the icon rather than the whole card. */
.danger-row .set-icon { background: rgba(220, 38, 38, 0.1); color: #dc2626; }

/* ============================================================
   GOAL TARGET ROW
   ============================================================ */
.target-row { display: flex; gap: 8px; }
.target-row select { flex: 1; }
.target-row input { width: 90px; }
.target-row select, .target-row input {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; font-family: inherit;
}

/* ============================================================
   COMBINED DAY MODAL — section headers
   ============================================================ */
.day-section-head {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  margin: 18px 0 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--border);
}
