/**
 * Integrasi visual untuk class milik plugin "Dokumen Bapperida".
 *
 * ATURAN: file ini TIDAK PERNAH mengedit assets/css/dokbap-style.css milik
 * plugin. Semua override hanya ditulis di sini, dari sisi theme, supaya
 * update plugin di masa depan tetap aman.
 *
 * Markup & nama class (dokbap-kategori-item, dokbap-dokumen-item, dll)
 * TIDAK DIUBAH karena dokbap-script.js plugin bergantung pada struktur ini.
 */

/* ===== Grid Kategori ===== */
.dokbap-kategori-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 1.25rem;
	margin: 0 0 2rem;
}

.dokbap-kategori-group {
	margin: 0 0 2.75rem;
}

.dokbap-kategori-group-title {
	font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
	font-size: 1.125rem;
	font-weight: 700;
	color: #172033;
	margin: 0 0 1.25rem;
	padding-bottom: 0;
	border-bottom: none;
	position: relative;
	padding-left: 1rem;
}

.dokbap-kategori-group-title::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.2em;
	bottom: 0.2em;
	width: 4px;
	border-radius: 999px;
	background: #14b8a6;
}

.dokbap-kategori-item {
	padding: 1.75rem 1rem;
	border: 1px solid #e2e8f0;
	border-radius: 1rem;
	background: #fff;
	color: #172033;
	box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.dokbap-kategori-item:hover,
.dokbap-kategori-item:focus-visible {
	box-shadow: 0 10px 25px -5px rgba(14, 35, 64, 0.15);
	transform: translateY(-3px);
	border-color: #1d5fe0;
	color: #1d5fe0;
	outline: none;
}

.dokbap-kategori-item:focus-visible {
	outline: 2px solid #1d5fe0;
	outline-offset: 2px;
}

.dokbap-kategori-icon img {
	width: 72px;
	height: 72px;
}

.dokbap-kategori-icon .dashicons {
	font-size: 64px;
	width: 64px;
	height: 64px;
	color: #1d5fe0;
}

.dokbap-kategori-nama {
	font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: inherit;
}

/* ===== Grid Daftar Dokumen ===== */
.dokbap-dokumen-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 1.5rem;
	margin: 0;
}

.dokbap-dokumen-item {
	border: 1px solid #e2e8f0;
	border-radius: 1rem;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dokbap-dokumen-item:hover {
	box-shadow: 0 10px 25px -5px rgba(23, 32, 51, 0.12);
	transform: translateY(-2px);
}

.dokbap-dokumen-cover {
	height: 220px;
	background: #f8fafc;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dokbap-dokumen-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.dokbap-cover-placeholder .dashicons {
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: #1d5fe050;
}

.dokbap-dokumen-info {
	padding: 1rem 1rem 0;
}

.dokbap-dokumen-info h4 {
	font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
	font-size: 0.9375rem;
	font-weight: 700;
	color: #172033;
	margin: 0 0 0.25rem;
	line-height: 1.35;
}

.dokbap-tahun {
	font-size: 0.75rem;
	color: #64748b;
}

.dokbap-dokumen-aksi {
	display: flex;
	gap: 0.5rem;
	padding: 1rem;
}

.dokbap-btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	height: 2.5rem;
	border-radius: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 600;
	text-decoration: none;
	border: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.dokbap-btn[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.dokbap-btn-lihat {
	background: #f1f5f9;
	color: #172033;
}

.dokbap-btn-lihat:hover:not([disabled]) {
	background: #e2e8f0;
}

.dokbap-btn-download {
	background: #1d5fe0;
	color: #fff;
}

.dokbap-btn-download:hover {
	background: #14532d;
	color: #fff;
}

.dokbap-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* ===== Modal Flipbook ===== */
.dokbap-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 9999;
	align-items: center;
	justify-content: center;
}

.dokbap-modal.is-open {
	display: flex;
}

.dokbap-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(14, 35, 64, 0.85);
}

.dokbap-modal-content {
	position: relative;
	background: #fff;
	border-radius: 1.25rem;
	max-width: min(90vw, 960px);
	max-height: 90vh;
	width: 100%;
	padding: 1.5rem;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

#dokbap-modal-title {
	font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
	font-size: 1.125rem;
	font-weight: 700;
	color: #172033;
	margin: 0 0 1rem;
	padding-right: 2rem;
}

.dokbap-modal-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 999px;
	border: none;
	background: #f1f5f9;
	color: #172033;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease;
}

.dokbap-modal-close:hover {
	background: #e2e8f0;
}

#dokbap-flipbook-container {
	flex: 1;
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f8fafc;
	border-radius: 0.75rem;
}

.dokbap-loading,
.dokbap-error {
	font-size: 0.875rem;
	color: #64748b;
	padding: 2rem;
	text-align: center;
}

.dokbap-error {
	color: #b91c1c;
}

@media (max-width: 640px) {
	.dokbap-modal-content {
		max-width: 100vw;
		max-height: 100vh;
		height: 100vh;
		border-radius: 0;
		padding: 1rem;
		padding-top: calc(1rem + env(safe-area-inset-top, 0px));
		padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
	}

	.dokbap-dokumen-grid {
		grid-template-columns: 1fr;
	}
}
