/* =============================
   Header Buttons and Modals
   ============================= */

/* Header Buttons */
.header-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
	background: #f8fafc;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	color: #475569;
	text-decoration: none;
	font-size: 0.85rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.3s ease;
	position: relative;
	margin-left: 0.5rem;
	width: 40px;
	height: 40px;
	min-width: 40px;
}

.header-btn:hover {
	background: #3b82f6;
	color: #ffffff;
	border-color: #3b82f6;
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.header-btn i {
	font-size: 1rem;
}

/* Cart Count Badge */
.cart-count {
	position: absolute;
	top: -8px;
	right: -8px;
	background: #ef4444;
	color: #ffffff;
	font-size: 0.7rem;
	font-weight: 600;
	padding: 0.2rem 0.4rem;
	border-radius: 10px;
	min-width: 18px;
	text-align: center;
	line-height: 1;
}

/* Dark Mode Toggle */
.dark-mode-toggle.active {
	background: #1e293b;
	color: #ffffff;
	border-color: #1e293b;
}

.dark-mode-toggle.active i::before {
	content: "\f185"; /* sun icon */
}

/* Search Modal */
.search-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.8);
	z-index: 9999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 5%;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.search-modal.active {
	opacity: 1;
	visibility: visible;
}

.search-modal-content {
	background: #ffffff;
	border-radius: 12px;
	width: 90%;
	max-width: 600px;
	max-height: 80vh;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	transform: translateY(-20px);
	transition: transform 0.3s ease;
}

.search-modal.active .search-modal-content {
	transform: translateY(0);
}

.search-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.5rem;
	border-bottom: 1px solid #e5e7eb;
	background: #f8fafc;
}

.search-header h3 {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 600;
	color: #1e293b;
}

.search-close {
	background: none;
	border: none;
	font-size: 1.2rem;
	color: #6b7280;
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 6px;
	transition: all 0.3s ease;
}

.search-close:hover {
	background: #e5e7eb;
	color: #374151;
}

.search-form-container {
	padding: 1.5rem;
}

.search-input-group {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.search-input {
	flex: 1;
	padding: 0.75rem 1rem;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	font-size: 1rem;
	transition: border-color 0.3s ease;
}

.search-input:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-submit {
	padding: 0.75rem 1.5rem;
	background: #3b82f6;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 1rem;
	cursor: pointer;
	transition: background 0.3s ease;
}

.search-submit:hover {
	background: #2563eb;
}

.search-results {
	max-height: 400px;
	overflow-y: auto;
}

.search-loading,
.search-no-results {
	text-align: center;
	padding: 2rem;
	color: #6b7280;
}

.search-loading i {
	font-size: 1.5rem;
	margin-bottom: 0.5rem;
	display: block;
}

.search-no-results i {
	font-size: 2rem;
	margin-bottom: 1rem;
	display: block;
	color: #d1d5db;
}

.search-result-item {
	padding: 1rem;
	border-bottom: 1px solid #f1f5f9;
	transition: background 0.3s ease;
}

.search-result-item:hover {
	background: #f8fafc;
}

.search-result-item:last-child {
	border-bottom: none;
}

.search-result-title {
	font-weight: 600;
	color: #1e293b;
	margin-bottom: 0.25rem;
}

.search-result-title a {
	color: inherit;
	text-decoration: none;
}

.search-result-title a:hover {
	color: #3b82f6;
}

.search-result-excerpt {
	color: #6b7280;
	font-size: 0.9rem;
	line-height: 1.4;
}

.search-result-meta {
	color: #9ca3af;
	font-size: 0.8rem;
	margin-top: 0.5rem;
}

/* Cart Modal */
.cart-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.8);
	z-index: 9999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 5%;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.cart-modal.active {
	opacity: 1;
	visibility: visible;
}

.cart-modal-content {
	background: #ffffff;
	border-radius: 12px;
	width: 90%;
	max-width: 500px;
	max-height: 80vh;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	transform: translateY(-20px);
	transition: transform 0.3s ease;
	display: flex;
	flex-direction: column;
}

.cart-modal.active .cart-modal-content {
	transform: translateY(0);
}

.cart-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.5rem;
	border-bottom: 1px solid #e5e7eb;
	background: #f8fafc;
}

.cart-header h3 {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 600;
	color: #1e293b;
}

.cart-close {
	background: none;
	border: none;
	font-size: 1.2rem;
	color: #6b7280;
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 6px;
	transition: all 0.3s ease;
}

.cart-close:hover {
	background: #e5e7eb;
	color: #374151;
}

.cart-content {
	flex: 1;
	overflow-y: auto;
	padding: 1.5rem;
}

.cart-empty {
	text-align: center;
	padding: 2rem;
	color: #6b7280;
}

.cart-empty i {
	font-size: 3rem;
	margin-bottom: 1rem;
	display: block;
	color: #d1d5db;
}

