/*
 * Event-specific components, enqueued on is_singular('event') +
 * is_post_type_archive('event') by class-saf-events-templates.php.
 *
 * Covers the peer-shift list + staff roster, AND (Tier D, S-04) the
 * base button + guest-signup form styling for the transactional
 * sections [saf_event_full] still renders as a shortcode bridge.
 * Those `.saf-btn` / `.saf-form__*` rules used to live in the dormant
 * `sober-af` theme's components.css / design-extras.css, which the
 * Elementor+JTC hybrid front end no longer enqueues -- so the shortcode
 * markup rendered unstyled. They are ported here (next to the shortcode
 * that emits them) rather than re-enqueuing two whole theme stylesheets;
 * the donate form self-enqueues its own CSS, and the native Elementor
 * hero / body / related sections need none of this.
 */

.saf-events-shifts {
  padding-block: var(--saf-gap-6);
}

.saf-events-shifts h2 {
  margin: 0 0 var(--saf-gap-4);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.saf-events-shifts__empty {
  padding: var(--saf-gap-5);
  background: #ffffff;
  border: 1px solid rgba(28, 23, 16, 0.08);
  border-radius: 10px;
  color: var(--saf-fg-muted, #1c1710);
}

/* Inline links in the empty/login-prompt text MUST stay underlined --
 * axe `link-in-text-block` (WCAG 1.4.1): a link inside running text
 * needs a non-colour affordance. The old theme's global `a` underline
 * (base.css) is not enqueued on the Tier-D front end, and the Hello Biz
 * parent theme resets `text-decoration` -- so the underline must be set
 * here with `!important` + an element-qualified selector to win the
 * cascade. */
p.saf-events-shifts__empty a {
  color: var(--saf-brick-red, #be2727);
  text-decoration: underline !important;
  text-underline-offset: 2px;
}

.saf-events-shifts__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--saf-gap-3);
}

.saf-events-shift {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--saf-gap-3);
  padding: var(--saf-gap-4) var(--saf-gap-5);
  background: #ffffff;
  border: 1px solid rgba(28, 23, 16, 0.08);
  border-radius: 10px;
}

.saf-events-shift__main {
  flex: 1 1 280px;
  min-width: 0;
}

.saf-events-shift__title {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.saf-events-shift__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--saf-fg-muted, #1c1710);
  font-size: 0.95rem;
}

