/**
 * DHRCA Registry — priest dashboard, front end.
 *
 * Mobile-first. Audience 1/2 in Website-Design-Brief.md §4 are on Android phones
 * over mobile data: 16px minimum type, 44px minimum tap targets, no hover
 * dependency, single column until there is room for more.
 */

.dhrca-dash {
	--dhrca-maroon: #762f03;
	--dhrca-dark: #3f1801;
	--dhrca-gold: #c99700;
	--dhrca-sand: #f2e9da;
	--dhrca-paper: #faf6ef;
	--dhrca-line: #e4d8c3;
	--dhrca-ink: #241c12;
	--dhrca-muted: #756750;

	max-width: 900px;
	margin: 0 auto;
	padding: 24px 18px 64px;
	color: var(--dhrca-ink);
	font-size: 16px;
	line-height: 1.7;
}

.dhrca-dash h1 { font-size: 26px; line-height: 1.3; margin: 0 0 6px; }
.dhrca-dash__sub { color: var(--dhrca-muted); margin: 0 0 24px; }
.dhrca-dash .dhrca-muted { color: var(--dhrca-muted); }
.dhrca-back { margin-bottom: 8px; }
.dhrca-back a { color: var(--dhrca-maroon); text-decoration: none; }

/* Signed-in strip --------------------------------------------------------- */

.dhrca-userbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	padding: 10px 14px;
	margin-bottom: 20px;
	background: var(--dhrca-paper);
	border: 1px solid var(--dhrca-line);
	border-radius: 8px;
	font-size: 14px;
}

.dhrca-userbar__who { color: var(--dhrca-muted); }

.dhrca-userbar__out {
	color: var(--dhrca-maroon);
	font-weight: 600;
	text-decoration: none;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	padding: 0 4px;
}

.dhrca-userbar__out:hover,
.dhrca-userbar__out:focus-visible { text-decoration: underline; }

/* Sign-in ----------------------------------------------------------------- */

.dhrca-dash--login { max-width: 460px; padding-top: 48px; }

.dhrca-login {
	background: #fff;
	border: 1px solid var(--dhrca-line);
	border-radius: 14px;
	padding: 32px 28px 26px;
}

.dhrca-login h1 { font-size: 24px; margin: 0 0 4px; }
.dhrca-login__sub { color: var(--dhrca-muted); font-size: 15px; margin: 0 0 24px; }

.dhrca-login .dhrca-actions { margin-top: 22px; position: static; }
.dhrca-login .dhrca-btn--primary { width: 100%; text-align: center; }

.dhrca-login__help { margin: 18px 0 0; text-align: center; font-size: 15px; }
.dhrca-login__help a { color: var(--dhrca-maroon); }

.dhrca-login__note {
	margin: 18px 0 0;
	padding-top: 16px;
	border-top: 1px solid var(--dhrca-line);
	color: var(--dhrca-muted);
	font-size: 14px;
	text-align: center;
}

.dhrca-field--check label {
	display: flex !important;
	align-items: center;
	gap: 10px;
	font-weight: 400;
	font-size: 15px;
	cursor: pointer;
}

.dhrca-field--check input {
	width: auto;
	min-height: 0;
	width: 20px;
	height: 20px;
	margin: 0;
	flex: 0 0 20px;
}

/* Sections ---------------------------------------------------------------- */

.dhrca-section {
	font-size: 18px;
	margin: 32px 0 4px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--dhrca-gold);
}

.dhrca-section__hint { color: var(--dhrca-muted); font-size: 14px; margin: 0 0 16px; }

/* Alerts ------------------------------------------------------------------ */

.dhrca-alert {
	padding: 14px 16px;
	border-radius: 8px;
	margin-bottom: 20px;
	border-left: 4px solid var(--dhrca-gold);
	background: var(--dhrca-paper);
}

