:root {
	--primary: #4361ee;
	--secondary: #3f37c9;
	--success: #4cc9f0;
	--warning: #f8961e;
	--danger: #f94144;
	--light: #f8f9fa;
	--dark: #212529;
	--gray: #6c757d;
}

@font-face {
	font-family: 'Kanit';
	src: url('/fonts/Kanit-Light-bc48af1340b72978ed1945a639f286da.ttf') format('truetype');
	font-weight: 300;
	font-style: normal;
}

@font-face {
	font-family: 'Kanit';
	src: url('/fonts/Kanit-Regular-4e90956ae64683872e50efaffa7f354f.ttf') format('truetype');
	font-weight: 400;
	font-style: normal;
}

@font-face {
	font-family: 'Kanit';
	src: url('/fonts/Kanit-Medium-da9eae892a8a3763f7fdbe859a4dd895.ttf') format('truetype');
	font-weight: 500;
	font-style: normal;
}


body {
	font-family: 'Kanit', sans-serif;
	background-color: #f5f7fa;
	color: #333;
	margin: 0;
	padding: 0;
}

.dashboard-container {
	display: grid;
	grid-template-columns: 250px 1fr;
	min-height: 100vh;
}

.nav-submenu {
	background: rgba(0, 0, 0, 0.1);
	display: none;
	padding: 5px 0;
}

.nav-item.active+.nav-submenu {
	display: block;
}

.nav-subitem {
	padding: 10px 25px 10px 50px;
	display: flex;
	align-items: center;
	cursor: pointer;
	transition: all 0.3s;
	font-size: 0.9rem;
}

.nav-subitem:hover,
.nav-subitem.active {
	background: rgba(255, 255, 255, 0.1);
}

.nav-subitem i {
	margin-right: 10px;
	font-size: 0.9rem;
	width: 15px;
	text-align: center;
}

