/*
 * RAWASY quote page: the list of fabrics and the request form.
 *
 * The list and the form are Rawasy Core's and Fluent Forms'; this sheet only
 * lays them out. With fabrics in the list, the list and the form stand side by
 * side on a computer and one above the other on a phone. While the list is
 * empty, Rawasy Core's script hides the form, and the list's empty line takes
 * the page. Every rule starts from the page's body class, so it outranks the
 * plugin's sheet, which can be printed after this one.
 *
 * Logical properties only, so the same rules serve RTL and LTR.
 */

/* The page's opening line, under the page's title and in line with it. */
.rawasy-quote-page .entry-content > .rawasy-quote-page__lead {
	margin-block: 0 clamp(1.75rem, 3.5vw, 2.5rem);
	font-size: var(--rawasy-type-lead);
	line-height: 1.85;
	color: var(--rawasy-body);
	text-wrap: pretty;
}

/* Side by side once the form is shown: the list takes the wider column, the form a panel beside it. */
@media (min-width: 1000px) {
	/* The grid keeps the width of the page's other content: Blocksy's container, 5% from the window at least. */
	.rawasy-quote-page .entry-content:has(.rawasy-quote-form:not([hidden])) {
		display: grid;
		grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
		column-gap: clamp(2rem, 4vw, 4rem);
		align-items: start;
		box-sizing: border-box;
		inline-size: min(90%, var(--theme-normal-container-max-width, 1290px));
		margin-inline: auto;
	}

	.rawasy-quote-page .entry-content:has(.rawasy-quote-form:not([hidden])) > * {
		max-inline-size: none;
		margin-inline: 0;
	}

	.rawasy-quote-page .entry-content:has(.rawasy-quote-form:not([hidden])) > .rawasy-quote-page__lead {
		grid-column: 1 / -1;
	}

	.rawasy-quote-page .entry-content:has(.rawasy-quote-form:not([hidden])) > .rawasy-quote-panel {
		position: sticky;
		inset-block-start: calc(var(--wp-admin--admin-bar--height, 0px) + 7.5rem);
	}
}

