/**
 * Guest Form Component Styles
 *
 * Pre-arrival guest information form grid
 *
 * @package MphbGuestServices
 * @since 2.0.0
 */

#pre-arrival-guests {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
	margin-bottom: 1rem;
}

#pre-arrival-guests .gs-row-sep {
	position: relative;
	padding: 1rem;
	background: var(--gs-color-surface, #fff);
	border: 1px solid var(--gs-color-border, #e5e7eb);
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Guest Age Chips */
#pre-arrival-guests .guest-age-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.3;
	background: #e0f2fe;
	color: #0b5394;
	border: 1px solid #cfe8fb;
	margin-bottom: 0.4rem;
}

#pre-arrival-guests .guest-age-chip.is-child {
	background: #fdf4ff;
	border-color: #f3e8ff;
	color: #86198f;
}

#pre-arrival-guests .guest-age-chip.is-infant {
	background: #ecfeff;
	border-color: #cffafe;
	color: #0f766e;
}

/* Form Elements */
#pre-arrival-guests .gs-row-sep label {
	font-weight: 600;
	color: var(--gs-color-text, #333);
}

#pre-arrival-guests .gs-row-sep input {
	width: 100%;
	box-sizing: border-box;
}

/* Remove Button */
#pre-arrival-guests .guest-remove-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	background: #fee2e2;
	border: 1px solid #fca5a5;
	color: #b91c1c;
	cursor: pointer;
	padding: 2px 5px;
	font-size: 1.05rem;
	font-weight: 700;
	border-radius: 999px;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
	min-height: 16px;
	min-width: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

#pre-arrival-guests .guest-remove-btn:hover,
#pre-arrival-guests .guest-remove-btn:focus {
	background: #fecdd3;
	border-color: #f87171;
	transform: translateY(-1px);
	outline: none;
}

/* Passport Image Preview */
.gs-passport-wrapper {
	margin-top: 4px;
}

