/* ===== BuG Tools – Frontend Styles (BuG NRW Design) ===== */

:root {
	--bug-green:        #009036;
	--bug-green-dark:   #006633;
	--bug-blue:         #003064;
	--bug-text:         #212326;
	--bug-text-light:   #555;
	--bug-border:       #e0e0e0;
	--bug-bg-light:     #fafafa;
	--bug-bg-hover:     #f5f9f6;
	--bug-radius:       4px;
}

.bug-schulsuche {
	font-family: 'Open Sans', Arial, sans-serif;
	color: var(--bug-text);
	max-width: 100%;
}

/* ===== Suchmaske ===== */

.bug-search-form {
	margin-bottom: 28px;
}

.bug-search-fields {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 16px;
	margin-bottom: 16px;
}

.bug-field label {
	display: block;
	font-size: 0.83rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--bug-text-light);
	margin-bottom: 5px;
}

.bug-field input[type="text"],
.bug-field select {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid #c8cfd8;
	border-radius: var(--bug-radius);
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--bug-text);
	background: #fff;
	box-sizing: border-box;
	transition: border-color .15s, box-shadow .15s;
	appearance: none;
	-webkit-appearance: none;
}

.bug-field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	padding-right: 30px;
}

.bug-field input[type="text"]:focus,
.bug-field select:focus {
	outline: none;
	border-color: var(--bug-green);
	box-shadow: 0 0 0 2px rgba(0,144,54,.18);
}

.bug-search-actions {
	display: flex;
	gap: 10px;
	align-items: center;
}

.bug-btn {
	display: inline-block;
	padding: 10px 26px;
	border: none;
	border-radius: var(--bug-radius);
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s;
	line-height: 1.4;
}

.bug-btn-primary {
	background: var(--bug-green);
	color: #fff;
}

.bug-btn-primary:hover {
	background: var(--bug-green-dark);
}

.bug-btn-secondary {
	background: transparent;
	color: var(--bug-green-dark);
	border: 1px solid var(--bug-green-dark);
}

.bug-btn-secondary:hover {
	background: var(--bug-bg-hover);
}

/* ===== Karte ===== */

.bug-map {
	width: 100%;
	height: 480px;
	border-radius: var(--bug-radius);
	border: 1px solid var(--bug-border);
	margin-bottom: 28px;
	z-index: 1;
}

/* ===== Trefferliste als Tabelle ===== */

.bug-results-header {
	font-size: 0.9rem;
	color: var(--bug-text-light);
	margin-bottom: 10px;
}

.bug-results-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
	line-height: 1.5;
}

.bug-results-table thead {
	background-color: var(--bug-green-dark);
	color: #fff;
}

.bug-results-table th {
	padding: 0.7rem 1rem;
	text-align: left;
	font-weight: 600;
	white-space: nowrap;
}

.bug-results-table td {
	padding: 0.7rem 1rem;
	border-bottom: 1px solid var(--bug-border);
	vertical-align: middle;
}

.bug-results-table tbody tr:nth-child(even) td {
	background-color: var(--bug-bg-light);
}

.bug-results-table tbody tr:hover td {
	background-color: var(--bug-bg-hover);
	cursor: pointer;
}

.bug-result-link {
	background: none;
	border: none;
	padding: 0;
	color: var(--bug-green-dark);
	font-weight: 600;
	font-family: inherit;
	font-size: inherit;
	cursor: pointer;
	text-align: left;
	text-decoration: none;
}

.bug-result-link:hover {
	text-decoration: underline;
}

.bug-no-results {
	padding: 2rem;
	text-align: center;
	color: var(--bug-text-light);
	font-style: italic;
	background: var(--bug-bg-light);
	border-radius: var(--bug-radius);
}

/* ===== Modal ===== */

.bug-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bug-modal[hidden] {
	display: none;
}

.bug-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,.55);
}

.bug-modal-content {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 6px;
	width: min(780px, 95vw);
	max-height: 90vh;
	overflow-y: auto;
	padding: 32px;
	box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.bug-modal-loading {
	text-align: center;
	padding: 40px;
	color: var(--bug-text-light);
}

.bug-modal-close {
	position: absolute;
	top: 14px;
	right: 16px;
	background: none;
	border: none;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	color: #888;
	padding: 2px 6px;
	border-radius: var(--bug-radius);
	transition: background .12s;
}

.bug-modal-close:hover {
	background: #f0f0f0;
	color: #000;
}

/* ===== Detailansicht ===== */

.bug-detail-title {
	font-size: 1.4rem;
	color: var(--bug-blue);
	margin: 0 36px 6px 0;
	line-height: 1.3;
}

.bug-detail-badge {
	display: inline-block;
	background: var(--bug-green);
	color: #fff;
	font-size: 0.78rem;
	font-weight: 600;
	padding: 3px 12px;
	border-radius: 20px;
	margin-bottom: 22px;
	letter-spacing: .03em;
}

.bug-detail-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 20px;
	margin-bottom: 22px;
}