/* Sidebar */
.sidebar {
	position: relative;
	background: linear-gradient(180deg, #2b2d42 0%, #1a1a2e 100%);
	color: white;
	padding: 20px 0;
	z-index: 1000;
	box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.logo {
	text-align: center;
	padding: 0 20px 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo img {
	max-width: 80%;
}

.logo h2 {
	margin: 10px 0 0;
	font-weight: 500;
	font-size: 1.2rem;
}

.nav-menu {
	margin-top: 30px;
}

.nav-item {
	padding: 12px 25px;
	display: flex;
	align-items: center;
	cursor: pointer;
	transition: all 0.3s;
}

.nav-item:hover,
.nav-item.active {
	background: rgba(255, 255, 255, 0.1);
	border-left: 4px solid var(--success);
}

.nav-item i {
	margin-right: 10px;
	font-size: 1.1rem;
	width: 20px;
	text-align: center;
}

/* Main Content */
.main-content {
	padding: 20px 30px;
}

.header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 30px;
}

.header h1 {
	color: var(--dark);
	font-weight: 500;
	margin: 0;
	font-size: 1.8rem;
}


.user-profile {
	display: flex;
	align-items: center;
}

.user-profile img {
	width: 25px;
	height: 25px;
	border-radius: 50%;
	margin-right: 10px;
}

.user-profile {
	display: flex;
	align-items: center;
	cursor: pointer;
	padding: 8px 12px;
	border-radius: 8px;
	transition: all 0.3s;
}

.user-profile:hover {
	background-color: rgba(0, 0, 0, 0.05);
}

.dropdown-menu {
	border: none;
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
	border-radius: 10px;
	padding: 10px 0;
	margin-top: 10px;
}

.dropdown-item {
	padding: 8px 15px;
	border-radius: 5px;
	margin: 2px 0;
	transition: all 0.2s;
}

.dropdown-item:hover {
	background-color: #f8f9fa;
}

.dropdown-header {
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--gray);
	padding: 5px 15px;
}

.language-switcher {
	border-radius: 20px;
	overflow: hidden;
	border: 1px solid #4361ee;
}

.language-switcher .btn {
	border-radius: 0;
	border: none;
	padding: 5px 15px;
	font-weight: 500;
}

.language-switcher .btn:first-child {
	border-top-left-radius: 20px;
	border-bottom-left-radius: 20px;
}

.language-switcher .btn:last-child {
	border-top-right-radius: 20px;
	border-bottom-right-radius: 20px;
}

.language-switcher .btn.active {
	background-color: #4361ee;
	color: white;
}

.language-switcher .btn:not(.active):hover {
	background-color: #f0f0f0;
}

/* เพิ่มเอฟเฟกต์เมื่อโฮเวอร์ */
.language-switcher .btn:not(.active):hover {
	background-color: #f8f9fa;
	transform: scale(1.05);
}

/* เพิ่ม transition */
.language-switcher .btn {
	transition: all 0.2s ease;
}

/* Table Styles */
.table {
	margin-bottom: 0;
}

.table thead th {
	border-bottom-width: 1px;
	font-weight: 500;
	color: var(--gray);
	text-transform: uppercase;
	font-size: 0.8rem;
}

.table-hover tbody tr:hover {
	background-color: rgba(0, 0, 0, 0.02);
}

/* Card Styles */
.card {
	border: none;
	border-radius: 10px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
	margin-bottom: 20px;
}

.card-header {
	background-color: white;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	font-weight: 500;
	padding: 15px 20px;
	border-radius: 10px 10px 0 0 !important;
}

.card-body {
	padding: 20px;
	height: 100%;
}

/* Badge Styles */
.badge {
	font-weight: 500;
	padding: 5px 10px;
	border-radius: 20px;
	font-size: 0.75rem;
}

/* Button Styles */
.btn {
	border-radius: 8px;
	font-weight: 400;
	padding: 8px 16px;
}

.btn-sm {
	padding: 5px 10px;
	font-size: 0.8rem;
}

.btn-outline-primary {
	border-color: var(--primary);
	color: var(--primary);
}

.btn-outline-primary:hover {
	background-color: var(--primary);
	color: white;
}

.btn-outline-secondary {
	border-color: var(--gray);
	color: var(--gray);
}

.btn-outline-secondary:hover {
	background-color: var(--gray);
	color: white;
}

/* Form Styles */
.form-section {
	border: 1px solid #ddd;
	border-radius: 5px;
	padding: 10px;
	margin-bottom: 20px;
}

/* Form Styles */
.form-section-resource {
	background-color: #f8f9fa;
	border-radius: 10px;
	padding: 20px;
	margin-bottom: 20px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.section-title-resource {
	color: #0d6efd;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid #dee2e6;
}

.year-allocation-resource {
	background-color: white;
}

.allocation-item-resource {
	border-left: 4px solid #0d6efd;
}

.section-title {
	cursor: pointer;
	padding: 10px;
	background-color: #f8f9fa;
	border-radius: 5px;
	margin-bottom: 0;
}

.section-title:hover {
	background-color: #e9ecef;
}

.section-content {
	padding: 15px 10px 0 10px;
	transition: all 0.3s ease;
}

.section-title {
	border-bottom: 2px solid var(--primary);
	padding-bottom: 10px;
	margin-bottom: 20px;
	color: var(--primary);
}

.collapsed .section-content {
	display: none;
}

.collapsed .fa-chevron-down {
	transform: rotate(-90deg);
}

.toggle-icon {
	transition: transform 0.3s ease;
}

.form-control,
.form-select {
	border-radius: 8px;
	padding: 8px 12px;
	border: 1px solid #ddd;
}

.form-control:focus,
.form-select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

/* Pagination */
.pagination .page-item .page-link {
	border-radius: 8px;
	margin: 0 5px;
	border: none;
	color: var(--dark);
}

.pagination .page-item.active .page-link {
	background-color: var(--primary);
	color: white;
}


#sidebarToggle {
	display: none;
	background: none;
	border: none;
	font-size: 1.5rem;
	color: var(--dark);
	margin-right: 10px;
	cursor: pointer;
}

/* Responsive */
@media (max-width : 1200px) {
	.summary-cards {
		grid-template-columns: repeat(2, 1fr);
	}

	.charts-row,
	.bottom-row {
		grid-template-columns: 1fr;
	}
}

@media (max-width : 768px) {
	.dashboard-container {
		grid-template-columns: 1fr;
	}

	/* Hide sidebar by moving it left out of screen */
	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: var(--sidebar-width);
		transform: translateX(-100%);
		box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
	}

	/* Show sidebar when active */
	.sidebar.active {
		transform: translateX(0);
	}

	/* Show toggle button */
	#sidebarToggle {
		display: block;
	}

	.summary-cards {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 820px) {
	#overlay {
		display: none !important;
	}
}

