/* =================================================================
   PLACES PLUGIN - Front-end CSS
   Theme-agnostic: uses its own scoped classes, no global overrides.
   ================================================================= */

/* ---- Accent colour (overridden via inline style from plugin settings) ---- */
:root {
	--places-accent: var(--places-accent);
	--places-accent-light: var(--places-accent-light);
}

/* ---- Override Astra theme container constraints ---- */
/* Astra's > * wildcard rules apply max-width and margin: auto to all
   descendants inside .entry-content. Reset on our wrapper and its children. */
.places-wrapper,
.places-wrapper > * {
	max-width: 100% !important;
	margin-left: unset !important;
	margin-right: unset !important;
}

/* ---- Main wrapper: two-column flex layout ---- */
.places-wrapper {
	display: flex;
	flex-direction: row;
	gap: 0;
	width: 100%;
	height: calc(100vh - 80px);
	min-height: 500px;
	border-top: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #333;
	box-sizing: border-box;
}

.places-wrapper *,
.places-wrapper *::before,
.places-wrapper *::after {
	box-sizing: border-box;
}

/* ---- Left panel (filter + results) ---- */
.places-left-panel {
	flex: 0 0 340px;
	display: flex;
	flex-direction: column;
	background: #f9f9f9;
	border-right: 1px solid #ddd;
	overflow: hidden;
}

/* ---- Filter section ---- */
.places-filter {
	padding: 16px;
	background: #fff;
	border-bottom: 1px solid #e0e0e0;
}

.places-filter-row {
	margin-bottom: 10px;
}

.places-filter-row:last-child {
	margin-bottom: 0;
	display: flex;
	gap: 8px;
}

.places-filter label {
	display: block;
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #555;
	margin-bottom: 4px;
}

.places-filter input[type="text"],
.places-filter select {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 14px;
	background: #fff;
	color: #333;
}

.places-filter input[type="text"]:focus,
.places-filter select:focus {
	outline: none;
	border-color: var(--places-accent);
	box-shadow: 0 0 0 1px var(--places-accent);
}

