/* ABOUTME: Summary sidebar, floating bar, and all summary sub-components. */
/* ABOUTME: Handles desktop sidebar, tablet overlay, and mobile inline summary layouts. */

#form-summary {
	--sum-accent: #c2257e;
	--sum-accent-light: #f0cae0;
	--sum-info: #e5f4f5;
	--sum-info-text: #138b93;
	--sum-border: #111;
	--sum-border-light: #eee;

	background: var(--color-light-turquoise);
	margin-block: 10px;
	border-radius: 5px;
	min-width: 0;
	overflow: hidden;
}

/* Mobile base: summary visible inline below form */
.summary {
	display: flex;
	flex-direction: column;
	padding: var(--general-padding);
	background: transparent;
	align-items: flex-end;
}

.summary > * {
	width: 100%;
}

.summary h2 {
	margin-bottom: 0;
	text-align: center;
	/* font-size: 1rem; */
}

.sum-date .weekday,
.sum-date-range .weekday {
	font-size: 0.8rem;
	text-align: right;
	display: block;
}

.sum-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1vh;
	border-bottom: 1px solid var(--sum-border);
	margin-bottom: 2.5rem;
	padding-block: 1.5vh;
}

.sum-accordion > summary + * {
	margin-top: 5px;
}

/* Unified summary components */
.sum-section {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.sum-accordion {
	border-bottom: 1px solid var(--sum-border);
	padding: 5px 0;
}

.sum-accordion[open=""] {
	padding-bottom: 2rem;
}

.sum-accordion > summary {
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 44px;
	gap: 0.5rem;
	list-style: none;
}

.sum-accordion > summary::-webkit-details-marker {
	display: none;
}

details.sum-accordion > summary::before {
	content: "▶";
	font-size: 0.7rem;
	transition: transform 0.2s ease;
	margin-left: 4px;
}

details.sum-accordion[open] > summary::before {
	transform: rotate(90deg);
}

.sum-accordion-label {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	min-width: 0;
	flex: 1 1 auto;
}

.sum-accordion-actions {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	margin-left: auto;
	flex: 0 0 auto;
}

.sum-accordion > summary > strong,
.sum-accordion-actions > strong {
	margin-left: auto;
	font-family: monospace;
	font-size: 1rem;
}

.sum-accordion .sum-row {
	font-weight: bold;
}

.sum-row.sum-panel {
	border-bottom: 1px solid var(--sum-border);
	padding: 5px 0;
}

.sum-content {
	border-top: 1px solid var(--sum-border-light);
	padding-left: 22px;
	font-size: var(--step--1);
}

/* Mobile base: rows wrap, labels take full width */
.sum-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.25rem 0;
	font-weight: bold;
	flex-wrap: wrap;
}

.sum-row-label {
	width: 100%;
}

.sum-row strong {
	font-family: monospace;
	font-size: 1rem;
}

.sum-total,
.sum-subtotal {
	padding: 0.5rem;
	border-radius: 3px;
	width: fit-content;
}

.sum-total strong,
.sum-subtotal strong {
	font-family: monospace;
}

.sum-total {
	background: var(--sum-accent);
	color: white;
	margin-top: 10px;
	font-size: var(--step--1);
}

.sum-subtotal {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	background: var(--sum-info);
	color: var(--sum-border);
}

.sum-hint {
	background: var(--sum-info);
	color: var(--sum-info-text);
	padding: 0.4rem 0.6rem;
	border-radius: 3px;
	font-size: 0.85rem;
	font-weight: 500;
}

.sum-empty {
	background-color: var(--sum-accent-light);
	border: 1px solid var(--color-pink);
	border-radius: 5px;
	padding: 1rem;
}

.step-2 .sum-empty {
	display: block;
}

.sum-meta {
	display: flex;
	flex-wrap: wrap;
	container-name: summary-meta;
	container-type: inline-size;
	align-items: center;
	justify-content: center;
	gap: 0.75rem clamp(0.75rem, 3cqi, 1.25rem);
	width: 100%;
	text-align: center;
}

.sum-meta-block {
	box-sizing: border-box;
	min-width: min(100%, 9rem);
	max-width: 100%;
	overflow-wrap: break-word;
}

