/* SDS Booking: component styles. Uses only tokens from tokens.css (the five SDS guide colours, used as the guide says:
   white text on green, green headings and links).
   Specs: replica/design/components.md. Flat and solid: no tints, gradients or drop shadows. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base-size);
  line-height: var(--text-base-line);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; color: var(--color-heading); }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--color-link); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus { outline: none; }
:focus-visible { box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }
/* Headings get focus only so screen readers announce the new step; they aren't controls, so no ring. */
h1:focus-visible, h2:focus-visible { box-shadow: none; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Booking panel ---------- */
.panel {
  max-width: var(--layout-panel-max);
  margin: var(--layout-panel-top) auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: minmax(0, 360fr) minmax(0, 376fr) minmax(0, 328fr); /* layout-sidebar : calendar-col : times-col */
  overflow: hidden;
}
.panel > * + * { border-left: 1px solid var(--color-border); }
.panel__col { padding: var(--space-6); min-width: 0; }
.panel__col h2 { font-size: var(--text-lg-size); line-height: var(--text-lg-line); margin-bottom: var(--space-5); }
.panel__wide { grid-column: span 2; }
.panel--embedded { margin: 0; }

@media (max-width: 1119px) {
  .panel { grid-template-columns: 1fr 1fr; }
  .panel > .summary { grid-column: 1 / -1; border-bottom: 1px solid var(--color-border); }
  .panel > * + * { border-left: 0; }
  .panel > .summary + * + * { border-left: 1px solid var(--color-border); }
}
@media (max-width: 719px) {
  .panel { grid-template-columns: 1fr; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .panel > * + * { border-left: 0 !important; border-top: 1px solid var(--color-border); }
  .panel__col { padding: var(--space-5) var(--layout-gutter-sm); }
  .panel__wide { grid-column: auto; }
}

/* ---------- Event summary ---------- */
.summary { display: flex; flex-direction: column; gap: var(--space-4); }
.summary__logo { width: 180px; height: auto; }
.summary__host { font-size: var(--text-sm-size); line-height: var(--text-sm-line); }
.summary__title { font-size: var(--text-xl-size); line-height: var(--text-xl-line); }
.summary__desc summary { cursor: pointer; font-size: var(--text-sm-size); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.meta { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.meta li { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-sm-size); line-height: var(--text-sm-line); }
.meta__was { text-decoration: line-through; }

/* ---------- Month nav + grid ---------- */
/* The calendar keeps to the column's left edge, in line with the heading and time zone, and shrinks its cells
   when the column is narrower than seven full-size days. */
.month-nav, .grid-wrap { max-width: calc(7 * var(--layout-day-cell) + 6 * var(--space-1)); }
.month-nav { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.month-nav__label { font-weight: 700; min-width: 9em; text-align: center; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; cursor: pointer; color: var(--color-text);
  transition: background var(--motion-fast) var(--motion-ease);
}
.icon-btn:hover:not(:disabled) { background: var(--color-surface); }
.icon-btn--outline { border-color: var(--color-border-input); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

.grid-wrap { position: relative; }
.month-grid { display: flex; flex-direction: column; gap: var(--space-1); }
.month-grid__row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-1); }
.month-grid__cell { display: grid; }
.month-grid__dow { height: 32px; display: grid; place-items: center; font-size: var(--text-sm-size); }
.month-grid__dow abbr { text-decoration: none; }
.day {
  position: relative; width: 100%; aspect-ratio: 1;
  display: grid; place-items: center; border: 0; border-radius: var(--radius-sm);
  background: none; font-weight: 400; color: var(--color-text); cursor: default;
  transition: background var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.day--available { background: var(--color-accent); color: var(--color-on-accent); font-weight: 700; cursor: pointer; }
.day--available:hover { box-shadow: inset 0 0 0 2px var(--color-text); }
.day[aria-pressed="true"] { background: var(--color-selected); color: var(--color-on-selected); }
.day--today::after { content: ""; position: absolute; bottom: 6px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.notice {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  background: var(--color-bg); border: 1px solid var(--color-border-input); border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5); text-align: center; white-space: nowrap;
}
.notice p { font-size: var(--text-sm-size); margin-bottom: var(--space-1); }
.notice a { font-weight: 700; }

/* ---------- Time zone picker ---------- */
.tz { margin-top: var(--space-5); position: relative; }
.tz__label { font-size: var(--text-sm-size); font-weight: 700; margin-bottom: var(--space-1); }
.tz__btn { display: inline-flex; align-items: center; gap: var(--space-2); background: none; border: 0; padding: var(--space-1) 0; cursor: pointer; font-size: var(--text-sm-size); }
.tz__pop {
  margin-top: var(--space-2); width: 320px; max-width: 100%; max-height: 360px; overflow: auto;
  background: var(--color-bg); border: 1px solid var(--color-border-input); border-radius: var(--radius-md);
}
.tz__search { padding: var(--space-3); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; background: var(--color-bg); }
.tz__group { font-size: var(--text-sm-size); font-weight: 700; padding: var(--space-3) var(--space-4) var(--space-1); }
.tz__opt { display: flex; justify-content: space-between; padding: var(--space-2) var(--space-4); font-size: var(--text-sm-size); cursor: pointer; }
.tz__opt:hover { background: var(--color-surface); }
.tz__opt[aria-selected="true"] { background: var(--color-accent); color: var(--color-on-accent); font-weight: 700; }

/* ---------- Slots ---------- */
.slots__day { font-weight: 700; margin-bottom: var(--space-4); }
.slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.slot { display: flex; gap: var(--space-2); }
.slot__time {
  flex: 1; height: var(--layout-slot-height); border: 1px solid var(--color-border-input); border-radius: var(--radius-sm);
  background: var(--color-bg); font-weight: 700; cursor: pointer;
  transition: background var(--motion-fast) var(--motion-ease);
}
.slot__time:hover { background: var(--color-accent); color: var(--color-on-accent); border-color: var(--color-accent); }
.slot--selected { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.slot--selected .slot__time { background: var(--color-selected-soft); color: var(--color-on-selected-soft); border-color: var(--color-selected-soft); }
.slot--selected .btn { min-width: 0; padding: 0 var(--space-3); }
.prompt { font-size: var(--text-sm-size); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--layout-button-height); padding: 0 var(--space-5); border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: background var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.btn--primary { background: var(--color-accent); color: var(--color-on-accent); }
.btn--primary:hover, .btn--primary:active { background: var(--color-accent-hover); color: var(--color-on-accent-hover); }
.btn--secondary { background: var(--color-bg); color: var(--color-text); border-color: var(--color-border-input); }
.btn--secondary:hover { background: var(--color-surface); }
.btn--ghost { background: none; color: var(--color-link); padding: 0 var(--space-2); text-decoration: underline; text-underline-offset: 3px; }
.btn--ghost:hover { text-decoration-thickness: 2px; }
.btn--sm { height: 40px; padding: 0 var(--space-4); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn--primary:disabled:hover { background: var(--color-accent); color: var(--color-on-accent); }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] .icon { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form fields ---------- */
.form { display: flex; flex-direction: column; gap: var(--space-5); max-width: 520px; }
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label { font-size: var(--text-sm-size); font-weight: 700; }
.field__label .opt { font-weight: 400; }
.field__help { font-size: var(--text-sm-size); }
.field__error {
  align-self: flex-start; display: inline-flex; gap: var(--space-2); align-items: center;
  background: var(--color-danger); color: var(--color-on-danger); border-radius: var(--radius-xs);
  padding: var(--space-1) var(--space-2); font-size: var(--text-sm-size); font-weight: 700;
}
.input, .textarea {
  width: 100%; min-height: var(--layout-input-height); padding: 0 var(--space-4);
  border: 1px solid var(--color-border-input); border-radius: var(--radius-sm); background: var(--color-bg);
}
.textarea { min-height: 96px; padding: var(--space-3) var(--space-4); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--color-text); opacity: .7; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-width: 2px; }
.input:disabled { opacity: .4; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; min-height: var(--layout-input-height); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border-input); border-radius: var(--radius-sm); }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); background: var(--color-surface); border-radius: var(--radius-xs); padding: var(--space-1) var(--space-2); font-size: var(--text-sm-size); }
.chip--invalid { background: var(--color-danger); color: var(--color-on-danger); font-weight: 700; }
.chip button { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 0; background: none; cursor: pointer; border-radius: var(--radius-xs); }
.chips input { flex: 1; min-width: 160px; border: 0; padding: var(--space-1); }

.consent { font-size: var(--text-xs-size); line-height: var(--text-xs-line); }

/* ---------- Event card ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-5); }
.card {
  display: flex; gap: var(--space-4); align-items: center;
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-5); color: var(--color-text); text-decoration: none;
  transition: border-color var(--motion-fast) var(--motion-ease);
}
.card:hover { border-color: var(--color-border-input); }
.card__body { flex: 1; min-width: 0; }
.card__title { font-size: var(--text-lg-size); line-height: var(--text-lg-line); font-weight: 700; color: var(--color-heading); }
.card__meta { font-size: var(--text-sm-size); margin: var(--space-1) 0 var(--space-2); }
.card__desc { font-size: var(--text-sm-size); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Alert ---------- */
.alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm-size); font-weight: 700; }
.alert--error { background: var(--color-danger); color: var(--color-on-danger); }
.alert--warning { background: var(--color-warning); color: var(--color-on-warning); }
.alert--success { background: var(--color-success); color: var(--color-on-success); }

/* ---------- Confirmation ---------- */
.confirm { display: flex; flex-direction: column; gap: var(--space-5); align-items: flex-start; }
.confirm__badge { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--color-success); color: var(--color-on-success); }
.confirm h2 { font-size: var(--text-xl-size); line-height: var(--text-xl-line); }
.confirm dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); padding: var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-md); width: 100%; }
.confirm dt { font-size: var(--text-sm-size); }
.confirm dd { margin: 0; font-weight: 700; }
.confirm__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ---------- Skeleton (solid, no shimmer) ---------- */
.skel { background: var(--color-surface); border-radius: var(--radius-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
