/**
 * Rate Comparison Tool - Styles
 * v1.0.54 — Quiet activity counter, new rate comparison settings
 *
 * Desktop badge: rendered after booking widget (normal flow)
 * Mobile badge: rendered inside sticky container (inherits fixed positioning)
 * Modal: rendered in footer, shared by both badges
 */

/* CSS Variables */
:root {
	--hrck-header-bg: #7b8491;
	--hrck-savings-color: #16a34a;
	--hrck-highlight-color: #dcfce7;
	--hrck-diff-color: #D32F2F;
	--hrck-font-direct: 1.25rem;
	--hrck-font-saving: 1rem;
}

/* ==========================================================================
   Badge Wrapper (shared by desktop + mobile)
   ========================================================================== */

.hrck-rate-comparison-wrapper {
	display: none; /* Hidden until price data loads */
	justify-content: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.5;
	color: #111827;
	box-sizing: border-box;
	opacity: 0;
	transition: opacity 0.4s ease;
}

.hrck-rate-comparison-wrapper.hrck-visible {
	display: flex;
	opacity: 1;
}

.hrck-rate-comparison * {
	box-sizing: border-box;
}

/* Widget Container */
.hrck-rate-comparison {
	background: transparent;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	width: 100%;
	max-width: 600px;
	overflow: visible;
	font-size: 12px;
	transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Desktop Badge — after booking widget in normal document flow
   ========================================================================== */

.hrck-desktop-badge {
	margin-top: 12px;
	margin-bottom: 20px;
}

.hrck-desktop-badge .hrck-rate-comparison {
	background: #fff;
}

/* Desktop badge: single-line pill layout */
.hrck-desktop-badge .hrck-collapsed-preview {
	padding: 6px 14px;
}

.hrck-desktop-badge .hrck-savings-text-large {
	white-space: nowrap;
	font-size: 0.8125rem;
}

.hrck-desktop-badge .hrck-collapsed-compare {
	font-size: 0.8125rem;
	padding: 3px 10px;
}

/* Hide desktop badge on mobile (sticky container handles it) */
@media (max-width: 959px) {
	.hrck-desktop-badge {
		display: none !important;
	}

	/* But show on checkout pages where there's no sticky widget */
	.hrck-desktop-badge.hrck-checkout-context {
		display: flex !important;
	}
}

/* ==========================================================================
   Mobile Badge — positioned above the sticky bar, like a tab on a shelf
   ========================================================================== */

/* Ensure sticky container doesn't clip the badge above it */
.homelocal-sticky-booking-widget-container {
	overflow: visible !important;
}

.hrck-mobile-badge {
	position: absolute;
	bottom: 100%;
	left: 0;
	right: 0;
	z-index: 1;
	pointer-events: none;
}

.hrck-mobile-badge.hrck-visible {
	display: block;
	opacity: 1;
}

/* Shrink badge to content width and center it */
.hrck-mobile-badge .hrck-rate-comparison {
	width: fit-content;
	max-width: calc(100% - 32px);
	margin: 0 auto;
	background: transparent;
	pointer-events: auto;
}

/* Tab on the ledge — rounded top, flat bottom flush with sticky bar */
.hrck-mobile-badge .hrck-collapsed-preview {
	border-radius: 10px 10px 0 0;
	box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
}

/* Mobile badge is inside hk-hidden@m container, so it's automatically hidden on desktop.
   No extra hiding rule needed here. */

/* ==========================================================================
   Green Badge (collapsed preview) — shared styles
   ========================================================================== */

.hrck-header {
	display: none; /* Old header, unused */
}

.hrck-collapsed-preview {
	background: var(--hrck-savings-color);
	padding: 8px 16px;
	text-align: center;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	cursor: pointer;
	position: relative;
	z-index: 10;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effect only on devices with a pointer (desktop) */
@media (hover: hover) {
	.hrck-collapsed-preview:hover {
		filter: brightness(1.05);
		transform: translateY(-1px);
	}

	.hrck-collapsed-preview:active {
		transform: translateY(0);
	}
}

.hrck-collapsed-left {
	display: flex;
	align-items: center;
	gap: 7px;
	color: #fff;
}

.hrck-collapsed-checkmark {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: #fff;
}

.hrck-collapsed-preview .hrck-savings-text-large {
	font-size: 0.875rem;
	font-weight: 600;
	color: #fff;
	margin-bottom: 0;
}

.hrck-collapsed-preview .hrck-savings-amount-large {
	font-weight: 700;
	font-size: 1rem;
}

.hrck-collapsed-compare {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	padding: 4px 12px;
	border-radius: 4px;
	font-size: 0.875rem;
	font-weight: 600;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 6px;
}

.hrck-collapsed-chevron {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	transition: transform 0.3s ease;
}

/* ==========================================================================
   Skeleton Loader (desktop badge only)
   ========================================================================== */

.hrck-skeleton {
	padding: 16px 24px;
	text-align: center;
}

.hrck-skeleton-line {
	background: #e5e7eb;
	height: 10px;
	border-radius: 4px;
	margin: 8px auto;
	width: 80%;
	animation: hrckPulse 1.5s infinite;
}

.hrck-skeleton-savings {
	width: 60%;
}

.hrck-skeleton-tagline {
	width: 90%;
}

@keyframes hrckPulse {
	0%, 100% {
		opacity: 0.6;
	}
	50% {
		opacity: 1;
	}
}

/* ==========================================================================
   Content Area — always hidden in badge, shown only when cloned into modal
   ========================================================================== */

.hrck-content {
	display: none !important;
}

/* ==========================================================================
   Modal Content Styles (inside modal body after clone)
   ========================================================================== */

/* Savings Sections */
.hrck-savings-bottom {
	text-align: center;
	padding: 10px 20px;
	background: #fff;
}

.hrck-savings-text-large {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--hrck-savings-color);
	margin-bottom: 4px;
}

.hrck-savings-amount-large {
	font-weight: 700;
}

.hrck-savings-subtext {
	font-size: 0.75rem;
	color: #6b7280;
	font-weight: 500;
	margin-top: 0;
}

/* Direct Booking Price */
.hrck-direct-container {
	padding: 12px 20px 8px 20px;
	text-align: center;
	background: #fff;
}

.hrck-direct-price-wrap {
	font-size: 1.75rem;
	font-weight: 600;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 7px;
	margin-bottom: 5px;
}

.hrck-check-icon {
	color: var(--hrck-savings-color);
	width: 24px;
	height: 24px;
	flex-shrink: 0;
}

.hrck-direct-label {
	font-size: 0.8125rem;
	font-weight: 400;
	color: #4b5563;
}

.hrck-best-price {
	background: var(--hrck-highlight-color);
	color: var(--hrck-savings-color);
	padding: 2px 8px;
	font-weight: 700;
	font-size: 0.6875rem;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	border-radius: 12px;
}

/* OTA Tiles */
.hrck-ota-tiles {
	padding: 12px 20px;
	background: #F8F9FA;
	border-radius: 8px;
	margin: 0 20px 10px 20px;
}

.hrck-ota-row {
	position: relative;
	padding: 5px 0;
	border-bottom: 1px solid #e5e7eb;
}

.hrck-ota-row:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.hrck-ota-row:first-child {
	padding-top: 0;
}

.hrck-ota-row-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

/* OTA Logos */
.hrck-ota-logo-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.hrck-ota-logo {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
}

.hrck-ota-label {
	font-weight: 500;
	font-size: 0.875rem;
	color: #374151;
	margin-left: 10px;
	flex: 1;
}

.hrck-ota-price-block {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	flex-shrink: 0;
}

.hrck-ota-price-row {
	display: flex;
	align-items: baseline;
	gap: 4px;
}

.hrck-ota-from {
	font-size: 0.6875rem;
	color: #9ca3af;
	text-transform: lowercase;
	letter-spacing: 0;
}

.hrck-ota-price {
	font-weight: 600;
	font-size: 1rem;
	color: #111827;
}

.hrck-ota-diff {
	font-size: 0.75rem;
	color: var(--hrck-diff-color);
	font-weight: 600;
}

/* Disclaimer */
.hrck-disclaimer {
	font-size: 0.6875rem;
	color: #9ca3af;
	text-align: center;
	padding: 8px 24px 12px 24px;
	background: #fff;
	line-height: 1.4;
}

/* ==========================================================================
   Universal Modal
   ========================================================================== */

.hrck-rate-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 20px;
	-webkit-overflow-scrolling: touch;
}

