/* ==================================================================
 * HEAT MAP TAB STYLES
 * Add this to the end of site.css
 * ================================================================== */

/* Search form grid */
.heatmap-search-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1rem;
	margin-bottom: 0.5rem;
}
.heatmap-search-grid .text-input {
	max-width: none;
	width: 100%;
}

/* Map + grid side-by-side layout */
.heatmap-layout {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 1.5rem;
	margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
	.heatmap-layout {
		grid-template-columns: 1fr;
	}
}

/* Map container */
#heatmap-map {
	width: 100%;
	height: 420px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--slate-200);
	z-index: 1; /* Leaflet needs this */
}

/* Map panel needs relative positioning for Leaflet */
.heatmap-map-panel {
	position: relative;
}

/* Legend below map */
.heatmap-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 0.75rem;
}
.hm-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.82rem;
	color: var(--slate-600);
}
.hm-legend-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

/* Popup styles */
.hm-popup {
	font-size: 0.85rem;
	line-height: 1.5;
}
.hm-popup-category {
	font-weight: 600;
}
.hm-popup-detail {
	color: var(--slate-500);
	font-size: 0.8rem;
}
.hm-popup-severity {
	font-weight: 600;
	font-size: 0.8rem;
}

/* Category breakdown table */
.hm-breakdown-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}
.hm-breakdown-table th {
	text-align: left;
	font-weight: 600;
	color: var(--teal);
	padding: 0.4rem 0.5rem;
	border-bottom: 2px solid var(--slate-200);
	font-size: 0.8rem;
}
.hm-breakdown-table td {
	padding: 0.5rem;
	border-bottom: 1px solid var(--slate-100);
	vertical-align: middle;
}
.hm-breakdown-table td:nth-child(2) {
	width: 50px;
	text-align: center;
	font-weight: 600;
	color: var(--slate-700);
}
.hm-breakdown-table td:nth-child(3) {
	width: 40%;
}

/* Bar chart tracks */
.hm-bar-track {
	background: var(--slate-100);
	border-radius: 4px;
	height: 14px;
	overflow: hidden;
}
.hm-bar-fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.4s ease;
}

/* Severity bars */
.hm-severity-bars {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-top: 0.5rem;
}
.hm-severity-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.hm-severity-label {
	width: 65px;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--slate-600);
	flex-shrink: 0;
}
.hm-severity-row .hm-bar-track {
	flex: 1;
}
.hm-severity-count {
	width: 30px;
	text-align: right;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--slate-700);
}

/* Results table */
.hm-results-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}
.hm-results-table th {
	background: var(--teal);
	color: var(--white);
	padding: 0.5rem 0.75rem;
	text-align: left;
	font-weight: 600;
	font-size: 0.82rem;
}
.hm-results-table td {
	padding: 0.5rem 0.75rem;
	border-bottom: 1px solid var(--slate-200);
	vertical-align: top;
}
.hm-results-table tr:hover td {
	background: var(--slate-50);
}
.hm-reason-cell {
	color: var(--slate-500);
	font-size: 0.82rem;
	max-width: 300px;
}

/* Severity badge colours in the table */
.hm-sev-critical { color: var(--red); font-weight: 700; }
.hm-sev-high { color: var(--orange); font-weight: 600; }
.hm-sev-medium { color: var(--amber); font-weight: 500; }
.hm-sev-low { color: var(--green); font-weight: 500; }

/* Grid panel sub-headings */
.heatmap-grid-panel h3 {
	color: var(--teal);
	font-size: 0.95rem;
	margin-top: 1.25rem;
	margin-bottom: 0.5rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--slate-200);
}
/* Interactive filter styles */
.hm-filter-row {
	cursor: pointer;
	transition: background 0.15s ease;
}

	.hm-filter-row:hover {
		background: var(--slate-50);
	}

.hm-row-active {
	background: var(--slate-100) !important;
	outline: 2px solid var(--teal);
	outline-offset: -2px;
	border-radius: 3px;
}

/* Clickable summary cards */
.card-clickable {
	cursor: pointer;
}

.card-active {
	outline: 3px solid var(--teal);
	outline-offset: -3px;
	background: var(--slate-50);
}

/* Filter indicator above results table */
.hm-active-filter {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.6rem 1rem;
	background: var(--slate-100);
	border-left: 4px solid var(--teal);
	border-radius: var(--radius-sm);
	margin-bottom: 0.75rem;
	font-size: 0.9rem;
	color: var(--slate-700);
}

.hm-clear-filter {
	flex-shrink: 0;
	margin-left: 1rem;
}
