/* Week agenda, Week-view planning tools and the Fill from curriculum dialog (October 6, 2026).
   js/week-agenda.js draws the agenda; js/curriculum-fill.js the dialog moved from the retired
   Weekly planner. Colors come from the parent scheme tokens in parent-experience.css. */

/* In Agenda the hourly calendar and phone list stay in the page (Print reads them) but are not shown. */
@media screen {
  html[data-hh-layout] #week-grid.hh-week-agenda-mode > :is(.week-calendar-desktop, .week-list-mobile) { display: none !important; }
}
@media print {
  .hh-week-agenda { display: none !important; }
}

.hh-week-agenda {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  container: hh-week-agenda / inline-size;
  overscroll-behavior: contain;
}
.hh-week-agenda-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
  padding: 2px 2px 12px;
}
/* Narrower desktops (or the event details panel open beside the week): tighter columns. */
@container hh-week-agenda (max-width: 1000px) {
  .hh-week-agenda-grid { gap: 6px; }
  .hh-week-agenda-day { padding: 6px; gap: 6px; }
  .hh-week-agenda .hh-week-agenda-card .hh-agenda-open { padding: 7px 7px 7px 11px; }
  .hh-week-agenda .hh-week-agenda-card .hh-agenda-title { font-size: 13px; }
  .hh-week-agenda-empty { font-size: 12px; }
}
@container hh-week-agenda (max-width: 820px) {
  .hh-week-agenda-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hh-week-agenda-day { padding: 8px; }
}
.hh-week-agenda-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--hh-line, var(--bg-elev-2));
  border-radius: 14px;
  background: var(--bg-elev);
  color: var(--text);
}
.hh-week-agenda-day.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent);
}
.hh-week-agenda-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  width: 100%;
  min-height: 36px;
  padding: 4px 4px 2px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.hh-week-agenda-head:hover .hh-week-agenda-dayname { text-decoration: underline; }