.hrck-rate-modal.hrck-modal-open {
	display: flex;
}

.hrck-rate-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* Lighter backdrop on desktop */
@media (min-width: 960px) {
	.hrck-rate-modal-backdrop {
		background: rgba(0, 0, 0, 0.2);
	}
}

.hrck-rate-modal.hrck-modal-open .hrck-rate-modal-backdrop {
	opacity: 1;
}

.hrck-rate-modal-content {
	position: relative;
	background: #fff;
	border-radius: 12px;
	max-width: 400px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	z-index: 1;
	transform: scale(0.9);
	opacity: 0;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.hrck-rate-modal.hrck-modal-open .hrck-rate-modal-content {
	transform: scale(1);
	opacity: 1;
}

/* Responsive modal on mobile — slightly wider than green tab */
@media (max-width: 959px) {
	.hrck-rate-modal-content {
		max-width: 360px;
		margin: 10px;
	}

	/* Compact header */
	.hrck-rate-modal-header {
		padding: 10px 14px;
	}

	.hrck-rate-modal-title {
		font-size: 1rem;
	}

	/* Compact direct price section */
	.hrck-direct-container {
		padding: 8px 14px 6px;
	}

	.hrck-direct-price-wrap {
		font-size: 1.5rem;
		margin-bottom: 2px;
	}

	/* Compact OTA tiles */
	.hrck-ota-tiles {
		padding: 8px 12px;
		margin: 0 14px 6px;
	}

	.hrck-ota-row {
		padding: 4px 0;
	}

	/* Compact savings footer */
	.hrck-savings-bottom {
		padding: 6px 14px;
	}

	.hrck-savings-text-large {
		font-size: 1rem;
		margin-bottom: 2px;
	}

	/* Compact disclaimer */
	.hrck-disclaimer {
		padding: 4px 14px 8px;
	}
}

.hrck-rate-modal-header {
	position: sticky;
	top: 0;
	background: #fff;
	padding: 16px 20px;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-radius: 12px 12px 0 0;
	z-index: 10;
}

.hrck-rate-modal-title {
	font-size: 1.125rem;
	font-weight: 600;
	color: #111827;
	margin: 0;
}

.hrck-rate-modal-close {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: #6b7280;
	transition: color 0.2s ease;
	border-radius: 4px;
}

.hrck-rate-modal-close:hover {
	color: #111827;
	background: #f3f4f6;
}

.hrck-rate-modal-close svg {
	width: 24px;
	height: 24px;
	display: block;
}

.hrck-rate-modal-body {
	padding: 0;
}

/* ==========================================================================
   Booking Widget Container — responsive text scaling
   Ensures badge text fits within the booking widget's constrained width
   ========================================================================== */

.homelocal-booking-widget-container .hrck-savings-text-large,
.homelocal-booking-widget-container .hrck-savings-amount-large,
.homelocal-booking-widget-container .hrck-collapsed-compare {
	font-size: clamp(0.6rem, 2vw + 0.2rem, 0.7rem);
	line-height: 1.2;
	font-weight: 700;
}
