/* HailCare: shifts screens. Keep this small; prefer the shared components in hailcare-ui.css. */

/* ---- Shift page (/jobs/:id) ----------------------------------------------
   Phones: title, then the summary panel (date, time, pay and the actions),
   then details. From 960px the panel moves to a side column and stays in
   view while the details scroll. */
.shifts-page { display: grid; gap: var(--sp-8); }
.shifts-page > * { min-width: 0; }
.shifts-head { display: grid; gap: var(--sp-2); margin-bottom: calc(var(--sp-4) * -1); }
/* The status pill, then the clinic and its rating. A long clinic name wraps
   beside the pill, never leaving the pill alone on its line. */
.shifts-head__meta { display: flex; align-items: flex-start; gap: var(--sp-2) var(--sp-3); }
.shifts-head__meta > .pill { flex: none; margin-top: 8px; }
.shifts-head__by { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-2); min-width: 0; }
.shifts-head__by > a { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); }

.shifts-facts { display: grid; gap: var(--sp-1); }
.shifts-facts__date { font-size: var(--fs-figure-lg); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: -0.015em; }
.shifts-facts__rel { color: var(--muted); font-size: var(--fs-meta); margin-bottom: var(--sp-1); }
.shifts-facts__time { font-size: var(--fs-lead); font-weight: var(--fw-medium); }
.shifts-facts__time .muted { font-weight: var(--fw-regular); }
.shifts-facts__paybox { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--rule); }
.shifts-facts__extra { font-size: var(--fs-meta); line-height: 1.6; }
.shifts-facts__pay { font-size: var(--fs-figure-lg); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: -0.015em; }

.shifts-actions { display: grid; gap: var(--sp-3); margin-top: var(--sp-6); }
/* Short notes under the buttons ("After booking, you can release…"). */
.shifts-actions > p { color: var(--muted); font-size: var(--fs-meta); }
/* The state in one sentence, above the buttons: body size, ink. A check
   marks a shift the phlebotomist can book, an alert one they can't yet. */
.shifts-actions > .shifts-say { display: flex; align-items: flex-start; gap: var(--sp-2); color: var(--ink); font-size: var(--fs-body); }
.shifts-say .ico { margin-top: 2px; }
.shifts-say--ok .ico { color: var(--primary); }
.shifts-say--warn .ico { color: var(--warning); }
/* Long names ("Rate Sunset Occupational Health") wrap inside the panel. */
.shifts-actions .btn, .shifts-manage .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 1.3; padding-top: 10px; padding-bottom: 10px; }

/* Who to call: the clinic contact (phlebotomist) or who booked it (clinic). */
.shifts-contact { display: grid; gap: 0; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--rule); }
.shifts-contact dt { color: var(--muted); font-size: var(--fs-meta); }
.shifts-contact dd { overflow-wrap: anywhere; }
.shifts-contact dd:first-of-type { font-weight: var(--fw-semibold); }
.shifts-contact a { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); }
/* Under "Booked by": the credentials are self-reported, with CDPH's lookup. */
.shifts-contact .shifts-contact__self { margin-top: var(--sp-1); color: var(--muted); font-size: var(--fs-meta); font-weight: var(--fw-regular); }
.shifts-contact .shifts-contact__self a { display: inline; min-height: 0; font-weight: inherit; }

/* Cancel, release, report a no-show: last, below a hairline. */
.shifts-manage { display: grid; gap: var(--sp-2); margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--rule); }
.shifts-manage > p { color: var(--muted); font-size: var(--fs-meta); }

.shifts-details > h2, .shifts-desc > h2 { margin-bottom: var(--sp-3); }
/* The details and the description are cards under their headings. */
.shifts-kv, .shifts-desc > p {
  padding: var(--sp-1) var(--sp-5); background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  --well: var(--panel-bg);
}
.shifts-desc > p { padding: var(--sp-5); }
/* The summary is what the page is about: it stands a little higher. */
.shifts-panel { box-shadow: var(--shadow-raised); }
/* Links in the details (name, phone, map) are 44px tall tap targets on their own lines. */
.shifts-kv a { display: inline-flex; align-items: center; min-height: 44px; }
/* The location name ("Main clinic, 2nd floor lab") stands apart from the street address below it. */
.shifts-place { display: block; font-weight: var(--fw-semibold); }
/* Required certifications on the shift page, one per line, each with its full name. */
.shifts-cert { display: block; }
.shifts-cert + .shifts-cert { margin-top: var(--sp-2); }
.shifts-certs + .shifts-certs { margin-top: var(--sp-4); }

/* Other phlebotomists' questions on the clinic's shift page. */
.shifts-inquiries .shift { grid-template-areas: "title status" "where where"; grid-template-columns: minmax(0, 1fr) auto; }
.shifts-inquiries .shift__title { grid-area: title; font-size: var(--fs-body); }
.shifts-inquiries .shift__status { grid-area: status; margin-top: 0; }
.shifts-inquiries .shift__where { grid-area: where; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tablets: facts and actions side by side inside the panel. */
@media (min-width: 640px) and (max-width: 959px) {
  .shifts-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--sp-7); align-items: start; }
  .shifts-actions { margin-top: 0; }
}

