/**
 * WP Map Listings Frontend Stylesheet
 */

/* General Wrapper Styling */
.wpml-wrapper {
	--wpml-primary-color: #ff385c; /* Airbnb style signature red */
	--wpml-text-dark: #222222;
	--wpml-text-gray: #717171;
	--wpml-bg-light: #f7f7f7;
	--wpml-border-color: #dddddd;
	--wpml-shadow-light: 0 6px 16px rgba(0,0,0,0.08);
	--wpml-shadow-heavy: 0 16px 32px rgba(0,0,0,0.15);
	
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
	color: var(--wpml-text-dark);
	max-width: 100%;
	margin: 0 auto;
	padding: 20px;
	box-sizing: border-box;
}

.wpml-wrapper * {
	box-sizing: border-box;
}

/* Typography Overrides */
.wpml-wrapper h1, 
.wpml-wrapper h2, 
.wpml-wrapper h3 {
	font-family: 'Outfit', sans-serif;
	font-weight: 600;
	color: var(--wpml-text-dark);
	margin-top: 0;
}

/* 1. Premium Search Bar */
.wpml-search-bar {
	display: flex;
	align-items: center;
	background: #ffffff;
	border: 1px solid var(--wpml-border-color);
	border-radius: 40px;
	padding: 6px 6px 6px 24px;
	box-shadow: 0 3px 12px rgba(0,0,0,0.08);
	max-width: 850px;
	margin: 0 auto 15px auto; /* Reduced margin to stick to drawer */
	transition: box-shadow 0.2s, border-color 0.2s;
}

.wpml-search-bar:hover,
.wpml-search-bar:focus-within {
	box-shadow: 0 6px 20px rgba(0,0,0,0.12);
	border-color: #b0b0b0;
}

.wpml-search-field {
	display: flex;
	align-items: center;
	flex: 1;
	position: relative;
	padding: 4px 16px;
	border-right: 1px solid var(--wpml-border-color);
}

.wpml-search-field:last-of-type {
	border-right: none;
}

.wpml-search-field .field-icon {
	color: var(--wpml-text-gray);
	font-size: 16px;
	margin-right: 12px;
}

.wpml-search-field .field-details {
	display: flex;
	flex-direction: column;
	flex: 1;
}

.wpml-search-field label {
	font-size: 10px;
	font-weight: 800;
	text-transform: uppercase;
	color: var(--wpml-text-dark);
	letter-spacing: 0.5px;
	margin-bottom: 2px;
}

.wpml-search-field input[type="text"],
.wpml-search-field select {
	border: none !important;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	color: var(--wpml-text-dark) !important;
	background: transparent !important;
	outline: none !important;
	width: 100% !important;
	height: auto !important;
	box-shadow: none !important;
}

.wpml-search-field select {
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
}

/* Custom dropdown arrow for select */
.wpml-search-field select::-ms-expand {
	display: none;
}

/* 1.1 Filters Toggle Button inside Search Bar */
.wpml-filter-toggle-btn {
	background: #ffffff;
	border: 1px solid var(--wpml-border-color);
	padding: 10px 18px;
	border-radius: 24px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wpml-text-dark);
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 8px;
	transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
	margin-left: 10px;
	flex-shrink: 0;
}

.wpml-filter-toggle-btn:hover {
	background-color: var(--wpml-bg-light);
	border-color: #b0b0b0;
}

.wpml-filter-toggle-btn.active {
	background-color: var(--wpml-text-dark);
	color: #ffffff;
	border-color: var(--wpml-text-dark);
	box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.wpml-filter-badge {
	background: var(--wpml-primary-color);
	color: #ffffff;
	font-size: 10px;
	font-weight: 700;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.wpml-search-button {
	background: var(--wpml-primary-color);
	color: #ffffff;
	border: none;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 0.2s, transform 0.1s;
	font-size: 16px;
	margin-left: 8px;
	flex-shrink: 0;
}

.wpml-search-button:hover {
	background-color: #e61e4d;
	transform: scale(1.05);
}

.wpml-search-button:active {
	transform: scale(0.95);
}

/* 1.2 Filters Collapsible Drawer */
.wpml-filters-drawer {
	background: #ffffff;
	border: 1px solid var(--wpml-border-color);
	border-radius: 16px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.08);
	max-width: 850px;
	margin: 0 auto 30px auto;
	padding: 20px;
	overflow: hidden;
	transition: all 0.3s ease-in-out;
}

.wpml-drawer-inner {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 20px;
	margin-bottom: 20px;
}

.wpml-drawer-filter {
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.wpml-drawer-filter label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--wpml-text-dark);
	margin-bottom: 6px;
}