.bootstrap-select,
.bootstrap-select .btn {
	width: 100% !important;
	min-width: 0 !important;
	max-width: 100%;
	box-sizing: border-box;
}

.bootstrap-select .btn {
	padding-right: 0.75rem;
	background-color: #fff;
	border: 1px solid #ddd;
	border-radius: 0.375rem;
	color: #212529;
	box-shadow: none;
	min-width: 200px;
}

.bootstrap-select .btn:focus,
.bootstrap-select .btn:active,
.bootstrap-select .btn:focus-visible,
.bootstrap-select .btn.show {
	background-color: #fff !important;
	border-color: var(--primary);
	box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
	outline: none !important;
}


.bootstrap-select .dropdown-menu {
	border-radius: 0.375rem;
	border: 1px solid #ddd;
	box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
	z-index: 2000;
	max-height: 300px;
	overflow-y: auto;
}

.bootstrap-select .bs-searchbox input {
	border: 1px solid #ddd;
	border-radius: 0.375rem;
	padding: 0.375rem 0.75rem;
	font-size: 1rem;
	box-shadow: none;
}

.bootstrap-select .bs-searchbox input:focus {
	border-color: var(--primary);
	outline: 0;
	box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

.bootstrap-select .dropdown-menu li a {
	white-space: normal !important;
	word-wrap: break-word !important;
	overflow-wrap: break-word !important;
	word-break: break-word !important;
	max-width: 100%;
	display: block;
	padding-right: 1rem;
}

.bootstrap-select .dropdown-menu .dropdown-item.selected {
	background-color: #4361ee;
	color: #fff;
}

.bootstrap-select .dropdown-menu {
	overflow-x: hidden !important;
	overflow-y: auto !important;
	max-height: 300px;
	width: 100% !important;
	box-sizing: border-box;
}

.bootstrap-select:is(.is-invalid, .error, .has-error) .dropdown-toggle,
.bootstrap-select.was-validated select:invalid+.dropdown-toggle {
	border-color: #ced4da;
}

.bootstrap-select .bs-searchbox ~ .inner li.active:not(.selected) > a {
    background-color: transparent !important;
    color: inherit !important;
}

.bootstrap-select .bs-searchbox ~ .inner li.active:not(.selected):hover > a,
.bootstrap-select .bs-searchbox ~ .inner li:not(.active):hover > a {
    background-color: #e2e6ea !important;
    color: #000000 !important;
}

.overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.4);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease;
	z-index: 1000;
}

.overlay.active {
	opacity: 1;
	visibility: visible;
}

/* กรณีข้อความยาวใน side bar */
.sidebar {
	width: 250px;
/* 	height: 100vh; */
	overflow-y: auto;
	overflow-x: hidden;
	box-sizing: border-box;
}

.nav-menu,
.nav-item,
.nav-submenu,
.nav-subitem {
	max-width: 100%;
	white-space: normal;
	overflow-wrap: break-word;
	word-wrap: break-word;
	word-break: break-word;
	box-sizing: border-box;
}

/* 
สำหรับ Chrome / Edge / Safari
.sidebar::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-track {
  background: #2c2f33;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: #555;
}

สำหรับ Firefox มีข้อจำกัดปรับได้แค่สี
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: #888 #2c2f33;
}
 */

/* remove style validation  */
.is-invalid {
	border-color: #ced4da !important;
	box-shadow: none !important;
}

.was-validated .form-control:valid,
.form-control.is-valid,
.was-validated .form-control:invalid,
.form-control.is-invalid {
	background-image: none !important;
	padding-right: 0.8rem !important;
}

/* custom validation floating from */
.invalid-feedback.d-block {
	font-size: 0.9em;
	margin-top: 0.25rem;
}

/* remove fa-eye Edge */
input::-ms-reveal {
	display: none;
}

/* navtab-horizon */
.collapsed .section-content {
	display: none;
}

.collapsed .fa-chevron-down {
	transform: rotate(-90deg);
}

.nav-tabs .nav-link.active {
	font-weight: bold;
	border-bottom: 3px solid var(--primary);
}

