/* DBHRMS Statistics — Public Styles
   Works with any WP theme via CSS custom properties */

:root {
	--dbhrms-primary:    #1a4f7a;
	--dbhrms-accent:     #e8a015;
	--dbhrms-bg:         #f8f9fa;
	--dbhrms-card-bg:    #ffffff;
	--dbhrms-border:     #e2e8f0;
	--dbhrms-text:       #2d3748;
	--dbhrms-muted:      #718096;
	--dbhrms-radius:     12px;
	--dbhrms-shadow:     0 2px 12px rgba(0,0,0,.08);
}

/* Dark mode only applies inside the plugin wrapper, not to the whole WP page */

/* ── Dashboard ─────────────────────────────────────────────────── */

.dbhrms-dashboard,
.dbhrms-search-wrap {
	font-family: inherit;
	color: var(--dbhrms-text);
	background: var(--dbhrms-bg);
	border-radius: var(--dbhrms-radius);
	padding: 24px;
}

.dbhrms-search-wrap {
	max-width: 900px;
}

.dbhrms-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 16px;
	margin-bottom: 32px;
}

.dbhrms-stat-card {
	background: var(--dbhrms-card-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: var(--dbhrms-radius);
	box-shadow: var(--dbhrms-shadow);
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	transition: transform .2s, box-shadow .2s;
}

.dbhrms-stat-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.dbhrms-stat-icon-img {
	width: 48px;
	height: 48px;
	object-fit: contain;
	display: block;
	flex-shrink: 0;
}

.dbhrms-stat-count {
	font-size: clamp(1.2rem, 3.5vw, 2rem);
	font-weight: 700;
	color: var(--dbhrms-primary);
	line-height: 1.2;
	word-break: break-all;
}

.dbhrms-stat-label {
	font-size: .8rem;
	color: var(--dbhrms-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
}

.dbhrms-stat-note {
	font-size: .7rem;
	color: var(--dbhrms-muted);
	opacity: .75;
	font-style: italic;
}

/* ── Charts row ────────────────────────────────────────────────── */

.dbhrms-charts-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 20px;
	margin-bottom: 32px;
}

.dbhrms-chart-card {
	background: var(--dbhrms-card-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: var(--dbhrms-radius);
	box-shadow: var(--dbhrms-shadow);
	padding: 20px;
}

.dbhrms-chart-card h3 {
	margin: 0 0 12px;
	font-size: 1rem;
	color: var(--dbhrms-text);
	border-bottom: 2px solid var(--dbhrms-accent);
	padding-bottom: 8px;
}

/* ── Search ────────────────────────────────────────────────────── */

.dbhrms-search-form {
	margin-bottom: 24px;
}

.dbhrms-search-row {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.dbhrms-select,
.dbhrms-input {
	padding: 10px 14px;
	border: 1px solid var(--dbhrms-border);
	border-radius: 8px;
	background: var(--dbhrms-card-bg);
	color: var(--dbhrms-text);
	font-size: .95rem;
	outline: none;
	transition: border-color .2s;
}

.dbhrms-select:focus,
.dbhrms-input:focus {
	border-color: var(--dbhrms-primary);
}

.dbhrms-input {
	flex: 1;
	min-width: 200px;
}

.dbhrms-btn {
	padding: 10px 20px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: .95rem;
	font-weight: 600;
	transition: opacity .2s, transform .1s;
}

.dbhrms-btn:active { transform: scale(.97); }

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

.dbhrms-btn-primary:hover { opacity: .88; }

.dbhrms-search-status {
	min-height: 1.5em;
	color: var(--dbhrms-muted);
	font-size: .9rem;
	margin-bottom: 12px;
}

.dbhrms-results-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.dbhrms-result-card {
	background: var(--dbhrms-card-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: var(--dbhrms-radius);
	padding: 16px;
	box-shadow: var(--dbhrms-shadow);
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s, transform .15s;
}
.dbhrms-result-card:hover {
	border-color: var(--dbhrms-primary);
	box-shadow: 0 4px 16px rgba(26,79,122,.15);
	transform: translateY(-2px);
}

.dbhrms-result-name {
	font-weight: 700;
	margin-bottom: 6px;
	color: var(--dbhrms-primary);
}

.dbhrms-result-meta {
	font-size: .82rem;
	color: var(--dbhrms-muted);
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin-top: 4px;
}

.dbhrms-result-type {
	display: inline-block;
	background: var(--dbhrms-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: 4px;
	padding: 1px 7px;
	font-size: .75rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--dbhrms-primary);
	font-weight: 600;
	align-self: flex-start;
}

.dbhrms-result-trn {
	font-size: .72rem;
	font-weight: 600;
	color: var(--dbhrms-accent);
	letter-spacing: .03em;
}

.dbhrms-result-district {
	font-weight: 600;
}

.dbhrms-result-division,
.dbhrms-result-address {
	opacity: .85;
}

/* ── Pagination ────────────────────────────────────────────────── */

.dbhrms-pagination {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.dbhrms-page-btn {
	padding: 6px 14px;
	border: 1px solid var(--dbhrms-border);
	border-radius: 6px;
	background: var(--dbhrms-card-bg);
	color: var(--dbhrms-text);
	cursor: pointer;
	font-size: .875rem;
	transition: background .15s;
}

.dbhrms-page-btn:hover,
.dbhrms-page-btn.active {
	background: var(--dbhrms-primary);
	color: #fff;
	border-color: var(--dbhrms-primary);
}

/* ── Temple detail ─────────────────────────────────────────────── */

.dbhrms-temple-detail {
	background: var(--dbhrms-card-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: var(--dbhrms-radius);
	box-shadow: var(--dbhrms-shadow);
	overflow: hidden;
}

.dbhrms-temple-header {
	background: var(--dbhrms-primary);
	color: #fff;
	padding: 24px 28px;
}

.dbhrms-temple-name {
	margin: 0 0 10px;
	font-size: 1.5rem;
}

.dbhrms-badge {
	display: inline-block;
	background: rgba(255,255,255,.2);
	border: 1px solid rgba(255,255,255,.4);
	border-radius: 20px;
	padding: 3px 12px;
	font-size: .8rem;
	margin-right: 6px;
}

.dbhrms-badge-alt {
	background: rgba(232,160,21,.3);
	border-color: rgba(232,160,21,.5);
}

.dbhrms-temple-body {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	padding: 24px 28px;
}

@media (max-width: 600px) {
	.dbhrms-temple-body { grid-template-columns: 1fr; }
}

.dbhrms-info-table {
	width: 100%;
	border-collapse: collapse;
}

.dbhrms-info-table th,
.dbhrms-info-table td {
	padding: 8px 0;
	border-bottom: 1px solid var(--dbhrms-border);
	text-align: left;
	vertical-align: top;
}

.dbhrms-info-table th {
	color: var(--dbhrms-muted);
	font-weight: 600;
	font-size: .85rem;
	width: 40%;
}

.dbhrms-facilities-list {
	list-style: none;
	padding: 0;
	margin: 8px 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.dbhrms-facilities-list li {
	background: var(--dbhrms-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: 6px;
	padding: 4px 10px;
	font-size: .85rem;
}

.dbhrms-temple-map {
	border-top: 1px solid var(--dbhrms-border);
}

.dbhrms-temple-map iframe {
	display: block;
	border: none;
}

/* ── Clickable list table rows ─────────────────────────────────── */

tr.dbhrms-list-row-clickable {
	cursor: pointer;
	transition: background .12s;
}

tr.dbhrms-list-row-clickable:hover {
	background: rgba(26,79,122,.06);
}

/* ── Error / notice ────────────────────────────────────────────── */

.dbhrms-error {
	background: #fff5f5;
	border: 1px solid #fc8181;
	color: #c53030;
	border-radius: 8px;
	padding: 14px 18px;
	font-size: .9rem;
}

/* ── Detail modal (search result click) ─────────────────────────── */

.dbhrms-detail-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.55);
	z-index: 99999;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 20px 20px;
	overflow-y: auto;
}
.dbhrms-detail-overlay.is-open { display: flex; }

.dbhrms-detail-box {
	background: #fff;
	border-radius: var(--dbhrms-radius);
	box-shadow: 0 12px 48px rgba(0,0,0,.22);
	width: 100%;
	max-width: 640px;
	position: relative;
	overflow: hidden;
	margin: auto;
}

.dbhrms-detail-header {
	background: var(--dbhrms-primary);
	color: #fff;
	padding: 20px 52px 20px 24px;
}
.dbhrms-detail-title {
	margin: 0 0 8px;
	font-size: 1.25rem;
	line-height: 1.3;
}
.dbhrms-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.dbhrms-detail-badge {
	display: inline-block;
	background: rgba(255,255,255,.2);
	border: 1px solid rgba(255,255,255,.35);
	border-radius: 20px;
	padding: 2px 10px;
	font-size: .75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.dbhrms-detail-close {
	position: absolute;
	top: 14px;
	right: 16px;
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	color: rgba(255,255,255,.8);
	line-height: 1;
	padding: 4px 8px;
}
.dbhrms-detail-close:hover { color: #fff; }

.dbhrms-detail-body { padding: 20px 24px 24px; }
.dbhrms-detail-loading {
	text-align: center;
	padding: 32px;
	color: var(--dbhrms-muted);
	font-size: .9rem;
}

.dbhrms-detail-section { margin-bottom: 18px; }
.dbhrms-detail-section-title {
	font-size: .7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--dbhrms-primary);
	margin: 0 0 8px;
	padding-bottom: 4px;
	border-bottom: 2px solid var(--dbhrms-primary);
	display: inline-block;
}

.dbhrms-detail-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px 16px;
}
@media (max-width: 480px) { .dbhrms-detail-grid { grid-template-columns: 1fr; } }

.dbhrms-detail-row { font-size: .875rem; }
.dbhrms-detail-row .dbhrms-dl { color: var(--dbhrms-muted); font-size: .78rem; margin-bottom: 1px; }
.dbhrms-detail-row .dbhrms-dv { color: var(--dbhrms-text); font-weight: 500; }

.dbhrms-detail-officer {
	background: var(--dbhrms-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: 8px;
	padding: 10px 14px;
	margin-bottom: 8px;
	font-size: .875rem;
}
.dbhrms-detail-officer-role {
	font-size: .7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--dbhrms-accent);
	margin-bottom: 4px;
}
.dbhrms-detail-officer-name { font-weight: 600; color: var(--dbhrms-primary); }
.dbhrms-detail-officer-meta { color: var(--dbhrms-muted); font-size: .8rem; margin-top: 3px; }

.dbhrms-detail-nilame {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--dbhrms-bg);
	border: 1px solid var(--dbhrms-border);
	border-radius: 6px;
	padding: 4px 10px;
	font-size: .82rem;
	margin: 3px 3px 3px 0;
}
.dbhrms-detail-nilame-type {
	font-size: .7rem;
	color: var(--dbhrms-accent);
	font-weight: 600;
	text-transform: uppercase;
}
