/* vAMSYS Live Flight Map — scoped so theme styles can't leak in */

.vlm-wrap {
	--vlm-accent: #38bdf8;
	--vlm-bg: #0b1220;
	--vlm-panel: #111a2e;
	--vlm-line: rgba(148, 163, 184, .14);
	--vlm-text: #e5edf7;
	--vlm-muted: #8a9bb4;
	--vlm-hover: rgba(148, 163, 184, .07);
	--vlm-chip-bg: rgba(148, 163, 184, .12);
	--vlm-shadow: 0 20px 50px -20px rgba(2, 6, 23, .55), 0 2px 6px rgba(2, 6, 23, .25);
	margin: 0;
}
.vlm-wrap.vlm-theme-light {
	--vlm-bg: #ffffff;
	--vlm-panel: #f6f8fb;
	--vlm-line: rgba(15, 23, 42, .08);
	--vlm-text: #0f172a;
	--vlm-muted: #64748b;
	--vlm-hover: rgba(15, 23, 42, .03);
	--vlm-chip-bg: rgba(15, 23, 42, .06);
	--vlm-shadow: 0 20px 50px -24px rgba(15, 23, 42, .25), 0 1px 3px rgba(15, 23, 42, .08);
}

/* Reset whatever the theme applies to these elements */
.vlm-wrap, .vlm-wrap * {
	box-sizing: border-box;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
	letter-spacing: normal;
	text-transform: none;
	white-space: normal;
	text-shadow: none;
}
.vlm-wrap p, .vlm-wrap br { margin: 0; padding: 0; }

.vlm-card {
	background: var(--vlm-bg);
	color: var(--vlm-text);
	border: 1px solid var(--vlm-line);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: var(--vlm-shadow);
}

/* Header */
.vlm-head {
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--vlm-line);
}
.vlm-titlewrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vlm-logo {
	display: grid; place-items: center; flex: none;
	width: 36px; height: 36px; border-radius: 10px;
	color: var(--vlm-accent);
	background: color-mix(in srgb, var(--vlm-accent) 16%, transparent);
}
.vlm-logo svg { transform: rotate(45deg); }
.vlm-wrap .vlm-title { font-size: 17px; font-weight: 700; line-height: 1.2; color: var(--vlm-text); }
.vlm-wrap .vlm-sub { font-size: 12.5px; color: var(--vlm-muted); margin-top: 2px; line-height: 1.3; }