@media (min-width: 960px) {
  .shifts-page {
    grid-template-columns: minmax(0, 1fr) var(--panel);
    grid-template-areas: "head panel" "details panel" "desc panel" "msgs panel";
    grid-template-rows: auto auto auto 1fr;
    column-gap: var(--sp-9);
    row-gap: var(--sp-8);
    align-items: start;
  }
  .shifts-head { grid-area: head; margin-bottom: 0; }
  .shifts-panel { grid-area: panel; position: sticky; top: var(--sp-6); padding: var(--sp-6); }
  .shifts-details { grid-area: details; }
  .shifts-desc { grid-area: desc; }
  .shifts-page > section[aria-labelledby="messages-title"] { grid-area: msgs; }
}

/* A short window could hide the end of a sticky panel: let it scroll with the page. */
@media (min-width: 960px) and (max-height: 760px) {
  .shifts-panel { position: static; }
}

/* ---- Find shifts (/jobs) --------------------------------------------------
   One GET form on a tint. Search, City or ZIP and Minimum pay are always
   visible; On or after and Sort sit under "More filters", which opens by
   itself while either is set. Apply comes after every field. On phones it
   all folds into one Filters bar, so the first shift shows on the first
   screen. */
.shifts-find-head { margin-bottom: var(--sp-6); }
.shifts-filters { display: grid; gap: var(--sp-3); padding: var(--sp-4); margin-bottom: var(--sp-5); }
.shifts-filters__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-3); }
.shifts-filters__q { grid-column: 1 / -1; }
/* From ZIP, then "Use my location" under it (shown by public/js/app.js). */
.shifts-near { display: grid; gap: var(--sp-1); align-content: start; }
.shifts-locate { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-size: var(--fs-meta); font-weight: var(--fw-semibold); cursor: pointer; justify-self: start; }
.shifts-locate:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.shifts-locate[hidden] { display: none; }
.shifts-locate[aria-busy="true"] { color: var(--muted); cursor: progress; }
.shifts-filters__note[hidden] { display: none; }
/* Why distances are off ("We can't find ZIP code 99999"). */
.shifts-filters__note { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-meta); color: var(--ink); }
.shifts-filters__note .ico { margin-top: 2px; color: var(--primary); flex: none; }
.shifts-filters__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
/* Open, the disclosure takes the whole row and Apply moves below its fields. */
.shifts-more { flex: 1 1 auto; min-width: 0; }
.shifts-more[open] { flex-basis: 100%; }
.shifts-more__fields { display: grid; gap: var(--sp-3); padding-bottom: var(--sp-2); }
.shifts-filters__buttons { display: flex; align-items: center; gap: var(--sp-2) var(--sp-5); margin-left: auto; }
.shifts-filters__clear { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); }
/* The filters fold into one bar naming what is set (views/jobs/index.ejs):
   closed on phones, so the shifts come first; public/js/app.js opens it on
   wider screens. */
.shifts-filterbox > summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); min-height: 44px; padding-right: var(--sp-6); position: relative; cursor: pointer; list-style: none; }
.shifts-filterbox > summary::-webkit-details-marker { display: none; }
.shifts-filterbox > summary::after { content: ''; position: absolute; right: 4px; top: 50%; width: 9px; height: 9px; margin-top: -7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s ease; }
.shifts-filterbox[open] > summary::after { margin-top: -2px; transform: rotate(-135deg); }
.shifts-filterbox > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: var(--r-sm); }
.shifts-filterbox__title { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: var(--fw-semibold); color: var(--ink); }
.shifts-filterbox__chips { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); font-size: var(--fs-meta); min-width: 0; }
.shifts-filterbox__body { display: grid; gap: var(--sp-3); padding-top: var(--sp-3); }
@media (prefers-reduced-motion: reduce) { .shifts-filterbox > summary::after { transition: none; } }
@media (min-width: 480px) { .shifts-more__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) {
  .shifts-find-head { margin-bottom: var(--sp-7); }
  /* Open, the extra fields and Apply share a row, Apply at the bottom right. */
  .shifts-filters__foot { align-items: flex-end; }
  .shifts-more[open] { flex-basis: auto; }
  .shifts-filters { padding: var(--sp-5) var(--sp-6); gap: var(--sp-4); margin-bottom: var(--sp-6); }
  .shifts-filters__grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 0.8fr); gap: var(--sp-4); }
  .shifts-filters__q { grid-column: auto; }
  .shifts-more__fields { max-width: 36rem; gap: var(--sp-4); }
  .shifts-filterbox__body { gap: var(--sp-4); }
}

/* Results: on phones the form lands here (#results) after Apply, so the
   list is in view. On wider screens everything already fits, so the page
   stays at the top (the margin is larger than the offset, which the browser
   clamps to zero). */
.shifts-results { scroll-margin-top: var(--sp-3); }
/* "No shifts match these filters. Clear filters": clear of the toggle above,
   and the link never splits across lines. */
