/* =========================================================================
   Reading Trolls — Book Fair Map
   -------------------------------------------------------------------------
   IMPORTANT: WP темата прилага глобален CSS reset:
     - font: inherit на всички елементи
     - background-color: #7b1e3a на всички <button>
   Затова всеки <button> тук изрично задава background + font-size с !important.
   ========================================================================= */

.rt-fair-map {
	max-width: 1180px;
	margin: 0 auto;
	padding: 24px 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: #1a1a1a;
	box-sizing: border-box;
}

.rt-fair-map *,
.rt-fair-map *::before,
.rt-fair-map *::after {
	box-sizing: border-box;
}

.rt-fair-map-header h2 {
	font-size: 24px;
	line-height: 1.25;
	margin: 0 0 6px;
	color: #1a1a1a;
	font-weight: 700;
}

.rt-fair-map-header p {
	margin: 0 0 18px;
	color: #555;
	font-size: 15px;
	line-height: 1.5;
}

/* ---------- Search bar ---------- */

.rt-fair-search-wrap {
	display: flex;
	gap: 10px;
	margin-bottom: 18px;
	position: relative;
}

.rt-fair-search-field {
	position: relative;
	flex: 1;
	min-width: 0; /* защита от flex-shrink overflow bug в Chrome */
}

.rt-fair-search {
	width: 100%;
	flex: 1;
	min-height: 44px;
	border-radius: 10px;
	border: 1px solid var(--rt-border, #ddd);
	padding: 10px 14px;
	font-size: 15px !important;
	font-family: inherit;
	background: #fff;
	color: #1a1a1a;
}

.rt-fair-search:focus {
	outline: 2px solid #0798c8;
	outline-offset: 1px;
	border-color: #0798c8;
}

.rt-fair-clear {
	min-height: 44px;
	padding: 0 18px;
	border-radius: 10px;
	border: 1px solid var(--rt-border, #ddd);
	background: #f5f5f5 !important;
	color: #1a1a1a !important;
	font-size: 14px !important;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
}

.rt-fair-clear:hover {
	background: #eaeaea !important;
}

/* ---------- Suggestions dropdown ---------- */

.rt-fair-suggestions {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--rt-border, #ddd);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
	max-height: 360px;
	overflow-y: auto;
	z-index: 50;
}

.rt-fair-suggestion {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 14px;
	border: 0;
	border-bottom: 1px solid #f0f0f0;
	background: #fff !important;
	color: #1a1a1a !important;
	text-align: left;
	font-size: 14px !important;
	font-family: inherit;
	cursor: pointer;
}

.rt-fair-suggestion:last-child {
	border-bottom: 0;
}

.rt-fair-suggestion:hover {
	background: #f5f9fc !important;
}

.rt-fair-sugg-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.rt-fair-sugg-kind {
	font-size: 11px !important;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: #7a7a7a !important;
}

.rt-fair-suggestion.is-program .rt-fair-sugg-kind {
	color: #0798c8 !important;
}

.rt-fair-sugg-name {
	flex: 1;
	color: #1a1a1a !important;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rt-fair-sugg-tent {
	color: #0798c8 !important;
	font-weight: 700;
	font-size: 13px !important;
	flex-shrink: 0;
}

.rt-fair-program-hits-note {
	margin: 0 0 10px;
	font-size: 13px;
	color: #555;
}

.rt-fair-event-item.is-highlight {
	background: #eef8fc;
	border-radius: 8px;
	box-shadow: inset 3px 0 0 #0798c8;
	padding-left: 10px;
}

/* ---------- Layout ---------- */

.rt-fair-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 18px;
	align-items: start;
}

/* ---------- Map canvas ---------- */

.rt-fair-map-canvas {
	position: relative;
	overflow: auto;
	border-radius: 16px;
	border: 1px solid var(--rt-border, #ddd);
	background: #fafafa;
	-webkit-overflow-scrolling: touch;
}

.rt-fair-map-stage {
	position: relative;
	width: 100%;
}

.rt-fair-map-stage img {
	display: block;
	width: 100%;
	height: auto;
	user-select: none;
	-webkit-user-drag: none;
}

.rt-fair-markers {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.rt-fair-marker {
	position: absolute;
	pointer-events: auto;
	transform: translate(-50%, -50%);
	min-width: 28px;
	min-height: 28px;
	padding: 0 8px;
	border-radius: 999px;
	border: 2px solid #fff !important;
	background: #0798c8 !important;
	color: #fff !important;
	font-family: inherit;
	font-weight: 700 !important;
	font-size: 10px !important;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
	transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.rt-fair-marker:hover,
.rt-fair-marker:focus-visible {
	background: #7b1e3a !important;
	outline: none;
	transform: translate(-50%, -50%) scale(1.12);
	z-index: 1;
}

.rt-fair-marker.is-main-stage {
	background: #2e7d32 !important;
	min-width: 28px;
	font-size: 10px !important;
	letter-spacing: 0.02em;
}

.rt-fair-marker.is-main-stage:hover,
.rt-fair-marker.is-main-stage:focus-visible,
.rt-fair-marker.is-main-stage.is-active {
	background: #1b5e20 !important;
	box-shadow: 0 6px 18px rgba(27, 94, 32, 0.40);
}

.rt-fair-tent-badge.is-main-stage {
	background: #2e7d32;
	color: #fff;
}

.rt-fair-marker.is-active {
	background: #7b1e3a !important;
	transform: translate(-50%, -50%) scale(1.2);
	box-shadow: 0 6px 18px rgba(123, 30, 58, 0.40);
	z-index: 2;
}

/* ---------- Panel (desktop) ---------- */

.rt-fair-panel {
	position: relative;
	border: 1px solid var(--rt-border, #ddd);
	border-radius: 16px;
	padding: 16px;
	background: #fff;
	min-height: 200px;
}

.rt-fair-panel-close {
	display: none;
	position: absolute;
	top: 8px;
	right: 8px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 0;
	background: #f5f5f5 !important;
	color: #1a1a1a !important;
	font-size: 20px !important;
	font-family: inherit;
	line-height: 1;
	cursor: pointer;
}

.rt-fair-panel-close:hover {
	background: #eaeaea !important;
}

.rt-fair-empty {
	color: #666;
	font-size: 14px;
	padding: 12px 0;
	text-align: center;
	line-height: 1.5;
}

/* ---------- Tent result ---------- */

.rt-fair-tent-header {
	margin-bottom: 12px;
}

.rt-fair-tent-badge {
	display: inline-block;
	padding: 4px 12px;
	background: #0798c8;
	color: #fff;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
}

.rt-fair-pub-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rt-fair-pub {
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 14px;
	color: #1a1a1a;
	margin-bottom: 4px;
	background: #fafafa;
	line-height: 1.4;
}

.rt-fair-pub.is-highlight {
	background: #fff3cc;
	font-weight: 600;
	box-shadow: inset 3px 0 0 #f4b400;
}

/* ---------- Multi-tent result ---------- */

.rt-fair-multi-header {
	margin-bottom: 12px;
	font-size: 14px;
	color: #555;
	line-height: 1.5;
}

.rt-fair-multi-card {
	border: 1px solid #eee;
	border-radius: 12px;
	padding: 12px;
	margin-bottom: 12px;
}

.rt-fair-multi-card:last-child {
	margin-bottom: 0;
}

.rt-fair-multi-btn {
	display: inline-block !important;
	padding: 4px 12px !important;
	margin-bottom: 8px !important;
	background: #0798c8 !important;
	color: #fff !important;
	border: 0;
	border-radius: 999px;
	font-size: 14px !important;
	font-family: inherit;
	font-weight: 700 !important;
	cursor: pointer;
}

.rt-fair-multi-btn:hover {
	background: #057ba3 !important;
}

.rt-fair-no-results {
	padding: 24px 12px;
	text-align: center;
	color: #666;
	font-size: 14px;
	line-height: 1.5;
}

/* ---------- Top Titles section ---------- */

.rt-fair-top-titles {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid #eee;
}

.rt-fair-top-title-heading {
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 700;
	color: #1a1a1a;
}

.rt-fair-top-title-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rt-fair-top-title-item {
	padding: 10px 12px;
	border-radius: 10px;
	background: #fff8ec;
	margin-bottom: 8px;
	font-size: 14px;
	line-height: 1.4;
}

.rt-fair-top-title-item:last-child {
	margin-bottom: 0;
}

.rt-fair-top-title-name {
	display: block;
	font-weight: 700;
	color: #1a1a1a;
}

.rt-fair-top-title-publisher,
.rt-fair-top-title-note {
	display: block;
	margin-top: 3px;
	font-size: 12px;
	color: #666;
}

/* ---------- Events section ---------- */

.rt-fair-events {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid #eee;
}

.rt-fair-events-heading {
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 700;
	color: #1a1a1a;
}

.rt-fair-events-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rt-fair-event-item {
	padding: 10px 12px;
	border-radius: 10px;
	background: #f5f9fc;
	margin-bottom: 8px;
	font-size: 14px;
	line-height: 1.45;
}

.rt-fair-event-item:last-child {
	margin-bottom: 0;
}

.rt-fair-event-date {
	display: block;
	font-size: 12px;
	color: #666;
}

.rt-fair-event-time {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	font-weight: 700;
	color: #0798c8;
}

.rt-fair-event-title {
	display: block;
	margin-top: 5px;
	font-weight: 700;
	color: #1a1a1a;
}

.rt-fair-event-publisher {
	display: block;
	margin-top: 3px;
	font-size: 12px;
	color: #666;
}

.rt-fair-event-desc {
	margin: 6px 0 0;
	font-size: 13px;
	color: #444;
	line-height: 1.45;
}

/* ---------- Event location (само за globalProgram view) ---------- */

.rt-fair-event-location {
	display: inline-block;
	margin-top: 2px;
	font-size: 12px;
	font-weight: 600;
	color: #555;
}

/* Когато location е кликаем tent badge */
button.rt-fair-event-location.is-tent {
	background: #eef7fb !important;
	color: #0798c8 !important;
	border: 1px solid #cce5ee;
	border-radius: 999px;
	padding: 3px 10px !important;
	font-family: inherit;
	font-size: 12px !important;
	font-weight: 700 !important;
	cursor: pointer;
}

button.rt-fair-event-location.is-tent:hover {
	background: #d8edf6 !important;
}

/* ---------- "Цялата програма" toggle бутон ---------- */

.rt-fair-program-toggle {
	min-height: 44px;
	padding: 0 16px;
	border-radius: 10px;
	border: 1px solid #0798c8;
	background: #0798c8 !important;
	color: #fff !important;
	font-size: 14px !important;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
}

.rt-fair-program-toggle:hover {
	background: #057ba3 !important;
	border-color: #057ba3;
}

/* ---------- Program view (цялата програма) ---------- */

.rt-fair-program-view {
	margin-top: 8px;
	scroll-margin-top: 32px;
}

.rt-fair-program-view-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}

.rt-fair-program-close {
	min-height: 40px;
	padding: 0 14px;
	border-radius: 10px;
	border: 1px solid var(--rt-border, #ddd);
	background: #f5f5f5 !important;
	color: #1a1a1a !important;
	font-size: 14px !important;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
}

.rt-fair-program-close:hover {
	background: #eaeaea !important;
}

.rt-fair-program-view-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	color: #1a1a1a;
}

.rt-fair-program-content {
	border: 1px solid var(--rt-border, #ddd);
	border-radius: 16px;
	padding: 16px;
	background: #fff;
}

.rt-fair-day-group {
	margin-bottom: 24px;
}

.rt-fair-day-group:last-child {
	margin-bottom: 0;
}

.rt-fair-day-heading {
	margin: 0 0 12px;
	padding: 8px 14px;
	background: linear-gradient(135deg, #0798c8 0%, #057ba3 100%);
	color: #fff;
	border-radius: 10px;
	font-size: 16px;
	font-weight: 700;
}

/* В program view искаме events да не са с допълнителен border-top */
.rt-fair-day-group .rt-fair-events {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

/* ---------- Program past days toggle ---------- */

.rt-fair-program-past-control {
	margin: 0 0 18px;
	padding: 12px;
	border: 1px solid #e8eef2;
	border-radius: 12px;
	background: #f8fbfd;
}

.rt-fair-program-note {
	margin: 0 0 10px;
	font-size: 13px;
	line-height: 1.45;
	color: #555;
}

.rt-fair-program-past-toggle {
	min-height: 38px;
	padding: 0 14px;
	border-radius: 999px;
	border: 1px solid #0798c8;
	background: #fff !important;
	color: #0798c8 !important;
	font-size: 13px !important;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
}

.rt-fair-program-past-toggle:hover {
	background: #eef7fb !important;
}

.rt-fair-program-past-days {
	margin-bottom: 22px;
}

/* Заглавията на минали дни в по-неутрален сивкав gradient */
.rt-fair-program-past-days .rt-fair-day-heading {
	background: linear-gradient(135deg, #9aa7ad 0%, #7c898f 100%);
}

/* ---------- Calibration mode ---------- */

.rt-fair-calibrate-badge {
	background: #f4b400;
	color: #1a1a1a;
	padding: 10px 14px;
	border-radius: 8px;
	font-weight: 700;
	font-size: 14px;
	margin-bottom: 12px;
	text-align: center;
}

.rt-fair-calibrate-picker {
	width: 100%;
	padding: 10px 12px;
	margin-bottom: 12px;
	border-radius: 8px;
	border: 1px solid #ddd;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
}

.rt-fair-calibrate-output {
	width: 100%;
	margin-top: 12px;
	padding: 10px;
	border-radius: 8px;
	border: 1px solid #ddd;
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	font-size: 12px;
	resize: vertical;
}

.rt-fair-calibrate-export {
	margin-top: 8px;
	padding: 10px 18px;
	background: #0798c8 !important;
	color: #fff !important;
	border: 0;
	border-radius: 8px;
	font-size: 14px !important;
	font-family: inherit;
	font-weight: 600 !important;
	cursor: pointer;
}

.rt-fair-calibrate-export:hover {
	background: #057ba3 !important;
}

/* =========================================================================
   Mobile (< 768px)
   ========================================================================= */

@media (max-width: 768px) {
	.rt-fair-map {
		padding: 16px 12px;
	}

	.rt-fair-map-header h2 {
		font-size: 20px;
	}

	.rt-fair-map-header p {
		font-size: 14px;
	}

	.rt-fair-layout {
		display: block;
	}

	.rt-fair-search-wrap {
		position: sticky;
		top: 0;
		z-index: 10;
		background: #fff;
		margin: 0 -12px 12px;
		padding: 8px 12px;
		border-bottom: 1px solid #eee;
	}

	.rt-fair-map-canvas {
		overflow: auto;
		max-height: 70vh;
	}

	.rt-fair-map-stage {
		min-width: 600px; /* за да остане overflow scroll възможен на тесни екрани */
	}

	.rt-fair-marker {
		min-width: 22px;
		min-height: 22px;
		font-size: 9px !important;
	}

	/* Bottom sheet */
	.rt-fair-panel {
		position: fixed;
		left: 12px;
		right: 12px;
		bottom: 12px;
		z-index: 9999;
		max-height: 60vh;
		overflow-y: auto;
		transform: translateY(120%);
		transition: transform 0.25s ease;
		box-shadow: 0 16px 42px rgba(0, 0, 0, 0.25);
		margin: 0;
	}

	.rt-fair-panel.is-open {
		transform: translateY(0);
	}

	.rt-fair-panel-close {
		display: block;
	}

	.rt-fair-program-view {
		scroll-margin-top: 112px;
	}

	/* Search bar на 2 реда: търсачка горе, бутоните 50/50 отдолу.
	 * flex: 1 0 100% е на field-а, за да се force-не на цял ред заедно
	 * със suggestions dropdown-а, който е absolute спрямо field-а. */
	.rt-fair-search-wrap {
		flex-wrap: wrap;
	}

	.rt-fair-search-field {
		flex: 1 0 100%;
		width: 100%;
	}

	.rt-fair-search {
		width: 100%;
	}

	.rt-fair-clear,
	.rt-fair-program-toggle {
		flex: 1 1 calc(50% - 5px);
		justify-content: center;
		text-align: center;
	}

	/* Past-days toggle: цяла ширина на mobile за по-лесен tap */
	.rt-fair-program-past-toggle {
		width: 100%;
		justify-content: center;
		text-align: center;
	}
}

/* =========================================================================
   Desktop sticky result panel
   Държи информацията за избраната шатра видима, докато картата се скролва
   ========================================================================= */

@media (min-width: 769px) {
	.rt-fair-panel {
		position: sticky;
		top: 90px;
		max-height: calc(100vh - 110px);
		overflow-y: auto;
		align-self: start;
		z-index: 5;
	}

	body.admin-bar .rt-fair-panel {
		top: 122px;
		max-height: calc(100vh - 142px);
	}
}

@media (min-width: 769px) {
	.rt-fair-panel.is-open {
		box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
	}
}
