/**
 * Kode Pajak Search - Frontend Stylesheet
 * Scoped under .kps-wrapper to prevent conflicts with WordPress themes
 */

.kps-wrapper {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: #334155;
	width: 100%;
	margin: 0 auto;
	position: relative;
}

.kps-wrapper *,
.kps-wrapper *::before,
.kps-wrapper *::after {
	box-sizing: border-box;
}

/* --- Search & Filter Bar --- */
.kps-search-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 20px;
	align-items: center;
}

.kps-input-group {
	position: relative;
}

.kps-search-input-wrap {
	flex: 1 1 280px;
	position: relative;
	display: flex !important;
	align-items: center !important;
	height: 44px !important;
	min-height: 44px !important;
	background-color: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 0 14px !important;
	transition: all 0.2s ease-in-out;
	box-sizing: border-box !important;
}

.kps-search-input-wrap:focus-within,
.kps-search-input-wrap.kps-focused {
	border-color: #2563eb !important;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.kps-filter-wrap {
	flex: 0 1 260px;
	min-width: 200px;
}

.kps-icon-search {
	position: static !important;
	transform: none !important;
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	color: #94a3b8;
	margin-right: 10px !important;
	flex-shrink: 0 !important;
	pointer-events: none;
}

.kps-wrapper input.kps-search-input,
.kps-wrapper input[type="text"].kps-search-input {
	flex: 1 1 auto !important;
	width: 100% !important;
	height: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 14px !important;
	line-height: normal !important;
	color: #1e293b !important;
	background: transparent !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
}

.kps-clear-search {
	position: static !important;
	transform: none !important;
	background: none !important;
	border: none !important;
	font-size: 18px !important;
	line-height: 1 !important;
	color: #94a3b8;
	cursor: pointer;
	padding: 2px 4px !important;
	margin-left: 6px !important;
	flex-shrink: 0 !important;
}

.kps-clear-search:hover {
	color: #475569;
}

.kps-filter-select {
	width: 100%;
	height: 44px !important;
	min-height: 44px !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	padding: 8px 32px 8px 14px;
	font-size: 14px;
	color: #1e293b;
	background-color: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	outline: none;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px;
	transition: all 0.2s ease-in-out;
}

