/**
 * Structural / layout styles - shared by every theme.
 * All colors and shape tokens are CSS custom properties with sane
 * defaults here; individual theme files (assets/css/themes/*.css)
 * override the variables and add a few distinctive flourishes.
 */
:root {
	--hrp-primary: #1d4ed8;
	--hrp-primary-dark: #1e40af;
	--hrp-secondary: #64748b;
	--hrp-accent: #f59e0b;
	--hrp-bg: #ffffff;
	--hrp-surface: #f8fafc;
	--hrp-border: #e2e8f0;
	--hrp-text: #1f2933;
	--hrp-text-muted: #64748b;
	--hrp-success: #16a34a;
	--hrp-danger: #dc2626;
	--hrp-warning: #f59e0b;
	--hrp-radius: 10px;
	--hrp-radius-btn: 8px;
	--hrp-font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--hrp-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--hrp-hero-bg: linear-gradient(135deg, var(--hrp-primary), var(--hrp-primary-dark));
}

.hrp-dashboard, .hrp-branch-directory, .hrp-verify-id-page, .hrp-login-page,
.hrp-report-page, .hrp-case-list, .hrp-case-detail {
	max-width: 1100px;
	margin: 0 auto;
	padding: 24px;
	font-family: var(--hrp-font-body);
	color: var(--hrp-text);
	background: var(--hrp-bg);
}

.hrp-dashboard h1, .hrp-branch-directory h1, .hrp-verify-id-page h1,
.hrp-login-page h1, .hrp-report-page h1, .hrp-case-list h1, .hrp-case-detail h1,
.hrp-case-detail h2, .hrp-case-detail h3 {
	font-family: var(--hrp-font-heading);
}

/* Hero banner - rendered at the top of the dashboard & public pages, theme-specific look */
.hrp-hero {
	background: var(--hrp-hero-bg);
	color: #fff;
	border-radius: var(--hrp-radius);
	padding: 28px 32px;
	margin-bottom: 24px;
}
.hrp-hero h1 { margin: 0 0 6px; color: #fff; }
.hrp-hero p { margin: 0; opacity: 0.9; }
.hrp-hero-logo { max-height: 56px; max-width: 220px; margin-bottom: 12px; display: block; }

.hrp-dashboard-header h1 { margin-bottom: 4px; }
.hrp-breadcrumb { color: var(--hrp-text-muted); font-size: 0.9rem; margin-top: 0; }

.hrp-stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 16px;
	margin: 24px 0;
}

