/**
 * PlaidCars EV Chargers — map styles.
 *
 * Layout: .evc-map-wrap is a column of:
 *   1. .evc-map-area  — the map itself (flex-grow), holds floating search + drawer + backdrop
 *   2. .evc-toolbar   — chip filters + reset
 *   3. .evc-data-attribution
 *
 * Drawer uses a bottom-sheet pattern on mobile (half/full states, drag handle),
 * a right-side card on desktop.
 *
 * Typography: system font stack, 15px base, 1.45 line-height. Color ramp is
 * monochrome grays with accent colors per-network.
 */

.evc-map-wrap {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
	background: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: #1f2937;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid #e5e7eb;
}

/* === Fullscreen mode ===
 * Map-first page pattern (Google Maps / openchargemap.io).
 * - Breaks out of the site's content container to full viewport width.
 * - Fills the viewport height below the site header using dvh (handles mobile
 *   URL-bar collapse without gaps).
 * - Filter toolbar stays compact; the map eats the rest.
 * Header offset defaults to 64px; override per-shortcode with `header_offset="96"`
 * or site-wide by setting `--evc-header-offset` on the theme's body.
 *
 * Recommended page setup:
 *   - In WP Page editor, choose Astra page layout "Full Width — Stretched"
 *     (Settings → Astra → Disable title + Disable content padding).
 *   - Drop this shortcode alone on the page: [ev_chargers_map fullscreen="1"]
 */
.evc-wrap--fullscreen {
	--evc-header-offset: 64px;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	height: calc(100dvh - var(--evc-header-offset));
	/* Fallback for browsers without dvh support. */
	height: calc(100vh - var(--evc-header-offset));
	border-radius: 0;
	border: 0;
	border-top: 1px solid #eef0f3;
}
@supports (height: 100svh) {
	.evc-wrap--fullscreen { min-height: calc(100svh - var(--evc-header-offset)); }
}

/* In fullscreen the map area takes the whole wrap height; the toolbar is
 * absolutely positioned *over* the map (Google/Apple Maps pattern) so the
 * map isn't pushed down by a separate strip. Only applies when the map is
 * wide enough to host floating filters (>= 720px); narrower viewports keep
 * the toolbar stacked below for thumb-reach. */
