/* ============================================================
   Task Booking (participant task discovery + booking) page.
   Structure in @layer layout, paint in @layer design. Content-named
   classes only — no legacy/appearance names, no hardcoded color.
   The list page sits in the overview page kind and the detail and
   booking pages in the task kind (web/templates/page_kinds/), so this
   file sets only what is inside them. See docs/FRONTEND-ARCHITECTURE.md.
   ============================================================ */

@layer layout {
  /* What the page grid cannot place on its own: the filter group's rhythm,
     the search row, and the badges inside a task row. */
  .task-booking .filters { display: grid; gap: var(--t-space-4); }
  .task-booking .needs { display: grid; gap: var(--t-space-2); }
  .task-booking .needs-label, .task-booking .count { margin: 0; }
  .task-booking .rows .main .tags { display: flex; flex-wrap: wrap; gap: var(--t-space-1); }
  /* The task map (MEA-6): the image scales to the column, and the note under
     it says why some rows carry no pin number. */
  .task-booking .task-map { display: grid; gap: var(--t-space-2); margin: 0; }
  .task-booking .task-map img { inline-size: 100%; block-size: auto;
                                border-radius: var(--mea-radius-md); }
  .task-booking .task-map figcaption { font-size: var(--t-font-size-sm); }

  /* ── shared with other pages (audit, compliance, messages, user
     management): the bare filter-chip and search-box classes stay here until
     those pages move onto the chips and field components. ── */
  .filter-chip { display: inline-flex; align-items: center; min-height: var(--t-target-min, 44px);
                 padding: var(--mea-space-2) var(--mea-space-4); border: 0;
                 border-radius: var(--mea-radius-pill); cursor: pointer; white-space: nowrap; }
  .search-box { flex: 1; min-inline-size: 0; display: flex; align-items: center; gap: var(--mea-space-2);
                margin: 0; padding: var(--mea-space-2) var(--mea-space-3);
                border-radius: var(--mea-radius-md); }
  .search-box__input { flex: 1; min-height: var(--t-target-min, 44px);
                       border: 0; background: transparent; padding: 0; }

  /* Booking modal. */
  .booking-modal__task { display: grid; gap: var(--mea-space-1); }
  .booking-modal__task-name, .booking-modal__task-provider, .booking-modal__task-duration { margin: 0; }
  .slot-choices__status { margin: 0; }
  .slot-choice { display: inline-flex; align-items: center; min-height: var(--t-target-min, 44px);
                 padding: var(--mea-space-2) var(--mea-space-4); border: 0;
                 border-radius: var(--mea-radius-pill); cursor: pointer; }
  .booking-modal__msg { margin: 0; }

}

@layer design {

  .task-booking .needs-label, .task-booking .count,
  .task-booking .task-map figcaption { color: var(--c-surface-text-color-muted); }

  /* ── shared with other pages (see @layer layout) ── */
  .filter-chip { background: var(--t-bg-recessed); color: var(--t-text-secondary);
                 font-size: var(--mea-text-sm); font-weight: var(--mea-w-semibold);
                 transition: background var(--mea-dur-fast), color var(--mea-dur-fast); }
  .filter-chip:hover { background: var(--t-bg-active); }
  .filter-chip.is-active { background: var(--t-accent); color: var(--t-accent-text); }

  .search-box { background: var(--t-bg-elevated); border: 1px solid var(--t-border); }
  .search-box__icon { color: var(--t-text-muted); }
  .search-box__input { color: var(--t-text); font-size: var(--mea-text-md); }
  .search-box__input::placeholder { color: var(--t-text-muted); }
  .search-box:focus-within { border-color: var(--t-border-focus); }

  .booking-modal__task-name { font-size: var(--mea-text-md); font-weight: var(--mea-w-semibold); color: var(--t-text); }
  .booking-modal__task-provider, .booking-modal__task-duration { font-size: var(--mea-text-sm); color: var(--t-text-muted); }
  .slot-choice { background: transparent; color: var(--t-text); border: 1.5px solid var(--t-border);
                 font-size: var(--mea-text-sm); font-weight: var(--mea-w-semibold);
                 transition: background var(--mea-dur-fast), color var(--mea-dur-fast); }
  .slot-choice:hover { background: var(--t-bg-recessed); }
  .slot-choice.is-selected { background: var(--t-accent); color: var(--t-accent-text); border-color: var(--t-accent); }
  .slot-choices__status { font-size: var(--mea-text-sm); color: var(--t-text-muted); }

}

/* ── Task detail and booking (task_detail, task_booking_book). Each renders
   through pages/_task.html, so the page is one raised work surface; the
   template pads it top and bottom and the page pads its own content inline.
   Colour comes from the surface it sits on. ── */
@layer layout {
	.task-booking {
		/* A load error: the alert callout holds an icon, the message and a retry link. */
		& .callout {
			display: grid;
			gap: var(--t-space-3);
			justify-items: start;

			& p {
				margin: 0;
			}

			& svg {
				inline-size: 1.5rem;
				block-size: 1.5rem;
			}
		}
	}

	:is(.task-detail, .booking-page) {
		padding-inline: var(--t-space-5);

		& > a[rel="prev"] {
			justify-self: start;
		}

		& p {
			margin: 0;
		}
	}

	.task-detail {
		& .task-category {
			justify-self: start;
		}

		& .task-desc {
			font-size: var(--t-font-size-sm);
		}

		/* The badges of what a task needs, in the value of their fact. */
		& .tags {
			display: flex;
			flex-wrap: wrap;
			gap: var(--t-space-2);
			margin: 0;
			padding: 0;
			list-style: none;
		}
	}

	.booking-page {
		& form {
			display: grid;
			gap: var(--t-space-3);
		}

		& .booking-date button {
			justify-self: start;
		}

		& .booking-modal__task {
			display: grid;
			gap: var(--t-space-1);
		}

		& .booking-modal__task-name {
			font-size: var(--t-font-size-md);
			font-weight: var(--t-font-weight-semibold);
		}

		& :is(.booking-modal__task-provider, .booking-modal__task-duration, .slot-choices__status) {
			font-size: var(--t-font-size-sm);
		}
	}
}

@layer design {
	:is(.task-detail, .booking-page) {
		& .task-desc {
			color: var(--c-surface-text-color-muted);
		}

		& .booking-modal__task-name {
			color: var(--c-surface-text-color-base);
		}

		& :is(.booking-modal__task-provider, .booking-modal__task-duration, .slot-choices__status) {
			color: var(--c-surface-text-color-muted);
		}
	}
}