.dhrca-alert--ok { border-left-color: #17683a; background: #eef7f0; }
.dhrca-alert--error { border-left-color: #a4231b; background: #fdf4f3; }
.dhrca-alert ul { margin: 8px 0 0 18px; }

.dhrca-empty {
	padding: 32px 20px;
	text-align: center;
	background: var(--dhrca-paper);
	border: 1px dashed var(--dhrca-line);
	border-radius: 10px;
}

/* Empty state ------------------------------------------------------------- */

.dhrca-empty__icon { font-size: 40px; display: block; margin-bottom: 8px; }
.dhrca-empty h2 { font-size: 20px; margin: 0 0 8px; }
.dhrca-empty p { margin: 0 0 6px; }

/* Cards ------------------------------------------------------------------- */

.dhrca-cards {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

@media (min-width: 640px) {
	.dhrca-cards { grid-template-columns: repeat(2, 1fr); }
}

.dhrca-card {
	background: #fff;
	border: 1px solid var(--dhrca-line);
	border-radius: 14px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow .18s ease, border-color .18s ease;
}

.dhrca-card:hover,
.dhrca-card:focus-within {
	border-color: var(--dhrca-gold);
	box-shadow: 0 6px 20px rgba(60, 20, 10, .1);
}

.dhrca-card__photo { aspect-ratio: 16 / 9; overflow: hidden; background: var(--dhrca-sand); }
.dhrca-card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.dhrca-card__body { padding: 20px; display: flex; flex-direction: column; flex: 1; }

.dhrca-card__type {
	display: inline-block;
	align-self: flex-start;
	padding: 3px 10px;
	border-radius: 11px;
	background: var(--dhrca-sand);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--dhrca-maroon);
}

.dhrca-card__title { font-size: 20px; line-height: 1.35; margin: 10px 0 4px; }
.dhrca-card__key { font-size: 13px; color: var(--dhrca-muted); }

.dhrca-card__meter {
	height: 10px;
	background: var(--dhrca-sand);
	border-radius: 5px;
	overflow: hidden;
	margin: 16px 0 8px;
}

.dhrca-card__meter > span {
	display: block;
	height: 100%;
	border-radius: 5px;
	background: var(--dhrca-gold);
	transition: width .3s ease;
}

/* Completeness carries colour as well as width, but the accessible name on the
   element states the numbers — colour is never the only signal. */
.dhrca-card__meter--good > span { background: #17683a; }
.dhrca-card__meter--part > span { background: var(--dhrca-gold); }
.dhrca-card__meter--thin > span { background: #c0654e; }

.dhrca-card__meta { font-size: 14px; color: var(--dhrca-muted); margin: 0 0 18px; }
.dhrca-card__meta strong { color: var(--dhrca-ink); }
.dhrca-card__go { margin-top: auto; text-align: center; }

/* Buttons ----------------------------------------------------------------- */

.dhrca-btn {
	display: inline-block;
	min-height: 44px;
	padding: 11px 20px;
	border: 1.5px solid var(--dhrca-maroon);
	border-radius: 8px;
	background: #fff;
	color: var(--dhrca-maroon);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.dhrca-btn:hover,
.dhrca-btn:focus-visible { background: var(--dhrca-paper); color: var(--dhrca-maroon); }

.dhrca-btn--primary { background: var(--dhrca-maroon); color: #fff; }
.dhrca-btn--primary:hover,
.dhrca-btn--primary:focus-visible { background: var(--dhrca-dark); color: #fff; }

.dhrca-btn--quiet { border-color: transparent; color: var(--dhrca-muted); }
.dhrca-btn--quiet:hover,
.dhrca-btn--quiet:focus-visible { color: var(--dhrca-ink); background: var(--dhrca-sand); }

.dhrca-btn:focus-visible { outline: 3px solid rgba(201, 151, 0, .45); outline-offset: 2px; }

/* Form -------------------------------------------------------------------- */

.dhrca-form { margin-top: 20px; }
.dhrca-field { margin-bottom: 20px; }

.dhrca-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

.dhrca-field input,
.dhrca-field textarea,
.dhrca-field select {
	width: 100%;
	min-height: 44px;
	padding: 11px 13px;
	border: 1.5px solid var(--dhrca-line);
	border-radius: 8px;
	font-size: 16px; /* 16px prevents iOS zoom on focus */
	line-height: 1.7;
	font-family: inherit;
	background: #fff;
	color: var(--dhrca-ink);
}

.dhrca-field textarea { min-height: 120px; }

.dhrca-field input:focus,
.dhrca-field textarea:focus,
.dhrca-field select:focus {
	outline: 3px solid rgba(201, 151, 0, .4);
	outline-offset: 1px;
	border-color: var(--dhrca-maroon);
}

.dhrca-help { display: block; margin-top: 5px; font-size: 14px; color: var(--dhrca-muted); font-style: normal; }
.dhrca-actions { margin-top: 28px; }

.dhrca-req { font-weight: 400; font-size: 14px; color: #a4231b; }

/* Field-level errors ------------------------------------------------------ */

.dhrca-fielderr {
	display: block;
	margin-bottom: 6px;
	padding: 6px 10px;
	background: #fdf4f3;
	border-left: 3px solid #a4231b;
	border-radius: 0 4px 4px 0;
	color: #7d1a14;
	font-size: 14px;
}

.dhrca-field--error input,
.dhrca-field--error textarea,
.dhrca-field--error select { border-color: #a4231b; }

.dhrca-alert[role="alert"] { scroll-margin-top: 20px; }
.dhrca-alert a { color: inherit; }
.dhrca-alert li { margin-bottom: 4px; }

/* Long trilingual forms on a phone mean the save button is otherwise a scroll
   away at all times. Keep it in reach. */
.dhrca-actions {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-top: 28px;
}

@media (max-width: 639px) {
	.dhrca-actions {
		position: sticky;
		bottom: 0;
		z-index: 5;
		margin: 28px -18px 0;
		padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
		background: #fff;
		border-top: 1px solid var(--dhrca-line);
		box-shadow: 0 -4px 16px rgba(36, 28, 18, .07);
	}

	.dhrca-actions .dhrca-btn--primary { flex: 1; text-align: center; }
}

/* Language tabs ----------------------------------------------------------- */

.dhrca-langtabs {
	display: flex;
	gap: 4px;
	margin-bottom: 20px;
	border-bottom: 2px solid var(--dhrca-line);
	flex-wrap: wrap;
}

/* The dashboard renders inside the active theme, so theme button rules apply.
   Reset hard, and use !important only where a theme would otherwise win. */
.dhrca-dash button,
.dhrca-dash .dhrca-btn {
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}

.dhrca-langtab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	border: 0 !important;
	border-bottom: 3px solid transparent !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--dhrca-muted);
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	line-height: 1.4;
	cursor: pointer;
	margin-bottom: -2px;
	transition: color .15s ease, border-color .15s ease;
}

.dhrca-langtab:hover { color: var(--dhrca-ink) !important; }

.dhrca-langtab.is-active {
	color: var(--dhrca-maroon);
	border-bottom-color: var(--dhrca-gold) !important;
}

.dhrca-langtab:focus-visible { outline: 3px solid rgba(201, 151, 0, .4); outline-offset: -3px; }



.dhrca-langpane { display: none; }
.dhrca-langpane.is-active { display: block; }

/* Tamil and Sinhala need more vertical room than Latin — Website-Design-Brief §5 */
.dhrca-langpane[data-lang="ta"] input,
.dhrca-langpane[data-lang="ta"] textarea,
.dhrca-langpane[data-lang="si"] input,
.dhrca-langpane[data-lang="si"] textarea {
	font-size: 17px;
	line-height: 1.8;
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
