/*
 * FleetForm Pricing Intel.
 *
 * ── How this survives a tenant theme ─────────────────────────────────────────
 *
 * hello-elementor (and friends) repaint any bare `table tbody tr:hover > td`,
 * and they are enqueued AFTER core, so every specificity TIE goes to the theme.
 * The house answer is core's fleet-theme-armor.css: it owns the PROPERTY at
 * 0-3-0 via `--ff-row-bg-*`, and we own the VALUE by setting the token — a
 * custom property is not subject to the specificity contest at its point of use.
 *
 * Rule 2 of that contract applies here too: the plain declarations are kept
 * ALONGSIDE the tokens at identical values, because the armour does not reach
 * every surface and this screen has to render correctly with it and without it.
 *
 * No `!important` anywhere in this file. If something loses, the fix is a token
 * or a namespaced class, never a bigger hammer.
 */

.fleet-pi {
	--fleet-pi-owner: #1f6f43;
	--fleet-pi-owner-bg: #e8f5ee;
	--fleet-pi-dynamic: #8a4b00;
	--fleet-pi-dynamic-bg: #fdf0e0;
	--fleet-pi-blocked-bg: #f1f1f1;
	--fleet-pi-line: #dcdcde;

	/* Owned by the armour at 0-3-0; we only supply the values. */
	--ff-row-bg-odd: transparent;
	--ff-row-bg-even: rgba(0, 0, 0, 0.02);
	--ff-row-bg-hover: rgba(0, 0, 0, 0.04);

	font-size: 14px;
}

/* ── Banner ─────────────────────────────────────────────────────────────── */

.fleet-pi-banner {
	border-left: 4px solid var(--fleet-pi-line);
	padding: 12px 16px;
	margin: 0 0 18px;
	background: #fff;
	border-radius: 3px;
	line-height: 1.5;
}
.fleet-pi-banner--ok   { border-left-color: #1f6f43; background: var(--fleet-pi-owner-bg); }
.fleet-pi-banner--warn { border-left-color: #b26b00; background: var(--fleet-pi-dynamic-bg); }
.fleet-pi-banner--bad  { border-left-color: #a02c2c; background: #fdeaea; }

/* ── Navigation ─────────────────────────────────────────────────────────── */

.fleet-pi-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; }
.fleet-pi-nav-item {
	padding: 7px 14px;
	border: 1px solid var(--fleet-pi-line);
	border-radius: 3px;
	text-decoration: none;
	background: #fff;
	color: inherit;
}
.fleet-pi-nav-item.is-active { background: var(--fleet-primary-color, #2271b1); color: #fff; border-color: transparent; }

.fleet-pi-range, .fleet-pi-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 16px; }
.fleet-pi-range-item {
	padding: 3px 9px;
	border: 1px solid var(--fleet-pi-line);
	border-radius: 12px;
	font-size: 12px;
	text-decoration: none;
	background: #fff;
	color: inherit;
}
.fleet-pi-range-item.is-active { border-color: var(--fleet-primary-color, #2271b1); font-weight: 600; }

/* ── Tables ─────────────────────────────────────────────────────────────── */

/*
 * Wide content scrolls inside its OWN container. The 90-day grid is far wider
 * than any viewport, and letting the page body scroll horizontally instead
 * would drag the whole admin chrome sideways with it.
 */
.fleet-pi-scroll { overflow-x: auto; max-width: 100%; }

.fleet-pi-table, .fleet-pi-grid { border-collapse: collapse; width: 100%; background: transparent; }
.fleet-pi-table th, .fleet-pi-table td,
.fleet-pi-grid th, .fleet-pi-grid td {
	border: 1px solid var(--fleet-pi-line);
	padding: 6px 10px;
	text-align: left;
	vertical-align: middle;
}
.fleet-pi-table thead th, .fleet-pi-grid thead th { background: rgba(0, 0, 0, 0.03); font-weight: 600; }

/* Kept alongside the tokens above — see the file header, rule 2. */
.fleet-pi-table tbody tr:nth-child(even) > td { background-color: rgba(0, 0, 0, 0.02); }
.fleet-pi-table tbody tr:hover > td { background-color: rgba(0, 0, 0, 0.04); }

/* ── Grid ───────────────────────────────────────────────────────────────── */

.fleet-pi-grid { width: auto; font-size: 12px; }
.fleet-pi-grid th.fleet-pi-vehicle {
	position: sticky;
	left: 0;
	z-index: 1;
	background: #fff;
	min-width: 200px;
	text-align: left;
}
.fleet-pi-vehicle em { display: block; font-style: normal; font-size: 11px; opacity: 0.65; font-weight: 400; }
.fleet-pi-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; opacity: 0.6; }
.fleet-pi-date { text-align: center; white-space: nowrap; padding: 4px 6px; }
.fleet-pi-date span { display: block; font-size: 10px; opacity: 0.6; text-transform: uppercase; }
.fleet-pi-date em { font-style: normal; font-size: 11px; }

.fleet-pi-cell { text-align: right; white-space: nowrap; position: relative; }
.fleet-pi-cell--owner   { color: var(--fleet-pi-owner);   background-color: var(--fleet-pi-owner-bg); }
.fleet-pi-cell--dynamic { color: var(--fleet-pi-dynamic); background-color: var(--fleet-pi-dynamic-bg); font-weight: 600; }
.fleet-pi-cell--blocked { opacity: 0.45; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.06) 0 3px, transparent 3px 6px); }
.fleet-pi-cell--none    { color: #999; text-align: center; }

.fleet-pi-moved-dot {
	display: inline-block;
	width: 5px; height: 5px;
	margin-left: 4px;
	border-radius: 50%;
	background: currentColor;
	vertical-align: middle;
}

/* ── Legend ─────────────────────────────────────────────────────────────── */

.fleet-pi-legend { font-size: 12px; margin: 0 0 10px; }
.fleet-pi-key { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--fleet-pi-line); vertical-align: -2px; margin-right: 3px; }
.fleet-pi-key--owner   { background: var(--fleet-pi-owner-bg); }
.fleet-pi-key--dynamic { background: var(--fleet-pi-dynamic-bg); }
.fleet-pi-key--blocked { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.14) 0 3px, transparent 3px 6px); }

