/* schedules.css — layout of the Schedules page (schedules.js). Colours,
 * radii and shadows come from the shared classes in ui.css (.ui-panel,
 * .badge, .btn-primary, .btn-secondary, .btn-ghost, .schedules-tab) and the
 * tokens in base.css, so both themes apply as is. */

.schedules-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 24px 32px;
}
.schedules-panel.active { display: block; }
.schedules {
  max-width: 880px;
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
}

/* Heading and New schedule */
.schedules-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.schedules-head-text { min-width: 0; }
.schedules-head h2 { margin: 0; color: var(--text); font-size: 22px; font-weight: 800; }
.schedules-sub { margin: 4px 0 0; color: var(--text-dim); font-size: 14px; }
.schedules-new { flex-shrink: 0; }
.schedules-note, .schedules-load-error { margin: 0; color: var(--error); font-size: 13px; overflow-wrap: anywhere; }
.schedules-note:empty, .schedules-load-error:empty { display: none; }

/* Tabs */
.schedules-tabs { display: flex; gap: 4px; border-bottom: 1px solid; }
.schedules-tab {
  padding: 8px 16px;
  border: none; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.schedules-tab-content { display: none; flex-direction: column; gap: 12px; }
.schedules-tab-content.active { display: flex; }
.schedules-jobs { display: flex; flex-direction: column; gap: 12px; }
.schedules-loading { margin: 0; color: var(--text-dim); font-size: 14px; }

/* A job */
.schedules-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.schedule-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px;
  border: 1px solid;
  min-width: 0;
}
.schedule-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.schedule-name {
  flex: 1; min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 16px; font-weight: 700;
  overflow-wrap: anywhere;
}
.schedule-status { flex-shrink: 0; }
.schedule-toggle.btn-secondary { flex-shrink: 0; padding: 6px 14px; font-size: 14px; min-width: 88px; }

.schedule-facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px;
  margin: 0;
}
.schedule-fact { min-width: 0; }
.schedule-fact dt {
  color: var(--text-dim);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.schedule-fact dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.schedule-countdown { font-weight: 700; font-variant-numeric: tabular-nums; }
.schedule-when { display: block; color: var(--text-dim); font-size: 12px; }

.schedule-latest {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.schedule-latest-text { min-width: 0; color: var(--text-secondary, var(--text-dim)); overflow-wrap: anywhere; }
.schedule-latest-error { color: var(--tone-danger-text); }
.schedule-view-results.btn-ghost { padding: 4px 10px; font-size: 13px; }

.schedule-request summary {
  width: fit-content;
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.schedule-request p {
  margin: 6px 0 0;
  color: var(--text-secondary, var(--text-dim));
  font-size: 13px; line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.schedule-meta { margin: 0; color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.schedule-card-error { margin: 0; color: var(--error); font-size: 13px; overflow-wrap: anywhere; }
.schedule-card-error:empty { display: none; }

/* No schedules: what a schedule is, and three examples */
.schedules-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 24px 20px;
  border: 1px solid;
  text-align: center;
}
.schedules-empty-state svg { color: var(--accent); }
.schedules-empty-state h3 { margin: 4px 0 0; color: var(--text); font-size: 18px; font-weight: 800; }
.schedules-empty-state p { margin: 0; max-width: 560px; color: var(--text-secondary, var(--text-dim)); font-size: 14px; line-height: 1.5; }
.schedules-examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.schedule-example {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 14px;
  border: 1px solid;
  color: var(--text);
  font: inherit; text-align: left;
  cursor: pointer;
  min-width: 0;
}
.schedule-example:hover, .schedule-example:focus-visible { border-color: var(--accent); }
.schedule-example-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* The example's icon on a tile tinted with its tone (base.css defines each tone in both themes) */
.schedule-example-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--tile-bg);
  box-shadow: inset 0 0 0 1px var(--tile-ring);
  color: var(--tile-text);
}
.schedule-example-icon.tone-danger { --tile-bg: var(--tone-danger-bg); --tile-ring: var(--tone-danger-ring); --tile-text: var(--tone-danger-text); }
.schedule-example-icon.tone-violet { --tile-bg: var(--tone-violet-bg); --tile-ring: var(--tone-violet-ring); --tile-text: var(--tone-violet-text); }
.schedule-example-icon.tone-info { --tile-bg: var(--tone-info-bg); --tile-ring: var(--tone-info-ring); --tile-text: var(--tone-info-text); }
.schedule-example-title { min-width: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.schedule-example-text { color: var(--text-secondary, var(--text-dim)); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }

/* Results */
.schedules-results-filter {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  color: var(--text-secondary, var(--text-dim)); font-size: 14px;
}
.schedules-results-filter[hidden] { display: none; }
.schedules-results-filter strong { color: var(--text); overflow-wrap: anywhere; }
.schedules-results-filter .btn-ghost { padding: 4px 10px; font-size: 13px; }
.schedules-results { display: flex; flex-direction: column; gap: 10px; }
.schedules-results-empty { margin: 0; color: var(--text-dim); font-style: italic; }
.schedules-results-error {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  color: var(--error); font-size: 13px; overflow-wrap: anywhere;
}
.schedules-results-error .btn-secondary,
.schedules-results-older.btn-secondary { padding: 6px 14px; font-size: 14px; }
.schedules-results-older { align-self: center; }
.schedule-result { padding: 12px 16px; border: 1px solid; min-width: 0; }
.schedule-result .result-header {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 13px;
}
.schedule-result .result-name { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.schedule-result .result-time { color: var(--text-dim); }
.schedule-result .result-body { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; overflow-x: auto; }
.schedule-result .result-body ul, .schedule-result .result-body ol { padding-left: 20px; margin: 6px 0; }
.schedule-result .result-body li { margin: 3px 0; }
.schedule-result .result-body p { margin: 6px 0; }
.schedule-result .result-body p:first-child { margin-top: 0; }
.schedule-result .result-body p:last-child { margin-bottom: 0; }
.schedule-result .result-body strong { color: var(--strong); }
.schedule-result .result-body em { color: var(--em); }
.schedule-result .result-body code { background: var(--bg); padding: 2px 5px; border-radius: 3px; font-size: 13px; font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace; }
.schedule-result .result-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.schedule-result .result-body blockquote { border-left: 3px solid var(--accent); padding-left: 10px; margin: 6px 0; color: var(--text-dim); }

@media (max-width: 700px) {
  .schedules-panel { padding: 16px 12px max(20px, env(safe-area-inset-bottom)); }
  .schedules-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .schedules-new { width: 100%; }
  .schedule-card { padding: 12px; }
  .schedule-card-head { flex-wrap: wrap; }
  .schedule-name { flex-basis: 100%; }
  .schedule-toggle.btn-secondary { margin-left: auto; }
  .schedule-facts { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .schedules-examples { grid-template-columns: minmax(0, 1fr); }
}