.wpml-drawer-filter select,
.wpml-drawer-filter input[type="text"] {
	border: 1px solid var(--wpml-border-color) !important;
	border-radius: 8px !important;
	padding: 8px 12px !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	color: var(--wpml-text-dark) !important;
	background: #ffffff !important;
	outline: none !important;
	height: 38px !important;
	width: 100% !important;
	transition: border-color 0.2s;
}

.wpml-drawer-filter select:focus,
.wpml-drawer-filter input[type="text"]:focus {
	border-color: var(--wpml-primary-color) !important;
}

/* Boolean toggle layout (inline) */
.wpml-drawer-filter.wpml-filter-boolean {
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	background: var(--wpml-bg-light);
	padding: 10px 16px;
	border-radius: 12px;
	border: 1px solid var(--wpml-border-color);
	height: 48px;
	align-self: end;
}

.wpml-drawer-filter.wpml-filter-boolean .wpml-filter-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--wpml-text-dark);
}

/* Airbnb iOS Toggle Switch */
.wpml-toggle-switch {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	margin-bottom: 0 !important; /* reset default */
	flex-shrink: 0;
}

.wpml-toggle-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.wpml-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #b0b0b0;
	transition: .2s;
	border-radius: 24px;
}

.wpml-slider:before {
	position: absolute;
	content: "";
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: .2s;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.wpml-toggle-switch input:checked + .wpml-slider {
	background-color: var(--wpml-primary-color);
}

.wpml-toggle-switch input:checked + .wpml-slider:before {
	transform: translateX(20px);
}

/* Drawer Footer */
.wpml-drawer-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-top: 1px solid var(--wpml-border-color);
	padding-top: 16px;
}

.wpml-clear-filters-btn {
	background: none;
	border: none;
	color: var(--wpml-text-dark);
	font-size: 13px;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
	padding: 8px 0;
}

.wpml-clear-filters-btn:hover {
	color: #000;
}

.wpml-apply-filters-btn {
	background: var(--wpml-text-dark);
	color: #ffffff;
	border: none;
	padding: 10px 20px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s;
}

.wpml-apply-filters-btn:hover {
	background-color: #000000;
}

/* 2. Subheader Meta Section */
.wpml-meta-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 24px;
	border-bottom: 1px solid var(--wpml-border-color);
	padding-bottom: 16px;
}

.wpml-listings-count {
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.5px;
	margin-bottom: 0;
}

.wpml-meta-tag {
	display: flex;
	align-items: center;
	background: var(--wpml-bg-light);
	border: 1px solid var(--wpml-border-color);
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	color: var(--wpml-text-dark);
}

.wpml-meta-tag .tag-icon {
	color: var(--wpml-primary-color);
	margin-right: 6px;
}

/* 3. Split Screen Layout */
.wpml-split-layout {
	display: grid;
	grid-template-columns: 1.2fr 0.8fr; /* Airbnb style grid allocation */
	gap: 24px;
	height: 80vh;
	max-height: 900px;
	min-height: 500px;
}

/* Left Panel: Listings Cards List */
.wpml-listings-pane {
	overflow-y: auto;
	padding-right: 8px;
	scroll-behavior: smooth;
}

/* Scrollbar Customization */
.wpml-listings-pane::-webkit-scrollbar {
	width: 6px;
}
.wpml-listings-pane::-webkit-scrollbar-track {
	background: transparent;
}
.wpml-listings-pane::-webkit-scrollbar-thumb {
	background: #ddd;
	border-radius: 4px;
}
.wpml-listings-pane::-webkit-scrollbar-thumb:hover {
	background: #bbb;
}

/* Listings Grid */
.wpml-listings-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 24px;
}

.wpml-no-listings {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	background: var(--wpml-bg-light);
	border: 1px dashed var(--wpml-border-color);
	border-radius: 16px;
	color: var(--wpml-text-gray);
}

.wpml-no-listings i {
	font-size: 40px;
	margin-bottom: 15px;
	color: #ccc;
}

/* Listing Cards styling */
.wpml-card {
	display: flex;
	flex-direction: column;
	border-radius: 12px;
	overflow: hidden;
	position: relative;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	cursor: pointer;
}