.kps-filter-select:focus {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* --- Table Container (Responsive Horizontal Scroll with Perfect Radius) --- */
.kps-wrapper .kps-table-container,
.kps-table-container {
	position: relative;
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 10px !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
	/* Anti-aliasing and subpixel clipping fix for Chrome/Safari/Firefox */
	transform: translateZ(0);
	-webkit-mask-image: -webkit-radial-gradient(white, black);
	mask-image: radial-gradient(white, black);
	box-sizing: border-box;
}

.kps-wrapper .kps-table,
.kps-wrapper table.kps-table,
.kps-table {
	width: 100% !important;
	margin: 0 !important;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	padding: 0 !important;
	border-collapse: separate !important;
	border-spacing: 0 !important;
	text-align: left;
	font-size: 14px;
	line-height: 1.5;
	border: none !important;
	table-layout: auto;
	box-sizing: border-box;
}

/* Header Cells */
.kps-wrapper .kps-table thead th,
.kps-table thead th {
	background-color: #f8fafc;
	color: #334155;
	font-weight: 600;
	padding: 14px 18px;
	border-top: none !important;
	border-bottom: 1px solid #e2e8f0 !important;
	border-left: none !important;
	border-right: 1px solid #edf2f7 !important;
	white-space: nowrap;
	text-transform: uppercase;
	font-size: 12px;
	letter-spacing: 0.04em;
	box-sizing: border-box;
}

.kps-wrapper .kps-table thead th:last-child,
.kps-table thead th:last-child {
	border-right: none !important;
}

/* Rounded top corners on header */
.kps-wrapper .kps-table thead tr:first-child th:first-child {
	border-top-left-radius: 9px !important;
}
.kps-wrapper .kps-table thead tr:first-child th:last-child {
	border-top-right-radius: 9px !important;
}

/* Body Cells */
.kps-wrapper .kps-table tbody td,
.kps-table tbody td {
	padding: 14px 18px;
	border-top: none !important;
	border-bottom: 1px solid #f1f5f9 !important;
	border-left: none !important;
	border-right: 1px solid #f8fafc !important;
	vertical-align: middle;
	color: #334155;
	box-sizing: border-box;
}

.kps-wrapper .kps-table tbody td:last-child,
.kps-table tbody td:last-child {
	border-right: none !important;
}

.kps-wrapper .kps-table tbody tr:nth-child(even),
.kps-table tbody tr:nth-child(even) {
	background-color: #fafbfc;
}

.kps-wrapper .kps-table tbody tr:hover,
.kps-table tbody tr:hover {
	background-color: #f1f5f9;
	transition: background-color 0.15s ease-in-out;
}

/* Last row seamless bottom edge */
.kps-wrapper .kps-table tbody tr:last-child td,
.kps-table tbody tr:last-child td {
	border-bottom: none !important;
}

.kps-wrapper .kps-table tbody tr:last-child td:first-child {
	border-bottom-left-radius: 9px !important;
}
.kps-wrapper .kps-table tbody tr:last-child td:last-child {
	border-bottom-right-radius: 9px !important;
}

/* --- Column specific styles --- */
.kps-col-kap {
	width: 120px;
	white-space: nowrap;
}

.kps-col-jenis-pajak {
	width: 150px;
	white-space: nowrap;
}

.kps-col-kjs {
	width: 90px;
	white-space: nowrap;
	text-align: center;
}

.kps-table thead th.kps-col-kjs {
	text-align: center;
}

.kps-col-setoran {
	min-width: 180px;
}

.kps-col-keterangan {
	min-width: 280px;
}

/* --- Badges --- */
.kps-badge {
	display: inline-block;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	font-size: 13px;
	font-weight: 700;
	padding: 5px 10px;
	border-radius: 6px;
	letter-spacing: 0.03em;
	line-height: 1.2;
	box-sizing: border-box;
}

.kps-badge-kap {
	background-color: #eff6ff;
	color: #1d4ed8;
	border: 1px solid #bfdbfe;
}

.kps-badge-kjs {
	background-color: #f0fdf4;
	color: #15803d;
	border: 1px solid #bbf7d0;
}

.kps-tax-tag {
	display: inline-block;
	background-color: #f1f5f9;
	color: #475569;
	font-size: 12px;
	font-weight: 500;
	padding: 4px 10px;
	border-radius: 6px;
	border: 1px solid #e2e8f0;
	line-height: 1.2;
	box-sizing: border-box;
}

.kps-keterangan-text {
	color: #475569;
	font-size: 13px;
	line-height: 1.6;
}

/* --- Empty State --- */
.kps-empty-state {
	padding: 48px 20px;
	text-align: center;
	color: #94a3b8;
}

.kps-empty-state svg {
	margin: 0 auto 14px;
	stroke: #cbd5e1;
	display: block;
}

.kps-empty-state p {
	font-size: 15px;
	margin: 0;
	color: #64748b;
}

/* --- Loading Overlay & Spinner --- */
.kps-loading-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.75);
	backdrop-filter: blur(2px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 10;
	gap: 12px;
	font-size: 13px;
	color: #475569;
	font-weight: 500;
}

.kps-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid #e2e8f0;
	border-top-color: #2563eb;
	border-radius: 50%;
	animation: kps-spin 0.8s linear infinite;
}

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

/* --- Pagination --- */
.kps-pagination-wrapper {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	margin-top: 18px;
	gap: 14px;
}

.kps-pagination-info {
	font-size: 13px;
	color: #64748b;
}

.kps-pagination-list {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 6px;
	align-items: center;
}

.kps-page-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 10px;
	font-size: 13px;
	font-weight: 500;
	color: #475569;
	background-color: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	text-decoration: none;
	transition: all 0.15s ease-in-out;
	cursor: pointer;
}

.kps-page-link:hover {
	color: #2563eb;
	border-color: #2563eb;
	background-color: #eff6ff;
}

.kps-page-link.kps-current {
	color: #ffffff;
	background-color: #2563eb;
	border-color: #2563eb;
	font-weight: 600;
	cursor: default;
}

.kps-dots span {
	display: inline-block;
	padding: 0 4px;
	color: #94a3b8;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 767px) {
	.kps-search-bar {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
	}

	.kps-search-input-wrap,
	.kps-filter-wrap {
		flex: 0 0 auto !important;
		width: 100% !important;
		min-width: 100% !important;
		max-width: 100% !important;
		height: 44px !important;
		min-height: 44px !important;
	}

	.kps-pagination-wrapper {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.kps-table thead th,
	.kps-table tbody td {
		padding: 10px 12px;
		font-size: 13px;
	}
}
