/**
 * MHM Rentiva - Unified Search Widget
 * 
 * Implements Glassmorphism and high-contrast tabbed interface.
 */

.rv-unified-search {
	--rv-glass-bg: rgba(255, 255, 255, 0.98);
	--rv-shadow: var(--mhm-shadow-lg);
	--rv-radius: 10px;
	--rv-border: var(--mhm-border-primary);
	--rv-primary: var(--mhm-primary);

	background: var(--rv-glass-bg);
	border-radius: var(--rv-radius);
	box-shadow: var(--rv-shadow);
	padding-block: max(var(--mhm-space-phi-3, 1.3125rem), var(--mhm-space-6));
	padding-inline: max(var(--mhm-surface-gutter-desktop, var(--mhm-space-phi-2, 0.8125rem)), var(--mhm-space-6));
	width: 100%;
	max-width: 1140px;
	margin: 0 auto;
	box-sizing: border-box;
	position: relative;
	z-index: 10;
}

/* 
 * WPAutoP / Block Editor Defense
 * WordPress sometimes injects <br> and <p> tags into shortcode outputs 
 * within Block Themes, which completely destroys CSS Grid layouts.
 */
.rv-unified-search br {
	display: none !important;
}

.rv-unified-search p {
	margin: 0 !important;
}

/* Tabs */
.rv-unified-search__header {
	margin-bottom: var(--mhm-space-6);
	border-bottom: 2px solid var(--mhm-gray-100);
}

.rv-unified-search__tabs {
	display: flex;
	gap: var(--mhm-space-4);
}

.rv-unified-search__tab {
	background: transparent;
	border: none;
	padding: var(--mhm-space-3) var(--mhm-space-4);
	font-weight: var(--mhm-font-semibold);
	color: var(--mhm-text-secondary);
	cursor: pointer;
	border-bottom: 3px solid transparent;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: var(--mhm-text-base);
	margin-bottom: -2px;
	/* Overlap border */
}

.rv-unified-search__tab:hover {
	color: var(--rv-primary);
}

.rv-unified-search__tab.is-active {
	color: var(--rv-primary);
	border-bottom-color: var(--rv-primary);
}

/* Panel */
.rv-unified-search__panel {
	display: none;
	animation: rvFadeIn 0.3s ease;
}

.rv-unified-search__panel.is-active {
	display: block;
}

