/**
 * Nexta Properties — Mobile App Experience
 * Activates only on screens ≤ 900px wide.
 * Transforms the website into a native-app-like interface.
 */

@media (max-width: 900px) {

	/* =================================================================
	   GLOBAL MOBILE RESETS
	   ================================================================= */
	body.nexta-mobile {
		padding-bottom: 64px !important; /* room for bottom nav */
		-webkit-tap-highlight-color: transparent;
	}
	body.nexta-mobile * {
		-webkit-tap-highlight-color: transparent;
	}

	/* Hide WP admin bar on mobile (it eats screen space) */
	body.nexta-mobile.admin-bar #wpadminbar { display: none !important; }
	body.nexta-mobile.admin-bar { margin-top: 0 !important; }
	body.nexta-mobile.admin-bar html { margin-top: 0 !important; }

	/* =================================================================
	   APP HEADER — auto-hides on scroll-down
	   ================================================================= */
	.nexta-app-header {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		height: 56px;
		background: rgba(255, 255, 255, 0.95);
		backdrop-filter: saturate(180%) blur(20px);
		-webkit-backdrop-filter: saturate(180%) blur(20px);
		border-bottom: 1px solid rgba(232, 226, 212, 0.6);
		z-index: 1000;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 16px;
		transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
		font-family: inherit;
	}
	.nexta-app-header.is-hidden {
		transform: translateY(-100%);
	}
	.nexta-app-header-logo {
		font-family: 'Playfair Display', Georgia, serif;
		font-size: 22px;
		font-weight: 600;
		color: #0a1628;
		text-decoration: none;
		letter-spacing: 0.02em;
	}
	.nexta-app-header-logo span { color: #c9a876; }
	.nexta-app-header-actions {
		display: flex;
		align-items: center;
		gap: 8px;
	}
	.nexta-app-header-btn {
		width: 38px;
		height: 38px;
		border-radius: 50%;
		background: transparent;
		border: none;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #0a1628;
		cursor: pointer;
		padding: 0;
		transition: background 0.15s ease;
	}
	.nexta-app-header-btn:active {
		background: rgba(10, 22, 40, 0.08);
	}

	/* Push body content below the fixed header */
	body.nexta-mobile .nexta-archive-wrap,
	body.nexta-mobile .nexta-app-content {
		padding-top: 56px;
	}

	/* =================================================================
	   BOTTOM NAVIGATION BAR — like Airbnb
	   ================================================================= */
	.nexta-bottom-nav {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		height: 64px;
		background: rgba(255, 255, 255, 0.97);
		backdrop-filter: saturate(180%) blur(20px);
		-webkit-backdrop-filter: saturate(180%) blur(20px);
		border-top: 1px solid rgba(232, 226, 212, 0.8);
		display: flex;
		align-items: center;
		justify-content: space-around;
		padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
		z-index: 1000;
		font-family: inherit;
	}
	.nexta-bottom-nav-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		flex: 1;
		padding: 4px 0;
		color: #888;
		text-decoration: none;
		font-size: 10px;
		font-weight: 600;
		letter-spacing: 0.02em;
		transition: color 0.15s ease;
		cursor: pointer;
		background: none;
		border: none;
		font-family: inherit;
	}
	.nexta-bottom-nav-item.is-active {
		color: #c9a876;
	}
	.nexta-bottom-nav-item:active {
		transform: scale(0.95);
	}
	.nexta-bottom-nav-item svg {
		width: 22px;
		height: 22px;
		stroke-width: 1.6;
	}
	.nexta-bottom-nav-item.is-active svg {
		stroke-width: 2;
	}

	/* =================================================================
	   MAP-LIST PAGE — Map full-screen by default, list slides up
	   ================================================================= */
	.nexta-maplist {
		position: fixed;
		top: 56px;
		left: 0;
		right: 0;
		bottom: 64px;
		display: block !important;
	}

	/* Hide the desktop top filter bar */
	.nexta-maplist .nexta-ml-filters {
		position: fixed;
		top: 56px;
		left: 0;
		right: 0;
		z-index: 50;
		padding: 10px 14px;
		gap: 8px;
		overflow-x: auto;
		flex-wrap: nowrap;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		background: rgba(255, 255, 255, 0.95);
		backdrop-filter: saturate(180%) blur(20px);
		border-bottom: 1px solid rgba(232, 226, 212, 0.6);
		box-shadow: none;
	}
	.nexta-maplist .nexta-ml-filters::-webkit-scrollbar { display: none; }
	.nexta-maplist .nexta-ml-filter-btn {
		flex-shrink: 0;
		padding: 8px 14px;
		font-size: 12px;
		border-radius: 100px;
	}
	.nexta-maplist .nexta-ml-tools {
		display: none;
	}

	/* Hide count bar - the bottom sheet header shows it */
	.nexta-maplist .nexta-ml-count { display: none; }

	/* The split — map takes the full viewport */
	.nexta-maplist .nexta-ml-split {
		display: block;
		height: 100%;
		max-height: none;
		min-height: 0;
	}
	.nexta-maplist .nexta-ml-map-pane {
		position: absolute;
		inset: 0;
		top: 52px; /* space for filter bar */
		display: block !important;
		border-right: none;
	}

	/* The list becomes a bottom sheet */
	.nexta-maplist .nexta-ml-list-pane {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 64px; /* above bottom nav */
		max-height: 75vh;
		min-height: 100px;
		background: #fff;
		border-top-left-radius: 16px;
		border-top-right-radius: 16px;
		box-shadow: 0 -8px 32px rgba(10, 22, 40, 0.18);
		z-index: 100;
		transition: transform 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
		transform: translateY(calc(100% - 80px));
		border-right: none;
		overflow: hidden;
		display: flex !important;
		flex-direction: column;
	}
	.nexta-maplist .nexta-ml-list-pane.is-expanded {
		transform: translateY(0);
	}

	/* Drag handle at the top of the bottom sheet */
	.nexta-ml-sheet-handle {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 10px 16px 12px;
		cursor: pointer;
		flex-shrink: 0;
		user-select: none;
		-webkit-user-select: none;
		touch-action: none;
	}
	.nexta-ml-sheet-handle::before {
		content: '';
		width: 36px;
		height: 4px;
		background: #ccc;
		border-radius: 2px;
		margin-bottom: 8px;
	}
	.nexta-ml-sheet-handle-text {
		font-size: 13px;
		color: #0a1628;
		font-weight: 600;
	}
	.nexta-ml-sheet-handle-text strong {
		color: #c9a876;
	}

	/* List inside the bottom sheet */
	.nexta-maplist .nexta-ml-list-pane {
		overflow: hidden;
	}
	.nexta-ml-list-scroll {
		overflow-y: auto;
		flex: 1;
		-webkit-overflow-scrolling: touch;
	}
	.nexta-maplist .nexta-ml-list {
		display: grid;
		grid-template-columns: 1fr;
		gap: 14px;
		padding: 0 14px 20px;
	}

	/* Property cards on mobile - more compact */
	.nexta-maplist .nexta-ml-card {
		display: grid;
		grid-template-columns: 130px 1fr;
		gap: 0;
		border-radius: 12px;
	}
	.nexta-maplist .nexta-ml-card-image {
		aspect-ratio: 1/1;
	}
	.nexta-maplist .nexta-ml-card-body {
		padding: 12px 14px;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}
	.nexta-maplist .nexta-ml-card-price {
		font-size: 17px;
	}
	.nexta-maplist .nexta-ml-card-title {
		font-size: 13px;
		-webkit-line-clamp: 1;
	}
	.nexta-maplist .nexta-ml-card-address {
		font-size: 11px;
		margin-bottom: 6px;
	}
	.nexta-maplist .nexta-ml-card-meta {
		gap: 10px;
		padding-top: 8px;
		font-size: 11px;
	}

	/* Hide favorite/photo count badges on mobile cards */
	.nexta-maplist .nexta-ml-card-fav {
		width: 30px;
		height: 30px;
		top: 8px;
		right: 8px;
	}
	.nexta-maplist .nexta-ml-card-photos { display: none; }
	.nexta-maplist .nexta-ml-card-badge {
		font-size: 9px;
		padding: 3px 8px;
		top: 8px;
		left: 8px;
	}

	/* =================================================================
	   FILTER BOTTOM SHEET — slides up when filter button tapped
	   ================================================================= */
	.nexta-maplist .nexta-ml-filter-dropdown {
		position: fixed;
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		max-height: 80vh;
		border-radius: 16px 16px 0 0;
		padding: 24px 20px calc(40px + env(safe-area-inset-bottom));
		min-width: 0;
		box-shadow: 0 -8px 32px rgba(10, 22, 40, 0.25);
		z-index: 2000;
		transform: translateY(100%);
		transition: transform 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
		display: block;
	}
	.nexta-maplist .nexta-ml-filter-group.is-open .nexta-ml-filter-dropdown {
		transform: translateY(0);
	}
	.nexta-maplist .nexta-ml-filter-group.is-open .nexta-ml-filter-dropdown::before {
		content: '';
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: -1;
	}
	.nexta-maplist .nexta-ml-filter-dropdown::after {
		content: '';
		position: absolute;
		top: 8px;
		left: 50%;
		transform: translateX(-50%);
		width: 40px;
		height: 4px;
		background: #ddd;
		border-radius: 2px;
	}
	.nexta-maplist .nexta-ml-filter-dropdown label {
		font-size: 13px;
		margin-bottom: 12px;
	}
	.nexta-maplist .nexta-ml-filter-dropdown input,
	.nexta-maplist .nexta-ml-filter-dropdown select {
		font-size: 16px; /* prevent iOS zoom on focus */
		padding: 12px 14px;
	}
	.nexta-maplist .nexta-ml-filter-actions button {
		padding: 14px 16px;
		font-size: 14px;
	}

	/* =================================================================
	   LANGUAGE SWITCHER on mobile — also a bottom sheet
	   ================================================================= */
	.nexta-lang-dropdown {
		position: fixed !important;
		top: auto !important;
		bottom: 0 !important;
		left: 0 !important;
		right: 0 !important;
		border-radius: 16px 16px 0 0 !important;
		padding: 24px 0 calc(30px + env(safe-area-inset-bottom)) !important;
	}
	.nexta-lang-option {
		padding: 16px 20px !important;
		font-size: 15px !important;
	}

	/* =================================================================
	   PRICE PINS on mobile — slightly smaller
	   ================================================================= */
	.nexta-ml-pin {
		font-size: 11px;
		padding: 5px 9px;
	}

	/* =================================================================
	   SINGLE PROPERTY PAGE — full-screen mobile layout
	   ================================================================= */
	body.nexta-mobile.single-property,
	body.nexta-mobile.single-property #content,
	body.nexta-mobile.single-property .site-content,
	body.nexta-mobile.single-property main {
		padding-top: 0 !important;
		margin-top: 0 !important;
	}

	body.nexta-mobile.single-property .nexta-app-header {
		background: transparent;
		border-bottom: none;
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}
	body.nexta-mobile.single-property .nexta-app-header-logo { display: none; }
	body.nexta-mobile.single-property .nexta-app-header-actions {
		width: 100%;
		justify-content: space-between;
	}
	body.nexta-mobile.single-property .nexta-app-header-btn {
		background: rgba(255, 255, 255, 0.85);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		box-shadow: 0 2px 8px rgba(10, 22, 40, 0.15);
	}
	body.nexta-mobile.single-property .nexta-app-header.is-scrolled {
		background: rgba(255, 255, 255, 0.95);
		backdrop-filter: saturate(180%) blur(20px);
		-webkit-backdrop-filter: saturate(180%) blur(20px);
		border-bottom: 1px solid rgba(232, 226, 212, 0.6);
	}
	body.nexta-mobile.single-property .nexta-app-header.is-scrolled .nexta-app-header-logo {
		display: block;
	}
	body.nexta-mobile.single-property .nexta-app-header.is-scrolled .nexta-app-header-btn {
		background: transparent;
		box-shadow: none;
	}

	/* =================================================================
	   FULL-SCREEN PHOTO LIGHTBOX (swipeable)
	   ================================================================= */
	.nexta-ml-lightbox {
		position: fixed;
		inset: 0;
		background: #000;
		z-index: 9999;
		display: none;
		flex-direction: column;
		opacity: 0;
		transition: opacity 0.25s ease;
	}
	.nexta-ml-lightbox.is-open {
		display: flex;
		opacity: 1;
	}
	.nexta-ml-lightbox-header {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		padding: calc(env(safe-area-inset-top, 0) + 14px) 14px 14px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		z-index: 10;
		color: #fff;
		background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent);
	}
	.nexta-ml-lightbox-counter {
		font-size: 14px;
		font-weight: 600;
	}
	.nexta-ml-lightbox-close {
		width: 40px;
		height: 40px;
		border-radius: 50%;
		background: rgba(255, 255, 255, 0.15);
		backdrop-filter: blur(10px);
		border: none;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		cursor: pointer;
	}
	.nexta-ml-lightbox-track {
		flex: 1;
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.nexta-ml-lightbox-track::-webkit-scrollbar { display: none; }
	.nexta-ml-lightbox-slide {
		flex: 0 0 100%;
		height: 100%;
		scroll-snap-align: start;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 60px 0;
	}
	.nexta-ml-lightbox-slide img {
		max-width: 100%;
		max-height: 100%;
		object-fit: contain;
	}

	/* =================================================================
	   PWA INSTALL PROMPT
	   ================================================================= */
	.nexta-install-banner {
		position: fixed;
		bottom: calc(64px + env(safe-area-inset-bottom));
		left: 12px;
		right: 12px;
		background: linear-gradient(135deg, #0a1628, #1a2942);
		color: #fff;
		border-radius: 12px;
		padding: 14px 16px;
		display: flex;
		align-items: center;
		gap: 12px;
		box-shadow: 0 8px 24px rgba(10, 22, 40, 0.35);
		z-index: 999;
		transform: translateY(calc(100% + 80px));
		transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
		font-family: inherit;
	}
	.nexta-install-banner.is-shown {
		transform: translateY(0);
	}
	.nexta-install-banner-icon {
		width: 44px;
		height: 44px;
		border-radius: 10px;
		background: linear-gradient(135deg, #c9a876, #a88652);
		display: flex;
		align-items: center;
		justify-content: center;
		font-family: 'Playfair Display', Georgia, serif;
		font-size: 22px;
		font-weight: 600;
		color: #0a1628;
		flex-shrink: 0;
	}
	.nexta-install-banner-text {
		flex: 1;
		min-width: 0;
	}
	.nexta-install-banner-title {
		font-size: 13px;
		font-weight: 600;
		margin-bottom: 2px;
	}
	.nexta-install-banner-desc {
		font-size: 11px;
		color: rgba(255, 255, 255, 0.7);
		line-height: 1.3;
	}
	.nexta-install-banner-btn {
		background: #c9a876;
		color: #0a1628;
		border: none;
		padding: 8px 14px;
		border-radius: 6px;
		font-size: 12px;
		font-weight: 700;
		cursor: pointer;
		font-family: inherit;
		flex-shrink: 0;
	}
	.nexta-install-banner-close {
		background: none;
		border: none;
		color: rgba(255, 255, 255, 0.5);
		font-size: 22px;
		cursor: pointer;
		padding: 4px 8px;
		flex-shrink: 0;
	}

	/* =================================================================
	   SHORTCODE PROPERTY GRID — mobile layout
	   ================================================================= */
	.nexta-prop-list {
		grid-template-columns: 1fr !important;
		gap: 14px !important;
	}

}

/* =================================================================
   DESKTOP: hide all mobile-only chrome
   ================================================================= */
@media (min-width: 901px) {
	.nexta-app-header,
	.nexta-bottom-nav,
	.nexta-ml-sheet-handle,
	.nexta-ml-lightbox,
	.nexta-install-banner {
		display: none !important;
	}
}