/* Buttons */
.places-btn {
	display: inline-block;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 600;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.places-btn:first-child {
	flex: 1;
	background: var(--places-accent);
	color: #fff;
}

.places-btn:first-child:hover {
	background: #005f8d;
}

.places-btn-secondary {
	background: #e0e0e0;
	color: #333;
}

.places-btn-secondary:hover {
	background: #ccc;
}

/* ---- Results / listing cards ---- */
.places-results {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
}

.places-loading,
.places-no-results {
	text-align: center;
	color: #888;
	padding: 24px 12px;
	margin: 0;
}

/* ---- Individual listing card ---- */
.places-card {
	display: flex;
	gap: 10px;
	padding: 10px;
	margin-bottom: 8px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	cursor: pointer;
	transition: box-shadow 0.15s, border-color 0.15s;
}

.places-card:hover,
.places-card-active {
	border-color: var(--places-accent);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.places-card-img {
	flex: 0 0 80px;
	width: 80px;
	height: 60px;
	object-fit: cover;
	border-radius: 3px;
}

.places-card-body {
	flex: 1;
	min-width: 0; /* allow text truncation */
}

.places-card-title {
	margin: 0 0 4px 0;
	font-size: 14px;
	font-weight: 600;
	color: #222;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.places-card-addr {
	margin: 0 0 4px 0;
	font-size: 12px;
	color: #666;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.places-card-cats {
	display: inline-block;
	font-size: 11px;
	color: var(--places-accent);
	background: var(--places-accent-light);
	padding: 2px 6px;
	border-radius: 3px;
}

/* ---- Map container ---- */
.places-map {
	flex: 1 1 0%;
	min-width: 0;
	min-height: 500px;
}

/* Make sure Leaflet fills its container */
.places-map .leaflet-container {
	width: 100% !important;
	height: 100% !important;
}

/* ---- Leaflet popup styling ---- */
.places-popup h3 {
	margin: 0 0 6px 0;
	font-size: 16px;
}

.places-popup p {
	margin: 0 0 6px 0;
	font-size: 13px;
}

.places-popup a {
	color: var(--places-accent);
	text-decoration: none;
}

.places-popup a:hover {
	text-decoration: underline;
}

.places-popup-photos {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
	margin-top: 8px;
}

.places-popup-img {
	width: 80px;
	height: 60px;
	object-fit: cover;
	border-radius: 3px;
	border: 1px solid #ddd;
}

/* ---- Responsive: stack on mobile (shortcode page) ---- */
@media (max-width: 768px) {
	.places-wrapper {
		flex-direction: column;
		height: auto;
		min-height: auto;
	}

	.places-left-panel {
		flex: 0 0 auto;
		max-height: 300px;
		border-right: none;
		border-bottom: 1px solid #ddd;
	}

	.places-map {
		min-height: 400px;
	}
}


/* =================================================================
   SINGLE PLACE PAGE
   ================================================================= */

.places-single {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: #333;
	line-height: 1.6;
}

/* ---- Container (centers content, respects theme width) ---- */
.places-single-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

/* ---- Header: title + categories ---- */
.places-single-header {
	padding: 40px 0 20px;
}

.places-single-title {
	font-size: 2.2em;
	font-weight: 700;
	margin: 0 0 8px;
	line-height: 1.2;
}

.places-single-cats {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 8px;
}

.places-single-cat {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--places-accent);
	background: var(--places-accent-light);
	padding: 4px 10px;
	border-radius: 3px;
}

/* ---- Photo gallery banner ---- */
.places-single-gallery-wrap {
	width: 100%;
	overflow: hidden;
	background: #f0f0f0;
	margin-bottom: 30px;
}

.places-single-gallery {
	display: flex;
	gap: 4px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: #bbb #f0f0f0;
	padding: 4px 0;
	cursor: grab;
}

.places-single-gallery.places-gallery-dragging {
	cursor: grabbing;
	scroll-snap-type: none; /* disable snap while dragging for smooth feel */
}

.places-single-gallery.places-gallery-dragging img {
	pointer-events: none; /* prevent image drag ghost */
}

.places-single-gallery::-webkit-scrollbar {
	height: 8px;
}

.places-single-gallery::-webkit-scrollbar-track {
	background: #f0f0f0;
}

.places-single-gallery::-webkit-scrollbar-thumb {
	background: #bbb;
	border-radius: 4px;
}

.places-single-gallery-img {
	flex: 0 0 auto;
	height: 320px;
	width: auto;
	object-fit: cover;
	scroll-snap-align: start;
	border-radius: 0;
	display: block;
}

/* ---- Body: content left + sidebar right ---- */
.places-single-body {
	display: flex;
	gap: 40px;
	padding: 10px 0 60px;
}

.places-single-content {
	flex: 1;
	min-width: 0;
	font-size: 16px;
}

.places-single-content p {
	margin: 0 0 1em;
}

.places-single-content img {
	max-width: 100%;
	height: auto;
}

/* ---- Sidebar: map + address ---- */
.places-single-sidebar {
	flex: 0 0 360px;
}

.places-single-map {
	width: 100%;
	height: 280px;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid #ddd;
}

.places-single-details {
	margin-top: 16px;
	padding: 16px;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	font-size: 14px;
}

.places-single-detail {
	padding-bottom: 12px;
	margin-bottom: 12px;
	border-bottom: 1px solid #e0e0e0;
}

.places-single-detail:last-child {
	padding-bottom: 0;
	margin-bottom: 0;
	border-bottom: none;
}

.places-single-detail strong {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #888;
	margin-bottom: 4px;
}

.places-single-detail p {
	margin: 0;
	color: #333;
}

.places-single-detail a {
	color: var(--places-accent);
	text-decoration: none;
}

.places-single-detail a:hover {
	text-decoration: underline;
}

.places-detail-link {
	display: inline-block;
	margin-top: 6px;
	font-weight: 600;
	font-size: 13px;
}

/* ---- Responsive: single place page ---- */
@media (max-width: 768px) {
	.places-single-title {
		font-size: 1.6em;
	}

	.places-single-gallery-img {
		height: 220px;
	}

	.places-single-body {
		flex-direction: column;
		gap: 24px;
	}

	.places-single-sidebar {
		flex: 0 0 auto;
	}

	.places-single-map {
		height: 220px;
	}
}