.cart-empty p {
	margin-bottom: 1.5rem;
	font-size: 1.1rem;
}

.cart-item {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem 0;
	border-bottom: 1px solid #f1f5f9;
}

.cart-item:last-child {
	border-bottom: none;
}

.cart-item-image {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 6px;
}

.cart-item-details {
	flex: 1;
}

.cart-item-title {
	font-weight: 600;
	color: #1e293b;
	margin-bottom: 0.25rem;
}

.cart-item-price {
	color: #3b82f6;
	font-weight: 600;
}

.cart-item-remove {
	background: #ef4444;
	color: #ffffff;
	border: none;
	border-radius: 4px;
	padding: 0.25rem 0.5rem;
	cursor: pointer;
	font-size: 0.8rem;
	transition: background 0.3s ease;
}

.cart-item-remove:hover {
	background: #dc2626;
}

.cart-footer {
	padding: 1.5rem;
	border-top: 1px solid #e5e7eb;
	background: #f8fafc;
}

.cart-total {
	text-align: center;
	margin-bottom: 1rem;
	font-size: 1.1rem;
	color: #1e293b;
}

.cart-actions {
	display: flex;
	gap: 0.75rem;
}

.btn {
	padding: 0.75rem 1.5rem;
	border: none;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.3s ease;
	text-decoration: none;
	display: inline-block;
	text-align: center;
}

.btn-primary {
	background: #3b82f6;
	color: #ffffff;
}

.btn-primary:hover {
	background: #2563eb;
	transform: translateY(-1px);
}

.btn-secondary {
	background: #6b7280;
	color: #ffffff;
}

.btn-secondary:hover {
	background: #4b5563;
	transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
	.header-btn {
		padding: 0.4rem;
		margin-left: 0.25rem;
		width: 36px;
		height: 36px;
		min-width: 36px;
	}
	
	.header-btn i {
		font-size: 0.9rem;
	}
	
	.search-modal-content,
	.cart-modal-content {
		width: 95%;
		margin: 0 1rem;
	}
	
	.search-header,
	.cart-header {
		padding: 1rem;
	}
	
	.search-form-container,
	.cart-content {
		padding: 1rem;
	}
	
	.cart-actions {
		flex-direction: column;
	}
}

@media (max-width: 480px) {
	.header-actions {
		gap: 0.25rem;
	}
	
	.header-btn {
		padding: 0.3rem;
		margin-left: 0.2rem;
		width: 32px;
		height: 32px;
		min-width: 32px;
	}
	
	.header-btn i {
		font-size: 0.8rem;
	}
	
	.search-modal,
	.cart-modal {
		padding-top: 2%;
	}
	
	.search-modal-content,
	.cart-modal-content {
		width: 98%;
		margin: 0 0.5rem;
	}
}

/* =============================
   Dark Mode Styles
   ============================= */

body.dark-mode {
	background-color: #0f172a;
	color: #e2e8f0;
}

body.dark-mode .site-header {
	background-color: #1e293b;
	border-bottom-color: #334155;
}

body.dark-mode .header-btn {
	background-color: #334155;
	border-color: #475569;
	color: #e2e8f0;
}

body.dark-mode .header-btn:hover {
	background-color: #3b82f6;
	border-color: #3b82f6;
	color: #ffffff;
}

body.dark-mode .search-modal-content,
body.dark-mode .cart-modal-content {
	background-color: #1e293b;
	color: #e2e8f0;
}

body.dark-mode .search-header,
body.dark-mode .cart-header {
	background-color: #334155;
	border-bottom-color: #475569;
}

body.dark-mode .search-header h3,
body.dark-mode .cart-header h3 {
	color: #e2e8f0;
}

body.dark-mode .search-close,
body.dark-mode .cart-close {
	color: #94a3b8;
}

body.dark-mode .search-close:hover,
body.dark-mode .cart-close:hover {
	background-color: #475569;
	color: #e2e8f0;
}

body.dark-mode .search-input {
	background-color: #334155;
	border-color: #475569;
	color: #e2e8f0;
}

body.dark-mode .search-input:focus {
	border-color: #3b82f6;
	background-color: #334155;
}

body.dark-mode .search-input::placeholder {
	color: #94a3b8;
}

body.dark-mode .search-result-item {
	border-bottom-color: #334155;
}

body.dark-mode .search-result-item:hover {
	background-color: #334155;
}

body.dark-mode .search-result-title {
	color: #e2e8f0;
}

body.dark-mode .search-result-excerpt {
	color: #94a3b8;
}

body.dark-mode .search-result-meta {
	color: #64748b;
}

body.dark-mode .cart-content {
	background-color: #1e293b;
}

body.dark-mode .cart-empty {
	color: #94a3b8;
}

body.dark-mode .cart-item {
	border-bottom-color: #334155;
}

body.dark-mode .cart-item-title {
	color: #e2e8f0;
}

