/* ==========================================================================
   OVA Doc Filter — Frontend Styles
   Adapted to EGovt / OVA-Doc design system
   ========================================================================== */

:root {
	--odf-primary: #202b5d;
	--odf-accent: #27ae60;
	--odf-link: #0067DA;
	--odf-text: #202b5d;
	--odf-text-light: #62718d;
	--odf-text-muted: #8a95a5;
	--odf-bg: #ffffff;
	--odf-bg-sidebar: #f7f1f0;
	--odf-bg-hover: #ffffff;
	--odf-border: #e8e8e8;
	--odf-border-light: #eeeeee;
	--odf-radius: 0px;
	--odf-radius-sm: 0px;
	--odf-shadow: 0px 10px 40px 0px rgba(6, 22, 58, 0.1);
	--odf-shadow-hover: 0px 10px 40px 0px rgba(6, 22, 58, 0.05);
	--odf-transition: 200ms ease;
	--odf-font-heading: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	--odf-font-body: 'Cabin', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Base */
.odf-filter {
	font-family: var(--odf-font-body);
	color: var(--odf-text);
	line-height: 1.5;
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
	max-width: 1270px;
	margin: 0 auto;
	padding: 0 10px;
}

.odf-filter *,
.odf-filter *::before,
.odf-filter *::after {
	box-sizing: border-box;
}

/* ==========================================================================
   Toolbar — Search & Sort
   ========================================================================== */

.odf-toolbar {
	display: flex;
	gap: 16px;
	align-items: center;
	margin-bottom: 24px;
	flex-wrap: wrap;
}

.odf-search-wrap {
	flex: 1;
	min-width: 250px;
	position: relative;
}

.odf-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--odf-text-muted);
	pointer-events: none;
	display: flex;
	align-items: center;
}

.odf-search-input {
	width: 100%;
	padding: 12px 40px 12px 42px;
	border: 2px solid var(--odf-border);
	border-radius: var(--odf-radius);
	font-size: 16px;
	font-family: var(--odf-font-body);
	color: var(--odf-text);
	background: var(--odf-bg);
	transition: border-color var(--odf-transition), box-shadow var(--odf-transition);
	outline: none;
}

.odf-search-input:focus {
	border-color: var(--odf-primary);
	box-shadow: none;
}

.odf-search-input::placeholder {
	color: var(--odf-text-muted);
}

.odf-search-clear {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	font-size: 20px;
	color: var(--odf-text-muted);
	cursor: pointer;
	padding: 4px 8px;
	line-height: 1;
	transition: color var(--odf-transition);
}

.odf-search-clear:hover {
	color: var(--odf-text);
}

.odf-sort-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.odf-sort-label {
	font-size: 15px;
	font-weight: 600;
	color: var(--odf-text-light);
	white-space: nowrap;
	font-family: var(--odf-font-heading);
}

.odf-sort-select {
	padding: 11px 32px 11px 14px;
	border: 2px solid var(--odf-border);
	border-radius: var(--odf-radius);
	font-size: 15px;
	font-family: var(--odf-font-body);
	color: var(--odf-text);
	background: var(--odf-bg);
	cursor: pointer;
	appearance: auto;
	outline: none;
	transition: border-color var(--odf-transition);
}

.odf-sort-select:focus {
	border-color: var(--odf-primary);
}

.odf-sort-order {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 2px solid var(--odf-border);
	border-radius: var(--odf-radius);
	background: var(--odf-bg);
	color: var(--odf-text-light);
	cursor: pointer;
	transition: all var(--odf-transition);
}

.odf-sort-order:hover {
	border-color: var(--odf-primary);
	color: var(--odf-primary);
}

.odf-sort-order[data-order="ASC"] .odf-sort-desc { display: none; }
.odf-sort-order[data-order="ASC"] .odf-sort-asc { display: block !important; }
.odf-sort-order[data-order="DESC"] .odf-sort-desc { display: block; }
.odf-sort-order[data-order="DESC"] .odf-sort-asc { display: none !important; }

/* ==========================================================================
   Active Filters
   ========================================================================== */

.odf-active-filters {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px;
	margin-bottom: 24px;
	background: var(--odf-bg-sidebar);
	border: none;
	flex-wrap: wrap;
}

.odf-active-filters-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--odf-text-light);
	white-space: nowrap;
	font-family: var(--odf-font-heading);
}

.odf-active-filters-list {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.odf-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	background: var(--odf-bg);
	box-shadow: var(--odf-shadow-hover);
	font-size: 14px;
	color: var(--odf-text);
}

