/*
 * Adamawa PHC Performance Dashboard — front-end + admin styles
 * Green executive theme matching ADSPHCDA branding.
 */

:root {
	--adphc-primary: #0a6b3a;
	--adphc-primary-dark: #084f2b;
	--adphc-secondary: #0f9d58;
	--adphc-accent: #e8f5ea;
	--adphc-good: #1a9c52;
	--adphc-moderate: #e2a422;
	--adphc-poor: #d64545;
	--adphc-ink: #1c2b23;
	--adphc-muted: #5c6d64;
	--adphc-border: #dbe8de;
	--adphc-bg: #f5faf6;
	--adphc-card-bg: #ffffff;
	--adphc-radius: 12px;
	--adphc-shadow: 0 2px 10px rgba(10,107,58,0.08);
	--adphc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.adphc-app { font-family: var(--adphc-font); color: var(--adphc-ink); background: var(--adphc-bg); border-radius: var(--adphc-radius); padding: 20px; box-sizing: border-box; max-width: 100%; }
.adphc-app *, .adphc-app *::before, .adphc-app *::after { box-sizing: border-box; }
.adphc-app img { max-width: none; }

/* Header */
.adphc-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.adphc-header-brand { display: flex; align-items: center; gap: 14px; }
.adphc-logo-badge { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--adphc-primary), var(--adphc-secondary)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.adphc-header h1 { font-size: 20px; margin: 0; color: var(--adphc-primary-dark); font-weight: 700; }
.adphc-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--adphc-muted); }
.adphc-header-actions { display: flex; align-items: center; gap: 10px; }
.adphc-period-badge { background: var(--adphc-accent); color: var(--adphc-primary-dark); padding: 6px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }

/* Buttons */
.adphc-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: all .15s ease; }
.adphc-btn-outline { background: #fff; border-color: var(--adphc-primary); color: var(--adphc-primary); }
.adphc-btn-outline:hover { background: var(--adphc-accent); }
.adphc-btn-text { background: transparent; color: var(--adphc-muted); border: none; }
.adphc-btn-text:hover { color: var(--adphc-primary); }
.adphc-btn:disabled { opacity: .6; cursor: not-allowed; }
.adphc-icon-refresh { display: inline-block; }
.adphc-icon-refresh.spinning { animation: adphc-spin 1s linear infinite; }

/* Filter bar */
.adphc-filterbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: var(--adphc-card-bg); border: 1px solid var(--adphc-border); border-radius: var(--adphc-radius); padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--adphc-shadow); }
.adphc-filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.adphc-filter-group label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--adphc-muted); font-weight: 600; }
.adphc-filter-group select, .adphc-lga-select-card select, #adphc-table-search { border: 1px solid var(--adphc-border); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; background: #fff; color: var(--adphc-ink); }
.adphc-filter-group select:focus, #adphc-table-search:focus { outline: 2px solid var(--adphc-secondary); outline-offset: 1px; }

/* Tabs */
.adphc-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--adphc-border); margin-bottom: 20px; }
.adphc-tab { background: transparent; border: none; padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--adphc-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color .15s ease, border-color .15s ease; }
.adphc-tab:hover { color: var(--adphc-primary); }
.adphc-tab.active { color: var(--adphc-primary); border-bottom-color: var(--adphc-primary); }

/* Panels */
.adphc-panel { display: none; animation: adphc-fade .25s ease; }
.adphc-panel.active { display: block; }
@keyframes adphc-fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: translateY(0);} }

/* Cards & grids */
.adphc-card { background: var(--adphc-card-bg); border: 1px solid var(--adphc-border); border-radius: var(--adphc-radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--adphc-shadow); }
.adphc-card h3 { margin: 0 0 12px; font-size: 15px; color: var(--adphc-primary-dark); }
.adphc-card .description { color: var(--adphc-muted); font-size: 12.5px; margin-top: -6px; margin-bottom: 12px; }
.adphc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.adphc-lga-select-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adphc-lga-select-card label { font-weight: 600; font-size: 13px; color: var(--adphc-muted); }
.adphc-lga-select-card select { min-width: 240px; }

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

/* KPI cards */
.adphc-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.adphc-kpi { background: var(--adphc-card-bg); border: 1px solid var(--adphc-border); border-left: 5px solid var(--adphc-primary); border-radius: 10px; padding: 14px 16px; box-shadow: var(--adphc-shadow); }
.adphc-kpi .adphc-kpi-value { font-size: 24px; font-weight: 800; color: var(--adphc-primary-dark); line-height: 1.1; }
.adphc-kpi .adphc-kpi-label { font-size: 12px; color: var(--adphc-muted); margin-top: 4px; font-weight: 600; }
.adphc-kpi.good { border-left-color: var(--adphc-good); }
.adphc-kpi.moderate { border-left-color: var(--adphc-moderate); }
.adphc-kpi.poor { border-left-color: var(--adphc-poor); }

