/**
 * Google Maps + What's Nearby — Community Page Builder
 *
 * Shared map canvas, InfoWindow, What's Nearby panel, and per-theme
 * palette overrides for all six theme templates.
 *
 * @package    AI_Community_Page_Builder
 * @subpackage AI_Community_Page_Builder/public/css
 * @since      1.0.0
 */

/* ==========================================================================
   MAP CANVAS — shared by every theme
   ========================================================================== */

.cpb-community-map {
	display: block;
	width: 100%;
	height: 420px;
	min-height: 280px;
	background: #e8edf2;
	overflow: hidden;
}

/* ==========================================================================
   60/40 MAP + PANEL WRAPPER
   ========================================================================== */

.cpb-map-with-panel {
	display: flex;
	gap: 0;
	/* Explicit height so children can resolve height: 100% correctly.
	   Google Maps requires a non-zero height on its container; flex items
	   with height: 100% need an ancestor with an explicit height value
	   (not just min-height) to resolve against. */
	height: 420px;
	border-radius: 6px;
	overflow: hidden;
}

.cpb-map-with-panel__map {
	flex: 0 0 60%;
	max-width: 60%;
	position: relative;
	/* Explicitly fill the flex container height so Google Maps renders. */
	height: 100%;
}

.cpb-map-with-panel__map .cpb-community-map {
	/* Fill parent — works because .cpb-map-with-panel has explicit height. */
	height: 100%;
	border-radius: 0;
}

/* ==========================================================================
   WHAT'S NEARBY PANEL
   ========================================================================== */

.cpb-whats-nearby {
	flex: 0 0 40%;
	max-width: 40%;
	/* Fill the flex container height. */
	height: 100%;
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border-left: 1px solid #e5e7eb;
	overflow: hidden;
}

.cpb-wn-title {
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #374151;
	margin: 0;
	padding: 1rem 1rem 0.5rem;
	flex-shrink: 0;
}

/* ---- Tabs ---- */

.cpb-wn-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 0 0.75rem 0.75rem;
	border-bottom: 1px solid #f3f4f6;
	flex-shrink: 0;
}

.cpb-wn-tab {
	appearance: none;
	-webkit-appearance: none;
	background: #f3f4f6;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	padding: 4px 8px;
	font-size: 0.7rem;
	font-weight: 600;
	color: #6b7280;
	cursor: pointer;
	line-height: 1.3;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	white-space: nowrap;
}

.cpb-wn-tab:hover {
	background: #e5e7eb;
	color: #374151;
}

.cpb-wn-tab--active {
	background: #2563eb;
	border-color: #2563eb;
	color: #ffffff;
}

.cpb-wn-tab--active:hover {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #ffffff;
}

/* ---- List ---- */

.cpb-wn-list {
	list-style: none;
	margin: 0;
	padding: 0.5rem 0;
	overflow-y: auto;
	flex: 1 1 auto;
	min-height: 0;
}

.cpb-wn-item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 7px 1rem;
	cursor: pointer;
	transition: background 0.1s ease;
	border-radius: 0;
}

.cpb-wn-item:hover,
.cpb-wn-item--hover {
	background: #f9fafb;
}

.cpb-wn-item--hidden {
	display: none;
}

.cpb-wn-item__dot {
	flex-shrink: 0;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.7);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
	margin-top: 3px;
}

.cpb-wn-item__name {
	font-size: 0.82rem;
	font-weight: 600;
	color: #111827;
	line-height: 1.35;
}

.cpb-wn-item__info {
	display: block;
	font-size: 0.72rem;
	color: #6b7280;
	margin-top: 1px;
}

/* ==========================================================================
   INFO WINDOW — popup on marker click
   ========================================================================== */

.cpb-map-info {
	padding: 4px 2px;
	min-width: 140px;
	max-width: 220px;
	font-family: inherit;
	line-height: 1.45;
}

.cpb-map-info__name {
	display: block;
	font-size: 0.9rem;
	font-weight: 700;
	color: #111827;
	margin-bottom: 4px;
}