.sum-meta-block--dates {
	flex: 1 1 13rem;
}

.sum-meta-block--details {
	flex: 1 1 9rem;
	line-height: 1.25;
}

.sum-meta-separator {
	width: 1px;
	min-height: 2.75rem;
	align-self: stretch;
	background: var(--sum-border);
	flex: 0 0 auto;
}

.sum-date-range {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	justify-content: center;
	gap: 0.25rem 0.5rem;
	max-width: 100%;
}

.sum-date-range > .separator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.sum-date-range .dateblock {
	display: inline-block;
	background: transparent;
	padding: 2px 5px;
	border-radius: 3px;
	min-width: 0;
	text-align: right;
}

@container summary-meta (max-width: 26rem) {
	.sum-meta-separator {
		width: min(100%, 14rem);
		height: 1px;
		min-height: 1px;
		align-self: center;
	}

	.sum-meta {
		flex-direction: column;
		gap: 0.65rem;
	}

	.sum-meta-block {
		flex-basis: auto;
		width: 100%;
	}
}

@container summary-meta (max-width: 18rem) {
	.sum-date-range {
		grid-template-columns: 1fr;
		gap: 0.25rem;
	}

	.sum-date-range > .separator {
		display: none;
	}
}

.sum-table {
	width: 100%;
	text-align: right;
}

.sum-table tfoot {
	background: var(--sum-border-light);
}

.sum-list {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-top: 0.5rem;
}

.sum-day-pricing {
	margin-top: 0.5rem;
	padding-top: 0.5rem;
	border-top: 1px solid var(--sum-border-light);
}

.sum-equipment-label {
	margin-top: 0.5rem;
	display: block;
}

.sum-list li {
	background: transparent;
	padding: 5px;
	border-radius: 3px;
	border-top: none;
}

.sum-content--people > div {
	display: flex;
	justify-content: space-between;
	margin-top: 6px;
}

.sum-content--people label {
	display: block;
}

/* --- Desktop (>=1024px): always visible sidebar --- */

@media screen and (min-width: 1024px) {
	#form-summary {
		min-width: auto;
		min-height: 0;
		max-height: none;
		overflow: hidden;
		position: relative;
	}

	/* Fill the grid cell exactly, scroll independently, show scroll shadows */
	#form-summary > .summary {
		position: absolute;
		inset: 0;
		overflow-y: auto;
		background:
			linear-gradient(#e5f4f5 30%, rgba(229, 244, 245, 0)) center top,
			linear-gradient(rgba(229, 244, 245, 0), #e5f4f5 70%) center bottom,
			radial-gradient(
					farthest-side at 50% 0,
					rgba(0, 0, 0, 0.4),
					rgba(0, 0, 0, 0)
				)
				center top,
			radial-gradient(
					farthest-side at 50% 100%,
					rgba(0, 0, 0, 0.4),
					rgba(0, 0, 0, 0)
				)
				center bottom;
		background-repeat: no-repeat;
		background-size:
			100% 40px,
			100% 40px,
			100% 14px,
			100% 14px;
		background-attachment: local, local, scroll, scroll;
		background-color: #e5f4f5;
	}

	.summary h2 {
		font-size: revert;
	}

	.sum-row {
		flex-wrap: nowrap;
	}

	.sum-row-label {
		width: auto;
	}
}

/* Mobile scroll-to-summary button */
.summary-scroll-btn {
	position: fixed;
	bottom: 0;
	right: 1rem;
	z-index: 90;
	background-color: var(--color-pink);
	color: white;
	border: none;
	border-radius: 5px 5px 0 0;
	padding: 0.75rem 1.25rem;
	font-weight: bold;
	font-size: 1rem;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	transition: opacity 0.2s ease;
	opacity: 0;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.125rem;
}

.summary-scroll-btn.visible {
	opacity: 1;
	pointer-events: auto;
}

.summary-scroll-btn__info {
	font-size: 0.8125rem;
	font-weight: normal;
	opacity: 0.9;
	white-space: nowrap;
}

.summary-scroll-btn__label {
	white-space: nowrap;
}

.summary-scroll-btn__arrow {
	display: inline-block;
	margin-left: 0.25rem;
}
