:root {
	--primary-color: #4155b5;
	--primary-dark: #2a3a8c;
	--primary-light: #7d97f4;
	--accent-color: #f97316;
	--text-primary-color: #4155b5;
	--text-color: #334155;
	--text-light: #64748b;
	--info-color: #105891;
	--bg-color: #f8fafc;
	--card-bg: #ffffff;
	--border-color: #e2e8f0;
	--shadow-color: rgba(0, 0, 0, 0.1);
	--highlight-color: #fef9c3;
	--skeleton-base: #f1f5f9;
	--skeleton-highlight: #e2e8f0;
}

.dark-mode {
	--primary-color: #4155b5;
	--primary-dark: #6366f1;
	--primary-light: #a5b4fc;
	--info-color: #103f91;
	--accent-color: #fb923c;
	--text-primary-color: #fefeff;
	--text-color: #e2e8f0;
	--text-light: #94a3b8;
	--bg-color: #1e293b;
	--card-bg: #334155;
	--border-color: #475569;
	--shadow-color: rgba(0, 0, 0, 0.3);
	--highlight-color: #854d0e;
	--skeleton-base: #475569;
	--skeleton-highlight: #64748b;
}

body {
	background-color: var(--bg-color);
	color: var(--text-color);
	transition: background-color 0.3s ease, color 0.3s ease;
}

.font-pali {
	font-family: 'Sarabun', sans-serif;
}