.cpb-map-info__desc {
	font-size: 0.8rem;
	color: #4b5563;
	margin: 0 0 6px;
}

.cpb-map-info__cat {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #2563eb;
	background: #eff6ff;
	border-radius: 3px;
	padding: 2px 6px;
}

/* ==========================================================================
   INLINE AGENT CARDS (Modern, Farmhouse — after sidebar removal)
   ========================================================================== */

.cpb-m-agent-card--inline,
.cpb-fh-agent-card--inline,
.cpb-la-agent-card--inline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.25rem;
	padding: 1.5rem;
	border-radius: 8px;
	margin: 2rem 0;
}

.cpb-m-agent-card--inline {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
}

.cpb-fh-agent-card--inline {
	background: #fdf8f1;
	border: 1px solid #e0d5c0;
}

.cpb-la-agent-card--inline {
	background: #fdfcfb;
	border-top: 1px solid #ede9e0;
	border-bottom: 1px solid #ede9e0;
	border-radius: 0;
}

.cpb-m-agent-card--inline .cpb-m-agent-card__photo,
.cpb-fh-agent-card--inline .cpb-fh-agent-card__photo,
.cpb-la-agent-card--inline .cpb-la-agent-card__photo {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.cpb-m-agent-card--inline .cpb-m-agent-card__photo-placeholder,
.cpb-fh-agent-card--inline .cpb-fh-agent-card__photo-placeholder,
.cpb-la-agent-card--inline .cpb-la-agent-card__photo-placeholder {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: #2563eb;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.4rem;
	font-weight: 700;
	flex-shrink: 0;
}

/* Nearby communities inline cards */

.cpb-m-nearby-card,
.cpb-fh-nearby-card,
.cpb-la-nearby-card {
	padding: 1.25rem 1.5rem;
	border-radius: 6px;
	margin: 1.5rem 0;
}

.cpb-m-nearby-card {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
}

.cpb-fh-nearby-card {
	background: #fdf8f1;
	border: 1px solid #e0d5c0;
}

.cpb-la-nearby-card {
	border-top: 1px solid #ede9e0;
}

.cpb-m-nearby-card__title,
.cpb-fh-nearby-card__title,
.cpb-la-nearby-card__title {
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0 0 0.75rem;
}

.cpb-m-nearby-card__title  { color: #374151; }
.cpb-fh-nearby-card__title { color: #6b5740; }
.cpb-la-nearby-card__title { color: #a89070; }

/* ==========================================================================
   PER-THEME MAP HEIGHT + PANEL PALETTE OVERRIDES
   ========================================================================== */

/* Modern */
.cpb-theme-modern .cpb-map-with-panel { height: 380px; }

/* Luxury — dark panel */
.cpb-theme-luxury .cpb-map-with-panel { height: 460px; }
.cpb-theme-luxury .cpb-whats-nearby {
	background: #1a2535;
	border-left-color: #2c3a4e;
}
.cpb-theme-luxury .cpb-wn-title { color: #c9a84c; }
.cpb-theme-luxury .cpb-wn-tabs  { border-bottom-color: #2c3a4e; }
.cpb-theme-luxury .cpb-wn-tab {
	background: #222d3d;
	border-color: #2c3a4e;
	color: #9ca5b3;
}
.cpb-theme-luxury .cpb-wn-tab:hover { background: #2c3a4e; color: #e2e8f0; }
.cpb-theme-luxury .cpb-wn-tab--active {
	background: #c9a84c;
	border-color: #c9a84c;
	color: #1c2331;
}
.cpb-theme-luxury .cpb-wn-tab--active:hover { background: #b8964a; border-color: #b8964a; }
.cpb-theme-luxury .cpb-wn-item:hover,
.cpb-theme-luxury .cpb-wn-item--hover { background: #222d3d; }
.cpb-theme-luxury .cpb-wn-item__name { color: #e2d5bc; }
.cpb-theme-luxury .cpb-wn-item__info { color: #8a7a5c; }
.cpb-theme-luxury .cpb-map-info__cat  { color: #c9a84c; background: rgba(201,168,76,0.12); }


/* Coastal — sandy/teal panel */
.cpb-theme-coastal .cpb-map-with-panel { height: 450px; }
.cpb-theme-coastal .cpb-whats-nearby {
	background: #f0f8ff;
	border-left-color: #cce0ee;
}
.cpb-theme-coastal .cpb-wn-title { color: #1e5f8c; }
.cpb-theme-coastal .cpb-wn-tabs  { border-bottom-color: #cce0ee; }
.cpb-theme-coastal .cpb-wn-tab {
	background: #e8f4f0;
	border-color: #cce0ee;
	color: #4a7ea0;
}
.cpb-theme-coastal .cpb-wn-tab:hover { background: #cce0ee; color: #1e5f8c; }
.cpb-theme-coastal .cpb-wn-tab--active {
	background: #4a90b8;
	border-color: #4a90b8;
	color: #ffffff;
}
.cpb-theme-coastal .cpb-wn-tab--active:hover { background: #3a7fa6; border-color: #3a7fa6; }
.cpb-theme-coastal .cpb-wn-item:hover,
.cpb-theme-coastal .cpb-wn-item--hover { background: #e0f0f8; }
.cpb-theme-coastal .cpb-wn-item__name { color: #1e4060; }
.cpb-theme-coastal .cpb-wn-item__info { color: #4a90b8; }

/* Farmhouse — warm earthy panel */
.cpb-theme-farmhouse .cpb-map-with-panel { height: 380px; }
.cpb-theme-farmhouse .cpb-whats-nearby {
	background: #fdf8f1;
	border-left-color: #e0d5c0;
}
.cpb-theme-farmhouse .cpb-wn-title { color: #6b5740; }
.cpb-theme-farmhouse .cpb-wn-tabs  { border-bottom-color: #e8dcc8; }
.cpb-theme-farmhouse .cpb-wn-tab {
	background: #f2e8d5;
	border-color: #e0d5c0;
	color: #8a7060;
}
.cpb-theme-farmhouse .cpb-wn-tab:hover { background: #e8dcc8; color: #6b5740; }
.cpb-theme-farmhouse .cpb-wn-tab--active {
	background: #7c9a6e;
	border-color: #7c9a6e;
	color: #ffffff;
}
.cpb-theme-farmhouse .cpb-wn-tab--active:hover { background: #6b8860; border-color: #6b8860; }
.cpb-theme-farmhouse .cpb-wn-item:hover,
.cpb-theme-farmhouse .cpb-wn-item--hover { background: #f2e8d5; }
.cpb-theme-farmhouse .cpb-wn-item__name { color: #4a3828; }
.cpb-theme-farmhouse .cpb-wn-item__info { color: #8a7060; }


/* ==========================================================================
   RESPONSIVE — stack panel below map on mobile
   ========================================================================== */

@media ( max-width: 768px ) {
	.cpb-map-with-panel,
	.cpb-theme-modern .cpb-map-with-panel,
	.cpb-theme-luxury .cpb-map-with-panel,
	.cpb-theme-coastal .cpb-map-with-panel,
	.cpb-theme-farmhouse .cpb-map-with-panel {
		flex-direction: column;
		height: auto;
		overflow: visible;
	}

	.cpb-map-with-panel__map,
	.cpb-whats-nearby {
		flex: none;
		max-width: 100%;
		width: 100%;
		height: auto;
	}

	.cpb-map-with-panel__map .cpb-community-map {
		height: 300px;
		min-height: 220px;
	}

	.cpb-whats-nearby {
		border-left: none;
		border-top: 1px solid #e5e7eb;
		max-height: none;
		overflow: visible;
	}

	.cpb-wn-list {
		overflow-y: visible;
	}

	.cpb-wn-tabs {
		overflow-x: auto;
		flex-wrap: nowrap;
		scrollbar-width: none;
	}
	.cpb-wn-tabs::-webkit-scrollbar { display: none; }
}
