/**
 * Booking form.
 *
 * Theme neutral, per SPEC section 15. No colours or fonts are imposed beyond
 * what the states need, so the form inherits the site's typography and Divi
 * specific styling can live in the child theme.
 */

.irb-form {
	--irb-gap: 0.75rem;
	--irb-border: #d7dbe0;
	--irb-muted: #5c6670;
	--irb-error: #a4272c;
	--irb-ok: #1f6b3a;
	--irb-focus: #1e5aa8;

	margin-block: 1.5rem;
}

.irb-form__fieldset {
	margin: 0 0 1.25rem;
	padding: var(--irb-gap);
	border: 1px solid var(--irb-border);
	border-radius: 4px;
}

.irb-form__legend {
	padding-inline: 0.35rem;
	font-weight: 600;
}

.irb-form__field {
	display: block;
	margin: 0 0 var(--irb-gap);
}

.irb-form__label {
	display: block;
	margin-bottom: 0.25rem;
	font-weight: 600;
}

.irb-form__input {
	width: 100%;
	max-width: 32rem;
	box-sizing: border-box;
}

.irb-form__required {
	color: var(--irb-error);
}

.irb-form__hint {
	margin: 0 0 var(--irb-gap);
	color: var(--irb-muted);
	font-size: 0.875rem;
}

/* Resources
   -------------------------------------------------------------------------
   The list itself is styled by picker.css, which the admin panel loads too. */

.irb-form__select-all {
	margin-bottom: var(--irb-gap);
}

.irb-form__rooms {
	display: block;
}

/* Date and time rows
   ------------------------------------------------------------------------- */

.irb-form__row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--irb-gap);
}

.irb-form__row .irb-form__field {
	flex: 1 1 12rem;
	margin-bottom: 0;
}

/* Errors and status
   ------------------------------------------------------------------------- */

/*
 * Tied to their field with aria-describedby in the markup, so a screen reader
 * reads the message when the field takes focus rather than leaving it stranded
 * somewhere else on the page. SPEC section 17.
 */
.irb-form__error {
	display: block;
	margin-top: 0.25rem;
	color: var(--irb-error);
	font-size: 0.875rem;
}

.irb-form__error:empty {
	display: none;
}

.irb-form__input[aria-invalid="true"] {
	border-color: var(--irb-error);
	outline-color: var(--irb-error);
}

.irb-form__status {
	margin: 0 0 var(--irb-gap);
	font-weight: 600;
}

.irb-form__status:empty {
	display: none;
}

.irb-form__notice {
	padding: var(--irb-gap);
	border: 1px solid var(--irb-border);
	border-radius: 4px;
}

/*
 * Who is signed in, above the form and above somebody's own bookings. Quiet
 * enough not to compete with the page, since it is a way out rather than
 * something anybody came here to do.
 */
/*
 * The login, on the page it was needed on. Narrow because it is a pair of
 * fields, not a form to fill in — the booking form below is the one that
 * deserves the width.
 */
.irb-login {
	max-width: 22rem;
}

.irb-login input[type="text"],
.irb-login input[type="password"] {
	width: 100%;
}

.irb-login__error {
	border-color: var(--irb-error);
}

.irb-login__lost {
	font-size: 0.875rem;
}

.irb-account {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: baseline;
	justify-content: flex-end;
	margin: 0 0 var(--irb-gap);
	font-size: 0.875rem;
}

/* Availability
   ------------------------------------------------------------------------- */

.irb-form__availability {
	margin: 0 0 var(--irb-gap);
}

.irb-form__availability:empty {
	display: none;
}

.irb-form__availability-headline {
	margin: 0;
	font-weight: 600;
}

/*
 * The left border repeats what the wording already says, rather than being the
 * only way to tell free from taken.
 */
.irb-form__availability--free,
.irb-form__availability--busy,
.irb-form__availability--checking {
	padding: var(--irb-gap);
	border-left: 4px solid var(--irb-border);
	border-radius: 2px;
}

.irb-form__availability--free {
	border-left-color: var(--irb-ok);
}

.irb-form__availability--busy {
	border-left-color: var(--irb-error);
}

.irb-form__conflicts {
	margin: 0.5rem 0 0;
	padding-left: 1.2rem;
}

/* Series conflicts
   ------------------------------------------------------------------------- */

.irb-form__series-conflict {
	margin-top: var(--irb-gap);
	padding: var(--irb-gap);
	border: 1px solid var(--irb-error);
	border-radius: 4px;
}

.irb-form__series-conflict ul {
	margin: 0.5rem 0;
	padding-left: 1.2rem;
}

.irb-form__secondary {
	margin-left: 0.5rem;
	background: none;
	border: 1px solid var(--irb-border);
}

/* Manage page and a person's own bookings
   ------------------------------------------------------------------------- */

.irb-manage__intro {
	margin-bottom: 1rem;
}

.irb-mine {
	margin-block: 1.5rem;
}

.irb-mine__heading {
	margin-bottom: 0.5rem;
}

.irb-mine__table {
	width: 100%;
	border-collapse: collapse;
}

.irb-mine__table th,
.irb-mine__table td {
	padding: 0.5rem 0.6rem;
	border-bottom: 1px solid var(--irb-border);
	text-align: left;
	vertical-align: top;
}

.irb-mine__table th {
	font-weight: 600;
}

/* Tables do not reflow, so on a narrow screen the rows become blocks with the
   column name in front of each value. */
@media (max-width: 640px) {
	.irb-mine__table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.irb-mine__table tr {
		display: block;
		margin-bottom: 1rem;
		border-bottom: 2px solid var(--irb-border);
	}

	.irb-mine__table td {
		display: block;
		border-bottom: 0;
	}
}

/* Focus
   ------------------------------------------------------------------------- */

.irb-form :is(input, select, button):focus-visible {
	outline: 2px solid var(--irb-focus);
	outline-offset: 2px;
}

@media (max-width: 782px) {
	.irb-form__row {
		flex-direction: column;
	}
}