.main-container {
	max-width: 1200px;
	margin: 0 auto;
	padding-bottom: 2rem;
}
.header {
	background: linear-gradient(135deg, #4155b5, #2a3a8c);
	color: white;
	padding: 0.75rem 0;
	margin-bottom: 1rem;
	border-radius: 0 0 1rem 1rem;
	box-shadow: 0 4px 15px rgba(65, 85, 181, 0.4);
	position: relative;
	overflow: hidden;
}

.modal-header {
	background: linear-gradient(135deg, #4155b5, #2a3a8c);
}
.modal-header h5 {
	color: white;
}

.header h1 {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 0;
	letter-spacing: 0.5px;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.header-actions {
	display: flex;
	gap: 0.5rem;
}

.header-btn {
	background-color: rgba(255, 255, 255, 0.2);
	color: white;
	border: none;
	border-radius: 50%;
	width: 2.2rem;
	height: 2.2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
}

.header-btn:hover {
	background-color: rgba(255, 255, 255, 0.3);
	transform: translateY(-2px);
}

.search-box {
	background: var(--card-bg);
	padding: 2rem;
	border-radius: 1rem;
	box-shadow: 0 4px 10px var(--shadow-color);
	margin-bottom: 1.5rem;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	position: relative;
}

.search-box:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 15px var(--shadow-color);
}

.search-input {
	border: 2px solid var(--border-color);
	border-radius: 0.5rem;
	padding: 0.75rem 1rem;
	font-size: 1.1rem;
	color: var(--text-color);
	background-color: var(--card-bg);
	transition: border-color 0.3s ease;
}

.search-input:focus {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

.search-icon {
	background-color: var(--primary-color);
	color: white;
	border: none;
}

.search-btn {
	background: var(--primary-color);
	color: white;
	border: none;
	padding: 0.75rem 2rem;
	border-radius: 0.5rem;
	font-size: 1.1rem;
	box-shadow: 0 2px 5px rgba(79, 70, 229, 0.3);
	transition: all 0.3s ease;
}

.search-btn:hover {
	background: var(--primary-dark);
	color: white;
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
}

.search-btn:disabled {
	background: var(--border-color);
	cursor: not-allowed;
}

.dict-card {
	border: none;
	border-radius: 1rem;
	box-shadow: 0 4px 6px var(--shadow-color);
	margin-bottom: 1.5rem;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	background-color: var(--card-bg);
	border-left: 4px solid var(--primary-light);
	overflow: hidden;
}

.dict-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 8px 15px var(--shadow-color);
}

.top-result {
	border-left-color: var(--accent-color);
}

.top-result::before {
	content: "ตรงกับคำค้นหามากที่สุด";
	position: absolute;
	top: 5px;
	right: 10px;
	font-size: 0.7rem;
	background-color: var(--accent-color);
	color: white;
	padding: 0.2rem 0.5rem;
	border-radius: 1rem;
}

.card-title {
	color: var(--text-primary-color);
	font-size: 1.8rem;
	font-weight: bold;
	margin-bottom: 0.75rem;
}

.card-text {
	color: var(--text-color);
	line-height: 1.7;
	font-size: 1.2rem;
	margin-bottom: 0;
}

.word-type {
	display: inline-block;
	background-color: var(--primary-light);
	color: white;
	font-size: 0.8rem;
	padding: 0.2rem 0.6rem;
	border-radius: 1rem;
	margin-bottom: 0.75rem;
}

.divider {
	height: 1px;
	background-color: var(--border-color);
	margin: 0.5rem 0 1rem 0;
}

.entry-actions {
	display: flex;
}

.entry-actions .btn {
	opacity: 0.7;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.entry-actions .btn:hover {
	opacity: 1;
	transform: scale(1.1);
}

.loader {
	padding: 2rem 0;
}

.skeleton-loader {
	background-color: var(--card-bg);
	padding: 1.5rem;
	border-radius: 1rem;
	margin-bottom: 1.5rem;
	box-shadow: 0 4px 6px var(--shadow-color);
	overflow: hidden;
}

.skeleton-header {
	height: 2rem;
	background: linear-gradient(90deg, var(--skeleton-base) 0%, var(--skeleton-highlight) 50%, var(--skeleton-base) 100%);
	border-radius: 0.5rem;
	margin-bottom: 1rem;
	background-size: 200% 100%;
	animation: shine 1.5s infinite;
	width: 40%;
}

.skeleton-line {
	height: 1rem;
	background: linear-gradient(90deg, var(--skeleton-base) 0%, var(--skeleton-highlight) 50%, var(--skeleton-base) 100%);
	border-radius: 0.25rem;
	margin-bottom: 0.75rem;
	background-size: 200% 100%;
	animation: shine 1.5s infinite;
}

.skeleton-line.short {
	width: 70%;
}

@keyframes shine {
	0% {
		background-position: -100% 0;
	}
	100% {
		background-position: 100% 0;
	}
}

.error-message {
	background: #f87171;
	color: white;
	padding: 1rem;
	border-radius: 0.5rem;
	text-align: center;
	margin: 1rem 0;
	box-shadow: 0 4px 6px rgba(248, 113, 113, 0.3);
}

.no-results {
	text-align: center;
	padding: 2rem;
	color: var(--text-light);
	font-size: 1.2rem;
	background-color: var(--card-bg);
	border-radius: 1rem;
	box-shadow: 0 4px 6px var(--shadow-color);
}

.no-results ul {
	text-align: left;
	margin-top: 0.5rem;
	padding-left: 2rem;
}

.stats {
	color: var(--text-light);
	font-size: 0.9rem;
	margin-bottom: 1rem;
	padding: 0.5rem 0;
}

.highlight {
	background-color: var(--highlight-color);
	padding: 0 3px;
	border-radius: 3px;
	font-weight: bold;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}

.dictionary-type {
	margin-bottom: 1.5rem;
}

.dict-type-btn {
	flex: 1;
	padding: 0.75rem;
	border-color: var(--primary-color);
	color: var(--primary-color);
	font-weight: 500;
	transition: all 0.3s ease;
}

.dict-type-btn:hover {
	background-color: rgba(99, 102, 241, 0.1);
	border-color: var(--primary-color);
	color: var(--primary-color);
}

.btn-check:checked + .dict-type-btn {
	background-color: var(--primary-color);
	color: white;
}

.theme-toggle-btn {
	padding: 0.4rem 0.8rem;
	border-radius: 2rem;
	transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
	transform: translateY(-2px);
}

/* แก้ไขการซ้อนทับโดยเปลี่ยนโครงสร้าง z-index */
.recent-searches {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background-color: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: 0.5rem;
	margin-top: 0.5rem;
	padding: 1rem;
	z-index: 1100; /* เพิ่ม z-index ให้สูงมากๆ */
	box-shadow: 0 4px 15px var(--shadow-color);
}

.recent-title {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.75rem;
	color: var(--text-light);
	font-size: 0.9rem;
}

.recent-items {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.recent-item {
	background-color: var(--border-color);
	color: var(--text-color);
	padding: 0.3rem 0.7rem;
	border-radius: 1rem;
	font-size: 0.9rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.recent-item:hover {
	background-color: var(--primary-light);
	color: white;
}

.favorites-header {
	margin-bottom: 1rem;
}

.favorites-header h3 {
	font-size: 1.3rem;
	color: var(--text-color);
}

.favorites-list {
	background-color: var(--card-bg);
	border-radius: 1rem;
	padding: 1rem;
	box-shadow: 0 4px 6px var(--shadow-color);
}

.favorite-item {
	padding: 0.75rem;
	border-bottom: 1px solid var(--border-color);
}

.favorite-item:last-child {
	border-bottom: none;
}

.favorite-word {
	font-weight: 500;
	color: var(--primary-color);
	cursor: pointer;
}

.favorite-word:hover {
	text-decoration: underline;
}


/* ปรับปุ่มให้เข้ากับธีม */
.btn-outline-primary, .btn-outline-secondary {
	border-color: var(--primary-color);
	color: var(--primary-color);
}

.btn-outline-primary:hover, .btn-outline-secondary:hover {
	background-color: var(--primary-color);
	color: white;
}

.search-btn, .btn-primary {
	background: var(--primary-color);
	color: white;
	border: none;
	box-shadow: 0 2px 5px rgba(65, 85, 181, 0.3);
}

.search-btn:hover, .btn-primary:hover {
	background: var(--primary-dark);
	color: white;
	box-shadow: 0 4px 8px rgba(65, 85, 181, 0.4);
}

.search-icon {
	background-color: var(--primary-color);
}

/* ปรับแต่ง word-type badge */
.word-type {
	background-color: var(--primary-color);
}

/* ทำให้ Recent searches อยู่เหนือทุกอย่าง */
.search-box {
	z-index: 10;
	position: relative;
}

.recent-searches {
	clip-path: inset(0 0 0 0); /* Fix for overflow issues */
}

.btn-menu {
	background: var(--info-color);
	border-color: var(--border-color);
}

@media (max-width: 768px) {
	.header {
		padding: 1rem 0;
	}

	.search-box {
		padding: 1.5rem;
	}

	.search-btn {
		margin-top: 0;
	}

	.card-title {
		font-size: 1.5rem;
	}

	.card-text {
		font-size: 1.1rem;
	}

	
	.top-result::before {
		font-size: 0.6rem;
		padding: 0.1rem 0.4rem;
	}
}

@media (max-width: 576px) {
	.header-subtitle {
		font-size: 0.8rem;
	}

	.dict-card {
		margin-bottom: 1rem;
	}

	.entry-actions {
		position: absolute;
		top: 1rem;
		right: 1rem;
	}

	.card-title {
		padding-right: 5px;
	}
}

/* Modal styles for dark mode compatibility */
.modal-content {
	background-color: var(--card-bg);
	color: var(--text-color);
}

.modal-header {
	border-bottom-color: var(--border-color);
}

.modal-footer {
	border-top-color: var(--border-color);
}

/* Button hover animations */
.btn {
	transition: all 0.3s ease;
}

.btn:active {
	transform: scale(0.95);
}

/* Animate.css customizations */
.animate__animated {
	--animate-duration: 0.5s;
}

[v-cloak] {
	display: none;
}