.hrp-stat-card {
	border-radius: var(--hrp-radius);
	padding: 20px;
	color: #fff;
	box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.hrp-stat-number { display: block; font-size: 2rem; font-weight: 700; }
.hrp-stat-label { display: block; font-size: 0.85rem; opacity: 0.9; }

.hrp-card-blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.hrp-card-green  { background: linear-gradient(135deg, #16a34a, #15803d); }
.hrp-card-amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.hrp-card-purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.hrp-card-teal   { background: linear-gradient(135deg, #0d9488, #0f766e); }
.hrp-card-red    { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.hrp-coming-soon { background: var(--hrp-surface); border: 1px dashed var(--hrp-border); border-radius: var(--hrp-radius); padding: 16px 20px; margin: 20px 0; }
.hrp-notice { color: var(--hrp-text-muted); font-size: 0.9rem; }

.hrp-quick-links { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.hrp-btn {
	display: inline-block;
	background: var(--hrp-primary);
	color: #fff;
	padding: 10px 18px;
	border-radius: var(--hrp-radius-btn);
	text-decoration: none;
	font-weight: 600;
	border: none;
	cursor: pointer;
	font-family: var(--hrp-font-body);
}
.hrp-btn:hover { background: var(--hrp-primary-dark); color: #fff; }

.hrp-state-block { margin-bottom: 32px; padding: 16px; border: 1px solid var(--hrp-border); border-radius: var(--hrp-radius); }
.hrp-region-block { margin: 16px 0 16px 16px; padding-left: 16px; border-left: 3px solid var(--hrp-border); }
.hrp-unit-list { list-style: none; margin: 8px 0 0 0; padding: 0; }
.hrp-unit-list li { margin-bottom: 10px; }
.hrp-exec-list { list-style: none; margin: 4px 0 0 12px; padding: 0; font-size: 0.85rem; color: var(--hrp-text-muted); }
.hrp-code { color: #94a3b8; font-weight: 400; font-size: 0.9rem; }

.hrp-verify-form { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }
.hrp-verify-form input { flex: 1; min-width: 220px; padding: 10px 12px; border: 1px solid var(--hrp-border); border-radius: var(--hrp-radius-btn); }
.hrp-verify-result { margin-top: 20px; }
.hrp-verify-success { background: #f0fdf4; border: 1px solid #86efac; border-radius: var(--hrp-radius); padding: 18px; }
.hrp-verify-fail { background: #fef2f2; border: 1px solid #fca5a5; border-radius: var(--hrp-radius); padding: 18px; }

/* --- Case management, forms, evidence vault --- */
.hrp-report-form, .hrp-case-detail, .hrp-case-list { margin-top: 20px; }
.hrp-report-form label { display: block; margin: 14px 0 4px; font-weight: 600; }
.hrp-report-form input[type=text], .hrp-report-form input[type=date],
.hrp-report-form select, .hrp-report-form textarea {
	width: 100%; padding: 10px 12px; border: 1px solid var(--hrp-border); border-radius: var(--hrp-radius-btn); box-sizing: border-box;
}
.hrp-report-form fieldset { border: 1px solid var(--hrp-border); border-radius: var(--hrp-radius); padding: 14px; margin-top: 16px; }
.hrp-report-form legend { padding: 0 8px; font-weight: 600; color: var(--hrp-text-muted); }
.hrp-checkbox-label { display: flex; align-items: center; gap: 8px; margin: 16px 0; font-weight: 600; }
.hrp-case-ref { font-family: monospace; font-size: 1.1rem; background: var(--hrp-surface); display: inline-block; padding: 4px 10px; border-radius: 6px; }

.hrp-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.hrp-table th, .hrp-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hrp-border); }
.hrp-table th { background: var(--hrp-surface); font-size: 0.85rem; text-transform: uppercase; color: var(--hrp-text-muted); }

.hrp-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; color: #fff; }
.hrp-badge-low { background: var(--hrp-success); }
.hrp-badge-medium { background: var(--hrp-warning); }
.hrp-badge-high { background: #f97316; }
.hrp-badge-critical { background: var(--hrp-danger); }
.hrp-badge-status { background: var(--hrp-secondary); margin-left: 6px; }

.hrp-case-filters { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.hrp-case-filters select { padding: 8px 10px; border-radius: var(--hrp-radius-btn); border: 1px solid var(--hrp-border); }

.hrp-pii-block { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--hrp-radius); padding: 14px 18px; margin: 16px 0; }
.hrp-case-evidence, .hrp-case-actions, .hrp-case-timeline { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--hrp-border); }
.hrp-evidence-list { list-style: none; padding: 0; }
.hrp-evidence-list li { padding: 8px 0; border-bottom: 1px solid var(--hrp-surface); }
.hrp-checksum { color: #94a3b8; font-size: 0.78rem; margin-left: 8px; font-family: monospace; }
.hrp-evidence-upload-form { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }

.hrp-inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 8px 12px 8px 0; }
.hrp-btn-small { padding: 6px 12px; font-size: 0.85rem; }
.hrp-btn-warning { background: var(--hrp-danger); }
.hrp-btn-warning:hover { background: #b91c1c; }

.hrp-case-timeline ul { list-style: none; padding: 0; }
.hrp-case-timeline li { padding: 10px 0; border-bottom: 1px solid var(--hrp-surface); }
.hrp-timeline-date { display: block; color: #94a3b8; font-size: 0.78rem; }
.hrp-note-form { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; max-width: 500px; }
.hrp-note-form textarea { padding: 10px; border-radius: var(--hrp-radius-btn); border: 1px solid var(--hrp-border); }

/* --- Phase 4: content & public engagement --- */
.hrp-content-page { max-width: 1100px; margin: 0 auto; padding: 24px; }
.hrp-submit-panel { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--hrp-border); }

.hrp-resource-grid, .hrp-event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 16px 0; }
.hrp-resource-card, .hrp-event-card {
	background: var(--hrp-surface); border: 1px solid var(--hrp-border); border-radius: var(--hrp-radius);
	padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.hrp-resource-card h3, .hrp-event-card h3 { margin: 4px 0; font-family: var(--hrp-font-heading); }

.hrp-news-item { padding: 20px 0; border-bottom: 1px solid var(--hrp-border); }
.hrp-news-item h3 { margin: 8px 0 4px; font-family: var(--hrp-font-heading); }
.hrp-news-date { color: var(--hrp-text-muted); font-size: 0.85rem; margin: 0 0 8px; }
.hrp-news-urgent_alert { background: #fef2f2; border-left: 4px solid var(--hrp-danger); padding-left: 16px; }

.hrp-event-datetime { font-weight: 600; color: var(--hrp-primary); margin: 0; }
.hrp-event-location { color: var(--hrp-text-muted); margin: 0 0 8px; }
.hrp-past-events-list { list-style: none; padding: 0; color: var(--hrp-text-muted); }
.hrp-past-events-list li { padding: 6px 0; border-bottom: 1px solid var(--hrp-surface); }

.hrp-lang-switcher { margin-top: 12px; }
.hrp-lang-switcher select { padding: 6px 10px; border-radius: 6px; border: none; background: rgba(255,255,255,0.15); color: #fff; font-size: 0.85rem; }
.hrp-lang-switcher select option { color: #1f2933; }

/* --- Unit Chat (WhatsApp-style) --- */
.hrp-unit-chat {
	background: #e9edf1; border: 1px solid var(--hrp-border); border-radius: var(--hrp-radius);
	overflow: hidden; margin: 20px 0; display: flex; flex-direction: column; height: 480px;
}
.hrp-chat-header {
	background: var(--hrp-primary); color: #fff; padding: 12px 16px; display: flex; flex-direction: column;
}
.hrp-chat-title { font-weight: 700; font-family: var(--hrp-font-heading); }
.hrp-chat-subtitle { font-size: 0.75rem; opacity: 0.85; }
.hrp-chat-messages {
	flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px;
	background-image: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0.4));
}
.hrp-chat-empty { text-align: center; color: var(--hrp-text-muted); margin-top: 40px; }
.hrp-chat-bubble-row { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; }
.hrp-chat-own { align-self: flex-end; flex-direction: row-reverse; }
.hrp-chat-avatar {
	width: 32px; height: 32px; border-radius: 50%; background: var(--hrp-secondary); color: #fff;
	display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.hrp-chat-own .hrp-chat-avatar { background: var(--hrp-primary); }
.hrp-chat-bubble {
	background: #fff; border-radius: 14px; padding: 8px 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
	display: flex; flex-direction: column; gap: 2px;
}
.hrp-chat-own .hrp-chat-bubble { background: #d9fdd3; }
.hrp-chat-sender { font-size: 0.72rem; font-weight: 700; color: var(--hrp-primary); }
.hrp-chat-own .hrp-chat-sender { display: none; }
.hrp-chat-text { font-size: 0.92rem; word-break: break-word; white-space: pre-wrap; }
.hrp-chat-time { font-size: 0.65rem; color: var(--hrp-text-muted); align-self: flex-end; }
.hrp-chat-input-row { display: flex; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid var(--hrp-border); }
.hrp-chat-input-row textarea {
	flex: 1; resize: none; border: 1px solid var(--hrp-border); border-radius: 20px; padding: 8px 16px; font-family: inherit;
	max-height: 80px;
}
.hrp-chat-send { border-radius: 20px !important; }

/* --- Sticky site header (replaces the theme header when hidden) --- */
.hrp-site-header {
	position: sticky;
	top: 0;
	z-index: 9999;
	background: var(--hrp-primary-dark, #1e40af);
	box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
body.admin-bar .hrp-site-header { top: 32px; }
@media screen and (max-width: 782px) {
	body.admin-bar .hrp-site-header { top: 46px; }
}
.hrp-site-header-inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 10px 20px;
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: nowrap;
}
.hrp-site-header-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	flex-shrink: 0;
}
.hrp-site-header-logo {
	max-height: 42px;
	max-width: 160px;
	display: block;
}
.hrp-site-header-name {
	color: #fff;
	font-weight: 800;
	font-size: 1.05rem;
	font-family: var(--hrp-font-heading);
	white-space: nowrap;
}
.hrp-nav-links {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-wrap: nowrap;
	flex: 1 1 auto;
	justify-content: flex-end;
	overflow-x: auto;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}
.hrp-nav-links::-webkit-scrollbar { height: 4px; }
.hrp-nav-links::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }
.hrp-nav-toggle {
	display: none;
	background: transparent;
	border: none;
	cursor: pointer;
	width: 36px;
	height: 32px;
	flex-direction: column;
	justify-content: space-between;
	padding: 4px 2px;
}
.hrp-nav-toggle span {
	display: block;
	height: 3px;
	background: #fff;
	border-radius: 2px;
}

.hrp-hero-logo-link { display: inline-block; }

/* --- Persistent public nav link styling (also used inside the sticky header) --- */
.hrp-public-nav-link {
	color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.8rem; font-weight: 600;
	padding: 8px 10px; border-radius: 6px; white-space: nowrap;
}
.hrp-public-nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.hrp-public-nav-highlight { background: rgba(255,255,255,0.18); color: #fff; }

/* ===================================================================
   Mobile responsiveness
   =================================================================== */
@media (max-width: 900px) {
	.hrp-nav-toggle { display: flex; }
	.hrp-site-header-inner { padding: 8px 14px; gap: 10px; }
	.hrp-site-header-logo { max-height: 36px; max-width: 130px; }
	.hrp-nav-links {
		display: none;
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		background: var(--hrp-primary-dark, #1e40af);
		padding: 8px 0 4px;
		gap: 0;
	}
	.hrp-nav-links.hrp-nav-open { display: flex; }
	.hrp-public-nav-link { padding: 12px 8px; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
}

@media (max-width: 640px) {
	.hrp-dashboard, .hrp-branch-directory, .hrp-verify-id-page, .hrp-login-page,
	.hrp-report-page, .hrp-case-list, .hrp-case-detail, .hrp-content-page {
		padding: 16px;
	}
	.hrp-hero { padding: 20px; }
	.hrp-hero h1 { font-size: 1.4rem; }
	.hrp-hero-logo { max-height: 44px; }
	.hrp-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
	.hrp-stat-number { font-size: 1.5rem; }
	.hrp-quick-links { gap: 8px; }
	.hrp-btn { padding: 10px 14px; font-size: 0.85rem; }

	/* Tables scroll horizontally instead of squeezing/breaking layout */
	.hrp-table { display: block; overflow-x: auto; white-space: nowrap; }

	.hrp-resource-grid, .hrp-event-grid { grid-template-columns: 1fr; }

	/* Chat */
	.hrp-unit-chat { height: 60vh; min-height: 320px; }
	.hrp-chat-bubble-row { max-width: 92%; }
	.hrp-chat-input-row { flex-wrap: wrap; }
	.hrp-chat-input-row textarea { min-width: 0; flex-basis: 100%; order: 1; }
	.hrp-chat-record { order: 2; }
	.hrp-chat-send { order: 3; flex: 1; }

	.hrp-inline-form { width: 100%; }
	.hrp-case-filters { flex-direction: column; align-items: stretch; }
	.hrp-case-filters select, .hrp-case-filters .hrp-btn { width: 100%; }
}

/* --- Unit member list (with DM chat links) --- */
.hrp-member-list { list-style: none; padding: 0; margin: 16px 0; }
.hrp-member-list li {
	display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hrp-border);
}
.hrp-member-avatar {
	width: 36px; height: 36px; border-radius: 50%; background: var(--hrp-primary); color: #fff;
	display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.hrp-member-name { font-weight: 600; flex: 1; }
.hrp-member-role { color: var(--hrp-text-muted); font-size: 0.8rem; margin-right: 8px; }

/* --- Chat recording controls + media bubbles --- */
.hrp-chat-record { font-size: 1.1rem; padding: 6px 10px !important; background: var(--hrp-surface) !important; color: initial !important; }
.hrp-chat-recording-indicator { padding: 8px 16px; background: #fef2f2; color: var(--hrp-danger); font-size: 0.85rem; text-align: center; }
.hrp-chat-audio { max-width: 240px; height: 36px; }
.hrp-chat-video { max-width: 260px; border-radius: 10px; margin-top: 4px; }
