/* Gold Stars Calculator, scoped under .gs-calculator-root */

.gs-calculator-root {
	/* Explicit fallbacks, no self-referential var() */
	--gsc-navy: #1a3a5c;
	--gsc-teal: #1a6b7a;
	--gsc-teal-dark: #155f6d;
	--gsc-gold: #d4a843;
	--gsc-gold-dark: #b8922e;
	--gsc-cream: #fbf5ea;
	--gsc-muted: #6c757d;
	--gsc-border: #e8ecf0;
	--gsc-wa: #25d366;

	--gsc-radius: 12px;
	--gsc-radius-pill: 50px;
	--gsc-ease: cubic-bezier(0.2, 0.6, 0.2, 1);
	--gsc-slider-progress: 50%; /* JS updates this live */

	direction: rtl;
	background: linear-gradient(180deg, #fff 0%, var(--gsc-cream) 100%);
	border: 1px solid var(--gsc-border);
	border-radius: 20px;
	padding: 2rem;
	box-shadow: 0 8px 32px rgba(26, 58, 92, 0.08);
	font-family: "Noto Kufi Arabic", "Tahoma", sans-serif;
	position: relative;
	overflow: hidden;
}

/* Subtle ambient shimmer behind the whole widget */
.gs-calculator-root::before {
	content: "";
	position: absolute;
	inset: -50%;
	background: radial-gradient(circle at 10% 10%, rgba(212, 168, 67, 0.08), transparent 40%),
	            radial-gradient(circle at 90% 90%, rgba(26, 107, 122, 0.06), transparent 40%);
	pointer-events: none;
	z-index: 0;
	animation: gsc-ambient 20s ease-in-out infinite alternate;
}
@keyframes gsc-ambient {
	0%   { transform: translate(0, 0); }
	100% { transform: translate(30px, -20px); }
}

.gs-calc-head,
.gs-calc-filters,
.gs-calc-matches { position: relative; z-index: 1; }

.gs-calc-head { margin-bottom: 1.75rem; }
.gs-calc-title {
	font-size: clamp(1.3rem, 2vw, 1.75rem);
	font-weight: 800;
	color: var(--gsc-navy);
	margin: 0 0 0.5rem;
	letter-spacing: -0.01em;
}
.gs-calc-sub {
	color: var(--gsc-muted);
	font-size: 0.95rem;
	margin: 0;
	line-height: 1.6;
}

.gs-calc-filters { display: grid; gap: 1.75rem; }
.gs-calc-row { display: flex; flex-direction: column; gap: 0.7rem; }
.gs-calc-label {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--gsc-navy);
	letter-spacing: 0.02em;
	display: flex;
	align-items: center;
	gap: 0.4rem;
}
.gs-calc-label::before {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--gsc-gold);
	box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.2);
}

/* ============================================================
   Chips
   ============================================================ */
.gs-calc-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.gs-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.6rem 1.1rem;
	border: 2px solid var(--gsc-border);
	border-radius: var(--gsc-radius-pill);
	background: #fff;
	color: var(--gsc-navy);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: transform 0.25s var(--gsc-ease),
	            background-color 0.3s var(--gsc-ease),
	            border-color 0.3s var(--gsc-ease),
	            color 0.3s var(--gsc-ease),
	            box-shadow 0.3s var(--gsc-ease);
	font-family: inherit;
	position: relative;
	overflow: hidden;
}
.gs-chip::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent);
	opacity: 0;
	transition: opacity 0.4s ease;
	pointer-events: none;
}
.gs-chip:hover {
	border-color: var(--gsc-teal);
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(26, 107, 122, 0.15);
}
.gs-chip:hover::after { opacity: 1; }
.gs-chip:active { transform: translateY(0) scale(0.97); }
.gs-chip.is-active {
	background: var(--gsc-gold);
	border-color: var(--gsc-gold);
	color: var(--gsc-navy);
	box-shadow: 0 6px 18px rgba(212, 168, 67, 0.4);
	animation: gsc-chip-pop 0.35s var(--gsc-ease);
}
@keyframes gsc-chip-pop {
	0%   { transform: scale(1); }
	50%  { transform: scale(1.08); }
	100% { transform: scale(1); }
}
.gs-chip i { font-size: 1rem; line-height: 1; transition: transform 0.3s var(--gsc-ease); }
.gs-chip.is-active i { transform: rotate(-6deg) scale(1.1); }

/* ============================================================
   Budget slider (with dynamic filled track)
   ============================================================ */