.evc-wrap--fullscreen .evc-map-area { flex: 1 1 auto; min-height: 0; }
.evc-wrap--fullscreen .evc-toolbar {
	padding: 8px 12px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
@media (min-width: 720px) {
	.evc-wrap--fullscreen .evc-toolbar {
		position: absolute;
		top: 60px;        /* sit below the search bar */
		left: 12px;
		right: 12px;
		z-index: 500;
		background: rgba(255, 255, 255, 0.96);
		backdrop-filter: saturate(160%) blur(6px);
		-webkit-backdrop-filter: saturate(160%) blur(6px);
		border: 1px solid #e5e7eb;
		border-radius: 12px;
		box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
		pointer-events: auto;
	}
	/* Data attribution also floats, bottom-left, so we don't eat vertical space. */
	.evc-wrap--fullscreen .evc-data-attribution {
		position: absolute;
		bottom: 8px; left: 12px;
		background: rgba(255, 255, 255, 0.92);
		border: 1px solid #e5e7eb;
		border-radius: 8px;
		padding: 4px 10px;
		font-size: 11px;
		z-index: 500;
		max-width: calc(100% - 100px);
	}
}
.evc-wrap--fullscreen .evc-data-attribution {
	/* Shorter footer so the map has more room. */
	font-size: 11px; padding: 5px 12px;
}
@media (max-width: 540px) {
	/* Mobile fullscreen: collapse filter groups into a single horizontal scroll
	 * strip so the map owns the screen. */
	.evc-wrap--fullscreen .evc-toolbar {
		flex-direction: row;
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 8px;
		padding: 6px 10px;
		scrollbar-width: none;
	}
	.evc-wrap--fullscreen .evc-toolbar::-webkit-scrollbar { display: none; }
	.evc-wrap--fullscreen .evc-filter-group {
		flex: 0 0 auto;
		flex-direction: row;
		align-items: center;
		gap: 6px;
	}
	.evc-wrap--fullscreen .evc-group-label {
		flex: 0 0 auto;
		font-size: 10px;
	}
	.evc-wrap--fullscreen .evc-reset {
		position: static;
		flex: 0 0 auto;
	}
}

/* === Map area === */
.evc-map-area {
	position: relative;
	flex: 1 1 auto;
	min-height: 340px;
}
.evc-map { width: 100%; height: 100%; min-height: 340px; }
.leaflet-container { background: #eef2f5; }

/* Pins */
.evc-pin-wrap { background: transparent !important; border: 0 !important; }

/* Cluster bubbles — dominant-network color with a count. */
.evc-cluster-wrap { background: transparent !important; border: 0 !important; }
.evc-cluster {
	background: var(--c, #2c3e50);
	color: #fff;
	border: 2px solid #fff;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 13px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* === Floating search bar ===
 * Sits top-left of the map. Font-size explicitly set so Astra (or any parent
 * theme) can't swell it. Width caps to the map width on mobile so the
 * placeholder never clips. */
.evc-searchbar {
	position: absolute;
	top: 12px; left: 12px;
	display: flex; align-items: center;
	gap: 4px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 4px 6px 4px 10px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	z-index: 500;
	width: 260px; max-width: calc(100% - 24px);
}
.evc-searchbar .evc-search-icon { color: #6b7280; flex-shrink: 0; }
.evc-search {
	border: 0; background: transparent; outline: none;
	font-size: 13px !important;
	line-height: 1.4 !important;
	padding: 4px 2px;
	width: 100%;
	min-width: 0;
	color: #111827;
	font-family: inherit;
}
.evc-search::placeholder { font-size: 13px; color: #9ca3af; opacity: 1; }
@media (max-width: 540px) {
	.evc-searchbar { width: calc(100% - 24px); }
}
.evc-locate {
	border: 0; background: transparent;
	padding: 6px;
	color: #374151;
	border-radius: 6px;
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
}
.evc-locate:hover { background: #f3f4f6; }

/* === Overlay (loading / empty / hint) — pill, no phantom border === */
.evc-overlay {
	position: absolute;
	top: 68px;
	left: 50%;
	transform: translateX(-50%);
	display: flex; align-items: center; gap: 8px;
	background: #fff;
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 13px; color: #374151;
	box-shadow: 0 2px 10px rgba(0,0,0,0.1);
	z-index: 500; pointer-events: none;
	white-space: nowrap;
}
/* Don't render overlay box when hidden — [hidden] already sets display:none; this
   makes extra sure any previous "phantom outline" is gone. */
.evc-overlay[hidden] { display: none !important; }
.evc-overlay--empty { background: #fff7ed; color: #9a3412; }
.evc-overlay--hint  { background: #eef2ff; color: #3730a3; }

.evc-spinner {
	display: inline-block; width: 14px; height: 14px;
	border: 2px solid #e5e7eb; border-top-color: #374151;
	border-radius: 50%;
	animation: evc-spin 0.7s linear infinite;
}
@keyframes evc-spin { to { transform: rotate(360deg); } }

/* === Backdrop (click-outside to dismiss drawer) === */
.evc-backdrop {
	position: absolute; inset: 0;
	background: rgba(15, 23, 42, 0.35);
	z-index: 900;
}
.evc-backdrop[hidden] { display: none; }
@media (min-width: 768px) {
	.evc-backdrop { background: transparent; }
}

/* === Chip filter toolbar ===
 * Each filter category is its own row (Provider / Adapter / Speed / Emirate).
 * On narrow viewports the label sits above the chips; on wider it sits in a
 * left gutter so chip rows align. */
.evc-toolbar {
	display: flex; flex-direction: column;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid #eef0f3;
	background: #fafbfc;
	position: relative;
}
.evc-filter-group {
	display: flex; flex-wrap: wrap; align-items: center;
	gap: 4px 12px;
}
.evc-group-label {
	font-size: 11px; font-weight: 700; color: #6b7280;
	text-transform: uppercase; letter-spacing: 0.08em;
	flex: 0 0 72px;
	min-width: 72px;
}
.evc-chips {
	display: flex; flex-wrap: wrap; gap: 6px;
	align-items: center;
	flex: 1 1 auto;
}
@media (max-width: 540px) {
	.evc-filter-group { flex-direction: column; align-items: flex-start; gap: 2px; }
	.evc-group-label { flex: 0 0 auto; min-width: 0; }
}
.evc-chip {
	display: inline-flex; align-items: center; gap: 6px;
	background: #fff;
	border: 1px solid #d1d5db;
	color: #374151;
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 13px; font-weight: 500;
	cursor: pointer;
	transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.evc-chip:hover { background: #f3f4f6; border-color: #9ca3af; }
.evc-chip.is-active {
	background: #111827;
	color: #fff;
	border-color: #111827;
}
.evc-chip.is-active .evc-chip-count { color: rgba(255,255,255,0.7); }
.evc-chip-dot {
	width: 8px; height: 8px; border-radius: 50%;
	background: #9ca3af;
}
.evc-chip-icon {
	display: inline-flex; width: 16px; height: 16px;
	align-items: center; justify-content: center;
}
.evc-chip-icon svg { width: 100%; height: 100%; }
.evc-chip-count {
	font-size: 11px; color: #9ca3af; font-variant-numeric: tabular-nums;
}
.evc-chip .evc-bolt { color: #f59e0b; font-size: 14px; }
.evc-chip.is-active .evc-bolt { color: #fbbf24; }
.evc-chip:focus-visible {
	outline: 2px solid #3b82f6; outline-offset: 2px;
}

.evc-reset {
	position: absolute;
	top: 6px; right: 10px;
	display: inline-flex; align-items: center; gap: 6px;
	background: #fff;
	border: 1px solid #d1d5db;
	color: #374151;
	font-size: 12px; font-weight: 500;
	padding: 4px 10px;
	border-radius: 999px;
	cursor: pointer;
}
.evc-reset:hover { background: #f3f4f6; }
.evc-reset[hidden] { display: none; }

/* === Data attribution === */
.evc-data-attribution {
	font-size: 12px; color: #6b7280;
	padding: 8px 12px; margin: 0;
	background: #fff;
	border-top: 1px solid #eef0f3;
}
.evc-data-attribution a { color: #374151; text-decoration: underline; }

/* ============================================================
 * Detail drawer — mobile bottom sheet, desktop right-side card
 * ============================================================ */
/*
 * Mobile: detail card takes over the full map area (like openchargemap.io).
 * Desktop: right-rail 380px card. The old "half / full" snap states are gone
 * — the sheet is always full on mobile and the close button is what returns
 * users to the map.
 */
.evc-drawer {
	position: absolute;
	inset: 0;
	background: #fff;
	box-shadow: 0 -6px 30px rgba(15, 23, 42, 0.15);
	z-index: 1000;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 14px 18px 24px;
}
.evc-drawer[hidden] { display: none; }

.evc-drawer-handle { display: none; } /* not used on full-screen card */

.evc-close {
	position: sticky;
	top: 0;
	margin: -6px -10px 6px auto;
	float: right;
	background: #fff;
	border: 1px solid #e5e7eb;
	width: 36px; height: 36px;
	border-radius: 50%;
	color: #374151;
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	z-index: 3;
	box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.evc-close:hover { background: #f3f4f6; }
.evc-drawer-loading {
	display: flex; align-items: center; gap: 8px;
	padding: 60px 0; justify-content: center;
	color: #6b7280;
}

/* Desktop: right-hand card so the map is still visible */
@media (min-width: 768px) {
	.evc-drawer {
		top: 72px; bottom: 16px; left: auto; right: 16px;
		width: 380px; max-height: calc(100% - 88px);
		border-radius: 16px;
		border: 1px solid #e5e7eb;
	}
}

/* === Card content === */
.evc-head {
	padding-top: 8px;
	padding-right: 44px; /* room for the close button */
}
.evc-ident {
	display: flex; align-items: center; gap: 10px;
	margin-bottom: 6px;
}
.evc-logo {
	width: 28px; height: 28px; border-radius: 8px;
	background: var(--c, #6b7280);
	color: #fff; font-weight: 700; font-size: 14px;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
}
.evc-net-name {
	font-size: 13px; color: #6b7280; font-weight: 600;
	letter-spacing: 0.02em; text-transform: uppercase;
}
.evc-verified-chip {
	display: inline-block; margin-left: 8px;
	background: #dcfce7; color: #166534;
	padding: 2px 8px; border-radius: 999px;
	font-size: 11px; font-weight: 600;
}
.evc-badge {
	display: inline-block; margin-left: 8px;
	background: #eef2ff; color: #3730a3;
	padding: 2px 8px; border-radius: 999px;
	font-size: 11px; font-weight: 600;
}
.evc-status-operational { background: #dcfce7; color: #166534; }
.evc-status-reported_issues { background: #fef3c7; color: #92400e; }
.evc-status-offline { background: #fee2e2; color: #991b1b; }

.evc-title {
	margin: 2px 0 2px;
	font-size: 22px; font-weight: 700;
	line-height: 1.2;
	color: #0f172a;
	letter-spacing: -0.01em;
}
.evc-subtitle {
	margin: 0 0 6px;
	color: #6b7280; font-size: 13px;
}
.evc-fact {
	margin: 4px 0 0;
	color: #111827; font-size: 15px; font-weight: 500;
}

/* Primary actions */
.evc-actions-primary {
	display: flex; gap: 8px; flex-wrap: wrap;
	margin: 16px 0 4px;
}
.evc-btn {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 10px 16px;
	border-radius: 10px;
	font-size: 14px; font-weight: 600;
	text-decoration: none;
	border: 1px solid transparent;
	cursor: pointer;
	line-height: 1;
}
.evc-btn-primary { background: #111827; color: #fff; }
.evc-btn-primary:hover { background: #1f2937; color: #fff; }
.evc-btn-ghost { background: #fff; color: #111827; border-color: #d1d5db; }
.evc-btn-ghost:hover { background: #f3f4f6; }
.evc-share { font: inherit; }

/* Sections */
.evc-section {
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid #f0f2f5;
}
.evc-section:first-of-type { border-top: 0; margin-top: 10px; padding-top: 6px; }
.evc-section h4 {
	margin: 0 0 6px;
	font-size: 12px; font-weight: 700;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.evc-section p { margin: 4px 0; }

.evc-where { color: #111827; font-size: 15px; }
.evc-address { color: #6b7280; font-size: 13px; margin: 2px 0 0; }

/* Facts grid */
.evc-facts {
	margin-top: 16px; padding-top: 16px;
	border-top: 1px solid #f0f2f5;
	display: grid;
	grid-template-columns: 1fr;
	gap: 4px;
}
.evc-fact-row {
	display: grid;
	grid-template-columns: 90px 1fr;
	font-size: 14px;
}
.evc-fact-row dt {
	color: #6b7280; font-weight: 500;
}
.evc-fact-row dd {
	margin: 0; color: #111827;
}

/* Pricing */
.evc-pricing-main {
	font-size: 15px; font-weight: 600; color: #111827;
	margin: 2px 0;
}
.evc-sub { color: #6b7280; font-size: 13px; }

/* Payment / apps */
.evc-payments { font-size: 14px; color: #111827; }
.evc-apps { list-style: none; padding: 0; margin: 6px 0 0; font-size: 14px; }
.evc-apps li { margin: 4px 0; }
.evc-apps a { color: #1d4ed8; text-decoration: underline; }

/* Gallery */
.evc-gallery { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0; padding: 0; }
.evc-gallery img {
	flex: 0 0 auto; width: 220px; height: 140px; object-fit: cover;
	border-radius: 10px; scroll-snap-align: start;
}

/* Footer */
.evc-drawer-footer {
	margin-top: 20px; padding-top: 14px;
	border-top: 1px solid #f0f2f5;
	display: flex; justify-content: flex-end;
}
.evc-report-btn {
	background: transparent;
	border: 0;
	color: #6b7280;
	font-size: 13px;
	cursor: pointer;
	padding: 6px 10px;
	text-decoration: underline;
}
.evc-report-btn:hover { color: #111827; }

/* Report form */
.evc-report-form label {
	display: block; margin: 10px 0 4px;
	font-size: 13px; font-weight: 600; color: #374151;
}
.evc-report-form input,
.evc-report-form textarea {
	width: 100%; padding: 10px 12px;
	border: 1px solid #d1d5db; border-radius: 8px;
	font-size: 14px; font-family: inherit;
	box-sizing: border-box;
}
.evc-report-form textarea { resize: vertical; }
.evc-report-form .evc-btn { margin-top: 12px; }
.evc-report-status { display: inline-block; margin-left: 10px; color: #6b7280; font-size: 13px; }