.odf-filter-chip-remove {
	background: none;
	border: none;
	font-size: 16px;
	line-height: 1;
	color: var(--odf-text-muted);
	cursor: pointer;
	padding: 0 2px;
	transition: color var(--odf-transition);
}

.odf-filter-chip-remove:hover {
	color: #e53e3e;
}

.odf-clear-all-filters {
	background: none;
	border: none;
	font-size: 14px;
	color: var(--odf-link);
	cursor: pointer;
	font-weight: 600;
	padding: 4px 8px;
	margin-left: auto;
	font-family: var(--odf-font-body);
	transition: color var(--odf-transition);
}

.odf-clear-all-filters:hover {
	color: var(--odf-primary);
	text-decoration: underline;
}

/* ==========================================================================
   Content Layout
   ========================================================================== */

.odf-content {
	display: flex;
	gap: 0;
	align-items: flex-start;
}

.odf-layout-top .odf-content {
	flex-direction: column;
	gap: 24px;
}

.odf-layout-top .odf-sidebar {
	width: 100%;
}

.odf-layout-top .odf-category-tree {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
}

.odf-layout-top .odf-cat-item {
	flex: none;
}

.odf-layout-top .odf-subcategory-list {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 240px;
	background: var(--odf-bg);
	box-shadow: var(--odf-shadow);
	z-index: 10;
	padding: 4px 0;
}

.odf-layout-top .odf-cat-parent {
	position: relative;
}

/* ==========================================================================
   Sidebar — Category Tree (matches OVA-Doc .ova-list-cat)
   ========================================================================== */

.odf-sidebar {
	width: 317px;
	flex-shrink: 0;
	position: sticky;
	top: 150px;
	margin-bottom: 70px;
}

.odf-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 0 16px 0;
}

.odf-sidebar-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 24px;
	line-height: 1.2;
	font-weight: 600;
	color: var(--odf-primary);
	font-family: var(--odf-font-heading);
}

.odf-sidebar-title svg {
	color: var(--odf-text-light);
}

.odf-mobile-toggle {
	display: none;
	background: none;
	border: none;
	color: var(--odf-primary);
	cursor: pointer;
	padding: 4px;
	transition: background var(--odf-transition);
}

.odf-category-tree {
	list-style: none;
	margin: 0;
	padding: 0;
	background: var(--odf-bg-sidebar);
	padding: 26px 30px 37px 30px;
}

.odf-cat-item {
	margin: 0;
	padding: 0;
	position: relative;
}

.odf-cat-item:not(:last-child) {
	border-bottom: 1px solid #e5e5e5;
}

.odf-cat-row {
	display: flex;
	align-items: center;
}

.odf-cat-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin-left: 4px;
	padding: 0;
	background: none;
	border: none;
	color: var(--odf-text-muted);
	cursor: pointer;
	transition: all var(--odf-transition);
	flex-shrink: 0;
}

.odf-cat-toggle:hover {
	color: var(--odf-primary);
}

.odf-cat-toggle svg {
	transition: transform var(--odf-transition);
}

.odf-cat-item[aria-expanded="true"] > .odf-cat-row > .odf-cat-toggle svg {
	transform: rotate(90deg);
}

.odf-cat-btn {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 17px 10px 13px 10px;
	background: none;
	border: none;
	font-size: 17px;
	line-height: 1.2;
	font-family: var(--odf-font-body);
	color: var(--odf-primary);
	cursor: pointer;
	text-align: left;
	transition: all var(--odf-transition);
	gap: 8px;
}

.odf-cat-all .odf-cat-btn {
	font-weight: 600;
}

.odf-cat-parent > .odf-cat-row > .odf-cat-btn {
	font-weight: 600;
}

.odf-cat-btn:hover {
	background: var(--odf-bg-hover);
	box-shadow: var(--odf-shadow-hover);
}

.odf-cat-active > .odf-cat-btn,
.odf-cat-active > .odf-cat-row > .odf-cat-btn {
	background: var(--odf-bg-hover);
	box-shadow: var(--odf-shadow-hover);
	color: var(--odf-primary);
	font-weight: 600;
}

.odf-cat-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.odf-cat-count {
	flex-shrink: 0;
	font-size: 14px;
	font-weight: 400;
	color: var(--odf-text-light);
}

.odf-cat-count::before { content: "("; }
.odf-cat-count::after { content: ")"; }