.btn-group .btn {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
}


.nav-item:hover,
.nav-item.active {
	background: rgba(255, 255, 255, 0.1);
	border-left: 4px solid var(--success);
}

/* Tab Styles */
.nav-tabs-approve .nav-link-approve {
	border: none;
	color: var(--gray);
	background-color: transparent;
	font-weight: 400;
	padding: 10px 20px;
}

.nav-tabs-approve .nav-link-approve.active {
	color: var(--primary);
	background-color: white;
	border-bottom: 3px solid var(--primary) !important;
	font-weight: 500;
}

/* Approval Card Styles */
.approval-card {
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
	margin-bottom: 20px;
	transition: all 0.3s ease;
	border: 1px solid rgba(0, 0, 0, 0.05);
}

.approval-card:hover {
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.approval-header {
	background-color: white;
	padding: 15px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	border-radius: 8px 8px 0 0;
}

.approval-body {
	padding: 20px;
}

.document-preview {
	border: 1px solid rgba(0, 0, 0, 0.05);
	border-radius: 8px;
	height: 300px;
	overflow-y: auto;
	padding: 15px;
	background-color: #f9f9f9;
}

/* ป้องกัน overflow*/
html,
body {
	max-width: 100%;
	overflow-x: hidden;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

input,
select,
textarea,
.form-control {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.container,
.container-fluid,
.main-content,
.content-wrapper {
	max-width: 100%;
	overflow-x: hidden;
}

.header .d-flex {
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: flex-end;
}

.header .language-switcher {
	flex-shrink: 0;
}

.header .user-profile {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	max-width: 100%;
}

.header .user-profile span {
	max-width: 120px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: inline-block;
}


@media (max-width: 768px) {
	html {
		font-size: 90%;
	}

	.main-content {
		padding: 15px;
	}

	.header h1 {
		font-size: 1.4rem;
	}

	.nav-item,
	.nav-subitem {
		font-size: 0.85rem;
		padding: 10px 20px;
	}

	.btn,
	.form-control {
		font-size: 0.9rem;
		padding: 6px 10px;
	}

	.header .d-flex {
		flex-direction: column;
		align-items: flex-end;
	}

	.header .user-profile {
		width: 100%;
		justify-content: flex-end;
	}

	.header .language-switcher {
		max-width: 100px;
		justify-content: flex-end;
	}
}

/* Report Header */
.report-header {
	background-color: white;
	border-radius: 10px;
	padding: 15px 20px;
	margin-bottom: 20px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Chart Container */
.chart-container {
	position: relative;
	min-height: 300px;
	height: 96%;
}
.pie-chart-total{
	position: absolute;
	bottom: 0;
	right: 0;
}

.chart-height {
	height: 250px;
}

/* Allocation Card */
.allocation-card {
	border-left: 4px solid var(--primary);
	transition: all 0.3s ease;
	margin-bottom: 15px;
}

.allocation-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Amount Style */
.amount {
	font-weight: bold;
	color: var(--primary);
}

/* Amount Style */
.total-amount {
	font-weight: bold;
	color: var(--success);
}

/* Funding Card */
.funding-card {
	border-left: 4px solid var(--primary);
	transition: all 0.3s ease;
	margin-bottom: 15px;
}

.funding-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

h5, h6 {
	white-space: normal;
	word-wrap: break-word;
	overflow-wrap: break-word;
	word-break: break-word;
	max-width: 100%;
	display: block;
}

.dropdown-menu.inner {
  overflow-y: auto !important;  /* scroll ของ inner */
  max-height: 20vh !important;  /* % ตามหน้าจอ */
}

.dropdown-menu {
  overflow: visible !important;  /* ปิด scroll ชั้นนอก */
  max-height: none !important;
}

/* Loading page */
#pageLoading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: none;
}
#pageLoading .spinner {
  position: absolute;
  top: 50%; left: 50%;
  width: 60px; height: 60px;
  border: 6px solid #fff;
  border-top: 6px solid #0d6efd;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1s linear infinite;
} 
@keyframes spin {
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.scroll-chart-container{
	width:100%;
	max-width:100%;
	overflow-x:auto;
	height: 100%;
}
.scroll-chart-container-body{
/* 	position: relative; */
	min-height: 300px;
	height: 96%;
}
