/**
 * Propstack View Switcher CSS
 *
 * Styles for the view switcher buttons and map/list view layout.
 *
 * @package Propstack_Api_V1
 * @since   1.1.1
 */

/* ====================================================================
   View Switcher Buttons
   ==================================================================== */

.propstack-view-switcher-actions {
	display: flex;
	gap: 10px;
	margin-top: 20px;
	justify-content: center;

	button.propstack-view-btn {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 12px 24px;
		border: 1px solid var(--main-color, #D2720D);
		border-radius: 8px;
		font-size: 15px;
		font-weight: 500;
		color: #333333;
		cursor: pointer;
		transition: all 0.3s ease;
		text-decoration: none;

		.view-icon {
			font-size: 18px;
			display: inline-block;
		}

		&:hover {
			&:not(.active) {
				background-color: var(--main-color, #D2720D);
				color: var(--contrastColorInverted, #fff)
				/* border-color: #999999; */
				/* transform: translateY(-2px); */
				/* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
			}
			&.active {
				background-color: var(--main-color, #D2720D);
				border-color: var(--main-color, #D2720D);
				color: #ffffff;
				cursor: default;
			}
		}

		&:not(:hover):not(:active):not(.has-background) {
			background-color: #ffffff;

			&.active {
				background-color: var(--main-color, #D2720D);
				border-color: var(--main-color, #D2720D);
				color: #ffffff;
			}
		}

		&:disabled {
			opacity: 0.5;
			cursor: not-allowed;
			pointer-events: none;
		}

	}
}






/* ====================================================================
   Content Wrapper Layout
   ==================================================================== */

.propstack-content-wrapper {
	position: relative;
	width: 100%;

	@media (min-width: 1201px) {
		margin-top: 30px;
	}
	@media (max-width: 1200px) {
		flex-direction: column-reverse;
	}
}

.propstack-properties-list-wrapper {
	width: 100%;

	.propstack-pagination {
		display: none;
	}
}

.propstack-map-wrapper {
	width: 100%;
}

/* Default: List only view (full width) */
.propstack-content-wrapper.propstack-list-only .propstack-properties-list-wrapper {
	width: 100%;
}

.propstack-content-wrapper.propstack-list-only .propstack-map-wrapper {
	display: none;
}

/* Split view - show map and list side by side */
.propstack-content-wrapper.propstack-split-view {
	display: flex;
	gap: 20px;
	align-items: flex-start;
}

.propstack-content-wrapper.propstack-split-view .propstack-properties-list-wrapper {
	flex: 1;
	min-width: 0; /* Allow flex item to shrink */
}

.propstack-content-wrapper.propstack-split-view .propstack-map-wrapper {
	flex: 1;
	position: sticky;
	top: 20px;
	max-height: calc(100vh - 100px);
    padding-left: 15px;

	@media (min-width: 1201px) {
		max-width: 35%;
	}
}

/* Responsive: Stack on smaller screens */
@media (max-width: 991px) {
	.propstack-content-wrapper.propstack-split-view .propstack-properties-list-wrapper,
	.propstack-content-wrapper.propstack-split-view .propstack-map-wrapper {
		width: 100%;
		position: relative;
        padding-left: 0;
	}
}

/* ====================================================================
   Map Filter Info Bar
   ==================================================================== */

.propstack-map-filter-info {
	background: #f2f2f2;
	border-radius: 5px;
	padding: 3px 8px;
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
    display: none !important;
}

.propstack-map-filter-info .info-icon {
	font-size: 18px;
}

/* Animation when showing/hiding */
.propstack-property-card,
.real-estate-post {
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.propstack-property-card.propstack-filtered-out,
.real-estate-post.propstack-filtered-out {
	display: none !important;
}

/* ====================================================================
   Map Search Controls
   ==================================================================== */

.propstack-map-search-controls {
	display: flex;
	gap: 10px;
	padding-bottom: 10px;
	align-items: flex-end;
}

.propstack-map-search-input-wrapper {
	flex: 1;
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 100%;
}

.propstack-map-search-label,
.propstack-map-radius-label {
	font-size: 13px;
	font-weight: 600;
	color: #333333;
	margin: 0;
}

.propstack-map-location-input {
	width: 100%;
	padding: 10px 40px 10px 12px;
	border: 1px solid var(--main-color, #D2720D);;
	border-radius: 6px;
	font-size: 15px;
	transition: border-color 0.3s ease;
}

.propstack-map-location-input:focus {
	outline: none;
	border-color: var(--main-color, #D2720D);
}

.propstack-map-search-clear {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 28px;
	height: 28px;
	background: transparent;
	border: none;
	cursor: pointer;
	display: none;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: background 0.2s ease;
}

.propstack-map-search-clear:hover {
	background: #f0f0f0;
}

.propstack-map-search-clear .clear-icon {
	font-size: 20px;
	color: #666666;
}

.propstack-map-location-input:not(:placeholder-shown) + .propstack-map-search-clear {
	display: flex;
}

.propstack-map-radius-wrapper {
	min-width: 160px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.propstack-map-radius-select {
	padding: 10px 12px;
	font-size: 15px;
	background: #ffffff;
	cursor: pointer;
}

.propstack-map-radius-select:focus {
	outline: none;
}

/* ====================================================================
   Map Container
   ==================================================================== */
.propstack-overview-map-container {
	width: 100%;
	flex: 1;
	border-radius: 0 0 8px 8px;
	overflow: hidden;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
	/* max-height: 100dvh;
	min-height: 100dvh; */
	height: 100%;
	min-height: 300px;
	margin-bottom: 20px;
}

.propstack-map-no-properties {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	background: #f5f5f5;
	border: 2px dashed #cccccc;
	border-radius: 8px;
}

.propstack-map-no-properties p {
	font-size: 16px;
	color: #666666;
	margin: 0;
}

/* ====================================================================
   Map Info Window / Popup
   ==================================================================== */

.propstack-map-info-window {
	max-width: 250px;
}

.info-window-image {
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	margin-bottom: 12px;
	border-radius: 4px;
}

.info-window-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.info-window-content {
	padding: 0;
}

.info-window-title {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 8px 0;
	line-height: 1.3;
}

.info-window-title a {
	color: #333333;
	text-decoration: none;
}

.info-window-title a:hover {
	color: var(--main-color, #D2720D);
}

.info-window-price {
	font-size: 18px;
	font-weight: 700;
	color: var(--main-color, #D2720D);
	margin-bottom: 8px;
}

.info-window-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.info-window-meta .meta-item {
	font-size: 13px;
	color: #666666;
	padding: 4px 8px;
	background: #f5f5f5;
	border-radius: 4px;
}

.info-window-link {
	margin-top: 12px;
}

.info-window-link .btn {
	display: block;
	padding: 8px 16px;
	background-color: var(--main-color, #D2720D);
	color: #ffffff;
	text-decoration: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 500;
	transition: background 0.3s ease;
    &::before{
        content: none !important;
    }
}

.info-window-link .btn:hover {
	background: #005a87;
}

/* Google Maps specific adjustments */
.gm-style .propstack-map-info-window {
	padding: 5px;
}

/* Leaflet popup specific adjustments */
.leaflet-popup-content-wrapper {
	padding: 0;
}

.leaflet-popup-content {
	margin: 0;
	padding: 12px;
	width: auto !important;
}

/* ====================================================================
   Responsive Design
   ==================================================================== */

@media (max-width: 991px) {
	.propstack-view-switcher-actions {
		flex-direction: column;
	}

	.propstack-view-btn {
		width: 100%;
		justify-content: center;
	}

	.propstack-overview-map-container {
		height: 500px;
	}
}

@media (max-width: 767px) {
	.propstack-view-switcher-actions {
		gap: 8px;
		margin-top: 15px;
		padding-top: 15px;
	}

	.propstack-view-btn {
		padding: 10px 20px;
		font-size: 14px;
	}

	.propstack-map-search-controls {
		flex-direction: column;
		gap: 12px;
	}

	.propstack-map-radius-wrapper {
		min-width: auto;
		width: 100%;
	}

	.propstack-overview-map-container {
		height: 400px;
	}

	.propstack-map-info-window {
		max-width: 250px;
	}

	.info-window-image {
		height: 150px;
	}
}

/* ====================================================================
   Dark Mode Support
   ==================================================================== */

@media (prefers-color-scheme: dark) {
	.propstack-view-btn {
		background: #2c2c2c;
		border-color: #444444;
		color: #e0e0e0;
	}

	.propstack-view-btn:hover {
		background: #3a3a3a;
		border-color: #666666;
	}

	.propstack-view-btn.active {
		background-color: var(--main-color, #D2720D);
		border-color: var(--main-color, #D2720D);
		color: #ffffff;
	}

	.propstack-map-no-properties {
		background: #2c2c2c;
		border-color: #444444;
	}

	.propstack-map-no-properties p {
		color: #e0e0e0;
	}

	.info-window-title a {
		color: #e0e0e0;
	}

	.info-window-meta .meta-item {
		background: #3a3a3a;
		color: #e0e0e0;
	}
}

/* ====================================================================
   Print Styles
   ==================================================================== */

@media print {
	.propstack-view-switcher-actions {
		display: none;
	}

	.propstack-map-wrapper {
		display: none;
	}

	.propstack-properties-list-wrapper {
		width: 100% !important;
	}
}




/* TEMP */

.propstack-content-wrapper.propstack-split-view {
    gap: 0;
    align-items: stretch;
}

.propstack-content-wrapper.propstack-split-view .propstack-map-wrapper {
    position: relative;
    top: 0;
    /* max-height: none; */
    /* height: 100%; */
    display: flex;
    flex-direction: column;
	/* padding: 10px; */
	height: 90dvh
}
