/* Plugins Page Styles */

.plugins-page-main {
	max-width: 1400px;
	margin: 0 auto;
	display: flex;
	gap: 2rem;
	align-items: flex-start;
}

.page-title {
	text-align: center;
	margin-bottom: 40px;
}

.page-title h1 {
	font-size: 2.5rem;
	margin-bottom: 10px;
	color: #1a1a1a;
}

.page-title p {
	font-size: 1.1rem;
	color: #666;
}

/* Filters */
.plugins-filters {
	display: flex;
	gap: 10px;
	padding: 0;
	align-items: stretch;
	width: 100%;
	margin-bottom: 1rem;
}

.plugins-filters > * {
	flex: 1;
}

.plugins-filters #reset-filters {
	flex: 0 0 auto;
	width: 100px;
	justify-content: center;
}

.plugins-filters .button {
	padding: 0 .8rem;
	border: 1px solid #e0e0e0;
	border-radius: 5px;
	height: 42px;
	background: #fff;
	color: var(--primary-color);
	cursor: pointer;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	font-size: 0.85rem;
	font-weight: 500;
	text-transform: uppercase;
}

.plugins-filters .button:hover {
	background: var(--primary-color);
	color: #fff;
	border-color: var(--primary-color);
}

.sidebar-toggle svg {
	margin-right: 8px;
	vertical-align: middle;
}

/* Select2 Customization */
.plugins-filters .select2-container--default .select2-selection--single {
	border: 1px solid #e0e0e0;
	border-radius: 5px;
	height: 42px;
	display: flex;
	align-items: center;
	background-color: #fff;
	transition: border-color 0.3s;
}

.plugins-filters .select2-container--default.select2-container--open .select2-selection--single {
	border-color: var(--primary-color);
}

.plugins-filters .select2-container--default .select2-selection--single .select2-selection__rendered {
	line-height: 42px;
	padding-left: 15px;
	color: #333;
	font-size: 0.9rem;
}

.plugins-filters .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 40px;
	right: 5px;
}

.plugins-filters .select2-container {
	min-width: 180px;
	margin-bottom: 0;
}

.plugins-filters .select2-dropdown {
	border: 1px solid #e0e0e0;
	border-radius: 0;
	box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.plugins-filters .select2-results__option {
	padding: 10px 15px;
	font-size: 0.9rem;
}

.plugins-filters .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
	background-color: var(--primary-color);
	color: white;
}

.plugins-filters .select2-container--default .select2-selection--single .select2-selection__clear {
	position: absolute;
	right: 30px;
	top: 50%;
	transform: translateY(-50%);
	margin: 0;
}

.plugins-filters .select2-container--default .select2-selection--single .select2-selection__clear:hover {
	color: var(--accent-color);
}

/* Layout */
.plugins-layout {
	flex: 1;
	min-width: 0;
}

/* Sidebar */
.plugins-sidebar {
	width: 250px;
	flex-shrink: 0;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 2rem;
	max-height: calc(100vh - 10rem);
}

.plugins-sidebar h3 {
	margin: 0 0 1rem 0;
	font-size: 1.1rem;
	font-weight: 600;
	color: #333;
	padding: 1rem 0 0 1rem;
}

.category-list {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1;
	overflow-y: auto;
	min-height: 0;
}

.category-item {
	padding: 0.5rem 1rem;
	cursor: pointer;
	transition: background-color 0.2s;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 13px;
}

.category-item:hover {
	background-color: #f5f5f5;
}

.category-item.active {
	background-color: var(--accent-color);
	color: white;
}

/* UI Parent Category - Not clickable */
.category-item.category-parent {
	cursor: default;
	font-weight: 600;
	background-color: #f9f9f9;
	pointer-events: none;
}

.category-item.category-parent:hover {
	background-color: #f9f9f5;
}

/* UI Child Category - Indented */
.category-item.category-child {
	padding-left: 2rem;
}

.category-name {
	flex: 1;
	text-transform: capitalize;
}

.category-count {
	font-size: 0.9em;
	opacity: 0.7;
	margin-left: 0.5rem;
}

/* Sidebar Toggle Button (Mobile Only) */
.sidebar-toggle {
	display: none !important;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.sidebar-toggle .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* Main Content */
.plugins-main-content {
	flex: 1;
	min-width: 0;
	margin-top: 1rem;
}

/* Charts */
.charts-wrapper {
	display: flex;
	gap: 2rem;
	margin-bottom: 2rem;
	align-items: flex-start;
}

.chart-container {
	background: #fff;
	border-radius: 8px;
	padding: 1.5rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	flex: 1 1 0;
	min-width: 0;
	height: 500px;
	display: flex;
	flex-direction: column;
}

.chart-container:first-child {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.chart-container:first-child canvas {
	max-width: 400px;
	max-height: 400px;
	width: auto !important;
	height: auto !important;
}

.chart-container h3 {
	margin: 0 0 1rem 0;
	font-size: 1.1rem;
	font-weight: 600;
	color: #333;
	flex-shrink: 0;
	text-align: center;
}

.chart-container canvas {
	flex: 1;
	min-height: 0;
}

#plugins-chart {
	padding: 20px;
}

#plugins-bar-chart {
	width: 100% !important;
	height: 100% !important;
}