.bug-detail-section h3 {
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--bug-green-dark);
	margin: 0 0 8px;
	padding-bottom: 5px;
	border-bottom: 2px solid var(--bug-green);
}

.bug-detail-section p {
	margin: 0 0 6px;
	font-size: 0.92rem;
	color: var(--bug-text);
}

.bug-detail-section a {
	color: var(--bug-green-dark);
	word-break: break-all;
}

.bug-detail-section a:hover {
	text-decoration: underline;
}

.bug-detail-map {
	width: 100%;
	height: 220px;
	border-radius: var(--bug-radius);
	border: 1px solid var(--bug-border);
}

/* Marker-Popup */
.bug-popup-link {
	background: none;
	border: none;
	color: var(--bug-green-dark);
	cursor: pointer;
	padding: 0;
	font-size: 0.9rem;
	font-family: inherit;
	text-decoration: underline;
}

/* ===== Responsive ===== */

@media (max-width: 700px) {
	.bug-search-fields {
		grid-template-columns: 1fr;
	}

	.bug-map {
		height: 320px;
	}

	.bug-results-table thead {
		display: none;
	}

	.bug-results-table,
	.bug-results-table tbody,
	.bug-results-table tr,
	.bug-results-table td {
		display: block;
		width: 100%;
	}

	.bug-results-table tr {
		margin-bottom: 0.75rem;
		border: 1px solid var(--bug-border);
		border-radius: var(--bug-radius);
		background: #fff;
	}

	.bug-results-table td {
		border-bottom: none;
		padding: 0.4rem 0.75rem;
	}

	.bug-results-table td::before {
		content: attr(data-label) ': ';
		font-weight: 600;
		color: var(--bug-green-dark);
	}

	.bug-results-table td:first-child::before {
		content: none;
	}

	.bug-modal-content {
		padding: 20px;
	}

	.bug-detail-grid {
		grid-template-columns: 1fr;
	}
}

/* ===== Statistik-Tabelle ===== */

.bug-statistik {
	font-family: 'Open Sans', Arial, sans-serif;
	margin: 1.5rem 0;
}

.bug-statistik-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.bug-statistik-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
	line-height: 1.4;
}

.bug-statistik-table thead {
	background-color: var(--bug-green-dark);
	color: #fff;
}

.bug-statistik-table thead th {
	padding: 0.65rem 1rem;
	text-align: center;
	font-weight: 600;
	white-space: nowrap;
}

.bug-statistik-table thead th.bug-stat-col-label {
	text-align: left;
}

.bug-statistik-table tbody th,
.bug-statistik-table tbody td {
	padding: 0.55rem 1rem;
	border-bottom: 1px solid var(--bug-border);
}

.bug-statistik-table tbody th {
	text-align: left;
	font-weight: 600;
	color: var(--bug-text);
	white-space: nowrap;
}

.bug-statistik-table tbody td {
	text-align: center;
	color: var(--bug-text);
}

.bug-statistik-table tbody tr:nth-child(even) td,
.bug-statistik-table tbody tr:nth-child(even) th {
	background-color: var(--bug-bg-light);
}

.bug-statistik-table tbody tr:hover td,
.bug-statistik-table tbody tr:hover th {
	background-color: var(--bug-bg-hover);
}

.bug-statistik-table tfoot tr.bug-stat-total th,
.bug-statistik-table tfoot tr.bug-stat-total td {
	padding: 0.65rem 1rem;
	font-weight: 700;
	background-color: #e8f4ec;
	border-top: 2px solid var(--bug-green);
	text-align: center;
	color: var(--bug-text);
}

.bug-statistik-table tfoot tr.bug-stat-total th {
	text-align: left;
	color: var(--bug-green-dark);
}

/* Summen-Spalte hervorheben */
.bug-statistik-table .bug-stat-sum,
.bug-statistik-table .bug-stat-col-sum {
	font-weight: 700;
	background-color: #f0f7f2;
	border-left: 2px solid var(--bug-green);
	border-right: 1px solid #c8dfd0;
}

.bug-statistik-meta {
	font-size: 0.8rem;
	color: var(--bug-text-light);
	margin-top: 8px;
}

.bug-statistik-meta a {
	color: var(--bug-green-dark);
}

.bug-stats-error {
	color: #c00;
	padding: 12px;
	background: #fff0f0;
	border-radius: var(--bug-radius);
	border: 1px solid #fcc;
}