.wpml-card:hover {
	transform: translateY(-4px);
}

.wpml-card.wpml-highlighted {
	box-shadow: 0 0 0 2px var(--wpml-primary-color), var(--wpml-shadow-heavy);
	transform: translateY(-4px);
	z-index: 10;
}

/* Card Image Wrapper */
.wpml-card-image-wrapper {
	position: relative;
	width: 100%;
	padding-top: 70%; /* 4:3 Aspect Ratio roughly */
	border-radius: 12px;
	overflow: hidden;
	background-color: #eaeaea;
}

.wpml-card-image-wrapper a {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.wpml-card-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.wpml-card:hover .wpml-card-image {
	transform: scale(1.06);
}

/* Badges absolutely positioned on image */
.wpml-card-badges {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2;
	pointer-events: none;
}

.wpml-badge {
	background: #ffffff;
	color: var(--wpml-text-dark);
	font-size: 12px;
	font-weight: 700;
	padding: 6px 12px;
	border-radius: 16px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid rgba(0, 0, 0, 0.04);
}

.wpml-badge.guest-favorite i {
	color: #f3a638; /* Gold icon */
}

/* Save / Heart Button */
.wpml-card-favorite {
	position: absolute;
	top: 12px;
	right: 12px;
	background: transparent;
	border: none;
	color: #ffffff;
	font-size: 20px;
	cursor: pointer;
	z-index: 2;
	transition: transform 0.2s;
	text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.wpml-card-favorite:hover {
	transform: scale(1.15);
}

.wpml-card-favorite.favorited i {
	color: var(--wpml-primary-color);
	font-weight: 900;
}

/* Carousel dots */
.wpml-card-dots {
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 5px;
	z-index: 2;
}

.wpml-card-dots .dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.6);
	transition: opacity 0.2s, background 0.2s;
}

.wpml-card-dots .dot.active {
	background: #ffffff;
	width: 6px;
	height: 6px;
}

/* Card details styling */
.wpml-card-details {
	padding: 12px 4px 8px 4px;
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

.wpml-card-header-row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 4px;
}

.wpml-card-title {
	font-size: 15px;
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
	flex: 1;
	padding-right: 10px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpml-card-title a {
	color: var(--wpml-text-dark);
	text-decoration: none;
}

.wpml-card-title a:hover {
	color: var(--wpml-primary-color);
}

/* Card Rating */
.wpml-card-rating {
	display: flex;
	align-items: center;
	font-size: 13px;
	font-weight: 500;
	flex-shrink: 0;
}

.wpml-card-rating i {
	color: var(--wpml-text-dark);
	margin-right: 4px;
	font-size: 11px;
}

.wpml-card-rating .rating-value {
	color: var(--wpml-text-dark);
	font-weight: 600;
}

.wpml-card-rating .rating-count {
	color: var(--wpml-text-gray);
	margin-left: 2px;
}

/* Card Description/Subtitle */
.wpml-card-subtitle {
	font-size: 13px;
	color: var(--wpml-text-gray);
	margin: 0 0 3px 0;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
}

.wpml-card-dates {
	font-size: 13px;
	color: var(--wpml-text-gray);
	margin: 0 0 6px 0;
}

/* Card Price & Cancellations */
.wpml-card-footer-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: auto;
}

.wpml-card-price {
	font-size: 15px;
	color: var(--wpml-text-dark);
}

.wpml-card-price .price-val {
	font-weight: 700;
	text-decoration: underline;
}

.wpml-card-price .price-label {
	color: var(--wpml-text-gray);
	font-weight: 400;
	font-size: 13px;
}

.wpml-badge-free-cancel {
	font-size: 11px;
	font-weight: 600;
	color: #008a05;
	background: #e8f9e9;
	padding: 4px 8px;
	border-radius: 12px;
	border: 1px solid #c2ecc4;
}

/* Right Panel: Map Pane Container */
.wpml-map-pane {
	position: sticky;
	top: 20px;
	height: 100%;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
	border: 1px solid var(--wpml-border-color);
}

.wpml-map-container {
	width: 100%;
	height: 100%;
	z-index: 1;
}