/* DataTable */
.plugins-table-container {
	background: #fff;
	border-radius: 8px;
	padding: 1.5rem 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* DataTable Wrapper Flexbox Layout */
.plugins-page-main .dataTables_wrapper {
	display: flex;
	flex-direction: column;
}

/* Mobile Responsive */
@media (max-width: 768px) {
	.plugins-page-main {
		flex-direction: column;
		gap: 0;
		max-width: 100%;
		box-sizing: border-box;
		padding: 20px 0;
	}
	
	.plugins-layout {
		flex-direction: column;
		width: 100%;
	}
	
	.sidebar-toggle {
		display: flex !important;
	}
	
	.plugins-sidebar {
		position: fixed;
		top: 0;
		left: -280px;
		width: 280px;
		height: 100vh;
		max-height: 100vh;
		z-index: 1000;
		transition: left 0.3s ease;
		border-radius: 0;
		margin: 0;
	}
	
	.plugins-sidebar.active {
		left: 0;
		box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
	}
	
	/* Filters 在手機版垂直排列 */
	.plugins-filters {
		flex-direction: column;
		max-width: 100%;
		box-sizing: border-box;
		gap: 10px;
	}
	
	.plugins-filters > * {
		flex: none;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}
	
	.plugins-filters #reset-filters {
		width: 100%;
	}
	
	.charts-wrapper {
		flex-direction: column;
		max-width: 100%;
		box-sizing: border-box;
	}
	
	.chart-container {
		width: 100%;
		max-width: 100%;
		padding: 1rem;
		box-sizing: border-box;
	}
	
	/* DataTable 水平滾動 */
	.plugins-table-container {
		overflow-x: visible;
		-webkit-overflow-scrolling: touch;
	}
	
	/* 只讓 table 本身可以滾動 */
	.dataTables_wrapper .dataTables_scroll {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
	
	.dataTables_wrapper .dataTables_scrollBody {
		overflow-x: auto !important;
		-webkit-overflow-scrolling: touch;
	}
	
	/* 確保控制項不會滾動 */
	.dataTables_wrapper .dataTables_length,
	.dataTables_wrapper .dataTables_filter,
	.dataTables_wrapper .dataTables_info,
	.dataTables_wrapper .dataTables_paginate {
		overflow-x: visible;
	}
	
	/* 手機版搜尋欄位調整 */
	.plugins-page-main .dataTables_wrapper .dataTables_filter {
		padding: 15px 20px;
		margin: 0 0 20px 0;
	}
	
	.plugins-page-main .dataTables_wrapper .dataTables_filter label {
		max-width: 100%;
	}
	
	.plugins-page-main .dataTables_wrapper .dataTables_filter input {
		font-size: 14px;
		padding: 12px 20px 12px 45px;
		background-position: 15px center;
		background-size: 18px;
	}
	
	#plugins-table {
		min-width: 600px;
	}
	
	/* 確保圓餅圖不變形 */
	.chart-container:first-child {
		height: 450px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	
	.chart-container:first-child canvas {
		max-width: 350px !important;
		max-height: 350px !important;
		width: auto !important;
		height: auto !important;
	}
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 999;
}

.sidebar-overlay.active {
	display: block;
}

@media (max-width: 768px) {
	.sidebar-overlay {
		display: none;
	}
	
	.sidebar-overlay.active {
		display: block;
	}
}

/* DataTables Customization */
#plugins-table {
	border-collapse: collapse;
}

#plugins-table thead th {
	background: #f5f5f5;
	padding: 15px;
	text-align: left;
	font-weight: 600;
	color: #333;
	border-bottom: 2px solid #e91e63;
}

#plugins-table tbody td {
	padding: 12px 15px;
	border-bottom: 1px solid #eee;
}

#plugins-table tbody td a {
	color: var(--accent-color);
	text-decoration: none;
}

#plugins-table tbody td a:hover {
	text-decoration: underline;
}

#plugins-table tbody tr:hover {
	background: #f9f9f9;
}

/* DataTables Controls */
.plugins-page-main .dataTables_wrapper .dataTables_length {
	margin-bottom: 15px;
	margin-left: 15px;
}

.plugins-page-main .dataTables_wrapper .dataTables_length select {
	padding: 5px 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
}