.gs-calc-budget-value {
	font-size: 2rem;
	font-weight: 800;
	color: var(--gsc-navy);
	margin-bottom: 0.5rem;
	display: flex;
	align-items: baseline;
	gap: 0.4rem;
	line-height: 1;
	transition: color 0.3s ease;
}
.gs-calc-budget-value::after {
	content: attr(data-unit);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--gsc-muted);
}
.gs-calc-budget-value.is-pulse {
	animation: gsc-budget-pulse 0.35s var(--gsc-ease);
}
@keyframes gsc-budget-pulse {
	0%   { transform: scale(1); color: var(--gsc-navy); }
	50%  { transform: scale(1.05); color: var(--gsc-teal); }
	100% { transform: scale(1); color: var(--gsc-navy); }
}

.gs-calc-slider-wrap {
	position: relative;
	padding: 0.5rem 0;
}

.gs-calc-slider {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 8px;
	background: transparent; /* Track rendered via ::before for cross-browser consistency */
	outline: none;
	margin: 0;
	padding: 0;
	position: relative;
	z-index: 2;
	cursor: grab;
}
.gs-calc-slider:active { cursor: grabbing; }

/* Track background (unfilled) */
.gs-calc-slider-wrap::before {
	content: "";
	position: absolute;
	inset-inline: 0;
	top: 50%;
	transform: translateY(-50%);
	height: 8px;
	border-radius: 4px;
	background: var(--gsc-border);
	z-index: 1;
}

/* Filled track (dynamic via --gsc-slider-progress) */
.gs-calc-slider-wrap::after {
	content: "";
	position: absolute;
	inset-inline-end: 0;
	top: 50%;
	transform: translateY(-50%);
	height: 8px;
	width: var(--gsc-slider-progress, 50%);
	border-radius: 4px;
	background: linear-gradient(90deg, var(--gsc-teal) 0%, var(--gsc-gold) 100%);
	box-shadow: 0 2px 8px rgba(212, 168, 67, 0.35);
	z-index: 1;
	transition: width 0.15s ease-out;
}

/* Slider thumb, webkit */
.gs-calc-slider::-webkit-slider-runnable-track {
	background: transparent;
	height: 8px;
}
.gs-calc-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid var(--gsc-gold);
	box-shadow: 0 4px 12px rgba(212, 168, 67, 0.4), 0 0 0 6px rgba(212, 168, 67, 0.12);
	cursor: grab;
	transition: transform 0.2s var(--gsc-ease), box-shadow 0.2s ease;
	margin-top: -8px; /* Center on 8px track */
}
.gs-calc-slider::-webkit-slider-thumb:hover {
	transform: scale(1.15);
	box-shadow: 0 6px 18px rgba(212, 168, 67, 0.55), 0 0 0 10px rgba(212, 168, 67, 0.18);
}
.gs-calc-slider:active::-webkit-slider-thumb {
	cursor: grabbing;
	transform: scale(1.25);
}

/* Firefox */
.gs-calc-slider::-moz-range-track {
	background: transparent;
	height: 8px;
	border: 0;
}
.gs-calc-slider::-moz-range-thumb {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid var(--gsc-gold);
	box-shadow: 0 4px 12px rgba(212, 168, 67, 0.4), 0 0 0 6px rgba(212, 168, 67, 0.12);
	cursor: grab;
	transition: transform 0.2s var(--gsc-ease), box-shadow 0.2s ease;
}
.gs-calc-slider::-moz-range-thumb:hover { transform: scale(1.15); }

.gs-calc-slider:focus { outline: none; }
.gs-calc-slider:focus::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(26, 107, 122, 0.35), 0 4px 12px rgba(212, 168, 67, 0.4); }
.gs-calc-slider:focus::-moz-range-thumb     { box-shadow: 0 0 0 5px rgba(26, 107, 122, 0.35), 0 4px 12px rgba(212, 168, 67, 0.4); }

/* Slider tick marks */
.gs-calc-slider-ticks {
	display: flex;
	justify-content: space-between;
	margin-top: 0.6rem;
	font-size: 0.72rem;
	color: var(--gsc-muted);
	padding: 0 0.2rem;
}
.gs-calc-slider-ticks span { position: relative; }
.gs-calc-slider-ticks span::before {
	content: "";
	display: block;
	width: 2px;
	height: 6px;
	background: var(--gsc-border);
	border-radius: 1px;
	margin: 0 auto 3px;
}

/* ============================================================
   Matches panel
   ============================================================ */
.gs-calc-matches {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--gsc-border);
}
.gs-calc-match-count {
	font-weight: 700;
	color: var(--gsc-teal);
	margin-bottom: 1rem;
	font-size: 0.95rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	transition: color 0.3s ease;
}
.gs-calc-match-count.is-loading { color: var(--gsc-muted); }
.gs-calc-match-count.is-loading::before {
	content: "";
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2px solid var(--gsc-border);
	border-top-color: var(--gsc-teal);
	animation: gsc-spin 0.8s linear infinite;
}
@keyframes gsc-spin { to { transform: rotate(360deg); } }

.gs-calc-match-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1rem;
}

