/* Styles for the parts poisto-app.js renders or toggles: alerts, detected
   item pills, the restricted-items notice, photo thumbnails, the calendar and
   arrival windows, outcome panels and the agreement modal. Tokens come from
   poistopalvelu.css. */

.quote-form[aria-busy='true'] {
  cursor: progress;
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.form-alert {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: #ffd2c4;
  background: rgba(255, 120, 90, 0.08);
  border: 1px solid rgba(255, 150, 120, 0.35);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
  max-width: 640px;
}

.form-alert-static {
  margin-top: var(--space-4);
}

.form-alert-light {
  color: #8a2d12;
  background: rgba(243, 111, 33, 0.08);
  border-color: rgba(160, 60, 20, 0.35);
}

.items-status:empty,
.addr-status:empty {
  display: none;
}

.items-status,
.addr-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim-on-navy);
  line-height: 1.5;
}

.addr-status.addr-ok {
  color: #9be6c0;
}

.addr-status.addr-error {
  color: #ffb4a3;
}

/* ── Detected items ─────────────────────────────────────────────────────── */
.item-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-pill {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
}

.item-pill--ok {
  border-color: rgba(155, 230, 192, 0.5);
  color: #c9f3dd;
}

.item-pill--review {
  border-color: rgba(255, 207, 120, 0.7);
  color: #ffdc9a;
  background: rgba(255, 207, 120, 0.08);
}

.item-pill--review::before {
  content: '? ';
}

.item-pill--blocked {
  border-color: #ff8a70;
  color: #fff;
  background: rgba(255, 110, 80, 0.22);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.item-pill--blocked::before {
  content: '✕ ';
  text-decoration: none;
  display: inline-block;
}

.restricted-alert {
  border: 1px solid #ff8a70;
  background: rgba(255, 110, 80, 0.12);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: #ffe1d8;
  line-height: 1.55;
}

.restricted-title {
  font-weight: 700;
  color: #fff;
}

.restricted-call {
  align-self: flex-start;
  padding: 10px 16px;
  font-size: 14px;
}

/* ── Photos (ids shared with /booking-photos.js) ────────────────────────── */
.upload-hint {
  font-size: 11px;
  opacity: 0.8;
}

.upload-box.drag-over {
  border-color: var(--orange);
  background: rgba(255, 255, 255, 0.04);
}

.photo-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.photo-thumb-grid:empty {
  display: none;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--navy-soft);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb-status {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: rgba(10, 15, 26, 0.85);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-thumb-status.done {
  color: #9be6c0;
}

.photo-thumb-status.error {
  color: #ffb4a3;
}

.photo-status-msg,
.photo-error-msg {
  display: none;
  font-family: var(--mono);
  font-size: 12px;
}

.photo-status-msg {
  color: #9be6c0;
}

.photo-error-msg {
  color: #ffb4a3;
}

/* ── Calendar ───────────────────────────────────────────────────────────── */
.dp-group {
  position: relative;
  max-width: 360px;
}

.dp-trigger {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-family: var(--sans);
  font-size: 15px;
  padding: 8px 24px 8px 0;
  cursor: pointer;
  position: relative;
}

.dp-trigger::after {
  content: '▾';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--orange);
}

.dp-trigger[aria-expanded='true'] {
  border-color: var(--orange);
}

.dp-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  width: min(340px, calc(100vw - 56px));
  background: var(--navy-soft);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dp-month-label {
  font-weight: 700;
}

.dp-nav {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.dp-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.dp-weekdays,
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.dp-weekdays span {
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
  color: var(--dim-on-navy);
  padding: 4px 0;
}

.dp-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 36px;
  border: 1px solid rgba(155, 230, 192, 0.35);
  background: rgba(155, 230, 192, 0.08);
  color: #fff;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.dp-day-num {
  line-height: 1;
}

.dp-day:hover {
  border-color: var(--orange);
}

.dp-day-outside {
  opacity: 0.55;
}

.dp-day-disabled {
  background: transparent;
  border-color: transparent;
  color: rgba(255, 255, 255, 0.25);
  cursor: default;
}

.dp-day-pending {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}

.dp-day-busy {
  background: rgba(255, 110, 80, 0.14);
  border-color: rgba(255, 110, 80, 0.45);
}

.dp-day-blocked {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  text-decoration: line-through;
}

/* ── Yhteiskuljetusetu ──────────────────────────────────────────────────
   A date we are already driving a removal on. The badge is positioned over
   the cell rather than added to its content, so the day number stays where
   it was and a 7-column grid inside a 360 px-wide popover keeps its square
   cells (~35 px) — no reflow, no horizontal overflow. The day number is
   nudged up by the same amount the badge occupies, so the two never touch. */
.dp-day-shared {
  border-color: rgba(155, 230, 192, 0.75);
  background: rgba(155, 230, 192, 0.2);
}

/* The badge takes the bottom ~13 px of a cell that is only 36 px square at
   360 px, so the number moves up by that much — measured, not guessed: at 360
   px the untouched number's line box and the badge were a pixel apart. */
.dp-day-shared .dp-day-num {
  transform: translateY(-6px);
}

.dp-badge {
  position: absolute;
  left: 50%;
  bottom: 1px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  padding: 1px 3px;
  border-radius: var(--radius-pill);
  background: #9be6c0;
  color: var(--navy);
}

/* On the selected (orange) day the mint pill would fight the fill. */
.dp-day-selected .dp-badge {
  background: var(--navy);
  color: #9be6c0;
}

.dp-day-today {
  box-shadow: inset 0 -2px 0 var(--orange);
}

.dp-day-selected {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--navy);
  font-weight: 800;
}