/* Subcategories */
.odf-subcategory-list {
	list-style: none;
	margin: 0;
	padding: 0 0 0 16px;
	max-height: 0;
	overflow: hidden;
	transition: max-height 300ms ease, opacity 200ms ease;
	opacity: 0;
}

.odf-cat-item[aria-expanded="true"] > .odf-subcategory-list {
	max-height: 2000px;
	opacity: 1;
}

.odf-cat-child > .odf-cat-row > .odf-cat-btn {
	font-weight: 500;
	font-size: 16px;
	padding-top: 12px;
	padding-bottom: 10px;
}

.odf-cat-grandchild .odf-cat-btn {
	font-size: 15px;
	padding-left: 16px;
	padding-top: 10px;
	padding-bottom: 8px;
	color: var(--odf-text-light);
}

/* ==========================================================================
   Documents Area
   ========================================================================== */

.odf-documents-area {
	flex: 1;
	min-width: 0;
	padding-left: 80px;
}

.odf-layout-top .odf-documents-area {
	padding-left: 0;
}

.odf-results-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--odf-border-light);
}

.odf-results-count {
	font-size: 16px;
	color: var(--odf-text-light);
	font-family: var(--odf-font-body);
}

.odf-results-count strong {
	color: var(--odf-primary);
	font-weight: 700;
}

/* Loading */
.odf-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 48px 20px;
	color: var(--odf-text-muted);
	font-size: 15px;
}

.odf-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid var(--odf-border);
	border-top-color: var(--odf-accent);
	border-radius: 50%;
	animation: odf-spin 0.7s linear infinite;
}

@keyframes odf-spin {
	to { transform: rotate(360deg); }
}

/* No results */
.odf-no-results {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	padding: 60px 20px;
	text-align: center;
	color: var(--odf-text-muted);
}

.odf-no-results svg {
	opacity: 0.35;
	color: var(--odf-text-light);
}

.odf-no-results p {
	margin: 0;
	font-size: 16px;
}

/* ==========================================================================
   Document Card (matches OVA-Doc .items-doc .item)
   ========================================================================== */

.odf-document-card {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 34px 60px 32px 32px;
	margin-bottom: 30px;
	background: var(--odf-bg);
	box-shadow: var(--odf-shadow);
	transition: all var(--odf-transition);
}

.odf-document-card:hover {
	box-shadow: 0px 10px 40px 0px rgba(6, 22, 58, 0.15);
}

.odf-doc-icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	color: var(--odf-text-light);
}

.odf-doc-content {
	flex: 1;
	min-width: 0;
}

.odf-doc-title {
	margin: 0 0 1px;
	font-size: 20px;
	line-height: 26px;
	font-weight: 600;
	font-family: var(--odf-font-heading);
}

.odf-doc-title a {
	color: var(--odf-primary);
	text-decoration: none;
	letter-spacing: 0.2px;
	transition: color var(--odf-transition);
}

.odf-doc-title a:hover {
	color: var(--odf-link);
}

.odf-doc-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	font-size: 16px;
	line-height: 26px;
	color: var(--odf-text-light);
	margin-top: 2px;
}

.odf-doc-number {
	font-weight: 600;
	color: var(--odf-accent);
	font-size: 14px;
}

.odf-doc-date {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 16px;
	color: var(--odf-text-light);
}

.odf-doc-date svg {
	opacity: 0.6;
}

.odf-doc-cats {
	font-size: 16px;
	color: var(--odf-primary);
}

.odf-doc-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

.odf-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 24px;
	height: 40px;
	font-size: 16px;
	font-weight: 500;
	font-family: var(--odf-font-body);
	letter-spacing: 0.2px;
	text-decoration: none;
	cursor: pointer;
	transition: all var(--odf-transition);
	white-space: nowrap;
	line-height: 40px;
}

.odf-btn-view {
	background: none;
	color: var(--odf-primary);
	border: 2px solid var(--odf-border);
}

.odf-btn-view:hover {
	color: #fff;
	background: var(--odf-primary);
	border-color: var(--odf-primary);
}

.odf-btn-download {
	background: var(--odf-accent);
	color: #ffffff;
	border: 2px solid var(--odf-accent);
}

.odf-btn-download:hover {
	background: var(--odf-primary);
	border-color: var(--odf-primary);
	color: #ffffff;
}

/* ==========================================================================
   Pagination (matches OVA-Doc .blog_pagination)
   ========================================================================== */