@keyframes rvFadeIn {
	from {
		opacity: 0;
		transform: translateY(5px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Form Layout */
.rv-unified-search__group {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: var(--mhm-space-4);
	margin-bottom: var(--mhm-space-4);
}

.rv-unified-search__field {
	display: flex;
	flex-direction: column;
	gap: var(--mhm-space-2);
}

/* Inputs */
.rv-label {
	font-size: var(--mhm-text-xs);
	font-weight: var(--mhm-font-bold);
	color: var(--mhm-text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.rv-input-wrapper {
	background: var(--mhm-bg-secondary);
	border: 1px solid var(--mhm-gray-200);
	border-radius: var(--mhm-radius-md);
	padding: 8px 12px;
	display: flex;
	align-items: center;
	gap: var(--mhm-space-2);
	height: 48px;
	/* Fixed height for alignment */
	box-sizing: border-box;
	transition: all 0.2s ease;
}

.rv-input-wrapper:focus-within {
	border-color: var(--rv-primary);
	background: var(--mhm-white);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rv-input-wrapper .dashicons {
	color: var(--mhm-gray-400);
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* SVG Icon Styling (Desktop) */
.rv-input-wrapper svg {
	width: 20px;
	height: 20px;
	color: var(--mhm-gray-400, #94a3b8);
	flex-shrink: 0;
}

.rv-unified-search__tab svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.rv-input,
.rv-select {
	border: none;
	background: transparent;
	width: 100%;
	font-size: var(--mhm-text-sm);
	color: var(--mhm-text-primary);
	outline: none;
	padding: 0;
	font-family: inherit;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

/* Action Button */
.rv-unified-search__action {
	margin-top: var(--mhm-space-4);
	display: flex;
	justify-content: flex-end;
}

.rv-unified-search .rv-btn {
	background: var(--rv-primary, var(--mhm-btn-bg)) !important;
	color: #ffffff !important;
	border: none;
	padding: 0 32px;
	height: 48px;
	border-radius: var(--mhm-radius-md);
	font-weight: var(--mhm-font-semibold);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: background 0.2s ease;
	font-size: var(--mhm-text-base);
}

.rv-unified-search .rv-btn:hover {
	background: var(--mhm-btn-hover-bg) !important;
}

.rv-unified-search .rv-btn.is-loading {
	opacity: 0.8 !important;
	cursor: wait !important;
	position: relative;
	color: transparent !important;
}

.rv-unified-search .rv-btn.is-loading::after {
	content: "";
	position: absolute;
	width: 20px;
	height: 20px;
	top: 14px;
	left: 50%;
	margin-left: -10px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: rvRotate 0.6s linear infinite;
}

.rv-unified-search {
	overflow: hidden;
	/* Prevent tabs and content overflow */
}


/* Responsive */
@media (max-width: 782px) {
	.rv-unified-search__group {
		grid-template-columns: 1fr;
	}

	.rv-unified-search__tabs {
		overflow-x: auto;
		padding-bottom: 2px;
	}

	.rv-btn {
		width: 100%;
	}
}

/* Transfer Results Container - Simplified for nested display */
.js-transfer-results-container {
	display: none;
	margin-top: var(--mhm-space-8);
}

.js-transfer-results-container:not(:empty) {
	display: block;
}

.rv-loading,
.rv-error {
	text-align: center;
	padding: var(--mhm-space-8);
	color: var(--mhm-text-secondary);
	background: var(--rv-glass-bg);
	border-radius: var(--rv-radius);
	border: var(--rv-border);
}

.rv-loading .dashicons {
	animation: rvRotate 2s linear infinite;
	font-size: 32px;
	width: 32px;
	height: 32px;
}

@keyframes rvRotate {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

/* Luggage Info — Premium compact style */
.rv-unified-search__luggage-info {
	margin-top: var(--mhm-space-4, 16px);
	padding: 8px 12px;
	background: var(--mhm-gray-50, #f8fafc);
	border-radius: var(--mhm-radius-md, 8px);
	border-left: 3px solid var(--mhm-gray-200, #e2e8f0);
	font-size: 11px;
	line-height: 1.5;
	color: var(--mhm-text-secondary, #64748b);
}

.rv-info-item {
	font-size: 11px;
	color: var(--mhm-text-secondary, #64748b);
	line-height: 1.5;
	margin: 0 0 2px 0;
	display: flex;
	align-items: center;
	gap: 4px;
}

.rv-info-item:last-child {
	margin-bottom: 0;
}

.rv-info-item .rv-bullet {
	color: var(--mhm-danger, #ef4444);
	font-size: 10px;
	font-weight: bold;
}

.rv-info-item strong {
	color: var(--mhm-text-primary);
}

/* Locked / Disabled States */
.rv-input-wrapper.is-locked {
	background: var(--mhm-gray-100);
	opacity: 0.7;
	cursor: not-allowed;
}

.rv-input-wrapper.is-locked .rv-select {
	cursor: not-allowed;
	color: var(--mhm-text-secondary);
}

.rv-input-wrapper.is-locked .rv-icon-lock {
	color: var(--mhm-gray-500);
	font-size: 16px;
}

/* Premium Responsive Optimization & UI Restoration */
@media screen and (max-width: 782px) {
	.rv-unified-search {
		padding-block: max(var(--mhm-space-phi-2, 0.8125rem), var(--mhm-space-4));
		padding-inline: max(var(--mhm-surface-gutter-mobile, var(--mhm-space-phi-2, 0.8125rem)), var(--mhm-space-4));
	}

	.rv-unified-search__group--mobile-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
		/* Precision gap */
		margin-bottom: 12px;
	}

	/* Precision Ratio for Date & Time (60/40) in VIP Transfer */
	.rv-unified-search__tab-content#vip-transfer .rv-unified-search__group--mobile-grid:nth-of-type(3) {
		grid-template-columns: 1.6fr 1.1fr;
	}

	/* Precision Ratio for Date & Time (60/40) in Rent a Car */
	.rv-unified-search__tab-content#rent-a-car .rv-unified-search__group--mobile-grid {
		grid-template-columns: 1.6fr 1.1fr;
		margin-bottom: 12px;
	}

	.rv-unified-search__field {
		margin-bottom: 0;
	}

	.rv-unified-search__field .rv-label {
		font-size: 10px;
		margin-bottom: 5px;
		text-transform: uppercase;
		letter-spacing: 0.8px;
		color: var(--mhm-text-secondary);
		font-weight: 600;
		display: block;
		line-height: 1.2;
	}

	/* Unified Surface (Glassmorphism) */
	.rv-input-wrapper {
		position: relative;
		display: flex;
		align-items: center;
		width: 100%;
		height: 48px;
		background: rgba(255, 255, 255, 0.05);
		/* Unified background */
		border: 1px solid rgba(0, 0, 0, 0.08);
		/* Unified border */
		border-radius: 8px;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
		overflow: hidden;
		/* Ensure inner elements don't spill */
	}

	/* Flattened Inner Elements */
	.rv-input,
	.rv-select,
	.rv-input-wrapper.is-locked .rv-select {
		height: 100% !important;
		width: 100% !important;
		background: transparent !important;
		/* Flattened */
		border: none !important;
		/* Flattened */
		box-shadow: none !important;
		/* Flattened */
		padding: 0 12px 0 40px !important;
		/* Unified padding for icon space */
		font-size: 14px;
		color: var(--mhm-text-primary);
		display: flex;
		align-items: center;
		outline: none !important;
		appearance: none;
		-webkit-appearance: none;
		margin: 0;
	}

	/* Standardized Icon Positioning */
	.rv-input-wrapper .rv-icon,
	.rv-input-wrapper .rv-icon-calendar,
	.rv-input-wrapper .rv-icon-clock,
	.rv-input-wrapper .rv-icon-location,
	.rv-input-wrapper .rv-icon-lock {
		position: absolute;
		left: 12px;
		font-size: 18px;
		color: var(--mhm-gray-400);
		margin: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
		width: 20px;
		z-index: 2;
		pointer-events: none;
		/* Let clicks pass through to input */
	}

	/* Select Arrow Restoration for flattened select */
	.rv-input-wrapper select.rv-select {
		background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
		background-repeat: no-repeat;
		background-position: right 10px top 50%;
		background-size: 10px auto;
		padding-right: 25px !important;
	}

	/* Fix for Number Inputs (Adult/Child/Luggage) */
	.rv-input[type="number"] {
		appearance: none;
		-moz-appearance: textfield;
		text-align: left;
	}

	.rv-input[type="number"]::-webkit-outer-spin-button,
	.rv-input[type="number"]::-webkit-inner-spin-button {
		-webkit-appearance: none;
		margin: 0;
	}

	.rv-unified-search__submit {
		height: 52px;
		font-size: 16px;
		letter-spacing: 0.5px;
		font-weight: 600;
		margin-top: 5px;
		border-radius: 10px;
		border: none;
		width: 100%;
	}

	/* Descriptions & Info Boxes */
	.rv-transfer-info-box {
		background: var(--mhm-gray-50);
		border: 1px solid var(--mhm-gray-100);
		border-radius: 8px;
		padding: 15px;
		margin-top: 15px;
	}

	.rv-transfer-info-box ul li {
		font-size: 12px;
		color: var(--mhm-text-secondary);
		line-height: 1.5;
		margin-bottom: 6px;
	}
}