.saf-events-shift__capacity {
  color: var(--saf-fg-muted, #1c1710);
  font-size: 0.85rem;
  opacity: 0.8;
}

.saf-events-shift__action {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.saf-events-shift__status {
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(28, 23, 16, 0.06);
  color: var(--saf-fg-muted, #1c1710);
  font-size: 0.9rem;
}

.saf-events-shift__status--signed {
  background: rgba(0, 98, 58, 0.12);
  color: #00623a;
}

.saf-events-shift__error {
  color: #be2727;
  font-size: 0.85rem;
  max-width: 240px;
}

.saf-btn--sm {
  padding: 8px 18px;
  font-size: 0.95rem;
}

/* Track B.1 follow-up: roster mark-handled affordance (admin tier). */
.saf-staff-roster__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(28, 23, 16, 0.08);
}

.saf-staff-roster__row:last-child {
  border-bottom: 0;
}

.saf-staff-roster__name {
  flex: 1 1 200px;
  min-width: 0;
}

.saf-staff-roster__status {
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(28, 23, 16, 0.06);
  color: var(--saf-fg-muted, #1c1710);
  font-size: 0.8rem;
  text-transform: lowercase;
}

.saf-staff-roster__status--handled {
  background: rgba(0, 98, 58, 0.12);
  color: #00623a;
}

.saf-staff-roster__status--archived {
  background: rgba(28, 23, 16, 0.04);
  opacity: 0.7;
}

.saf-staff-roster__status--spam {
  background: rgba(190, 39, 39, 0.1);
  color: #8a5c00;
}

.saf-staff-roster__when {
  color: var(--saf-fg-muted, #1c1710);
  font-size: 0.85rem;
  opacity: 0.82;
}

.saf-staff-roster__mark-handled {
  margin-left: auto;
}

.saf-staff-roster__error {
  color: #be2727;
  font-size: 0.85rem;
}

.saf-staff-roster__admin {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.saf-btn--danger {
  background: #be2727;
  color: #fff;
}

.saf-btn--danger:hover {
  background: #9b1f1f;
}

/* Priority 1.b: sponsor orders section (admin-only) */
.saf-sponsor-orders {
  margin-top: 24px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid rgba(28, 23, 16, 0.08);
  border-radius: 10px;
}

.saf-sponsor-orders__heading {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--saf-fg, #1c1710);
}

.saf-sponsor-orders__empty {
  margin: 0;
  color: var(--saf-fg-muted, #6b6560);
  font-size: 0.875rem;
}

.saf-sponsor-orders__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.saf-sponsor-orders__table th {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 2px solid rgba(28, 23, 16, 0.12);
  font-weight: 600;
  color: var(--saf-fg-muted, #6b6560);
}

.saf-sponsor-orders__table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(28, 23, 16, 0.06);
  color: var(--saf-fg, #1c1710);
}

.saf-sponsor-orders__table tr:last-child td {
  border-bottom: none;
}

.saf-shift-toggles {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.saf-shift-toggles__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--saf-fg, #1c1710);
}

.saf-shift-toggles__label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.saf-shift-toggles__status {
  font-size: 0.8125rem;
  color: var(--saf-fg-muted, #6b6560);
  margin-left: auto;
}

/* ------------------------------------------------------------------ *
 * S-04: base button + guest-signup form.
 * Ported verbatim from the OLD `sober-af` theme (components.css +
 * design-extras.css) so [saf_event_signup] + the peer-shift "Sign up"
 * button + the staff-panel JS buttons render styled on the Tier-D
 * hybrid front end. Tokens resolve from tokens.css (enqueued globally
 * by the child theme).
 * ------------------------------------------------------------------ */

.saf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--saf-gap-2);
  padding: 0.75rem 1.5rem;
  background: var(--saf-brick-red);
  color: var(--saf-linen);
  font-family: var(--saf-font-sans);
  font-weight: 700;
  font-size: var(--saf-text-base);
  text-decoration: none;
  border: 2px solid var(--saf-brick-red);
  border-radius: var(--saf-radius-pill);
  cursor: pointer;
  transition:
    background var(--saf-transition),
    color var(--saf-transition),
    transform var(--saf-transition);
}

.saf-btn:hover,
.saf-btn:focus-visible {
  background: var(--saf-burgundy);
  border-color: var(--saf-burgundy);
  color: var(--saf-linen);
  transform: translateY(-1px);
}

.saf-btn--secondary {
  background: transparent;
  color: var(--saf-brick-red);
}

.saf-btn--secondary:hover,
.saf-btn--secondary:focus-visible {
  background: var(--saf-brick-red);
  color: var(--saf-linen);
}

.saf-btn--ghost {
  background: transparent;
  color: var(--saf-charcoal);
  border-color: var(--saf-charcoal);
}

.saf-btn--ghost:hover,
.saf-btn--ghost:focus-visible {
  background: var(--saf-charcoal);
  color: var(--saf-linen);
}

.saf-form {
  display: grid;
  gap: var(--saf-gap-4);
}

/* Reset the role-radio <fieldset> chrome (improvement over OLD, which
 * left the browser-default border). Single-role events render a hidden
 * input and never hit this. */
.saf-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.saf-form__row {
  display: grid;
  gap: var(--saf-gap-2);
}

.saf-form__row + .saf-form__row {
  margin-top: var(--saf-gap-4);
}

.saf-form__label {
  font-weight: 700;
  font-size: var(--saf-text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--saf-fg);
  display: inline-flex;
  align-items: baseline;
  gap: 0.4ch;
}

.saf-form__req {
  color: var(--saf-brick-red);
  font-weight: 800;
}

.saf-form__optional {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--saf-text-xs);
  color: var(--saf-fg-muted);
}

.saf-form__input {
  display: block;
  width: 100%;
  min-height: 44px; /* WCAG / touch target */
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--saf-border);
  border-radius: var(--saf-radius);
  background: #fff;
  font: inherit;
  font-size: 1rem; /* prevent iOS zoom-on-focus < 16px */
  color: var(--saf-fg);
  transition:
    border-color var(--saf-transition),
    box-shadow var(--saf-transition);
}

.saf-form__input:hover {
  border-color: var(--saf-fg-muted);
}

.saf-form__input:focus,
.saf-form__input:focus-visible {
  outline: none;
  border-color: var(--saf-brick-red);
  box-shadow: 0 0 0 3px rgba(190, 39, 39, 0.18);
}

.saf-form__input::placeholder {
  color: #a59f93;
}

.saf-form__notice {
  padding: var(--saf-gap-4);
  border-radius: var(--saf-radius);
  font-weight: 500;
}

.saf-form__notice--success {
  background: #e4f2ea;
  color: var(--saf-emerald);
  border-left: 4px solid var(--saf-emerald);
}

.saf-form__notice--error {
  background: #fbe6e6;
  color: var(--saf-brick-red);
  border-left: 4px solid var(--saf-brick-red);
}

/* ------------------------------------------------------------------ *
 * S-04: layout primitives + section chrome for the [saf_event_full]
 * transactional cluster (peer shifts / guest signup / donate / staff).
 * Those sections still emit the OLD theme's `.saf-section` /
 * `.saf-container` / `.saf-band--*` / `.saf-section-title` / `.saf-eyebrow`
 * / `.saf-tag` markup; their rules were in base.css / design-extras.css /
 * components.css, none of which the Tier-D hybrid front end enqueues.
 * Cherry-picked here (NOT the whole files -- base.css carries global
 * element resets that would clobber the native Elementor sections).
 * ------------------------------------------------------------------ */

.saf-section {
  padding-block: var(--saf-gap-8);
}

.saf-container {
  width: 100%;
  max-width: var(--saf-container);
  margin-inline: auto;
  padding-inline: var(--saf-gap-5);
}

.saf-band--linen {
  background: var(--saf-bg);
}

.saf-band--linen-alt {
  background: var(--saf-bg-alt);
}

.saf-eyebrow {
  display: inline-block;
  font-size: var(--saf-text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--saf-denim);
  margin-bottom: var(--saf-gap-3);
}

.saf-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--saf-gap-5);
  flex-wrap: wrap;
  margin-bottom: var(--saf-gap-5);
}

.saf-section-title h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  margin: 0;
}

.saf-section-title__link {
  text-decoration: none;
  color: var(--saf-brick-red);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: border-color var(--saf-transition);
}

.saf-section-title__link:hover {
  border-color: var(--saf-brick-red);
}

.saf-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--saf-radius-pill);
  font-size: var(--saf-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--saf-bg-alt);
  color: var(--saf-charcoal);
}