.gs-match-card {
	background: #fff;
	border: 1px solid var(--gsc-border);
	border-radius: 14px;
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
	position: relative;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px);
	animation: gsc-match-in 0.5s var(--gsc-ease) forwards;
	transition: transform 0.3s var(--gsc-ease),
	            border-color 0.3s ease,
	            box-shadow 0.3s ease;
}
.gs-match-card:nth-child(1) { animation-delay: 0.05s; }
.gs-match-card:nth-child(2) { animation-delay: 0.12s; }
.gs-match-card:nth-child(3) { animation-delay: 0.19s; }
.gs-match-card:nth-child(4) { animation-delay: 0.26s; }
.gs-match-card:nth-child(5) { animation-delay: 0.33s; }
.gs-match-card:nth-child(6) { animation-delay: 0.40s; }
@keyframes gsc-match-in {
	to { opacity: 1; transform: translateY(0); }
}

.gs-match-card::before {
	content: "";
	position: absolute;
	top: 0;
	inset-inline-start: 0;
	width: 3px;
	height: 100%;
	background: linear-gradient(180deg, var(--gsc-teal) 0%, var(--gsc-gold) 100%);
	transition: width 0.3s ease;
}
.gs-match-card:hover {
	border-color: var(--gsc-gold);
	transform: translateY(-4px);
	box-shadow: 0 12px 32px rgba(26, 58, 92, 0.12);
}
.gs-match-card:hover::before { width: 5px; }

.gs-match-hotel {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--gsc-navy);
	margin: 0;
	line-height: 1.35;
}
.gs-match-meta {
	font-size: 0.8rem;
	color: var(--gsc-muted);
}
.gs-match-price {
	display: flex;
	align-items: baseline;
	gap: 0.35rem;
	font-size: 1.15rem;
	margin: 0.2rem 0;
}
.gs-match-price strong {
	color: var(--gsc-navy);
	font-weight: 800;
}
.gs-match-price span {
	color: var(--gsc-muted);
	font-size: 0.78rem;
}
.gs-match-stars {
	color: var(--gsc-gold);
	font-size: 0.85rem;
	letter-spacing: 2px;
}

.gs-match-wa,
.gs-calc-wa-fallback {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-top: auto;
	padding: 0.75rem 1rem;
	background: var(--gsc-wa);
	color: #fff;
	border-radius: var(--gsc-radius-pill);
	font-weight: 700;
	font-size: 0.9rem;
	text-decoration: none;
	transition: transform 0.2s var(--gsc-ease), box-shadow 0.3s ease;
	position: relative;
	overflow: hidden;
}
.gs-match-wa::before,
.gs-calc-wa-fallback::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), transparent);
	opacity: 0;
	transition: opacity 0.3s ease;
}
.gs-match-wa:hover,
.gs-calc-wa-fallback:hover {
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4);
}
.gs-match-wa:hover::before,
.gs-calc-wa-fallback:hover::before { opacity: 1; }

.gs-calc-fallback {
	grid-column: 1 / -1;
	text-align: center;
	padding: 2.5rem 1.5rem;
	background: linear-gradient(180deg, #fff 0%, var(--gsc-cream) 100%);
	border: 2px dashed var(--gsc-border);
	border-radius: 14px;
	opacity: 0;
	animation: gsc-match-in 0.5s var(--gsc-ease) 0.1s forwards;
}
.gs-calc-fallback-icon {
	font-size: 2.5rem;
	color: var(--gsc-gold);
	margin-bottom: 0.75rem;
	display: block;
	animation: gsc-fallback-wiggle 2s ease-in-out infinite;
}
@keyframes gsc-fallback-wiggle {
	0%, 100% { transform: rotate(0); }
	25%      { transform: rotate(-8deg); }
	75%      { transform: rotate(8deg); }
}
.gs-calc-fallback h4 { color: var(--gsc-navy); margin: 0 0 0.5rem; font-size: 1.15rem; font-weight: 700; }
.gs-calc-fallback p  { color: var(--gsc-muted); margin: 0 0 1.25rem; }

/* ============================================================
   Layouts
   ============================================================ */
@media (min-width: 992px) {
	.gs-calculator-root.gs-layout-split {
		display: grid;
		grid-template-columns: 5fr 7fr;
		gap: 2.5rem;
	}
	.gs-calculator-root.gs-layout-split .gs-calc-head { grid-column: 1 / -1; }
	.gs-calculator-root.gs-layout-split .gs-calc-matches {
		margin-top: 0;
		padding-top: 0;
		border-top: none;
	}
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
	.gs-chip, .gs-match-card, .gs-match-wa, .gs-calc-wa-fallback,
	.gs-calc-slider-wrap::after, .gs-calc-budget-value {
		transition: none;
		animation: none;
	}
	.gs-calculator-root::before { animation: none; }
	.gs-calc-fallback-icon { animation: none; }
	.gs-match-card { opacity: 1; transform: none; }
}