/* Google-style Search Bar */
.plugins-page-main .dataTables_wrapper .dataTables_filter {
	margin: 0 0 20px 0;
	padding: 0 10px;
	text-align: left;
	width: 100%;
	float: none;
}

.plugins-page-main .dataTables_wrapper .dataTables_filter label {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin: 0;
	font-size: 0;
}

.plugins-page-main .dataTables_wrapper .dataTables_filter input {
	width: 100%;
	padding: 12px 55px 12px 20px;
	border: 1px solid #ddd;
	border-radius: 24px;
	margin: 0;
	font-size: 16px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transition: all 0.3s ease;
}

/* 清除按鈕樣式 */
.plugins-page-main .dataTables_wrapper .dataTables_filter input::-webkit-search-cancel-button {
	cursor: pointer;
}

.plugins-page-main .dataTables_wrapper .dataTables_filter input:focus {
	outline: none;
	border-color: var(--accent-color);
	box-shadow: 0 4px 16px rgba(233, 30, 99, 0.2);
}

.plugins-page-main .dataTables_wrapper .dataTables_filter input::placeholder {
	color: #999;
}

/* Custom Search Button */
.custom-search-button {
	position: absolute;
	right: 5px;
	top: 50%;
	transform: translateY(-50%);
	background: var(--accent-color);
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	padding: 0;
}

.custom-search-button:hover {
	background: #d81b60;
	transform: translateY(-50%) scale(1.05);
}

.custom-search-button svg {
	stroke: #fff;
}

.plugins-page-main .dataTables_wrapper .dataTables_filter label {
	position: relative;
}

.plugins-page-main .dataTables_wrapper .dataTables_info {
	padding-top: 15px;
	color: #666;
	margin-left: 15px;
}

.plugins-page-main .dataTables_wrapper .dataTables_paginate {
	padding-top: 15px;
	margin-right: 15px;
}

.plugins-page-main .dataTables_wrapper .dataTables_paginate .paginate_button {
	padding: 5px 12px;
	margin: 5px 2px;
	border-radius: 4px;
	cursor: pointer;
	background: white;
	color: #333;
	transition: all 0.3s ease;
	border: 1px solid #ddd;
}

.plugins-page-main .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
	color: #fff;
	background: var(--accent-color);
	border-color: var(--accent-color);
}

.plugins-page-main .dataTables_wrapper .dataTables_paginate .paginate_button.current {
	background: var(--accent-color);
	color: white!important;
	border-color: var(--accent-color);
}

.plugins-page-main .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Loading State */
.plugins-page-main .dataTables_wrapper .dataTables_processing {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: rgba(255, 255, 255, 0.9);
	padding: 20px 40px;
	border-radius: 8px;
	color: #333;
	font-weight: 500;
	font-size: 14px;
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 10px;
	margin:0;
	width: 100%;
	height: 100%;
}


.plugins-page-main div.dataTables_processing>div:last-child>div {
	background-color: var(--accent-color);
}

/* Plugin Link Styling */
.plugin-link {
	color: var(--accent-color);
	text-decoration: none;
	font-weight: 500;
	transition: all 0.3s ease;
}

.plugin-link:hover {
	color: var(--primary-color);
	text-decoration: underline;
}

/* Price Page Button */
.button-small {
	display: inline-block;
	padding: 5px 12px;
	font-size: 0.85rem;
	border: 1px solid var(--accent-color);
	border-radius: 4px;
	color: var(--accent-color);
	text-decoration: none;
	transition: all 0.3s ease;
}

.button-small:hover {
	background: var(--accent-color);
	color: #fff!important;
	text-decoration: none!important;
}

/* Badge Styling */
.badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 3px;
	font-size: 0.85rem;
	font-weight: 500;
}

.badge-success {
	background: #4caf50;
	color: #fff;
}

.badge-danger {
	background: #f44336;
	color: #fff;
}

/* Plugin Name Wrapper */
.plugin-name-wrapper {
	display: flex;
	flex-direction: column;
	position: relative;
}

.plugin-name {
	font-weight: 500;
	color: #333;
}

.plugin-slug {
	font-size: 0.75rem;
	color: #999;
}

/* 描述預設隱藏 */
.plugin-description-small {
	display: none;
}

/* 為 tr 設定 position relative */
#plugins-table tbody tr {
	position: relative;
}

/* Hover 時顯示描述 overlay - 使用 fixed 定位不影響表格高度 */
#plugins-table tbody tr:hover .plugin-description-small {
	display: block;
	position: fixed;
	background: #fff;
	color: #333;
	padding: 12px 15px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	border-radius: 6px;
	border: 1px solid #e0e0e0;
	z-index: 10000;
	font-size: 0.85rem;
	line-height: 1.5;
	max-width: 500px;
	pointer-events: none;
}

/* Version Badges */
.version-badges {
	margin-bottom: 4px;
}

