/* Buoyly trip page styles (SPEC §6 PWA, Appendix A.8). High-contrast,
 * mobile-first, ≥48dp targets, single-screen feel. */

* { box-sizing: border-box; }

/* The HTML `hidden` attribute is `display: none` from the user-agent stylesheet,
 * but author rules like `.primary { display: flex }` override it — which would
 * show buttons we explicitly hid in JS. Pin it down so `element.hidden = true`
 * really hides the element. */
[hidden] { display: none !important; }

/* Brand palette pulled from Sharetribe branding.json:
 *   primaryButton  #138041  → primary CTA buttons (Book out / Book in)
 *   mainColor      #5ebcbe  → accents, theme color, links */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #0b1726;
  --ink-soft: #5a6b80;
  --accent: #138041;
  --accent-ink: #ffffff;
  --link: #138041;
  --brand-teal: #5ebcbe;
  --danger: #b3261e;
  --danger-ink: #ffffff;
  --border: #d5dbe2;
  --shadow: 0 1px 2px rgba(11, 23, 38, 0.06), 0 4px 12px rgba(11, 23, 38, 0.08);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1726;
    --card: #142235;
    --ink: #f4f6f8;
    --ink-soft: #a8b6c8;
    --accent: #1ea356;
    --accent-ink: #061322;
    --link: #5ebcbe;
    --brand-teal: #5ebcbe;
    --danger: #ff6f63;
    --danger-ink: #1a0808;
    --border: #233247;
    --shadow: none;
  }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.brand {
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
}

.brand img {
  display: block;
  height: 36px;
  width: auto;
  /* Logo is dark on white — in dark mode flip it so it stays readable. */
}

@media (prefers-color-scheme: dark) {
  .brand img { filter: invert(1) hue-rotate(180deg); }
}

.club { margin: 0 0 4px 0; font-size: 20px; font-weight: 700; }
.boat { margin: 0 0 4px 0; font-size: 18px; }
.when { margin: 0 0 4px 0; color: var(--ink-soft); }
.customer { margin: 0 0 4px 0; color: var(--ink-soft); font-size: 14px; }
.reference { margin: 0; color: var(--ink-soft); font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

.banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  color: var(--ink-soft);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.banner p { margin: 0; flex: 1; }

.status {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.status-headline { margin: 0 0 4px 0; font-weight: 700; font-size: 18px; }
.status-detail { margin: 0; color: var(--ink-soft); }

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.primary, .danger, .link {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 0;
  cursor: pointer;
  text-align: center;
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 18px 16px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  touch-action: manipulation;
}

.primary .icon { display: inline-block; vertical-align: middle; }
.primary .sub { display: block; font-weight: 400; font-size: 13px; opacity: 0.85; }

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Busy state — applied while the click handler waits for the API. Fades the
 * label and overlays a spinner so the user knows their tap registered. */
.is-busy {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.is-busy::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: buoyly-spin 0.7s linear infinite;
  color: var(--accent-ink);
}

.danger.is-busy::after { color: var(--danger-ink); }
.link.is-busy::after { color: var(--link); }

@keyframes buoyly-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .is-busy::after { animation-duration: 1.5s; }
}

.danger {
  background: var(--danger);
  color: var(--danger-ink);
  padding: 14px 16px;
  min-height: 48px;
}

.link {
  background: transparent;
  color: var(--link);
  padding: 12px 8px;
  min-height: 48px;
  text-decoration: underline;
}

.countdown {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  margin: 8px 0 0 0;
  color: var(--ink-soft);
}

.cancel details {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.cancel summary {
  cursor: pointer;
  font-weight: 600;
  padding: 8px 0;
}

.cancel form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.cancel select, .cancel textarea {
  font: inherit;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  min-height: 48px;
  width: 100%;
}

.cancel textarea { resize: vertical; min-height: 80px; }

.cancellation-summary {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.footer {
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  padding-top: 8px;
}

.footer p { margin: 4px 0; }

.offline {
  background: #ffeccf;
  color: #6b4308;
  border-radius: var(--radius);
  padding: 12px;
}

dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 20px;
  max-width: 360px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(11, 23, 38, 0.6);
}

dialog h2 { margin: 0 0 8px 0; font-size: 18px; }
dialog p { margin: 0 0 16px 0; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-actions button { min-height: 44px; padding: 10px 16px; }
