/* ROGEAP Statistics — public dashboard styles
   Scoped under #rogeap-app to avoid clashing with the active theme. */

#rogeap-app {
	--rogeap-primary: #1b6ec2;
	--rogeap-dark: #0d3c61;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1d2327;
}

#rogeap-app .rogeap-header {
	border-bottom: 3px solid var(--rogeap-primary);
	padding-bottom: 10px;
	margin-bottom: 18px;
}

#rogeap-app .rogeap-title {
	margin: 0;
	font-size: 1.6rem;
	color: var(--rogeap-dark);
}

#rogeap-app .rogeap-subtitle {
	margin: 4px 0 0;
	color: #646970;
	font-size: .9rem;
}

/* Filters */
#rogeap-app .rogeap-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: flex-end;
	background: #f6f8fa;
	border: 1px solid #e2e4e7;
	border-radius: 8px;
	padding: 14px 16px;
	margin-bottom: 18px;
}

#rogeap-app .rogeap-filter {
	display: flex;
	flex-direction: column;
	min-width: 150px;
}

#rogeap-app .rogeap-filter label {
	font-size: .72rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #646970;
	margin-bottom: 4px;
}

#rogeap-app .rogeap-filter-actions {
	flex-direction: row;
	gap: 8px;
	margin-left: auto;
}

/* KPI cards */
#rogeap-app .rogeap-kpis {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 14px;
	margin-bottom: 20px;
}

#rogeap-app .rogeap-kpi {
	background: #fff;
	border: 1px solid #e2e4e7;
	border-top: 4px solid var(--rogeap-primary);
	border-radius: 8px;
	padding: 16px;
	text-align: center;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

#rogeap-app .rogeap-kpi-value {
	font-size: 1.9rem;
	font-weight: 700;
	color: var(--rogeap-dark);
}

#rogeap-app .rogeap-kpi-label {
	margin-top: 4px;
	font-size: .82rem;
	color: #646970;
}

/* Tabs */
#rogeap-app .rogeap-tabs {
	margin-bottom: 18px;
}

/* Grid layout — the 3 panels (map + 2 charts) sit on a single aligned row. */
#rogeap-app .rogeap-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 18px;
	margin-bottom: 18px;
	align-items: stretch;
}

#rogeap-app .rogeap-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e2e4e7;
	border-radius: 8px;
	padding: 16px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
	/* Grid items default to min-width:auto, which refuses to shrink below the
	   content's min-content size. A Chart.js canvas then blows its column out
	   (one panel became ~1160px while the map was crushed to ~130px, even
	   though the columns are repeat(3, 1fr)). min-width:0 lets the three 1fr
	   tracks stay equal and Chart.js resizes each canvas to its 1/3 column. */
	min-width: 0;
}

#rogeap-app .rogeap-panel-title {
	margin: 0 0 12px;
	padding-right: 34px; /* leave room for the enlarge button */
	font-size: 1rem;
	color: var(--rogeap-dark);
}

/* Enlarge button (corner of each panel) */
#rogeap-app .rogeap-enlarge {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 30px;
	height: 30px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #646970;
	background: #fff;
	border: 1px solid #e2e4e7;
	border-radius: 8px;
	cursor: pointer;
	z-index: 3;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
	transition: background .15s, color .15s, border-color .15s, transform .1s;
}

#rogeap-app .rogeap-enlarge:hover {
	background: var(--rogeap-primary);
	color: #fff;
	border-color: var(--rogeap-primary);
}

#rogeap-app .rogeap-enlarge:active {
	transform: scale(.94);
}

#rogeap-app .rogeap-enlarge .rogeap-ico {
	width: 16px;
	height: 16px;
}

/* Toggle which icon shows: expand normally, collapse while enlarged. */
#rogeap-app .rogeap-enlarge .rogeap-ico-collapse,
#rogeap-app .rogeap-panel.is-enlarged .rogeap-enlarge .rogeap-ico-expand {
	display: none;
}

#rogeap-app .rogeap-panel.is-enlarged .rogeap-enlarge .rogeap-ico-collapse {
	display: inline-block;
}

/* Shared SVG icon sizing (buttons). */
#rogeap-app .rogeap-ico {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex: 0 0 auto;
}