/* Status badges */
.adphc-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.adphc-badge-good { background: #e5f7ec; color: var(--adphc-good); }
.adphc-badge-moderate { background: #fdf3df; color: #97690f; }
.adphc-badge-poor { background: #fbe7e7; color: var(--adphc-poor); }
.adphc-badge-unknown { background: #eef0ee; color: var(--adphc-muted); }
.adphc-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.adphc-dot.good { background: var(--adphc-good); }
.adphc-dot.moderate { background: var(--adphc-moderate); }
.adphc-dot.poor { background: var(--adphc-poor); }
.adphc-dot.unknown { background: #b7c2bb; }

/* Insights & recommendations */
.adphc-insight-list, .adphc-rec-list { display: flex; flex-direction: column; gap: 10px; }
.adphc-insight-item, .adphc-rec-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--adphc-accent); border-left: 4px solid var(--adphc-secondary); font-size: 13.5px; line-height: 1.5; }
.adphc-insight-item.poor, .adphc-rec-item.poor { background: #fdeeee; border-left-color: var(--adphc-poor); }
.adphc-insight-item.moderate { background: #fdf6e6; border-left-color: var(--adphc-moderate); }
.adphc-insight-item.good { background: #e9f8ef; border-left-color: var(--adphc-good); }
.adphc-rec-item strong { color: var(--adphc-primary-dark); }

/* Scorecard grid (executive/state) */
.adphc-scorecard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.adphc-scorecard-item { border: 1px solid var(--adphc-border); border-radius: 10px; padding: 12px 14px; }
.adphc-scorecard-item .label { font-size: 12.5px; font-weight: 700; color: var(--adphc-ink); margin-bottom: 6px; }
.adphc-progress { height: 8px; border-radius: 6px; background: #eef2ee; overflow: hidden; margin: 6px 0; }
.adphc-progress-bar { height: 100%; border-radius: 6px; background: var(--adphc-good); }
.adphc-progress-bar.moderate { background: var(--adphc-moderate); }
.adphc-progress-bar.poor { background: var(--adphc-poor); }
.adphc-scorecard-item .meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--adphc-muted); }

/* Indicator traffic-light grid */
.adphc-indicator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.adphc-indicator-card { border: 1px solid var(--adphc-border); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.adphc-indicator-card:hover { box-shadow: var(--adphc-shadow); transform: translateY(-1px); }
.adphc-indicator-card .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.adphc-indicator-card .name { font-size: 12.5px; font-weight: 700; }
.adphc-indicator-card .value { font-size: 20px; font-weight: 800; color: var(--adphc-primary-dark); }
.adphc-indicator-card .sub { font-size: 11px; color: var(--adphc-muted); }

/* Tables */
.adphc-table-wrap { overflow-x: auto; }
.adphc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adphc-table th, .adphc-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--adphc-border); white-space: nowrap; }
.adphc-table th { background: var(--adphc-accent); color: var(--adphc-primary-dark); font-weight: 700; position: sticky; top: 0; }
.adphc-table tbody tr:hover { background: #fbfffc; }
.adphc-table-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
#adphc-table-search { min-width: 260px; }
.adphc-table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.adphc-pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.adphc-pagination button { border: 1px solid var(--adphc-border); background: #fff; border-radius: 6px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; }
.adphc-pagination button.active { background: var(--adphc-primary); color: #fff; border-color: var(--adphc-primary); }

/* Heatmap */
.adphc-heatmap-wrap { overflow-x: auto; }
.adphc-heatmap { border-collapse: collapse; font-size: 11.5px; }
.adphc-heatmap th, .adphc-heatmap td { padding: 6px 8px; text-align: center; border: 1px solid #fff; white-space: nowrap; }
.adphc-heatmap th { background: var(--adphc-primary-dark); color: #fff; font-weight: 600; position: sticky; left: 0; }
.adphc-heatmap td.lga-name { text-align: left; font-weight: 700; background: var(--adphc-accent); position: sticky; left: 0; }

/* Loading / empty states */
.adphc-loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 60px 0; color: var(--adphc-muted); font-size: 14px; }
.adphc-spinner { width: 22px; height: 22px; border: 3px solid var(--adphc-border); border-top-color: var(--adphc-primary); border-radius: 50%; animation: adphc-spin .8s linear infinite; }
@keyframes adphc-spin { to { transform: rotate(360deg); } }
.adphc-empty { text-align: center; padding: 60px 20px; color: var(--adphc-muted); background: #fff; border: 1px dashed var(--adphc-border); border-radius: var(--adphc-radius); }

.adphc-footer { text-align: center; font-size: 12px; color: var(--adphc-muted); padding: 20px 0 6px; }

/* Toast */
.adphc-toast { position: fixed; bottom: 20px; right: 20px; background: var(--adphc-primary-dark); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 99999; opacity: 0; transform: translateY(10px); transition: all .25s ease; }
.adphc-toast.show { opacity: 1; transform: translateY(0); }
.adphc-toast.error { background: var(--adphc-poor); }

/* Responsive */
@media (max-width: 640px) {
	.adphc-header { flex-direction: column; align-items: flex-start; }
	.adphc-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
	.adphc-header h1 { font-size: 17px; }
	.adphc-tabs { overflow-x: auto; flex-wrap: nowrap; }
	.adphc-tab { flex-shrink: 0; }
}

/* Print */
@media print {
	.adphc-header-actions, .adphc-filterbar, .adphc-tabs, .adphc-table-toolbar, .adphc-pagination { display: none !important; }
	.adphc-panel { display: block !important; }
}

/* ---------------- Admin screens ---------------- */
.adphc-admin-wrap .title { color: var(--adphc-primary-dark); border-bottom: 2px solid var(--adphc-border); padding-bottom: 6px; }
.adphc-admin-status-cards { display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0; }
.adphc-status-card { background: #fff; border: 1px solid var(--adphc-border); border-left: 4px solid var(--adphc-primary); border-radius: 10px; padding: 14px 18px; min-width: 180px; }
.adphc-status-card strong { display: block; font-size: 20px; color: var(--adphc-primary-dark); }
.adphc-status-card span { font-size: 12px; color: var(--adphc-muted); }
.adphc-admin-callout { background: var(--adphc-accent); border: 1px solid var(--adphc-border); border-radius: 10px; padding: 16px 20px; margin-top: 20px; }
.adphc-config-table th, .adphc-config-table td { padding: 8px 10px; vertical-align: top; }
.adphc-color-field { width: 100px; }