.vlm-pill {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 7px 13px; border-radius: 999px;
	font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap !important;
	background: var(--vlm-chip-bg); color: var(--vlm-text);
}
.vlm-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: vlm-pulse 2s infinite; }
.vlm-wrap.is-stale .vlm-dot { background: #f59e0b; animation: none; }
.vlm-wrap.is-error .vlm-dot { background: #ef4444; animation: none; }
@keyframes vlm-pulse { 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* Map */
.vlm-mapbox { position: relative; width: 100%; background: var(--vlm-panel); }
.vlm-map { position: absolute; inset: 0; background: var(--vlm-panel); }
.vlm-wrap .leaflet-container { background: var(--vlm-panel); font-size: 13px; }

/* Muted OpenStreetMap tiles when no CARTO key is set */
.vlm-wrap.vlm-tiles-osm-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(195deg) brightness(.88) contrast(.92) saturate(.35); }
.vlm-wrap.vlm-tiles-osm-light .leaflet-tile-pane { filter: saturate(.18) brightness(1.04) contrast(.92); }

/* Inner shadow so the map sits in the card */
.vlm-mapbox::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 500; box-shadow: inset 0 0 40px rgba(0,0,0,.18); }
.vlm-theme-light .vlm-mapbox::after { box-shadow: inset 0 0 30px rgba(15,23,42,.06); }

/* Zoom + attribution */
.vlm-wrap .leaflet-bar { border: 1px solid var(--vlm-line) !important; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.vlm-wrap .leaflet-bar a { background: var(--vlm-bg); color: var(--vlm-text); border-bottom: 1px solid var(--vlm-line); width: 32px; height: 32px; line-height: 32px; }
.vlm-wrap .leaflet-bar a:hover { background: var(--vlm-panel); color: var(--vlm-accent); }
.vlm-wrap .leaflet-control-attribution { background: color-mix(in srgb, var(--vlm-bg) 75%, transparent); color: var(--vlm-muted); border-top-left-radius: 8px; font-size: 10.5px; padding: 2px 8px; }
.vlm-wrap .leaflet-control-attribution a { color: var(--vlm-muted); }
.vlm-wrap .leaflet-attribution-flag { display: none !important; }

/* Aircraft */
.vlm-plane { background: none; border: 0; color: var(--vlm-accent); }
.vlm-plane .vlm-rot { width: 24px; height: 24px; transition: transform .8s ease;
	filter: drop-shadow(0 0 6px color-mix(in srgb, var(--vlm-accent) 70%, transparent)) drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.vlm-plane svg { display: block; }
.vlm-plane.is-ground { opacity: .65; }
.vlm-plane.is-selected { color: #fbbf24; z-index: 1000 !important; }
.vlm-plane.is-selected .vlm-rot { filter: drop-shadow(0 0 8px rgba(251,191,36,.8)) drop-shadow(0 1px 1px rgba(0,0,0,.5)); }

.vlm-wrap .leaflet-tooltip.vlm-tip, .vlm-wrap .leaflet-tooltip.vlm-apt {
	background: var(--vlm-bg); color: var(--vlm-text); border: 1px solid var(--vlm-line);
	border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.vlm-wrap .leaflet-tooltip.vlm-tip::before, .vlm-wrap .leaflet-tooltip.vlm-apt::before { display: none; }

/* Popup */
.vlm-wrap .leaflet-popup-content-wrapper {
	background: var(--vlm-bg); color: var(--vlm-text); border: 1px solid var(--vlm-line);
	border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.5); padding: 0;
}
.vlm-wrap .leaflet-popup-tip { background: var(--vlm-bg); }
.vlm-wrap .leaflet-popup-content { margin: 0; width: 260px !important; }
.vlm-wrap a.leaflet-popup-close-button { color: var(--vlm-muted); top: 8px; right: 8px; }
.vlm-pop-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--vlm-line); }
.vlm-pop-cs { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.vlm-pop-route { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.vlm-pop-apt { flex: 1; min-width: 0; }
.vlm-pop-apt:last-child { text-align: right; }
.vlm-pop-apt b { display: block; font-size: 15px; font-weight: 700; }
.vlm-pop-apt span { display: block; font-size: 11px; color: var(--vlm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap !important; }
.vlm-pop-arrow { color: var(--vlm-accent); font-size: 16px; }
.vlm-pop-bar { margin-top: 10px; }
.vlm-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 12px 16px 14px; }
.vlm-pop-grid div { min-width: 0; }
.vlm-pop-grid small { display: block; font-size: 10.5px; text-transform: uppercase !important; letter-spacing: .06em !important; color: var(--vlm-muted); }
.vlm-pop-grid strong { display: block; font-size: 13.5px; font-weight: 600; margin-top: 1px; }

/* Shared bits */
.vlm-net { font-size: 9.5px; font-weight: 700; letter-spacing: .05em !important; text-transform: uppercase !important; padding: 3px 6px; border-radius: 5px;
	background: color-mix(in srgb, var(--vlm-accent) 18%, transparent); color: var(--vlm-accent); vertical-align: middle; }
.vlm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap !important;
	background: var(--vlm-chip-bg); color: var(--vlm-muted); }
.vlm-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.vlm-chip.ph-climb  { color: #22c55e; background: rgba(34,197,94,.13); }
.vlm-chip.ph-cruise { color: #38bdf8; background: rgba(56,189,248,.13); }
.vlm-chip.ph-descent{ color: #f59e0b; background: rgba(245,158,11,.14); }
.vlm-theme-light .vlm-chip.ph-climb  { color: #15803d; }
.vlm-theme-light .vlm-chip.ph-cruise { color: #0369a1; }
.vlm-theme-light .vlm-chip.ph-descent{ color: #b45309; }

.vlm-bar { height: 5px; border-radius: 99px; background: var(--vlm-chip-bg); overflow: hidden; }
.vlm-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--vlm-accent) 55%, transparent), var(--vlm-accent)); }

/* Flight list */
.vlm-list { border-top: 1px solid var(--vlm-line); overflow-x: auto; }
.vlm-wrap table.vlm-table { width: 100%; margin: 0 !important; border: 0 !important; border-collapse: collapse !important; border-spacing: 0; background: transparent !important; table-layout: auto; }
.vlm-wrap .vlm-table th, .vlm-wrap .vlm-table td {
	border: 0 !important; background: transparent !important; text-align: left !important; vertical-align: middle !important;
	color: var(--vlm-text) !important; font-size: 14px; line-height: 1.35; padding: 13px 16px !important;
}
.vlm-wrap .vlm-table thead th {
	font-size: 11px !important; font-weight: 600 !important; text-transform: uppercase !important; letter-spacing: .07em !important;
	color: var(--vlm-muted) !important; padding-top: 12px !important; padding-bottom: 12px !important;
	border-bottom: 1px solid var(--vlm-line) !important; white-space: nowrap !important;
}
.vlm-wrap .vlm-table tr, .vlm-wrap .vlm-table tr:nth-child(odd), .vlm-wrap .vlm-table tr:nth-child(even) { background: transparent !important; }
.vlm-wrap .vlm-table tbody tr { border-bottom: 1px solid var(--vlm-line); transition: background .15s; }
.vlm-wrap .vlm-table tbody tr:last-child { border-bottom: 0; }
.vlm-wrap .vlm-table tbody tr[data-id] { cursor: pointer; }
.vlm-wrap .vlm-table tbody tr[data-id]:hover, .vlm-wrap .vlm-table tbody tr.is-selected { background: var(--vlm-hover) !important; }
.vlm-wrap .vlm-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--vlm-accent); }
.vlm-wrap .vlm-table th:first-child, .vlm-wrap .vlm-table td:first-child { padding-left: 20px !important; }
.vlm-wrap .vlm-table th:last-child, .vlm-wrap .vlm-table td:last-child { padding-right: 20px !important; }
.vlm-wrap .vlm-table .vlm-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap !important; }

.vlm-cs { font-weight: 700; display: flex; align-items: center; gap: 7px; white-space: nowrap !important; }
.vlm-small { display: block; font-size: 12px; color: var(--vlm-muted); margin-top: 2px; white-space: nowrap !important; }
.vlm-route { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap !important; }
.vlm-route em { font-style: normal; color: var(--vlm-muted); font-weight: 400; }
.vlm-prog { min-width: 130px; }
.vlm-prog .vlm-small { margin-top: 5px; }

.vlm-wrap .vlm-table td.vlm-empty { text-align: center !important; color: var(--vlm-muted) !important; padding: 28px !important; }

@media (max-width: 720px) {
	.vlm-head { padding: 14px 16px; }
	.vlm-wrap .vlm-table .vlm-hide-sm { display: none; }
	.vlm-wrap .vlm-table th, .vlm-wrap .vlm-table td { padding: 11px 10px !important; font-size: 13px; }
}

.vlm-theme-light .vlm-net { color: color-mix(in srgb, var(--vlm-accent) 65%, #000); }

/* ---------- FedEx theme (purple & orange) ---------- */
.vlm-wrap.vlm-theme-fedex {
	--vlm-accent: #ff6600;
	--vlm-purple: #4d148c;
	--vlm-bg: #1c0b33;
	--vlm-panel: #160828;
	--vlm-line: rgba(196, 168, 235, .16);
	--vlm-text: #f6f1fc;
	--vlm-muted: #b9a5d6;
	--vlm-hover: rgba(255, 102, 0, .07);
	--vlm-chip-bg: rgba(196, 168, 235, .13);
	--vlm-shadow: 0 24px 60px -22px rgba(77, 20, 140, .65), 0 2px 8px rgba(20, 6, 40, .35);
}
.vlm-theme-fedex .vlm-card { border-color: rgba(77, 20, 140, .6); }
.vlm-theme-fedex .vlm-head {
	background: linear-gradient(100deg, #4d148c 0%, #3a0f6b 55%, #2a0b4e 100%);
	border-bottom: 3px solid #ff6600;
}
.vlm-theme-fedex .vlm-logo { background: #ff6600; color: #fff; box-shadow: 0 4px 14px rgba(255, 102, 0, .45); }
.vlm-wrap.vlm-theme-fedex .vlm-title { color: #fff; }
.vlm-wrap.vlm-theme-fedex .vlm-sub { color: rgba(255, 255, 255, .72); }
.vlm-theme-fedex .vlm-pill { background: rgba(255, 255, 255, .14); color: #fff; backdrop-filter: blur(4px); }

.vlm-wrap.vlm-tiles-osm-fedex .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(.85) contrast(.85) sepia(1) hue-rotate(228deg) saturate(4.5) brightness(.78); }
.vlm-theme-fedex .vlm-mapbox::after { box-shadow: inset 0 0 50px rgba(28, 11, 51, .55); }

.vlm-theme-fedex .vlm-plane .vlm-rot { filter: drop-shadow(0 0 7px rgba(255, 102, 0, .75)) drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.vlm-theme-fedex .vlm-plane.is-selected { color: #fff; }
.vlm-theme-fedex .vlm-plane.is-selected .vlm-rot { filter: drop-shadow(0 0 9px rgba(255, 255, 255, .9)) drop-shadow(0 0 3px #ff6600); }

.vlm-theme-fedex .vlm-bar i { background: linear-gradient(90deg, #6a2bb8, #ff6600); }
.vlm-theme-fedex .vlm-net { background: rgba(255, 102, 0, .16); color: #ff8a3d; }
.vlm-theme-fedex .vlm-chip.ph-cruise { color: #c4a3ff; background: rgba(150, 100, 235, .2); }
.vlm-theme-fedex .vlm-chip.ph-descent { color: #ff8a3d; background: rgba(255, 102, 0, .15); }
.vlm-wrap.vlm-theme-fedex .vlm-table thead th { background: rgba(77, 20, 140, .25) !important; color: #cdb8ec !important; }
.vlm-wrap.vlm-theme-fedex .vlm-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 #ff6600; }
.vlm-theme-fedex .leaflet-popup-content-wrapper { border-top: 3px solid #ff6600; }
.vlm-theme-fedex .vlm-pop-head { background: rgba(77, 20, 140, .35); border-top-left-radius: 12px; border-top-right-radius: 12px; }
.vlm-theme-fedex .vlm-pop-arrow { color: #ff6600; }

/* ---------- Width layouts ---------- */
.vlm-wrap.vlm-w-wide {
	--vlm-w: min(var(--vlm-max, 1400px), calc(100vw - var(--vlm-sbw, 0px) - 48px));
	width: var(--vlm-w) !important;
	max-width: none !important;
	margin-left: calc(50% - var(--vlm-w) / 2) !important;
	margin-right: 0 !important;
}
.vlm-wrap.vlm-w-full {
	width: calc(100vw - var(--vlm-sbw, 0px)) !important;
	max-width: none !important;
	margin-left: calc(50% - (100vw - var(--vlm-sbw, 0px)) / 2) !important;
	margin-right: 0 !important;
}
.vlm-wrap.vlm-w-full .vlm-card { border-radius: 0; border-left: 0; border-right: 0; }

/* Hide hairline seams between tiles */
.vlm-wrap .leaflet-tile { outline: 1px solid transparent; }
.vlm-wrap .leaflet-tile-container img { width: 256.5px !important; height: 256.5px !important; }

/* ---------- Neutralise only the visual box a Code/Preformatted wrapper adds ----------
   (Never touch overflow/float/height: page builders such as BeTheme rely on them for layout.) */
:where(pre, p):has(> .vlm-wrap) {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	margin: 0 !important;
	padding: 0 !important;
	white-space: normal !important;
	font: inherit !important;
}
.vlm-wrap { clear: both; }
.vlm-wrap::after { content: ""; display: table; clear: both; }

/* ---------- Airline statistics cards ---------- */
.vlm-statswrap { margin: 0; }
.vlm-wrap .vlm-stats-title { font-size: 22px; font-weight: 800; margin: 0 0 16px; color: inherit; }
/* Fill the column we're placed in (page builders often shrink-wrap columns) */
:where(div):has(> .vlm-wrap), :where(div):has(> div > .vlm-wrap) { flex-grow: 1; min-width: 0; }
:where(div):has(> .vlm-statswrap) { width: 100%; }
.vlm-wrap.vlm-statswrap.vlm-w-content { width: 100%; max-width: 100%; }
.vlm-statswrap { container-type: inline-size; container-name: vlmstats; }

/* Columns follow the space actually available, not the screen width */
.vlm-stats-grid { display: grid; grid-template-columns: repeat(var(--vlm-n, 4), minmax(0, 1fr)); gap: 16px; }
.vlm-stats-grid.vlm-n7, .vlm-stats-grid.vlm-n8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@container vlmstats (max-width: 1050px) {
	.vlm-stats-grid.vlm-n5, .vlm-stats-grid.vlm-n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container vlmstats (max-width: 820px) {
	.vlm-stats-grid.vlm-n4, .vlm-stats-grid.vlm-n7, .vlm-stats-grid.vlm-n8 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container vlmstats (max-width: 620px) {
	.vlm-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
	.vlm-stats-grid .vlm-stat { padding: 16px; }
	.vlm-wrap .vlm-stats-grid .vlm-stat-val { font-size: 26px; }
}
@container vlmstats (max-width: 360px) {
	.vlm-stats-grid { grid-template-columns: 1fr !important; }
}
.vlm-stat {
	position: relative; overflow: hidden;
	background: var(--vlm-bg); color: var(--vlm-text);
	border: 1px solid var(--vlm-line); border-radius: 16px;
	padding: 20px 20px 18px; box-shadow: var(--vlm-shadow);
	transition: transform .2s ease, box-shadow .2s ease;
}
.vlm-stat:hover { transform: translateY(-3px); }
.vlm-stat-icon {
	display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; margin-bottom: 14px;
	color: var(--vlm-accent); background: color-mix(in srgb, var(--vlm-accent) 15%, transparent);
}
.vlm-wrap .vlm-stat-val { font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em !important; font-variant-numeric: tabular-nums; color: var(--vlm-text); }
.vlm-wrap .vlm-stat-val small { font-size: 15px; font-weight: 600; color: var(--vlm-muted); letter-spacing: 0 !important; }
.vlm-wrap .vlm-stat-label { font-size: 14px; font-weight: 600; margin-top: 6px; color: var(--vlm-text); opacity: .9; }
.vlm-wrap .vlm-stat-sub { font-size: 12.5px; margin-top: 8px; color: var(--vlm-muted); display: flex; align-items: center; gap: 6px; }
.vlm-livedot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; animation: vlm-pulse 2s infinite; flex: none; }

/* FedEx: purple gradient cards, orange icon tiles, orange top accent */
.vlm-theme-fedex .vlm-stat { background: linear-gradient(150deg, #4d148c 0%, #2e0d57 70%, #240a45 100%); border-color: rgba(196,168,235,.18); }
.vlm-theme-fedex .vlm-stat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #ff6600, #ff9a4d); }
.vlm-theme-fedex .vlm-stat-icon { background: #ff6600; color: #fff; box-shadow: 0 6px 16px rgba(255,102,0,.35); }
.vlm-wrap.vlm-theme-fedex .vlm-stat-val small { color: #cdb8ec; }
.vlm-wrap.vlm-theme-fedex .vlm-stat-sub { color: #cdb8ec; }

.vlm-admin-note { padding: 10px 14px; border-left: 4px solid #d63638; background: #fff5f5; color: #50575e; font-size: 14px; }