body.dark-mode .cart-footer {
	background-color: #334155;
	border-top-color: #475569;
}

body.dark-mode .cart-total {
	color: #e2e8f0;
}

body.dark-mode .widget {
	background-color: #1e293b;
	border-color: #334155;
}

body.dark-mode .widget-title {
	color: #e2e8f0 !important;
	border-bottom-color: #3b82f6;
}

body.dark-mode .widget * {
	color: #e2e8f0 !important;
}

body.dark-mode .widget a {
	color: #60a5fa !important;
}

body.dark-mode .widget a:hover {
	color: #93c5fd !important;
}

body.dark-mode .widget p,
body.dark-mode .widget div,
body.dark-mode .widget span,
body.dark-mode .widget li {
	color: #e2e8f0 !important;
}

body.dark-mode .widget .textwidget {
	color: #e2e8f0 !important;
}

body.dark-mode .widget .widget-content {
	color: #e2e8f0 !important;
}

body.dark-mode .main-content {
	background-color: #0f172a;
}

body.dark-mode .post-card,
body.dark-mode .page-card {
	background-color: #1e293b;
	border-color: #334155;
}

body.dark-mode .post-title a,
body.dark-mode .page-title a {
	color: #e2e8f0;
}

body.dark-mode .post-excerpt,
body.dark-mode .page-excerpt {
	color: #94a3b8;
}

body.dark-mode .post-meta,
body.dark-mode .page-meta {
	color: #64748b;
}

body.dark-mode .footer {
	background-color: #1e293b;
	border-top-color: #334155;
}

body.dark-mode .footer-widgets .widget-title {
	color: #e2e8f0;
}

body.dark-mode .footer-widgets .widget {
	background-color: transparent;
	border-color: #334155;
}

body.dark-mode .footer-widgets .widget * {
	color: #94a3b8;
}

body.dark-mode .footer-widgets .widget a {
	color: #e2e8f0;
}

body.dark-mode .footer-widgets .widget a:hover {
	color: #3b82f6;
}

/* Dark mode for image widgets */
body.dark-mode .widget_media_image img {
	border: 1px solid #334155;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .widget_media_image img:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Dark mode for gallery widgets */
body.dark-mode .widget_media_gallery {
	background-color: transparent;
}

body.dark-mode .widget_media_gallery .gallery-item {
	background-color: #334155;
	border: 1px solid #475569;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	width: 250px !important;
	height: 250px !important;
}

body.dark-mode .widget_media_gallery .gallery-item:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
	transform: translateY(-2px);
}

body.dark-mode .widget_media_gallery .gallery-item img {
	border: none;
	object-fit: cover;
	width: 100% !important;
	height: 100% !important;
}

/* Dark mode for text widgets */
body.dark-mode .widget_text {
	background-color: #1e293b;
}

body.dark-mode .widget_text .textwidget {
	color: #e2e8f0 !important;
}

body.dark-mode .widget_text .textwidget p {
	color: #e2e8f0 !important;
}

body.dark-mode .widget_text .textwidget a {
	color: #60a5fa !important;
}

body.dark-mode .widget_text .textwidget a:hover {
	color: #93c5fd !important;
}

/* Dark mode for custom HTML widgets */
body.dark-mode .widget_custom_html {
	background-color: #1e293b;
}

body.dark-mode .widget_custom_html .textwidget {
	color: #e2e8f0 !important;
}

/* Dark mode for recent posts widget */
body.dark-mode .recent-posts-widget .recent-post-item {
	background-color: #334155;
	border-color: #475569;
}

body.dark-mode .recent-posts-widget .recent-post-title a {
	color: #e2e8f0 !important;
}

body.dark-mode .recent-posts-widget .recent-post-excerpt {
	color: #94a3b8 !important;
}

body.dark-mode .recent-posts-widget .recent-post-meta {
	color: #64748b !important;
}

/* Dark mode for categories widget */
body.dark-mode .categories-tree-widget .category-item a {
	color: #e2e8f0 !important;
}

body.dark-mode .categories-tree-widget .category-item a:hover {
	color: #60a5fa !important;
}

/* Dark mode for social widget */
body.dark-mode .social-links-widget .social-link {
	background-color: #334155;
	border-color: #475569;
	color: #e2e8f0 !important;
}

body.dark-mode .social-links-widget .social-link:hover {
	background-color: #3b82f6;
	color: #ffffff !important;
}

/* Dark mode for popular posts widget */
body.dark-mode .popular-posts-widget .popular-post-item {
	background-color: #334155;
	border-color: #475569;
}

body.dark-mode .popular-posts-widget .popular-post-title a {
	color: #e2e8f0 !important;
}

body.dark-mode .popular-posts-widget .popular-post-excerpt {
	color: #94a3b8 !important;
}

body.dark-mode .popular-posts-widget .popular-post-meta {
	color: #64748b !important;
}