/* ------------------------------------------------------------ The list. */

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__status {
	margin-block-end: 0.75rem;
	font-size: var(--rawasy-type-ui);
	font-weight: 600;
	color: var(--rawasy-heading);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__summary {
	margin-block: 0 0.75rem;
	font-size: var(--rawasy-type-ui);
	color: var(--rawasy-muted);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__rows {
	display: grid;
	gap: 0.75rem;
	border: 0;
}

/* A fabric in the list: a card, its name and codes on one side, its quantity on the other. */
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item {
	gap: 1rem 1.5rem;
	padding: 1.125rem 1.25rem;
	background: var(--rawasy-page-warm);
	border: 1px solid var(--rawasy-border);
	border-inline-start: 3px solid var(--rawasy-brand-orange);
	border-radius: var(--rawasy-radius-surface);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__title {
	font-size: 1.125rem;
	font-weight: 700;
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__title a {
	text-decoration: none;
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__title a:hover {
	color: var(--rawasy-link);
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__meta {
	margin-block-start: 0.25rem;
	font-size: var(--rawasy-type-small);
	color: var(--rawasy-muted);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__field label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--rawasy-muted);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__quantity,
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__unit,
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__remove {
	min-block-size: 2.875rem;
	border-color: var(--rawasy-border);
	border-radius: var(--rawasy-radius-control);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__quantity:hover,
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__unit:hover {
	border-color: var(--rawasy-muted);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__quantity[aria-invalid="true"] {
	border-color: var(--rawasy-brand-orange);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__remove {
	color: var(--rawasy-body);
	background: transparent;
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-item__remove:hover {
	color: var(--rawasy-heading);
	border-color: var(--rawasy-heading);
}

/* The empty list, and the line after a saved request: a calm panel with the way to the fabrics as a button. */
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__empty,
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__sent {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1.5rem;
	max-inline-size: 46rem;
	padding: clamp(1.75rem, 4vw, 2.75rem);
	font-size: var(--rawasy-type-lead);
	line-height: 1.8;
	background: var(--rawasy-page-warm);
	border: 1px solid var(--rawasy-border);
	border-radius: var(--rawasy-radius-surface);
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__empty a,
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__sent a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-block-size: var(--rawasy-control-height);
	padding: 0.625rem 2rem;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--rawasy-white);
	text-decoration: none;
	background: var(--rawasy-button-primary);
	border: 1px solid var(--rawasy-button-primary);
	border-radius: var(--rawasy-radius-control);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__empty a:hover,
.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__sent a:hover {
	background: var(--rawasy-button-primary-hover);
	border-color: var(--rawasy-button-primary-hover);
}

/* ------------------------------------------------------------ The form. */

/* The panel is drawn only while the form is shown; Rawasy Core's status line stays visible on its own. */
.rawasy-quote-page .rawasy-quote-panel:has(> .rawasy-quote-form:not([hidden])) {
	padding: clamp(1.5rem, 3vw, 2.25rem);
	background: var(--rawasy-white);
	border: 1px solid var(--rawasy-border);
	border-block-start: 3px solid var(--rawasy-heading);
	border-radius: var(--rawasy-radius-surface);
	box-shadow: 0 1.25rem 2.5rem rgba(30, 26, 23, 0.06);
}

.rawasy-quote-page .rawasy-quote-panel:has(> .rawasy-quote-form[hidden]) > .rawasy-quote-panel__head {
	display: none;
}

.rawasy-quote-page .rawasy-quote-panel__head > * {
	margin: 0;
}

.rawasy-quote-page .rawasy-quote-panel__title {
	font-size: var(--rawasy-type-h3);
	font-weight: 700;
	line-height: 1.4;
	color: var(--rawasy-heading);
}

.rawasy-quote-page .rawasy-quote-panel__lead {
	margin-block-start: 0.375rem;
	font-size: var(--rawasy-type-small);
	line-height: 1.7;
	color: var(--rawasy-muted);
}

/* Said before anything is filled in: sending is not open yet. */
.rawasy-quote-page .rawasy-quote-panel__closed {
	margin-block-start: 1rem;
	padding: 0.75rem 1rem;
	font-size: var(--rawasy-type-small);
	font-weight: 600;
	line-height: 1.7;
	color: var(--rawasy-heading);
	background: var(--rawasy-orange-soft);
	border-inline-start: 3px solid var(--rawasy-brand-orange);
}

.rawasy-quote-page .rawasy-quote-panel .rawasy-quote-form {
	max-inline-size: none;
	margin-block-start: 1.5rem;
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .ff-el-group {
	margin-block-end: 1.125rem;
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .ff-el-input--label label {
	font-size: var(--rawasy-type-small);
	font-weight: 600;
	color: var(--rawasy-heading);
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .ff-el-form-control {
	min-block-size: 3rem;
	padding: 0.625rem 0.875rem;
	font-family: inherit;
	color: var(--rawasy-heading);
	background: var(--rawasy-white);
	border: 1px solid var(--rawasy-border);
	border-radius: var(--rawasy-radius-control);
	box-shadow: none;
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .ff-el-form-control:hover {
	border-color: var(--rawasy-muted);
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .ff-el-form-control:focus {
	border-color: var(--rawasy-link);
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form textarea.ff-el-form-control {
	min-block-size: 7.5rem;
}

/* The button that sends: the width of the panel, as the page's one main action. */
.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .ff_submit_btn_wrapper {
	margin-block: 0.5rem 0;
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style) {
	inline-size: 100%;
	min-block-size: var(--rawasy-control-height);
	font-size: 1.0625rem;
	border-radius: var(--rawasy-radius-control);
}

.rawasy-quote-page .rawasy-quote-panel .rawasy-quote-request__status {
	max-inline-size: none;
}

/*
 * Requests not accepted yet: the form's fieldset is disabled (functions.php),
 * and it looks it. The fields are quiet and the button carries no brand
 * colour, so nothing on the panel looks like a working way to send.
 */
.rawasy-quote-page .rawasy-quote-panel--closed .rawasy-quote-panel__closed {
	margin-block-start: 0.75rem;
}

.rawasy-quote-page .rawasy-quote-panel--closed .rawasy-quote-form form.frm-fluent-form .ff-el-input--label label {
	color: var(--rawasy-muted);
}

.rawasy-quote-page .rawasy-quote-panel--closed .rawasy-quote-form form.frm-fluent-form .ff-el-form-control:disabled {
	background: var(--rawasy-page-warm);
	border-style: dashed;
	cursor: not-allowed;
	opacity: 1;
}

.rawasy-quote-page .rawasy-quote-panel--closed .rawasy-quote-form form.frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style):disabled {
	color: var(--rawasy-muted);
	background: var(--rawasy-card-surface);
	border: 1px dashed var(--rawasy-border);
	box-shadow: none;
	cursor: not-allowed;
	opacity: 1;
}

/* The agreement to the privacy text: a box that is easy to touch, and a link that looks like one. */
.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .rawasy-quote-consent input[type="checkbox"] {
	inline-size: 1.25rem;
	block-size: 1.25rem;
	margin-block-start: 0.25rem;
	margin-inline-end: 0.625rem;
}

.rawasy-quote-page .rawasy-quote-form form.frm-fluent-form .rawasy-quote-consent a {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
}

@media (prefers-reduced-motion: reduce) {
	.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__empty a,
	.rawasy-quote-page .rawasy-quote-list .rawasy-quote-list__sent a {
		transition: none;
	}
}