.dp-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim-on-navy);
  margin-top: 8px;
}

.dp-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.dp-dot-busy {
  background: rgba(255, 110, 80, 0.5);
}

.dp-dot-blocked {
  background: rgba(255, 255, 255, 0.2);
}

/* The same pill as on a day, sitting in the legend line. */
.dp-badge-legend {
  position: static;
  transform: none;
  flex: none;
}

.dp-load-error {
  font-family: var(--mono);
  font-size: 11px;
  color: #ffb4a3;
  margin-top: 8px;
}

/* The Yhteiskuljetusetu notice, between the calendar and the arrival
   windows. It is a status region, so it appears and disappears with the
   picked date; nothing around it moves except this block's own height. */
.shared-transport-note {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(155, 230, 192, 0.5);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: rgba(155, 230, 192, 0.12);
}

.shared-transport-note .stn-title {
  font-weight: 800;
  font-size: 15px;
  color: #9be6c0;
  /* Never break "säästä 5 €" before the € on a 360 px phone. */
  text-wrap: balance;
}

.shared-transport-note .stn-body {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--dim-on-navy);
  margin-top: 4px;
}

.slot-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--space-3);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 480px;
}

.slot-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  background: transparent;
  color: #fff;
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 4px;
  min-height: 44px;
  cursor: pointer;
}

.slot-btn:hover:not(:disabled) {
  border-color: var(--orange);
}

.slot-btn[aria-pressed='true'] {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--navy);
  font-weight: 700;
}

.slot-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.slot-btn.slot-taken {
  text-decoration: line-through;
}

.slot-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim-on-navy);
}

.slot-status:empty {
  display: none;
}

.slot-call {
  align-self: flex-start;
  margin-top: var(--space-2);
  padding: 10px 16px;
  font-size: 14px;
}

/* ── Outcome panels ─────────────────────────────────────────────────────── */
.outcome {
  margin-top: var(--space-5);
  max-width: 640px;
  border: 1px solid rgba(155, 230, 192, 0.5);
  background: rgba(155, 230, 192, 0.07);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--dim-on-navy);
  line-height: 1.6;
}

.outcome:focus {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.outcome-warn {
  border-color: rgba(255, 207, 120, 0.6);
  background: rgba(255, 207, 120, 0.07);
}

.outcome-title {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: #fff;
}

.outcome strong {
  color: #fff;
}

.outcome-summary,
.modal-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px var(--space-3);
  font-family: var(--mono);
  font-size: 13px;
  margin-top: var(--space-2);
}

.outcome-summary:empty,
.modal-facts:empty {
  display: none;
}

.outcome-summary dt,
.modal-facts dt {
  opacity: 0.75;
}

.outcome-summary dd,
.modal-facts dd {
  color: inherit;
  overflow-wrap: anywhere;
}

.outcome-summary dd {
  color: #fff;
}

/* ── Agreement modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 26, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 100;
}

.modal-card {
  position: relative;
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius-md);
  max-width: 640px;
  width: 100%;
  padding: var(--space-5);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-title {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 24px;
}

.modal-sub {
  color: var(--dim-on-cream);
  font-size: 14px;
  margin-top: 8px;
  line-height: 1.6;
  padding-right: var(--space-5);
}

.modal-summary {
  margin-top: var(--space-4);
  border-top: 1px solid rgba(24, 28, 34, 0.12);
  border-bottom: 1px solid rgba(24, 28, 34, 0.12);
  padding: var(--space-3) 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim-on-cream);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 180px;
}

.agreement-frame {
  width: 100%;
  height: min(48vh, 480px);
  border: 1px solid rgba(24, 28, 34, 0.15);
  border-radius: var(--radius-sm);
  background: #fff;
}

.agreement-download {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: flex-start;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--space-4);
}

.modal-btn {
  padding: 14px 22px;
  font-size: 15px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--dim-on-cream);
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--ink);
}

@media (max-width: 600px) {
  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal-card {
    max-height: 100vh;
    border-radius: 0;
    padding: var(--space-4) var(--space-3);
  }

  .agreement-frame {
    height: 52vh;
  }

  .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Saved offer (?resume=) and fallback call ───────────────────────────── */
.resume-panel {
  margin-top: var(--space-5);
}

.resume-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.resume-loading {
  font-family: var(--mono);
  font-size: 13px;
}

.resume-total {
  font-size: 20px;
  color: #fff;
  margin-top: var(--space-2);
}

.resume-total strong {
  white-space: nowrap;
  color: var(--orange);
  font-weight: 800;
}

.resume-pdf {
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: flex-start;
}

.resume-note {
  font-size: 13px;
}

.resume-new,
.fallback-call {
  align-self: flex-start;
  padding: 11px 18px;
  font-size: 14px;
}