.shifts-results > .empty { margin-top: var(--sp-4); }
.shifts-results > .empty a { white-space: nowrap; }
/* Pager: Previous left, Next right, "Page 2 of 3" centred between them
   whichever buttons show. */
.shifts-results .pager { display: grid; grid-template-columns: 1fr auto 1fr; }
.shifts-results .pager > :first-child { justify-self: start; }
.shifts-results .pager > :last-child { justify-self: end; }
@media (min-width: 768px) {
  .shifts-results { scroll-margin-top: 100vh; }
}

/* "All shifts | Shifts I qualify for": two submit buttons of the filter form
   (form="shift-filters"), the current one pressed. */
.segmented {
  display: flex; gap: var(--sp-1); padding: var(--sp-1); margin-bottom: var(--sp-2);
  border-radius: calc(var(--r-md) + 4px); background: var(--fill); box-shadow: inset 0 0 0 1px var(--rule);
}
.segmented__item {
  flex: 1 1 auto; min-width: 0; min-height: var(--control-h-sm); padding: 6px var(--sp-3);
  border: 0; border-radius: var(--r-md); background: transparent; cursor: pointer;
  color: var(--muted); font: var(--fw-semibold) var(--fs-body)/1.2 var(--font); text-align: center;
  transition: background-color var(--dur-color) var(--ease), color var(--dur-color) var(--ease);
}
.segmented__item:hover { color: var(--ink); background: var(--fill-strong); }
.segmented__item[aria-pressed="true"] { color: var(--primary-soft-ink); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--primary), var(--shadow-button); }
.segmented__item:focus-visible { outline-offset: 1px; }
@media (min-width: 768px) {
  .segmented { display: inline-flex; margin-bottom: var(--sp-3); }
  .segmented__item { flex: none; padding: 6px var(--sp-5); }
}
@media (forced-colors: active) {
  .segmented__item[aria-pressed="true"] { outline: 2px solid CanvasText; text-decoration: underline; }
}

/* Search field: a magnifier inside the box. */
.input-affix--icon .input-affix__pre { display: flex; left: 14px; }
.input-affix--icon .input { padding-left: 44px; }

/* ---- Rate (/jobs/:id/rate) -------------------------------------------------
   A form column, left-aligned like Post shift. The five choices are radio
   buttons drawn as one row of star tiles: the chosen star and every star
   below it fill in petrol. The radio covers its tile, invisible, so clicks,
   arrow keys and screen readers work as usual (without :has() it shows). */
.shifts-rate { max-width: var(--form); }
.shifts-rating { gap: var(--sp-2); }
.shifts-rating > legend { margin-bottom: var(--sp-2); font-size: var(--fs-body); font-weight: var(--fw-semibold); letter-spacing: 0; }
.shifts-stars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); max-width: 420px; }
.shifts-star {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 2px;
  min-height: 68px; padding: var(--sp-2) 0;
  border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface);
  color: var(--muted); font-weight: var(--fw-semibold); line-height: 1.2; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color var(--dur-color) var(--ease), border-color var(--dur-color) var(--ease), color var(--dur-color) var(--ease);
}
.shifts-star input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.shifts-star .ico { width: 28px; height: 28px; }
.shifts-star__n { color: var(--ink); }
.shifts-star:hover { border-color: var(--ink); color: var(--ink); }
.shifts-star:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-soft); }
.shifts-star:has(input:checked) .shifts-star__n { color: var(--primary-soft-ink); }
.shifts-stars:has(input[value="1"]:checked) .shifts-star:nth-child(-n+1) .ico,
.shifts-stars:has(input[value="2"]:checked) .shifts-star:nth-child(-n+2) .ico,
.shifts-stars:has(input[value="3"]:checked) .shifts-star:nth-child(-n+3) .ico,
.shifts-stars:has(input[value="4"]:checked) .shifts-star:nth-child(-n+4) .ico,
.shifts-stars:has(input[value="5"]:checked) .shifts-star:nth-child(-n+5) .ico { color: var(--primary); }
.shifts-stars:has(input[value="1"]:checked) .shifts-star:nth-child(-n+1) .ico__fill,
.shifts-stars:has(input[value="2"]:checked) .shifts-star:nth-child(-n+2) .ico__fill,
.shifts-stars:has(input[value="3"]:checked) .shifts-star:nth-child(-n+3) .ico__fill,
.shifts-stars:has(input[value="4"]:checked) .shifts-star:nth-child(-n+4) .ico__fill,
.shifts-stars:has(input[value="5"]:checked) .shifts-star:nth-child(-n+5) .ico__fill { display: inline; }
.shifts-star:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.shifts-star:has(input[aria-invalid="true"]) { border-color: var(--danger); border-width: 2px; }
/* Where :has() works, the tile shows the choice, so the radio dot can go.
   Elsewhere the native radio stays visible. */
@supports selector(:has(*)) {
  .shifts-star input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
  .shifts-star:focus-within { outline: none; }
  .shifts-star:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
}
@media (forced-colors: active) {
  .shifts-star:has(input:checked) { outline: 3px solid Highlight; outline-offset: -1px; }
}
