/* Tehsil browse modal — front page */

body.jj-tehsil-modal-open {
	overflow: hidden;
}

.jj-tehsil-modal[hidden] {
	display: none !important;
}

.jj-tehsil-modal:not([hidden]) {
	display: block;
	position: fixed;
	inset: 0;
	z-index: 100000;
}

.jj-tehsil-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	cursor: pointer;
}

.jj-tehsil-modal__dialog {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	max-width: 920px;
	width: calc(100% - 32px);
	max-height: min(90vh, 820px);
	margin: 24px auto;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
	overflow: hidden;
}

.jj-tehsil-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid #e5e7eb;
	background: #fafafa;
}

.jj-tehsil-modal__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
	color: #1f2937;
	line-height: 1.3;
}

.jj-tehsil-modal__close {
	border: 0;
	background: transparent;
	padding: 4px 8px;
	margin: -4px -8px 0 0;
	font-size: 28px;
	line-height: 1;
	color: #6b7280;
	cursor: pointer;
	border-radius: 4px;
}

.jj-tehsil-modal__close:hover,
.jj-tehsil-modal__close:focus {
	color: #111827;
	background: #e5e7eb;
	outline: none;
}

.jj-tehsil-modal__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	border-bottom: 1px solid #e5e7eb;
}

.jj-tehsil-modal__search {
	flex: 1;
	min-width: 200px;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 15px;
}

.jj-tehsil-modal__search:focus {
	border-color: #2f2b25;
	box-shadow: 0 0 0 1px #2f2b25;
	outline: none;
}

.jj-tehsil-modal__count {
	font-size: 13px;
	color: #6b7280;
	white-space: nowrap;
}

.jj-tehsil-modal__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 8px;
	padding: 16px 20px 20px;
	overflow-y: auto;
	flex: 1;
	min-height: 120px;
}

.jj-tehsil-modal__grid a {
	display: block;
	padding: 10px 12px;
	border-radius: 6px;
	border: 1px solid #e5e7eb;
	background: #fff;
	color: #374151;
	text-decoration: none;
	font-size: 14px;
	line-height: 1.35;
	transition: background 0.15s, border-color 0.15s;
}

.jj-tehsil-modal__grid a:hover,
.jj-tehsil-modal__grid a:focus {
	background: #f9fafb;
	border-color: #2f2b25;
	color: #111827;
	outline: none;
}

.jj-tehsil-modal__empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 24px 12px;
	color: #6b7280;
	font-size: 14px;
}

@media (max-width: 600px) {
	.jj-tehsil-modal__dialog {
		width: calc(100% - 20px);
		margin: 12px auto;
		max-height: 92vh;
	}

	.jj-tehsil-modal__grid {
		grid-template-columns: 1fr;
	}
}
