.mgs-container { margin-bottom: 24px; }

/* Search hero */
.mgs-hero { background: #f7f8fa; border: 1px solid #e0e3e8; border-radius: 8px; padding: 24px; margin-bottom: 24px; }
.mgs-input-group { display: flex; align-items: center; }
.mgs-input-wrap { position: relative; flex: 1 1 auto; }
.mgs-query-input { width: 100% !important; padding: 10px 58px 10px 12px !important; height: auto !important; max-width: none !important; margin-top: 0 !important; box-sizing: border-box; }
.mgs-btn-clear-query { position: absolute; right: 32px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 4px 5px; cursor: pointer; color: #bbb; font-size: 13px; line-height: 1; }
.mgs-btn-clear-query:hover { color: #555; }
.mgs-btn-search { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #888; font-size: 15px; cursor: pointer; transition: color .2s; }
.mgs-btn-search:hover { color: #0066cc; }

/* Two-column layout */
.mgs-main-layout { display: flex; gap: 28px; align-items: flex-start; }
.mgs-results-col { flex: 1 1 0; min-width: 0; }

/* Sidebar */
.mgs-sidebar { width: 230px; flex-shrink: 0; order: 2; }
.mgs-results-col { order: 1; }
.mgs-sidebar-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 2px solid #333; margin-bottom: 2px; }
.mgs-sidebar-title { font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: .06em; color: #333; }
a.mgs-clear-all { font-size: 12px; color: #888; text-decoration: underline; cursor: pointer; }
a.mgs-clear-all:hover { color: #333; }

/* Accordion list */
.mgs-acco { margin: 0; padding: 0; list-style: none; }
.mgs-acco-item { border-bottom: 1px solid #c5c5c5; }
a.mgs-acco-trigger { display: block; padding: 9px 0; text-decoration: none; color: #000; font-size: 14px; line-height: 18px; }
a.mgs-acco-trigger:hover { color: #444; }
.mgs-acco-trigger-inner { display: flex; justify-content: space-between; align-items: center; }
.mgs-acco-arrow { font-style: normal; font-size: 9px; color: #999; transition: transform .2s; display: inline-block; margin-top: 1px; }
.mgs-acco-item.open > a.mgs-acco-trigger .mgs-acco-arrow { transform: rotate(180deg); }
.mgs-acco-panel { display: none; padding: 2px 0 12px; }
.mgs-acco-item.open > .mgs-acco-panel { display: block; }

/* Filter controls inside panels */
.mgs-filter-select { width: 100%; padding: 6px 28px 6px 8px !important; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; color: #333; background-color: #fff; box-sizing: border-box; max-width: none !important; height: auto !important; font-family: verdana,arial,helvetica,sans-serif; }
.mgs-filter-select, .mgs-sort-select { -webkit-appearance: none !important; appearance: none !important; background-image: linear-gradient(45deg, transparent 50%, #666 50%), linear-gradient(135deg, #666 50%, transparent 50%) !important; background-position: calc(100% - 14px) center, calc(100% - 9px) center !important; background-size: 5px 5px, 5px 5px !important; background-repeat: no-repeat !important; }
.mgs-date-row { display: flex; gap: 6px; }
.mgs-date-row .mgs-filter-select { flex: 1; }

/* Checkbox lists */
.mgs-chk-list { margin: 0; padding: 0; list-style: none; max-height: 220px; overflow-y: auto; }
.mgs-chk-list-full { max-height: none; overflow-y: visible; }
.mgs-chk-item { padding: 3px 0; }
.mgs-chk-item label { display: flex; align-items: center; gap: 7px; padding-left: 8px; font-size: 13px; color: #333; font-weight: normal; cursor: pointer; margin: 0; text-transform: none; letter-spacing: 0; }
.mgs-chk-item input[type="checkbox"] { margin: 0; flex-shrink: 0; cursor: pointer; width: auto !important; height: auto !important; }

/* Topic groups */
.mgs-topic-parent { background: #f0f2f5; border-top: 1px solid #e5e5e5; }
.mgs-topic-parent:first-child { border-top: none; }
.mgs-topic-parent-row { display: flex; align-items: stretch; }
.mgs-topic-parent-label { flex: 1; display: flex; align-items: center; gap: 7px; padding: 5px 0 5px 8px; font-size: 12px; font-weight: bold; color: #444; cursor: pointer; margin: 0; text-transform: none; letter-spacing: 0; }
.mgs-topic-expand-btn { background: none; border: none; border-left: 1px solid #ddd; padding: 0 8px; cursor: pointer; color: #aaa; line-height: 1; }
.mgs-topic-expand-btn:hover { color: #555; background: #e0e2e8; }
.mgs-topic-expand-icon { font-size: 9px; transition: transform .2s; display: inline-block; }
.mgs-topic-expand-btn.open .mgs-topic-expand-icon { transform: rotate(90deg); }
.mgs-topic-children { display: none; list-style: none; margin: 0; padding: 2px 0 4px 14px; }
.mgs-topic-children.open { display: block; }

/* Sort bar */
.mgs-sort-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-bottom: 12px; font-size: 13px; border-bottom: 1px solid #e0e3e8; margin-bottom: 14px; }
.mgs-sort-bar label { color: #555; font-weight: bold; white-space: nowrap; margin: 0; }
.mgs-sort-select { padding: 5px 28px 5px 8px !important; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; font-family: verdana,arial,helvetica,sans-serif; min-width: 150px; background-color: #fff; max-width: none !important; height: auto !important; }

/* Results */
.mgs-results-col.mgs-loading { opacity: 0.45; pointer-events: none; }
#mgsResultsContainer .searchnotes { padding: 16px 20px; background: #f7f8fa; border: 1px solid #e0e3e8; border-radius: 10px; margin-bottom: 20px; font-size: 14px; line-height: 1.7; }
#mgsResultsContainer .searchnotes, #mgsResultsContainer .searchnotes p, #mgsResultsContainer .searchnotes li { color: #555 !important; }
#mgsResultsContainer .searchnotes p { margin: 0 0 8px; }
#mgsResultsContainer .searchnotes p:last-child, #mgsResultsContainer .searchnotes li:last-child { margin-bottom: 0; }
.mgs-empty-state, .mgs-no-results { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 32px; background: #f7f8fa; border: 1px solid #e0e3e8; border-radius: 10px; text-align: center; }
.mgs-empty-state-icon, .mgs-no-results-icon { font-size: 3em; color: #015c6e !important; opacity: .5; margin-bottom: 20px; flex-shrink: 0; }
.mgs-empty-state-body, .mgs-no-results-body { color: #555 !important; font-size: 15px; line-height: 1.7; max-width: 400px; }
.mgs-empty-state-body p, .mgs-empty-state-body li, .mgs-no-results-body p, .mgs-no-results-body li { color: #555 !important; margin: 0 0 8px; }
.mgs-empty-state-body p:last-child, .mgs-empty-state-body li:last-child, .mgs-no-results-body p:last-child { margin-bottom: 0; }
#mgsResultsContainer p.lead { display: none; }
#mgsResultsContainer #articleDateFilter { display: none; }

/* Pagination */
#mgsResultsContainer p:has(a.mgpagination) {
	display: flex;
	align-items: center;
	gap: 5px;
	flex-wrap: wrap;
	margin: 16px 0;
	font-size: 13px;
	color: #555;
}
#mgsResultsContainer a.mgpagination {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
	color: #0066cc !important;
	font-size: 12px;
	text-decoration: none !important;
	transition: border-color .15s, background .15s;
	white-space: nowrap;
}
#mgsResultsContainer a.mgpagination:hover { border-color: #0066cc; background: #f0f6ff; }
#mgsResultsContainer a.mgpagination span { display: inline-flex; align-items: center; }
#mgsResultsContainer a.mgpagination img { display: none; }

@media (max-width: 768px) {
	.mgs-main-layout { flex-direction: column; }
	.mgs-sidebar { width: 100%; }
}