.version-badge {
	display: inline-block;
	padding: 2px 6px;
	border-radius: 2px;
	font-size: 10px;
	font-weight: 500;
	text-transform: uppercase;
	margin-right: 4px;
}

.version-badge.version-free {
	background: #e8f5e9;
	color: #2e7d32;
}

.version-badge.version-pro {
	background: #f3e5f5;
	color: #7b1fa2;
}

.filter-breadcrumb {
	font-size: 0.85rem;
	color: #666
}

.breadcrumb-label {
	border: 1px solid var(--accent-color);
	color: var(--accent-color);
	border-radius: 10px;
	padding: 4px 8px;
	font-size: 12px;
	margin-right: .5rem;
}

/* Sites Overlay */
.sites-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
	z-index: 10000;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.3s ease-in-out, visibility 0.3s;
}

.sites-overlay.active {
	visibility: visible;
	opacity: 1;
	display: flex;
	justify-content: flex-end;
}

.sites-overlay-panel {
	position: fixed;
	right: 0;
	top: 0;
	width: 70%;
	max-width: 1200px;
	height: 100vh;
	background: #fff;
	box-shadow: -2px 0 20px rgba(0, 0, 0, 0.2);
	transform: translateX(100%);
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.sites-overlay.active .sites-overlay-panel {
	transform: translateX(0);
}

.sites-overlay-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	z-index: 10;
	border-radius: 4px;
	transition: background 0.2s;
}

.sites-overlay-close:hover {
	background: #f0f0f0;
}

.sites-overlay-close svg {
	width: 24px;
	height: 24px;
	stroke: #333;
}

.sites-overlay-header {
	padding: 30px 30px 20px;
	border-bottom: 1px solid #e0e0e0;
	background: #f8f9fa;
}

.sites-overlay-header h2 {
	margin: 0 0 8px 0;
	font-size: 1.5rem;
	color: #333;
}

.sites-overlay-header p {
	margin: 0;
	color: #666;
	font-size: 0.95rem;
}

.sites-overlay-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 5;
	display: none;
}

.sites-overlay-loading.active {
	display: block;
}

.sites-overlay-loading .loading-spinner {
	width: 50px;
	height: 50px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid var(--accent-color);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.sites-overlay-content {
	flex: 1;
	overflow-y: auto;
	padding: 30px;
}

/* Responsive */
@media (max-width: 1024px) {
	.sites-overlay-panel {
		width: 85%;
	}
}

@media (max-width: 768px) {
	.sites-overlay-panel {
		width: 95%;
	}
	
	.sites-overlay-content {
		padding: 20px;
	}
	
	.sites-overlay-header {
		padding: 20px;
	}
}

/* Two-column grid for sites in overlay */
.sites-overlay-content .sites-grid-container {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}

/* Responsive: single column on smaller screens */
@media (max-width: 768px) {
	.sites-overlay-content .sites-grid-container {
		grid-template-columns: 1fr;
	}
}

/* Site Card Image Loader (from style.css) */
.site-card-image-loader {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #f0f0f0;
	z-index: 1;
	opacity: 1;
	transition: opacity 0.3s ease;
}

.site-card-image-loader.hidden {
	opacity: 0;
	pointer-events: none;
}

.loader-dots {
	display: flex;
	gap: 4px;
	align-items: center;
}

.loader-dot {
	width: 6px;
	height: 6px;
	background-color: #E91D62;
	border-radius: 50%;
	animation: bounce 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(1) {
	animation-delay: 0s;
}

.loader-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes bounce {
	0%, 80%, 100% {
		transform: translateY(0);
		opacity: 0.4;
	}
	40% {
		transform: translateY(-8px);
		opacity: 1;
	}
}

/* Sites Overlay Footer */
.sites-overlay-footer {
	padding: 30px;
	text-align: center;
	border-top: 1px solid #e0e0e0;
	background: #f8f9fa;
}

.btn-view-more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 30px;
	background-color: var(--accent-color);
	color: #fff;
	text-decoration: none;
	border-radius: 25px;
	font-size: 1rem;
	font-weight: 500;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(233, 29, 98, 0.3);
}

.btn-view-more:hover {
	background-color: #d81b60;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(233, 29, 98, 0.4);
}

.btn-view-more svg {
	width: 20px;
	height: 20px;
	transition: transform 0.3s ease;
}

.btn-view-more:hover svg {
	transform: translateX(4px);
}

/* Plugin Dependency Link Styling */
.plugin-dependency-link {
	color: var(--accent-color);
	text-decoration: none;
	font-weight: 500;
	transition: all 0.2s ease;
	border-bottom: 1px dashed var(--accent-color);
}

.plugin-dependency-link:hover {
	color: var(--primary-color);
	border-bottom-style: solid;
	text-decoration: none;
}

.plugin-dependency {
	color: #666;
}