/* ── Movement / correlation ─────────────────────────────────────────────── */

.fleet-pi-delta { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fleet-pi-delta--up   { color: #1f6f43; }
.fleet-pi-delta--down { color: #a02c2c; }
.fleet-pi-delta em    { font-style: normal; opacity: 0.65; font-size: 11px; }
.fleet-pi-src-shift   { font-weight: 600; }

.fleet-pi-headline { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.fleet-pi-headline-num { font-size: 34px; font-weight: 700; line-height: 1; }
.fleet-pi-headline-sub { font-size: 13px; opacity: 0.75; }

.fleet-pi-h3 { margin: 26px 0 8px; font-size: 15px; }
.fleet-pi-note, .fleet-pi-empty { font-size: 13px; opacity: 0.8; margin: 0 0 14px; line-height: 1.55; }
.fleet-pi-excluded, .fleet-pi-list { margin: 0 0 16px 18px; font-size: 13px; line-height: 1.6; }
.fleet-pi-excluded em { opacity: 0.65; }

/*
 * `.num` and `.fleet-pi-dim` were written into the markup 8 times and matched
 * NO rule anywhere in this plugin or in core — the columns they label have been
 * left-aligned since the first release. `tabular-nums` is what makes a column of
 * prices scannable; without it the digits shift width per glyph and the eye
 * cannot compare rows.
 */
.fleet-pi-table td.num, .fleet-pi-table th.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.fleet-pi-dim { opacity: 0.7; font-size: 12px; }

/*
 * ── CHARTS ────────────────────────────────────────────────────────────────
 *
 * Colours derive from the TENANT's primary via color-mix rather than being
 * literals, so a chart follows the palette the way every other surface does.
 * Text uses --fleet-on-panel: the luminance-derived token core emits precisely
 * so foreground text stays readable on light AND dark tenant palettes.
 * --fleet-text-white would be invisible on the light presets.
 *
 * SVG sits outside every theme-armour target set, so nothing here is fighting
 * the tenant theme — but that also means <text> misses the armour's typography
 * floor, which is why Chart.php sets font-size on every text node explicitly.
 */
.fleet-pi-charts { margin: 0 0 22px; }
.fleet-pi-chart {
	width: 100%;
	height: 220px;
	display: block;
	margin: 0 0 18px;
	overflow: visible;
}
.fleet-pi-chart-empty {
	font-size: 13px;
	opacity: 0.75;
	margin: 0 0 18px;
	padding: 18px;
	border: 1px dashed var(--fleet-pi-line);
	border-radius: 4px;
}
.fleet-pi-series-1 { stroke: var(--fleet-primary-color, #e0a241); stroke-width: 2; }
.fleet-pi-series-2 {
	stroke: color-mix(in srgb, var(--fleet-primary-color, #e0a241) 55%, #2f6f9f);
	stroke-width: 2;
	stroke-dasharray: 4 3;
}
.fleet-pi-dot-1 { fill: var(--fleet-primary-color, #e0a241); }
.fleet-pi-dot-2 { fill: color-mix(in srgb, var(--fleet-primary-color, #e0a241) 55%, #2f6f9f); }
.fleet-pi-connector { stroke: var(--fleet-pi-line); stroke-width: 1; }
.fleet-pi-gridline { stroke: var(--fleet-pi-line); stroke-width: 1; }
.fleet-pi-axis-line { stroke: var(--fleet-pi-line); stroke-width: 1; }
.fleet-pi-axis { fill: var(--fleet-on-panel, #3c434a); opacity: 0.75; }
.fleet-pi-bar--up { fill: var(--fleet-pi-owner, #1f6f43); }
.fleet-pi-bar--down { fill: var(--fleet-pi-dynamic, #8a4b00); }

.fleet-pi-row--blocked td { opacity: 0.55; }
.fleet-pi-facts { margin: 0 0 12px 18px; font-size: 13px; line-height: 1.7; }

/* Tab descriptions and the vehicle cell. The description sits under the nav
   because a tab label cannot say what a screen is for, and every one of these
   carries caveats that only make sense once you know. */
.fleet-pi-viewdesc { font-size: 13px; opacity: 0.75; margin: 6px 0 14px; line-height: 1.55; }
.fleet-pi-vlink { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.fleet-pi-vname { font-weight: 600; }
.fleet-pi-thumb { flex: 0 0 auto; background: rgba(0, 0, 0, 0.04); }
/* A switched-off listing is dimmed AND labelled. Dimming alone reads as "no
   data", which is the opposite of the truth: the prices are real, they are
   simply not bookable. */
.fleet-pi-row--off .fleet-pi-vlink { opacity: 0.7; }
.fleet-pi-banner--warn { border-left: 3px solid var(--fleet-pi-dynamic, #8a4b00); }

@media (prefers-color-scheme: dark) {
	.fleet-pi {
		--fleet-pi-owner-bg: rgba(31, 111, 67, 0.18);
		--fleet-pi-dynamic-bg: rgba(179, 107, 0, 0.18);
		--fleet-pi-line: rgba(255, 255, 255, 0.16);
		--ff-row-bg-even: rgba(255, 255, 255, 0.03);
		--ff-row-bg-hover: rgba(255, 255, 255, 0.06);
		--fleet-pi-owner: #6fcf97;
		--fleet-pi-dynamic: #e0a241;
	}
	/* Every chart colour needs a dark declaration or the chart is a
	   light-mode-only mark. --fleet-on-panel already flips on its own. */
	.fleet-pi-chart-empty { border-color: rgba(255, 255, 255, 0.16); }
	.fleet-pi-banner, .fleet-pi-nav-item, .fleet-pi-range-item, .fleet-pi-grid th.fleet-pi-vehicle { background: transparent; }
}

/* A listing switched off on Turo. Dimmed AND labelled — dimming alone reads as
   "no data", which is the opposite of the problem: the data is there and it is
   simply not a price anyone can be quoted. */
.fleet-pi-row--off th.fleet-pi-vehicle { opacity: 0.72; }
.fleet-pi-row--off .fleet-pi-cell { opacity: 0.5; }
.fleet-pi-off { color: #a02c2c; font-style: normal; font-size: 11px; display: block; }