/* 4. Custom Speech Bubble Marker styling */
.wpml-custom-marker {
	background: var(--marker-bg, #ffffff);
	color: var(--marker-text, #222222);
	padding: 7px 12px;
	border-radius: 28px;
	font-weight: 700;
	font-size: 13px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
	border: 1px solid rgba(0,0,0,0.1);
	white-space: nowrap;
	cursor: pointer;
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s, color 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	
	/* Speech bubble arrow */
	position: relative;
}

.wpml-custom-marker::after {
	content: '';
	position: absolute;
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 6px solid var(--marker-bg, #ffffff);
	transition: border-top-color 0.2s;
}

.wpml-custom-marker:hover,
.wpml-custom-marker.wpml-active {
	background-color: var(--marker-active-bg, #222222) !important;
	color: var(--marker-active-text, #ffffff) !important;
	transform: scale(1.1);
	z-index: 999999 !important;
}

.wpml-custom-marker:hover::after,
.wpml-custom-marker.wpml-active::after {
	border-top-color: var(--marker-active-bg, #222222) !important;
}

/* Custom Marker Popup content styling */
.wpml-popup-content {
	display: flex;
	width: 200px;
	flex-direction: column;
	font-family: 'Inter', sans-serif;
}

.wpml-popup-image {
	width: 100%;
	height: 100px;
	object-fit: cover;
	border-radius: 6px;
	margin-bottom: 8px;
}

.wpml-popup-title {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 4px 0;
}

.wpml-popup-title a {
	color: var(--wpml-text-dark);
	text-decoration: none;
}

.wpml-popup-subtitle {
	font-size: 12px;
	color: var(--wpml-text-gray);
	margin: 0 0 6px 0;
}

.wpml-popup-price {
	font-size: 14px;
	font-weight: 700;
}

/* Leaflet Popup Style Overrides */
.leaflet-popup-content-wrapper {
	border-radius: 12px;
	padding: 4px;
	box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.leaflet-popup-close-button {
	padding: 8px !important;
}

/* 5. Mobile Toggle & Responsive Rules */
.wpml-mobile-toggle {
	display: none;
}

@media (max-width: 1024px) {
	.wpml-split-layout {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 768px) {
	.wpml-wrapper {
		padding: 10px;
	}
	
	.wpml-search-bar {
		flex-direction: column;
		border-radius: 20px;
		padding: 12px;
		gap: 10px;
	}
	
	.wpml-search-field {
		border-right: none;
		border-bottom: 1px solid var(--wpml-border-color);
		width: 100%;
		padding-bottom: 10px;
	}
	
	.wpml-search-field:last-of-type {
		border-bottom: none;
	}
	
	.wpml-filter-toggle-btn {
		width: 100%;
		margin-left: 0;
		justify-content: center;
		height: 40px;
	}

	.wpml-filters-drawer {
		border-radius: 12px;
		padding: 16px;
		margin-bottom: 20px;
	}

	.wpml-drawer-inner {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.wpml-search-button {
		width: 100%;
		border-radius: 8px;
		margin-left: 0;
		height: 44px;
	}

	.wpml-meta-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}
	
	.wpml-split-layout {
		display: block; /* Disable grid */
		height: calc(100vh - 200px);
		position: relative;
	}
	
	.wpml-listings-pane,
	.wpml-map-pane {
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		transition: opacity 0.25s ease, visibility 0.25s ease;
	}
	
	/* Toggle Views */
	.wpml-wrapper:not(.wpml-show-map) .wpml-map-pane {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
	}

	.wpml-wrapper.wpml-show-map .wpml-listings-pane {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
	}
	
	.wpml-listings-grid {
		grid-template-columns: 1fr; /* Single column listings cards on mobile */
		gap: 16px;
	}
	
	/* Mobile Floating Button */
	.wpml-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		bottom: 24px;
		left: 50%;
		transform: translateX(-50%);
		background: #222222;
		color: #ffffff;
		border: none;
		padding: 12px 20px;
		border-radius: 24px;
		font-weight: 600;
		font-size: 14px;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
		cursor: pointer;
		z-index: 9999;
		transition: transform 0.15s, background-color 0.15s;
		gap: 8px;
	}
	
	.wpml-mobile-toggle:hover {
		background: #000000;
		transform: translateX(-50%) scale(1.05);
	}
	
	.wpml-mobile-toggle:active {
		transform: translateX(-50%) scale(0.95);
	}
	
	/* Toggle button text visibility state */
	.wpml-wrapper.wpml-show-map .wpml-mobile-toggle .toggle-list-text {
		display: none;
	}
	.wpml-wrapper:not(.wpml-show-map) .wpml-mobile-toggle .toggle-map-text {
		display: none;
	}
}
