:root {
	--primary-color: #6366f1;
	--primary-dark: #4f46e5;
	--surface-color: #ffffff;
	--text-primary: #1f2937;
	--text-secondary: #6b7280;
 }
 
 body {
	font-family: Sarabun;
	background-color: #f3f4f6;
 }
 
 /* Card Styles */
 .card {
	border: none;
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
	border-radius: 16px;
	overflow: hidden;
 }
 
 .card-header {
	background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
	border: none;
	padding: 1.5rem;
 }
 
 .card-body {
	padding: 2rem;
 }
 
 .title-wrapper {
	color: white;
 }
 
 .title-wrapper h4 {
	font-size: 1.5rem;
	font-weight: 600;
	text-shadow: 0 2px 4px rgba(0,0,0,0.1);
	margin-bottom: 0.2rem;
 }
 
 .title-wrapper small {
	color: rgba(255,255,255,0.8);
	font-size: 0.9rem;
 }
 
 /* Button Styles */
 .btn {
	border-radius: 8px;
	padding: 0.5rem 1rem;
	font-weight: 500;
	transition: all 0.2s;
 }
 
 .btn-primary {
	background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
	border: none;
 }
 
 .btn-icon {
	width: 40px;
	height: 40px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(255,255,255,0.2);
	border: none;
	transition: all 0.2s ease;
 }
 
 .btn-icon:hover {
	background: rgba(255,255,255,0.3);
	transform: scale(1.05);
 }
 
 .btn-icon i {
	font-size: 1.2rem;
	color: white;
 }
 
 /* Pagination Styles */
 .pagination-controls {
	background: white;
	padding: 1.5rem;
	border-radius: 12px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	margin-top: 2rem;
 }
 
 .pagination-controls .btn {
	min-width: 80px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
 }
 
 .page-selector {
	width: 150px;
 }
 
 .page-selector .form-select {
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	padding: 0.5rem;
	font-weight: 500;
	cursor: pointer;
	background-color: #fff;
 }
 
 .page-selector .form-select:focus {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.1);
 }
 
 .page-text {
	color: var(--text-secondary);
	padding: 0.5rem 1rem;
 }
 
 /* Text and Word Styles */
 .pali-word {
	cursor: pointer;
	padding: 2px;
	font-size: 1.5rem;
 }
 
 .pali-text {
	line-height: 2.2rem;
	padding: 1rem;
	background: #fff;
	border-radius: 12px;
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
 }
 
 .space-preserve {
	white-space: pre;
 }
 
 .pali-word:hover {
	background-color: #fff269;
	border-radius: 3px;
 }
 
 .pali-word.punctuation {
	color: #666;
	cursor: default;
	padding: 0 2px;
 }
 
 .pali-word.punctuation:hover {
	background-color: transparent;
 }
 
 /* Loading Overlay */
 .loading-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(255,255,255,0.95);
	backdrop-filter: blur(4px);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 9999;
 }
 
 .spinner-wrapper {
	text-align: center;
 }
 
 .loading-text {
	font-weight: 500;
	color: var(--primary-color);
	margin-top: 1rem;
	font-size: 1.2rem;
 }
 
 .spinner-border {
	width: 3rem;
	height: 3rem;
	color: var(--primary-color);
 }
 
 /* Offcanvas Styles */
 .offcanvas {
	border-radius: 16px 16px 0 0;
 }
 
 .offcanvas-bottom {
	box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.1);
 }
 
 .offcanvas-header {
	background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
	padding: 1.5rem;
	border-radius: 16px 16px 0 0;
	color: white;
 }
 
 .offcanvas-header .input-group {
	background: var(--surface-color);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0,0,0,0.05);
 }
 
 .offcanvas-header .form-control {
	border: none;
	padding: 1rem;
	font-size: 1.1rem;
 }
 
 .offcanvas-header .btn-close {
	background-color: rgba(255,255,255,0.2);
	padding: 0.75rem;
	border-radius: 8px;
 }
 
 /* Page Header */
 .page-header {
	text-align: center;
	margin: 1rem 0;
	padding: 0.5rem;
	background: #f8fafc;
	border-radius: 8px;
 }
 
 .current-page-badge {
	background-color: white;
	padding: 0.5rem 1.5rem;
	border-radius: 8px;
	font-weight: 500;
	color: var(--text-primary);
	font-size: 1.1rem;
	box-shadow: 0 1px 2px rgba(0,0,0,0.05);
 }
 
 /* Menu Items */
 .text-meta {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.3rem;
 }
 
 .book-badge, .page-badge {
	font-size: 0.75rem;
	padding: 0.2rem 0.6rem;
	border-radius: 12px;
	font-weight: 500;
 }
 
 .book-badge {
	background-color: var(--primary-color);
	color: white;
 }
 
 .page-badge {
	background-color: #e5e7eb;
	color: var(--text-secondary);
 }
 
 .text-item.active .page-badge {
	background-color: #f3f4f6;
	color: var(--primary-color);
 }
 
 /* Search Results */
 .search-result-item {
	padding: 1rem;
	margin-bottom: 0.5rem;
	background: white;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.05);
	cursor: pointer;
	transition: all 0.2s;
 }
 
 .search-result-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 6px rgba(0,0,0,0.1);
 }
 
 .highlight {
	background-color: #fff269;
	padding: 0.1rem 0.3rem;
	border-radius: 4px;
	font-weight: 500;
 }
 
 @keyframes highlight-pulse {
	0% { background-color: #fff269; }
	50% { background-color: transparent; }
	100% { background-color: #fff269; }
 }
 
 .highlight-animation {
	animation: highlight-pulse 1s ease-in-out 2;
 }

 
 .text-line {
	margin-bottom: 0.5rem;
 }
 
 .indent {
	white-space: pre;
	color: transparent;
	user-select: none;
 }

 .page-selector {
	width: 120px;
 }
 
 .form-select-sm {
	min-width: 150px;
	font-weight: 500;
	font-size: 1.2rem;
 }
 
 .pagination-controls .form-select {
	background-color: #fff;
	border: 1px solid #dee2e6;
	transition: all 0.2s;
 }
 
 .pagination-controls .form-select:focus {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
 }

 /* Menu Styles */
.text-menu {
	max-width: 400px;
	width: 100%;
}

.text-menu .offcanvas-header {
	background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
	color: white;
	padding: 1rem 1.5rem;
}

.text-menu .offcanvas-title {
	font-size: 1.25rem;
	font-weight: 600;
}

.book-section {
	margin-bottom: 1.5rem;
}

.book-header {
	background: #f8fafc;
	color: var(--primary-color);
	padding: 0.75rem 1rem;
	font-weight: 600;
	border-radius: 8px;
	margin-bottom: 0.75rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1.1rem;
	box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chapter-list {
	padding-left: 0.5rem;
}

.chapter-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem 1rem;
	margin: 0.25rem 0;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	background: white;
	border: 1px solid #edf2f7;
}

.chapter-item:hover {
	background: #f8fafc;
	transform: translateX(5px);
}

.chapter-item.active {
	background: var(--primary-color);
	color: white;
	border-color: var(--primary-color);
}

.chapter-title {
	font-weight: 500;
}

.chapter-page {
	background: rgba(0,0,0,0.05);
	padding: 0.25rem 0.75rem;
	border-radius: 12px;
	font-size: 0.9rem;
	font-weight: 500;
}

.chapter-item.active .chapter-page {
	background: rgba(255,255,255,0.2);
}

/* Search input styling */
.text-search .input-group {
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	border-radius: 8px;
	overflow: hidden;
}

.text-search .form-control,
.text-search .input-group-text {
	border: none;
	padding: 0.75rem 1rem;
}

.text-search .input-group-text {
	background: white;
}

.book-header {
	background: #f8fafc;
	color: var(--primary-color);
	padding: 0.75rem 1rem;
	font-weight: 600;
	border-radius: 8px;
	margin-bottom: 0.5rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.book-header:hover {
	background: #edf2f7;
}

.book-header i.bi-chevron-right,
.book-header i.bi-chevron-down {
	font-size: 1.1rem;
	transition: transform 0.2s ease;
}

.chapter-list {
	padding-left: 0.5rem;
	/* max-height: 1000px; */
	overflow: hidden;
	transition: all 0.3s ease;
}

.chapter-list.collapsed {
	max-height: 0;
	opacity: 0;
	margin: 0;
	padding: 0;
}

.book-section {
	margin-bottom: 0.75rem;
	border-radius: 8px;
}

/* Animation for chevron */
.book-header .bi-chevron-down {
	transform: rotate(0deg);
}

.book-header .bi-chevron-right {
	transform: rotate(0deg);
}

/* Optional: Add active state for book header */
.book-header.active {
	background: #edf2f7;
}

/* Ensure smooth height transition */
.chapter-list {
	transform-origin: top;
}

.chapter-item {
	opacity: 1;
	transition: opacity 0.2s ease;
}

.chapter-list.collapsed .chapter-item {
	opacity: 0;
}

/* Loading transitions */
.loading-overlay {
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.fade-loading {
	opacity: 1;
	visibility: visible;
}

/* Content transitions */
.fade-content-enter-active,
.fade-content-leave-active {
	transition: opacity 0.3s ease;
}

.fade-content-enter,
.fade-content-leave-to {
	opacity: 0;
}

.fade-content-enter-to,
.fade-content-leave {
	opacity: 1;
}

/* Smooth page content transition */
.pali-text {
	transition: opacity 0.3s ease;
}

.pali-text.loading {
	opacity: 0.5;
}

/* Mobile responsiveness for pagination */
@media (max-width: 768px) {
	.pagination-controls .form-select {
			font-size: 0.9rem;
			padding: 0.375rem 0.5rem;
	}

	.pagination-controls .btn {
			padding: 0.375rem 0.5rem;
			font-size: 0.9rem;
	}

	.page-selector {
			width: auto;
			min-width: 100px;
	}

	.pagination-controls .btn i {
			margin: 0;
	}
}

.result-meta {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.5rem;
}

.chapter-badge {
	color: var(--primary-color);
	font-size: 0.9rem;
	font-weight: 500;
}

.page-badge {
	background: var(--primary-color);
	color: white;
	padding: 0.25rem 0.75rem;
	border-radius: 12px;
	font-size: 0.85rem;
	font-weight: 500;
	display: inline-block;
}

.floating-menu {
	position: absolute;
	background: white;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.1);
	z-index: 1000;
	padding: 0.5rem;
}

.highlight-colors {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
	padding: 0.5rem;
	border-bottom: 1px solid #eee;
}

.color-btn {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	transition: transform 0.2s;
}

.color-btn:hover {
	transform: scale(1.1);
}

.note-btn,
.translate-btn {
	display: block;
	width: 100%;
	padding: 0.5rem;
	border: none;
	background: none;
	text-align: left;
	cursor: pointer;
}

.note-btn:hover,
.translate-btn:hover {
	background: #f8f9fa;
}


.pali-word {
	position: relative;
	transition: background-color 0.3s;
}

.pali-word.highlight-mode {
	cursor: crosshair;
}

.pali-word.has-note {
	color: #771b03; /* Dark blue color */
	cursor: help;
}

.pali-word.has-note:hover {
	color: #e94e06; /* Slightly lighter blue on hover */
}

.floating-menu .highlight-colors {
	display: grid;
	grid-template-columns: repeat(7, 1fr); /* 7 buttons per row */
	grid-template-rows: repeat(2, 1fr); /* 2 rows */
	gap: 5px;
	margin-bottom: 8px;
}

.floating-menu .color-btn {
	width: 25px;
	height: 25px;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
}

.floating-menu .color-btn:hover {
	transform: scale(1.1);
	transition: transform 0.2s;
}


.custom-tooltip {
	--bs-tooltip-max-width: 300px;
	--bs-tooltip-bg: #fff;
	--bs-tooltip-color: #333;
	--bs-tooltip-border-radius: 0.375rem;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	border: 1px solid #ddd;
	padding: 8px;
	white-space: pre-wrap;
}

.note-icon {
	display: inline-block;
	vertical-align: super;
	transition: transform 0.2s;
}

.note-icon:hover {
	transform: scale(1.2);
}

.floating-note {
	position: absolute;
	z-index: 1050;
	background: #feff9c; /* Post-it yellow color */
	border: none;
	border-radius: 2px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	max-width: 300px;
	transform: rotate(-1deg);
	animation: fadeIn 0.2s ease-in-out;
	padding: 0;
	font-family: Sarabun;
}

.floating-note::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	border-width: 0 16px 16px 0;
	border-style: solid;
	border-color: #e4e4a1 #fff; /* Darker shade for folded corner */
	box-shadow: -2px 2px 2px rgba(0,0,0,0.1);
}

.floating-note-header {
	padding: 8px 12px 4px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px dashed rgba(0,0,0,0.1);
}

.floating-note-header i {
	color: #b5b559;
	font-size: 14px;
}

.floating-note-header .close-btn {
	background: none;
	border: none;
	color: #b5b559;
	font-size: 18px;
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
}

.floating-note-header .close-btn:hover {
	color: #999933;
}

.note-header-content {
	display: flex;
	align-items: center;
	gap: 8px;
}

.noted-word {
	font-weight: 500;
	color: #726f3b;
	font-size: 0.95em;
}

.floating-note-content {
	font-family: Sarabun;
	padding: 12px;
	/* white-space: pre-wrap; */
	max-height: 200px;
	overflow-y: auto;
	color: #515151;
	line-height: 1.5;
	font-size: 1em;
}

@keyframes fadeIn {
	from { 
			opacity: 0;
			transform: translateY(-10px) rotate(-1deg);
	}
	to { 
			opacity: 1;
			transform: translateY(0) rotate(-1deg);
	}
}

/* Style scrollbar for the note content */
.floating-note-content::-webkit-scrollbar {
	width: 6px;
}

.floating-note-content::-webkit-scrollbar-track {
	background: rgba(0,0,0,0.05);
}

.floating-note-content::-webkit-scrollbar-thumb {
	background: rgba(181,181,89,0.5);
	border-radius: 3px;
}

.color-btn.clear-highlight {
	background: white;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #666;
	border: 2px solid #ddd;
}

.color-btn.clear-highlight:hover {
	color: #333;
	border-color: #999;
}

.color-btn.clear-highlight i {
	font-size: 12px;
}

/* Make the floating menu wider to accommodate all colors in one row */
.floating-menu {
	min-width: 220px; /* Adjust this value based on your needs */
}

.floating-menu-content {
	padding: 8px;
}

.btn-icon {
	width: 38px;
	height: 38px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.btn-icon i {
	font-size: 1.2rem;
}

/* Optional: Add cursor style change when in highlight mode */
.pali-word {
	cursor: pointer;
}

.highlight-mode .pali-word {
	cursor: cell;
}

.btn-highlight-selected {
	/* color: #4b465c; */
	background-color: #ffc600 !important;
	border-color: #ffc600 !important;
}

/* Post-it style modal */
.post-it-modal {
	background: #feff9c;
	border: none;
	border-radius: 3px;
	box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.post-it-modal::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	border-width: 0 20px 20px 0;
	border-style: solid;
	border-color: #e4e4a1 #fff;
	box-shadow: -2px 2px 2px rgba(0,0,0,0.1);
}

.post-it-modal .modal-header {
	border-bottom: 1px dashed rgba(0,0,0,0.1);
	padding: 1rem 1.5rem;
	background: transparent;
}

.post-it-modal .note-header-content {
	display: flex;
	align-items: center;
	gap: 10px;
}

.post-it-modal .note-header-content i {
	color: #b5b559;
	font-size: 1.2rem;
}

.post-it-modal .modal-title {
	color: #726f3b;
	font-size: 1.1rem;
	margin: 0;
	font-weight: 500;
}

.post-it-modal .btn-close {
	opacity: 0.5;
	font-size: 0.8rem;
}

.post-it-modal .modal-body {
	padding: 1.5rem;
	background: linear-gradient(transparent, transparent 28px, #e4e4a1 28px);
	background-size: 100% 29px;
}

.post-it-modal .note-textarea {
	background: transparent;
	border: none;
	line-height: 29px;
	height: auto;
	min-height: 116px; /* 4 lines */
	resize: vertical;
	color: #515151;
	font-size: 1rem;
	padding: 0;
}

.post-it-modal .note-textarea:focus {
	box-shadow: none;
	outline: none;
}

.post-it-modal .modal-footer {
	border-top: 1px dashed rgba(0,0,0,0.1);
	padding: 1rem 1.5rem;
	background: transparent;
}

.post-it-modal .save-note-btn {
	background-color: #b5b559;
	border-color: #b5b559;
}

.post-it-modal .save-note-btn:hover {
	background-color: #999933;
	border-color: #999933;
}

.post-it-modal .btn-light {
	background-color: rgba(255,255,255,0.5);
	border-color: rgba(0,0,0,0.1);
}

.post-it-modal .btn-light:hover {
	background-color: rgba(255,255,255,0.7);
}

/* Placeholder styling */
.post-it-modal .note-textarea::placeholder {
	color: #b5b559;
	opacity: 0.6;
}

.edit-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 8px;
	border: none;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
	margin-bottom: 4px;
}

.edit-btn:hover {
	background: #f0f0f0;
}

.edit-word-input {
	font-size: 1.1rem;
	padding: 10px;
	border: 1px solid rgba(0,0,0,0.1);
	border-radius: 4px;
}

.edited-word-container {
	display: inline;
}

.edited-word {
	color: #dc3545 !important; /* Red color for edited words */
	font-style: italic;
}

.restore-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 8px;
	border: none;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
	margin-bottom: 4px;
	color: #dc3545;
}

.restore-btn:hover {
	background: #fff5f5;
}

.edited-word-container .edited-word {
	cursor: pointer;
}

.inline-edit-container {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #fff;
	padding: 2px;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.inline-edit-input {
	border: 1px solid #ddd;
	border-radius: 3px;
	padding: 2px 4px;
	font-size: inherit;
	width: auto;
	min-width: 60px;
}

.inline-edit-buttons {
	display: flex;
	gap: 2px;
}

.inline-edit-buttons button {
	border: none;
	background: none;
	padding: 2px 4px;
	cursor: pointer;
	border-radius: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.inline-edit-buttons .save-btn {
	color: #28a745;
}

.inline-edit-buttons .cancel-btn {
	color: #dc3545;
}

.inline-edit-buttons button:hover {
	background: rgba(0,0,0,0.05);
}

.btn-clear:hover{
	color: rgb(56, 56, 56);
}