/**
 * Tomorrow Orders Card Styles
 *
 * Styles for the dashboard cards showing tomorrow's services and equipment.
 *
 * @package MphbGuestServices
 * @since 2.0.0
 */

/* Body padding: handled by shared rule in portal.css via :has(.mphb-gs-meal-timeline) */

/* Orders timelines (past / today / upcoming) lay their rows on ONE grid:
   [time auto] [thumb 36px] [title 1fr] [price auto] [action 28px].
   Rows subgrid onto it so dates, prices, badges and the ✖ line up across every
   row whatever the text width in each language. The shared meal timeline
   (meals cards) keeps its flex layout: only the --orders modifier switches. */
.mphb-gs-meal-timeline--orders {
	display: grid;
	grid-template-columns: auto 36px minmax(0, 1fr) auto 28px;
}

.mphb-gs-meal-timeline--orders > .mphb-gs-meal-timeline__row {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: subgrid;
	column-gap: var(--gs-space-sm, 8px);
	align-items: center;
}

/* Browsers without subgrid: each row repeats the timeline template. */
@supports not (grid-template-columns: subgrid) {
	.mphb-gs-meal-timeline--orders > .mphb-gs-meal-timeline__row {
		grid-template-columns: auto 36px minmax(0, 1fr) auto 28px;
	}
}

/* The "show more" trigger appended by list-collapse.js spans the whole grid. */
.mphb-gs-meal-timeline--orders > .gs-collapse-trigger {
	grid-column: 1 / -1;
}

/* Every cell is pinned to its column: a past row has no action cell, a row
   without a thumbnail keeps its 36 px slot, so nothing shifts. */
.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__col-time {
	grid-column: 1;
	flex: none;
	flex-direction: row;
	align-items: center;
	gap: var(--gs-space-xs, 4px);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__col-thumb {
	grid-column: 2;
	flex: none;
}

.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__col-meal {
	grid-column: 3;
	flex: none;
	width: auto;
	min-width: 0;
}

/* Prices AND status pills (full stay, ongoing) share the right edge of this column. */
.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__col-price {
	grid-column: 4;
	flex: none;
	width: auto;
	justify-self: end;
	text-align: end;
	font-variant-numeric: tabular-nums;
}

.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__col-action {
	grid-column: 5;
	flex: none;
	width: 28px;
	min-height: 28px;
}

/* Cancel deadline: a discreet secondary line under the title, never a block of its own. */
.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__meal-note {
	flex-basis: 100%;
	margin-block-start: 2px;
	font-size: 11px;
	font-style: italic;
	font-weight: 400;
	white-space: normal;
	color: var(--gs-color-text-soft, #475569);
}

/* The portal's generic `button:not(...)` reset (min-height 44 px, 12/16 px padding,
   surface background, 8 px radius) outranks .gs-cancel-btn--icon and stretched the ✖
   into a tall block. Neutralised here, inside the orders grid only, with the same
   scoped !important pattern as the upcoming banner (transfer-existing.css). */
.mphb-gs-shell .mphb-gs-meal-timeline--orders .gs-cancel-btn--icon {
	width: 28px !important;
	height: 28px !important;
	min-height: 0 !important;
	padding: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	border: 1px solid transparent !important;
	box-shadow: none !important;
	color: var(--gs-color-text-soft, #475569) !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
}

.mphb-gs-shell .mphb-gs-meal-timeline--orders .gs-cancel-btn--icon:hover,
.mphb-gs-shell .mphb-gs-meal-timeline--orders .gs-cancel-btn--icon:focus-visible {
	background: rgba(239, 68, 68, 0.12) !important;
	border-color: rgba(239, 68, 68, 0.25) !important;
	color: #ef4444 !important;
	transform: none !important;
}

/* Dark theme — lift contrast on navy surfaces (literal hex per the standalone theme rules). */
[data-pp-theme="dark"] .mphb-gs-shell .mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__meal-note {
	color: rgba(244, 236, 220, 0.72);
}

[data-pp-theme="dark"] .mphb-gs-shell .mphb-gs-meal-timeline--orders .gs-cancel-btn--icon {
	color: rgba(244, 236, 220, 0.72) !important;
}

[data-pp-theme="dark"] .mphb-gs-shell .mphb-gs-meal-timeline--orders .gs-cancel-btn--icon:hover,
[data-pp-theme="dark"] .mphb-gs-shell .mphb-gs-meal-timeline--orders .gs-cancel-btn--icon:focus-visible {
	color: #f87171 !important;
}

/* Narrow screens: a date range stacks start over end instead of wrapping mid-range. */
@media (max-width: 480px) {
	.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__col-time {
		flex-direction: column;
		align-items: flex-start;
		gap: 2px;
	}

	.mphb-gs-meal-timeline--orders .mphb-gs-meal-timeline__range-sep {
		display: none;
	}
}

/* Action column (cancel/lock/status icons) */
.mphb-gs-meal-timeline__col-action {
	flex: 0 0 32px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Cancel button */
.mphb-gs-cancel-order-btn {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: var(--gs-radius-sm, 4px);
	background: transparent;
	color: var(--gs-color-text-soft, #475569);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.mphb-gs-cancel-order-btn:hover {
	background: var(--gs-danger-bg, rgba(239, 68, 68, 0.1));
	color: var(--gs-danger, #ef4444);
}

.mphb-gs-cancel-order-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Locked state (can't cancel) */
.mphb-gs-order-locked {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	font-size: 14px;
	line-height: 1;
	color: var(--gs-color-text-soft, #475569);
	opacity: 0.35;
}

/* Spinner for cancel loading state */
.mphb-gs-cancel-order-btn .gs-spinner {
	width: 16px;
	height: 16px;
	border-width: 2px;
}

/* Success indicator for delivered items */
.mphb-gs-meal-timeline__col-action .gs-text-success {
	color: var(--gs-success, #22c55e);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Warning indicator for awaiting delivery */
.mphb-gs-meal-timeline__col-action .gs-text-warning {
	color: var(--gs-warning, #f59e0b);
	display: flex;
	align-items: center;
	justify-content: center;
}