/* Action buttons (filter bar) */
#rogeap-app .rogeap-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 14px;
	font-size: .82rem;
	font-weight: 600;
	line-height: 1;
	color: #1d2327;
	background: #fff;
	border: 1px solid #cfd6dd;
	border-radius: 8px;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .1s;
}

#rogeap-app .rogeap-btn:hover {
	box-shadow: 0 2px 8px rgba(13, 60, 97, .16);
	transform: translateY(-1px);
}

#rogeap-app .rogeap-btn:active {
	transform: translateY(0);
}

#rogeap-app .rogeap-btn-ghost {
	color: #646970;
}

#rogeap-app .rogeap-btn-ghost:hover {
	color: var(--rogeap-dark);
	border-color: #9aa4ad;
}

#rogeap-app .rogeap-btn-neutral {
	color: #0d3c61;
	border-color: #bcd3e8;
	background: #eef5fb;
}

#rogeap-app .rogeap-btn-primary {
	color: #fff;
	background: var(--rogeap-primary);
	border-color: var(--rogeap-primary);
}

#rogeap-app .rogeap-btn-primary:hover {
	background: #155a9e;
	border-color: #155a9e;
}

#rogeap-app .rogeap-btn-success {
	color: #fff;
	background: #2bb673;
	border-color: #2bb673;
}

#rogeap-app .rogeap-btn-success:hover {
	background: #229460;
	border-color: #229460;
}

/* Chart canvas is sized by its wrapper (charts use maintainAspectRatio:false).
   overflow:hidden is a safety net: if Chart.js has not yet shrunk the canvas
   back after collapsing an enlarged panel, the oversized canvas is clipped to
   the wrapper instead of spilling over the rest of the page. */
#rogeap-app .rogeap-canvas-wrap {
	position: relative;
	flex: 1 1 auto;
	height: 300px;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

/* Belt-and-braces: never let a Chart.js canvas push past its wrapper (which
   would re-inflate the grid column). Chart.js sets inline width/height, so the
   attribute drives the intrinsic size while these cap the rendered box. */
#rogeap-app .rogeap-canvas-wrap canvas {
	max-width: 100%;
}

#rogeap-app .rogeap-panel-title small {
	font-weight: 400;
	color: #8c8f94;
	font-size: .78rem;
}

#rogeap-app .rogeap-map {
	flex: 1 1 auto;
	height: 300px;
	border-radius: 6px;
	z-index: 0;
}

#rogeap-app .rogeap-hint,
#rogeap-app .rogeap-footer {
	color: #8c8f94;
	font-size: .78rem;
	margin-top: 8px;
}

#rogeap-app .rogeap-loading {
	padding: 10px 0;
	color: var(--rogeap-primary);
	font-size: .9rem;
}

#rogeap-app .rogeap-panel-table {
	overflow-x: auto;
}

/* Backdrop behind an enlarged panel. */
#rogeap-app .rogeap-backdrop {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(13, 60, 97, .55);
}

#rogeap-app .rogeap-backdrop[hidden] {
	display: none;
}

/* Prevent the page from scrolling behind an enlarged panel. */
body.rogeap-modal-open {
	overflow: hidden;
}

/* A panel blown up in place: fixed, centred, near-fullscreen. The enlarge
   button stays visible and toggles back to collapse. */
#rogeap-app .rogeap-panel.is-enlarged {
	position: fixed;
	inset: 4vh 4vw;
	z-index: 99999;
	margin: 0;
	width: auto;
	height: auto;
	overflow: hidden;
	box-shadow: 0 16px 56px rgba(0, 0, 0, .4);
	animation: rogeap-pop .16s ease-out;
}

@keyframes rogeap-pop {
	from { transform: scale(.97); opacity: .6; }
	to   { transform: scale(1); opacity: 1; }
}

/* Chart/map fill the enlarged panel (flexbox computes the height). */
#rogeap-app .rogeap-panel.is-enlarged .rogeap-canvas-wrap,
#rogeap-app .rogeap-panel.is-enlarged .rogeap-map {
	height: auto;
	min-height: 0;
	flex: 1 1 auto;
}

/* Responsive */
@media (max-width: 960px) {
	#rogeap-app .rogeap-grid {
		grid-template-columns: 1fr;
	}
}