.saf-tag--denim {
  background: var(--saf-denim);
  color: var(--saf-linen);
}

.saf-tag--goldenrod {
  background: var(--saf-goldenrod);
  color: var(--saf-charcoal);
}

/* ------------------------------------------------------------------ *
 * S-04 follow-up: opt-in utility classes + new shortcode chrome.
 *   .saf-sidebar-sticky    -- linen event-details card stays in view on scroll
 *   .saf-pulse             -- pulsing dot affordance (brand identity)
 *   .saf-capacity*         -- visible progress bar on the shifts section
 *   .saf-event-status*     -- "Event" / "Past Event" pill content
 *   .saf-event-actions     -- tier-aware sidebar action button stack
 *   .saf-event-cal-buttons -- Add to Calendar / .ics button row
 * ------------------------------------------------------------------ */

.saf-sidebar-sticky {
  position: sticky;
  top: 96px; /* clears the JTC sticky header */
}

@keyframes saf-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.saf-pulse,
.saf-pulse svg,
.saf-pulse i {
  animation: saf-pulse 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .saf-pulse,
  .saf-pulse svg,
  .saf-pulse i {
    animation: none;
  }
}

.saf-capacity {
  display: block;
  margin: 0 0 var(--saf-gap-5, 24px);
}

.saf-capacity__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--saf-fg-muted, #1c1710);
}

.saf-capacity__label strong {
  color: var(--saf-brick-red, #be2727);
  font-weight: 700;
}

.saf-capacity__pct {
  margin-left: auto;
  font-weight: 600;
  font-size: 0.85rem;
  /* AA: keep contrast >=4.5:1 against linen-alt (#ECE6D6) -- charcoal
   * #1C1710 gives 13.9:1. No `opacity` -- axe color-contrast flags
   * opacity-reduced text (see memory: a11y-contrast-opacity-gotcha). */
  color: var(--saf-fg, #1c1710);
}

.saf-capacity-bar {
  display: block;
  height: 8px;
  width: 100%;
  background: rgba(28, 23, 16, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.saf-capacity-bar__fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--saf-emerald, #00623a), var(--saf-brick-red, #be2727));
  border-radius: 99px;
  transition: width 0.25s ease;
}

.saf-event-status {
  display: inline;
  font-family: "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--saf-burgundy, #7b181a);
}

.saf-event-status--past {
  color: var(--saf-fg-muted, #5a554e);
}

.saf-event-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--saf-gap-4, 16px);
}

.saf-event-actions .saf-btn {
  width: 100%;
  text-align: center;
}

.saf-event-cal-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--saf-gap-3, 12px);
  padding-top: var(--saf-gap-3, 12px);
  border-top: 1px dashed rgba(28, 23, 16, 0.12);
}

.saf-event-cal-buttons__btn {
  width: 100%;
  text-align: center;
  font-size: 0.92rem;
  padding-block: 0.55rem;
}