.hh-week-agenda-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hh-week-agenda-dayname { font-size: 15px; font-weight: 750; }
.hh-week-agenda-daynum { font-size: 13px; color: var(--text-muted); }
.hh-week-agenda-today {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--hh-on-accent, #fff);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .02em;
}
.hh-week-agenda-list { display: grid; gap: 6px; min-width: 0; }
.hh-week-agenda-label {
  margin: 2px 2px 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hh-week-agenda-empty { margin: 2px; color: var(--text-muted); font-size: 13px; }
/* Same card as the Day agenda (parent-experience.css .hh-agenda-card), without the drag handle column. */
.hh-week-agenda .hh-week-agenda-card { grid-template-columns: minmax(0, 1fr); border-radius: 10px; }
.hh-week-agenda .hh-week-agenda-card .hh-agenda-open {
  gap: 3px;
  padding: 9px 9px 9px 13px;
  min-height: 44px;
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.hh-week-agenda .hh-week-agenda-card .hh-agenda-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
/* Wrap between words in narrow columns; split a word only when it cannot fit at all. */
.hh-week-agenda .hh-week-agenda-card .hh-agenda-title { font-size: 14px; line-height: 1.3; overflow-wrap: break-word; }
.hh-week-agenda .hh-week-agenda-card .hh-agenda-meta { font-size: 12px; line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }
.hh-week-agenda .hh-week-agenda-card.is-done .hh-agenda-title { text-decoration: line-through; text-decoration-thickness: 1px; }
.hh-week-agenda .hh-week-agenda-external { border-style: dashed; }
.hh-week-agenda-add {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px dashed var(--hh-line, var(--bg-elev-2));
  border-radius: 10px;
  background: transparent;
  color: var(--hh-accent-ink, var(--accent));
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.hh-week-agenda-add:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.hh-week-agenda-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (pointer: coarse) { .hh-week-agenda-add, .hh-week-agenda-head { min-height: 44px; } }
html[data-hh-layout="mobile"] .hh-week-agenda { overflow: visible; }
html[data-hh-layout="mobile"] .hh-week-agenda-grid { grid-template-columns: minmax(0, 1fr); padding: 0 0 12px; }
html[data-hh-layout="mobile"] .hh-week-agenda-day { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px; }
html[data-hh-layout="mobile"] .hh-week-agenda-list { grid-column: 1 / -1; }
/* On a phone + Add sits beside the day name, so an empty day stays one short row. */
html[data-hh-layout="mobile"] .hh-week-agenda-add { grid-row: 1; grid-column: 2; min-height: 44px; padding: 6px 14px; }
html[data-hh-layout="mobile"] .hh-week-agenda-empty { margin: 0 2px; }
html[data-hh-layout="mobile"] .hh-week-agenda .hh-week-agenda-card .hh-agenda-title { font-size: 15px; }
html[data-hh-layout="mobile"] .hh-week-agenda .hh-week-agenda-card .hh-agenda-meta { font-size: 13px; }

/* Week-view tools: Copy from last week and Fill from curriculum look like the other week tools. */
html[data-hh-scheme] .week-header-actions #btn-fill-curriculum {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--hh-line, var(--bg-elev-2));
}
html[data-hh-scheme] .week-header-actions #btn-fill-curriculum:hover { border-color: var(--accent); }
.week-header-actions .week-tool-button:disabled { opacity: .6; cursor: progress; }

/* Fill from curriculum dialog (moved from plan.html's inline styles). */
.hh-fill-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .6);
}
.hh-fill-shell.open { display: flex; }
.hh-fill-shell .modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--hh-line, var(--bg-elev-2));
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  overscroll-behavior: contain;
}
.hh-fill-shell .modal-card h2 { margin: 0 0 4px; font-size: 20px; color: var(--text); }
.hh-fill-shell .modal-subtitle { margin: 0 0 12px; color: var(--text-muted); font-size: 13px; }
.hh-fill-shell .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.hh-fill-shell .modal-actions button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--hh-line, var(--bg-elev-2));
  border-radius: 8px;
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
}
.hh-fill-shell .modal-actions .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--hh-on-accent, #fff); }
.hh-fill-shell .modal-actions button:disabled { opacity: .55; cursor: default; }
.hh-fill-shell .modal-status {
  min-height: 18px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--text) 5%, var(--bg-elev));
  color: var(--text-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.hh-fill-shell .modal-status.error { color: var(--hh-ink-danger, var(--danger)); background: color-mix(in srgb, var(--danger) 10%, var(--bg-elev)); }
.hh-fill-shell .modal-status.success { color: var(--hh-ink-success, #b8d99c); background: color-mix(in srgb, var(--hh-positive, #3aab98) 12%, var(--bg-elev)); }
.hh-fill-shell .modal-status:empty { display: none; }
.hh-fill-shell .modal-status button { margin-left: 6px; }
.hh-fill-shell .modal-close { min-width: 44px; min-height: 44px; }
.hh-fill-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; font-size: 14px; font-weight: 650; }
.hh-fill-child select { min-height: 40px; min-width: 10rem; padding: 6px 10px; border: 1px solid var(--hh-line, var(--bg-elev-2)); border-radius: 8px; font: inherit; font-weight: 500; }
.hh-quick-course { margin: 0 0 12px; }
.hh-quick-course summary { min-height: 36px; display: flex; align-items: center; cursor: pointer; color: var(--hh-accent-ink, var(--accent)); font-size: 14px; font-weight: 650; }
.hh-quick-course form { display: grid; gap: 10px; margin-top: 8px; }
.hh-quick-course form > label { display: grid; gap: 4px; font-size: 13px; }
.hh-quick-course form :is(input:not([type="checkbox"]), select) { min-height: 40px; padding: 6px 10px; border: 1px solid var(--hh-line, var(--bg-elev-2)); border-radius: 8px; font: inherit; }
.hh-quick-course fieldset { display: flex; flex-wrap: wrap; gap: 6px 12px; border: 1px solid var(--hh-line, var(--bg-elev-2)); border-radius: 8px; }
.hh-quick-course fieldset label { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }
.hh-quick-course form p { margin: 0; color: var(--text-muted); font-size: 12px; }
.hh-fill-shell .fill-action { min-height: 36px; }
.hh-fill-shell .edit-pace-grid :is(input[type="number"], input[type="time"], input[type="date"], select) { min-height: 36px; }
.hh-fill-shell .edit-pace-grid input[type="date"] { width: 100%; padding: 7px 8px; border: 1px solid var(--hh-line, var(--bg-elev-2)); border-radius: 6px; font: inherit; font-size: 13px; }
@media (pointer: coarse) { .hh-fill-shell :is(.fill-action, .edit-pace-grid input, .edit-pace-grid select) { min-height: 44px; } }
.hh-fill-shell .fill-chapter-row { flex-wrap: wrap; }
.hh-fill-shell .fill-chapter-row .fill-chapter-title { flex: 1 1 10rem; }
.hh-fill-shell .edit-schedule-mode-options { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.hh-fill-shell .curriculum-import-table-wrap { max-width: 100%; }
html[data-hh-scheme="paper-sage"] .hh-fill-shell .fill-pace-row .fill-pace-projection.is-on-track { color: var(--hh-ink-success); }
html[data-hh-scheme="paper-sage"] .hh-fill-shell .fill-pace-row .fill-pace-projection.is-behind { color: var(--hh-ink-warning); }
@media (max-width: 480px) {
  .hh-fill-shell { padding: 8px; align-items: flex-end; }
  .hh-fill-shell .modal-card { padding: 16px; max-height: 94dvh; border-radius: 16px 16px 12px 12px; }
}