.odf-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	margin: 50px 0 80px 0;
}

.odf-page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	background: var(--odf-bg);
	border: 2px solid var(--odf-border);
	font-size: 16px;
	font-family: var(--odf-font-body);
	font-weight: 500;
	color: var(--odf-primary);
	cursor: pointer;
	transition: all var(--odf-transition);
	text-decoration: none;
}

.odf-page-btn:hover:not(.odf-page-active):not(.odf-page-disabled) {
	color: #fff;
	background: var(--odf-primary);
	border-color: var(--odf-primary);
}

.odf-page-active {
	background: var(--odf-primary);
	border-color: var(--odf-primary);
	color: #ffffff;
	font-weight: 700;
	cursor: default;
}

.odf-page-disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

.odf-page-ellipsis {
	padding: 0 6px;
	color: var(--odf-text-muted);
	font-size: 16px;
	cursor: default;
	border: none;
	background: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991px) {
	.odf-documents-area {
		padding-left: 40px;
	}
}

@media (max-width: 767px) {
	.odf-content {
		flex-direction: column-reverse;
	}

	.odf-sidebar {
		width: 100%;
		position: relative;
		top: 0;
		margin: 0 0 40px 0;
	}

	.odf-documents-area {
		width: 100%;
		padding-left: 0;
		padding-right: 0;
	}

	.odf-mobile-toggle {
		display: flex;
	}

	.odf-category-tree {
		max-height: 0;
		overflow: hidden;
		transition: max-height 300ms ease;
		padding-top: 0;
		padding-bottom: 0;
	}

	.odf-sidebar.odf-sidebar-open .odf-category-tree {
		max-height: 2000px;
		padding-top: 26px;
		padding-bottom: 37px;
	}

	.odf-sidebar.odf-sidebar-open .odf-mobile-toggle svg {
		transform: rotate(180deg);
	}

	.odf-document-card {
		padding: 24px 20px;
	}
}

@media (max-width: 600px) {
	.odf-toolbar {
		flex-direction: column;
		gap: 12px;
	}

	.odf-search-wrap {
		min-width: 100%;
	}

	.odf-sort-controls {
		width: 100%;
		justify-content: space-between;
	}

	.odf-sort-select {
		flex: 1;
	}

	.odf-document-card {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		padding: 20px;
	}

	.odf-doc-icon {
		display: none;
	}

	.odf-doc-actions {
		width: 100%;
	}

	.odf-btn {
		flex: 1;
		justify-content: center;
	}

	.odf-doc-meta {
		gap: 8px;
	}
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
	.odf-toolbar,
	.odf-sort-controls,
	.odf-search-wrap,
	.odf-pagination,
	.odf-doc-actions,
	.odf-mobile-toggle,
	.odf-active-filters,
	.odf-cat-toggle {
		display: none !important;
	}

	.odf-filter {
		font-size: 12px;
	}

	.odf-content {
		flex-direction: column;
	}

	.odf-sidebar {
		width: 100%;
		position: relative;
		top: 0;
	}

	.odf-documents-area {
		padding-left: 0;
	}

	.odf-category-tree,
	.odf-subcategory-list {
		max-height: none !important;
		opacity: 1 !important;
	}

	.odf-document-card {
		box-shadow: none;
		border: 1px solid #ccc;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.odf-document-card:hover {
		box-shadow: none;
	}

	.odf-doc-title a {
		color: #000 !important;
	}

	.odf-doc-title a::after {
		content: " (" attr(href) ")";
		font-size: 10px;
		color: #666;
		font-weight: 400;
	}
}

/* ==========================================================================
   Focus & Accessibility
   ========================================================================== */

.odf-filter :focus-visible {
	outline: 2px solid var(--odf-primary);
	outline-offset: 2px;
}

.odf-filter button:focus:not(:focus-visible),
.odf-filter a:focus:not(:focus-visible),
.odf-filter input:focus:not(:focus-visible),
.odf-filter select:focus:not(:focus-visible) {
	outline: none;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   High contrast mode
   ========================================================================== */

@media (forced-colors: active) {
	.odf-document-card {
		border: 2px solid ButtonText;
	}

	.odf-cat-active > .odf-cat-btn,
	.odf-cat-active > .odf-cat-row > .odf-cat-btn {
		forced-color-adjust: none;
		background: Highlight;
		color: HighlightText;
	}

	.odf-page-active {
		forced-color-adjust: none;
		background: Highlight;
		color: HighlightText;
	}
}