.passport-image-preview {
	margin: 4px 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.passport-image-preview img {
	max-width: 120px;
	max-height: 120px;
	width: auto;
	height: auto;
	object-fit: contain;
	border: 1px solid #ddd;
	border-radius: 4px;
	display: block;
}

.passport-preview-thumb {
	max-width: 120px;
	max-height: 120px;
	width: auto;
	height: auto;
	object-fit: contain;
	border: 1px solid #ddd;
	border-radius: 4px;
	display: block;
}

.gs-passport-change-btn {
	background: none !important;
	border: none !important;
	color: var(--gs-color-error, #ef4444) !important;
	cursor: pointer !important;
	padding: 0 !important;
	font-size: 11px !important;
	font-weight: normal !important;
	text-decoration: underline !important;
	box-shadow: none !important;
}

.gs-passport-change-btn:hover,
.gs-passport-change-btn:focus {
	color: var(--gs-color-error, #dc2626) !important;
	outline: none !important;
}

.gs-passport-upload {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: flex-start;
}

.gs-passport-cancel-btn {
	background: none !important;
	border: none !important;
	color: var(--gs-color-text-muted, #666) !important;
	cursor: pointer !important;
	padding: 0 !important;
	font-size: 11px !important;
	text-decoration: underline !important;
	box-shadow: none !important;
}

.gs-passport-cancel-btn:hover {
	color: #d63638 !important;
}

/* Transport Mode Button Group */
.gs-mode-btns {
	display: inline-flex;
	gap: 0.5rem;
}

.gs-mode-btn {
	position: relative;
	padding: 0.5rem 1.25rem;
	font-size: 13px;
	font-weight: 500;
	border: 1.5px solid var(--gs-color-border, #d1d5db);
	border-radius: 8px;
	background: var(--gs-color-surface, #f9fafb);
	color: var(--gs-color-text, #374151);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
	line-height: 1.4;
}

.gs-mode-btn:hover {
	border-color: var(--gs-color-primary, #c49a3a);
	background: var(--gs-color-surface, #f9fafb);
}

.gs-mode-btn.is-active {
	border-color: var(--gs-color-primary, #c49a3a);
	background: var(--gs-color-surface, #f9fafb);
	box-shadow: 0 0 0 1px var(--gs-color-primary, #c49a3a);
}

.gs-mode-btn.is-active::after {
	content: "\2713";
	position: absolute;
	top: -6px;
	right: -6px;
	width: 18px;
	height: 18px;
	background: var(--gs-color-primary, #c49a3a);
	color: #fff;
	border-radius: 50%;
	font-size: 11px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Arrival / Departure Two-Column Grid */
.gs-travel-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 1.5rem;
}

.gs-travel-grid > div {
	min-width: 0;
}

.gs-travel-col-title {
	display: block;
	font-weight: 700;
	font-size: 15px;
	color: #1e3a5f;
	margin-bottom: 0.75rem;
	padding-bottom: 0.35rem;
	border-bottom: 2px solid var(--gs-color-primary, #c49a3a);
}

/* Flight + ETA/ETD inline row */
.gs-travel-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-start;
	margin-bottom: 0.5rem;
}

/* Compact field widths inside travel columns */
.gs-travel-grid input[type="text"] {
	max-width: 140px;
	padding: 0 0.875rem;
	font-size: 15px;
	height: 42px;
	line-height: 42px;
	border: 1.5px solid var(--gs-color-border, #d1d5db);
	border-radius: 6px;
	text-align: center;
}

.gs-travel-grid select {
	max-width: 100%;
}

/* Travel grid label styling */
.gs-travel-grid .gs-label-strong {
	display: block;
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #4b5563;
	margin-bottom: 0.5rem;
}

/* Plain block styling for plane/car sections */
.gs-travel-grid .gs-plain-block {
	padding: 1rem;
	background: rgba(0, 0, 0, 0.02);
	border-radius: 6px;
	margin-bottom: 1rem;
}

.gs-travel-grid .gs-plain-block > div {
	margin-bottom: 1rem;
}

.gs-travel-grid .gs-plain-block > div:last-child {
	margin-bottom: 0;
}

/* Arrival mode blocks (#pre-arrival-plane / #pre-arrival-car) no longer
   carry .gs-plain-block themselves — a single shared card now wraps both
   of them plus the arrival-day selector (mobilite-bornes-vol-flag-horshoraire
   fix wave, designer review Important #8/#9: the day selector used to sit
   outside the bordered card, disconnected from "Arrival"). ID-scoped so the
   original internal rhythm between the flight/car row and the flight
   messages/estimate lines underneath is preserved regardless of nesting
   depth. Departure's blocks are untouched and still match the class rule
   above. */
.gs-travel-grid #pre-arrival-plane > div,
.gs-travel-grid #pre-arrival-car > div {
	margin-bottom: 1rem;
}

.gs-travel-grid #pre-arrival-plane > div:last-child,
.gs-travel-grid #pre-arrival-car > div:last-child {
	margin-bottom: 0;
}

/* Remove extra spacing from time elements inside travel rows */
.gs-travel-row .gs-field-time-split {
	margin-bottom: 0;
}

.gs-travel-row .gs-time-picker {
	margin-top: 0;
}

/* Custom Time Picker - larger and theme-aware */
.gs-time-picker {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.gs-time-picker select {
	/* Flèche native du navigateur — !important sur appearance pour
	   contrer toute règle qui remettrait `appearance: none` ailleurs
	   dans la cascade portal.css. Pareil sur background-image: none
	   pour purger une éventuelle data-URI SVG résiduelle. */
	-webkit-appearance: auto !important;
	-moz-appearance: auto !important;
	appearance: auto !important;
	background-image: none !important;
	padding: 0 0.5rem;
	font-size: 15px;
	font-weight: 500;
	height: 42px;
	line-height: 42px;
	border: 1.5px solid var(--gs-color-border, #d1d5db);
	border-radius: 6px;
	background-color: var(--gs-color-surface, #fff);
	color: var(--gs-color-text, #1f2937);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	cursor: pointer;
}

.gs-time-picker .gs-time-hour,
.gs-time-picker .gs-time-minute {
	/* Largeur suffisante pour les chiffres + la flèche native (qui peut
	   prendre 20-24px selon le moteur). */
	width: 80px;
	min-width: 80px;
	max-width: 80px;
}

.gs-time-picker select:hover {
	border-color: var(--gs-color-primary, #c49a3a);
}

.gs-time-picker select:focus {
	outline: none;
	border-color: var(--gs-color-primary, #c49a3a);
	box-shadow: 0 0 0 3px rgba(196, 154, 58, 0.1);
}

.gs-time-separator {
	font-size: 18px;
	font-weight: 700;
	color: var(--gs-color-text, #1f2937);
	user-select: none;
}

.gs-travel-grid .gs-min-select {
	max-width: 80px;
	flex: 0 1 auto !important;
}

@media (max-width: 640px) {
	.gs-travel-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Responsive Layout */
@media (max-width: 900px) {
	#pre-arrival-guests {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	#pre-arrival-guests {
		grid-template-columns: 1fr;
		gap: 0.8rem;
	}

	#pre-arrival-guests .gs-row-sep {
		padding: 0.8rem;
	}
}

/* Dark Mode Support — auto (prefers-color-scheme) + manual (data-pp-theme="dark").
   Pas de background-image ici : c'étaient ces overrides !important à
   spécificité supérieure qui ré-injectaient l'ancien SVG chevron et
   écrasaient le `background-image: none` du bloc de base. La flèche
   native s'affiche via appearance:auto + color-scheme:dark (portal.css). */
.mphb-gs-shell[data-pp-theme="dark"] .gs-time-picker select,
.mphb-gs-shell[data-theme="dark"] .gs-time-picker select {
	background-color: #1f2937 !important;
	background-image: none !important;
	border-color: #4b5563;
	color: #f9fafb;
}

/* Explicit dark selection (data-theme="dark") previously fell through to
   the light-mode #6b7280 label color — only the "auto" (system dark) branch
   below had a dark override, so a guest who explicitly picked dark theme
   saw the field-label text at ~3.91:1 contrast on the dark shell background,
   below WCAG AA. Mirrors the same #9ca3af target as the "auto" branch. */
.mphb-gs-shell[data-pp-theme="dark"] .gs-travel-grid .gs-label-strong,
.mphb-gs-shell[data-theme="dark"] .gs-travel-grid .gs-label-strong {
	color: #9ca3af;
}

@media (prefers-color-scheme: dark) {
	.mphb-gs-shell[data-theme="auto"] .gs-time-picker select {
		background-color: #1f2937 !important;
		background-image: none !important;
		border-color: #4b5563;
		color: #f9fafb;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-time-picker select:hover {
		border-color: var(--gs-color-primary, #c49a3a);
		background-color: #374151;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-time-picker select:focus {
		border-color: var(--gs-color-primary, #c49a3a);
		background-color: #374151;
		box-shadow: 0 0 0 3px rgba(196, 154, 58, 0.2);
	}

	/* Style dropdown options */
	.mphb-gs-shell[data-theme="auto"] .gs-time-picker select option {
		background-color: #1f2937;
		color: #f9fafb;
		padding: 0.5rem;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-time-separator {
		color: #f9fafb;
	}

	/* Dark mode for travel grid elements */
	.mphb-gs-shell[data-theme="auto"] .gs-travel-grid .gs-label-strong {
		color: #9ca3af;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-travel-grid .gs-plain-block {
		background: rgba(255, 255, 255, 0.03);
		border: 1px solid #374151;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-travel-grid input[type="text"] {
		background-color: #1f2937;
		border-color: #4b5563;
		color: #f9fafb;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-travel-grid input[type="text"]:focus {
		background-color: #374151;
		border-color: var(--gs-color-primary, #c49a3a);
	}

	.mphb-gs-shell[data-theme="auto"] .gs-travel-col-title {
		color: #f9fafb;
		border-bottom-color: var(--gs-color-primary, #c49a3a);
	}
}

/* ==========================================================================
   Flight Check Button Inline Fix
   ========================================================================== */

/* Override .gs-inline-field button rule to keep flight check buttons inline */
.gs-inline-field [data-car-flight-check] {
	flex-basis: auto;
	margin-top: 0;
	flex-shrink: 0;
}

/* Spicy preference picker (per guest) */
.gs-spicy-picker {
	display: inline-flex;
	align-items: center;
	gap: 2px;
}
.gs-spicy-pepper {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.4rem;
	padding: 2px;
	opacity: 0.25;
	filter: grayscale(1);
	transition: opacity 0.15s, filter 0.15s, transform 0.1s;
	line-height: 1;
}
.gs-spicy-pepper:hover {
	transform: scale(1.15);
}
.gs-spicy-pepper.is-active {
	opacity: 1;
	filter: none;
}
.gs-spicy-label {
	font-size: 0.8rem;
	margin-left: 6px;
	opacity: 0.6;
}
