/**
 * Plugin Hub Server — Dashboard Styles
 * Linear / Vercel-inspired design system
 */

.ph-dashboard {
	--ph-accent: #0070f3;
	--ph-accent-hover: #0060df;
	--ph-accent-soft: rgba(0, 112, 243, 0.08);
	--ph-bg: #fafafa;
	--ph-surface: #ffffff;
	--ph-border: rgba(0, 0, 0, 0.08);
	--ph-border-strong: rgba(0, 0, 0, 0.12);
	--ph-text: #171717;
	--ph-text-secondary: #666666;
	--ph-text-muted: #888888;
	--ph-radius: 12px;
	--ph-radius-sm: 8px;
	--ph-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
	--ph-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	background: var(--ph-bg);
	border-radius: var(--ph-radius);
	color: var(--ph-text);
	font-family: var(--ph-font);
	margin: 0 auto;
	max-width: 1280px;
	padding: 0 0 32px;
	-webkit-font-smoothing: antialiased;
}

/* Sticky toolbar */

.ph-dashboard-toolbar {
	background: rgba(250, 250, 250, 0.85);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--ph-border);
	margin-bottom: 28px;
	padding: 20px 24px;
	position: sticky;
	top: 0;
	z-index: 100;
}

.ph-dashboard-title {
	color: var(--ph-text);
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.2;
	margin: 0 0 8px;
}

.ph-dashboard-intro {
	color: var(--ph-text-secondary);
	font-size: 0.9375rem;
	line-height: 1.55;
	margin: 0 0 16px;
	max-width: 640px;
}

.ph-dashboard-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.ph-search-input,
.ph-category-filter {
	background: var(--ph-surface);
	border: 1px solid var(--ph-border-strong);
	border-radius: var(--ph-radius-sm);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	color: var(--ph-text);
	font-family: inherit;
	font-size: 0.875rem;
	line-height: 1.4;
	padding: 9px 14px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ph-search-input {
	flex: 1;
	min-width: min(100%, 220px);
}

.ph-search-input:focus,
.ph-category-filter:focus {
	border-color: var(--ph-accent);
	box-shadow: 0 0 0 3px var(--ph-accent-soft);
	outline: none;
}

.ph-category-filter {
	cursor: pointer;
	min-width: 160px;
}

/* Grid */

.ph-plugin-grid {
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	padding: 0 24px;
}

.ph-plugin-grid.is-loading {
	min-height: 320px;
}

@media (max-width: 640px) {
	.ph-dashboard-toolbar {
		padding: 16px;
	}

	.ph-plugin-grid {
		grid-template-columns: 1fr;
		padding: 0 16px;
	}

	.ph-dashboard-filters {
		flex-direction: column;
	}

	.ph-search-input,
	.ph-category-filter {
		width: 100%;
	}
}

/* Card */

.ph-plugin-card {
	background: var(--ph-surface);
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius);
	display: flex;
	flex-direction: column;
	gap: 0;
	overflow: hidden;
	padding: 20px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ph-plugin-card:hover {
	border-color: var(--ph-border-strong);
	box-shadow: var(--ph-shadow-hover);
	transform: translateY(-2px);
}

.ph-plugin-card__icon {
	margin-bottom: 16px;
}

.ph-plugin-card__icon img,
.ph-plugin-card__icon .ph-plugin-icon {
	border-radius: var(--ph-radius-sm);
	display: block;
	height: 56px;
	object-fit: cover;
	width: 56px;
}

.ph-plugin-card__icon .ph-icon-fallback {
	align-items: center;
	background: var(--ph-bg);
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius-sm);
	color: var(--ph-text-muted);
	display: flex;
	font-size: 28px;
	height: 56px;
	justify-content: center;
	width: 56px;
}

.ph-plugin-card__header {
	margin-bottom: 10px;
}

.ph-plugin-card__title {
	color: var(--ph-text);
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.3;
	margin: 0 0 8px;
}

.ph-plugin-card__meta {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ph-plugin-card__version {
	background: var(--ph-bg);
	border: 1px solid var(--ph-border);
	border-radius: 999px;
	color: var(--ph-text-secondary);
	font-size: 0.6875rem;
	font-weight: 500;
	letter-spacing: 0.02em;
	padding: 3px 8px;
	text-transform: uppercase;
}

.ph-category-badge {
	background: var(--ph-accent-soft);
	border-radius: 999px;
	color: var(--ph-accent);
	font-size: 0.6875rem;
	font-weight: 500;
	padding: 3px 8px;
}

.ph-plugin-card__desc {
	color: var(--ph-text-secondary);
	flex: 1;
	font-size: 0.875rem;
	line-height: 1.55;
	margin: 0 0 16px;
}

.ph-plugin-card__content {
	display: flex;
	flex: 1;
	flex-direction: column;
}

/* Card footer */

.ph-plugin-card__footer {
	align-items: center;
	border-top: 1px solid var(--ph-border);
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: space-between;
	margin-top: auto;
	padding-top: 16px;
}

.ph-plugin-card__downloads {
	color: var(--ph-text-muted);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ph-plugin-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
}

/* Buttons */

.ph-btn {
	border: 1px solid transparent;
	border-radius: var(--ph-radius-sm);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	justify-content: center;
	line-height: 1;
	padding: 8px 14px;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
	white-space: nowrap;
}

.ph-btn--primary {
	background: var(--ph-accent);
	border-color: var(--ph-accent);
	box-shadow: 0 1px 2px rgba(0, 112, 243, 0.24);
	color: #fff;
}

.ph-btn--primary:hover:not(:disabled) {
	background: var(--ph-accent-hover);
	border-color: var(--ph-accent-hover);
	box-shadow: 0 2px 8px rgba(0, 112, 243, 0.32);
	color: #fff;
}

.ph-btn--secondary {
	background: transparent;
	border-color: var(--ph-border-strong);
	color: var(--ph-text);
}

.ph-btn--secondary:hover {
	background: var(--ph-bg);
	border-color: var(--ph-text-muted);
	color: var(--ph-text);
}

.ph-btn--demo {
	background: transparent;
	border-color: var(--ph-border-strong);
	color: var(--ph-text-secondary);
}

.ph-btn--demo:hover {
	background: var(--ph-bg);
	border-color: var(--ph-accent);
	color: var(--ph-accent);
}

.ph-btn:disabled,
.ph-btn[disabled] {
	background: #f0f0f0;
	border-color: #e5e5e5;
	box-shadow: none;
	color: #999;
	cursor: not-allowed;
}

/* Coming Soon state */

.ph-plugin-card--soon {
	background: #f7f7f7;
	border-color: rgba(0, 0, 0, 0.06);
	border-style: dashed;
	opacity: 1;
}

.ph-plugin-card--soon:hover {
	box-shadow: none;
	transform: none;
}

.ph-plugin-card--soon .ph-plugin-card__icon img,
.ph-plugin-card--soon .ph-plugin-card__icon .ph-icon-fallback {
	filter: grayscale(100%);
	opacity: 0.55;
}

.ph-plugin-card--soon .ph-plugin-card__title,
.ph-plugin-card--soon .ph-plugin-card__desc {
	color: var(--ph-text-muted);
}

.ph-plugin-card--soon .ph-category-badge {
	background: rgba(0, 0, 0, 0.05);
	color: var(--ph-text-muted);
}

.ph-plugin-card--soon .ph-btn--primary[disabled] {
	background: #ececec;
	border-color: #ddd;
	color: #aaa;
}

/* Skeleton loading */

@keyframes ph-shimmer {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

.ph-plugin-card--skeleton {
	border-color: var(--ph-border);
	box-shadow: none;
	pointer-events: none;
}

.ph-plugin-card--skeleton:hover {
	box-shadow: none;
	transform: none;
}

.ph-skeleton {
	animation: ph-shimmer 1.4s ease-in-out infinite;
	background: linear-gradient(90deg, #eeeeee 0%, #f5f5f5 50%, #eeeeee 100%);
	background-size: 200% 100%;
	border-radius: var(--ph-radius-sm);
	display: block;
}

.ph-skeleton--icon {
	border-radius: var(--ph-radius-sm);
	height: 56px;
	margin-bottom: 16px;
	width: 56px;
}

.ph-skeleton--title {
	height: 18px;
	margin-bottom: 10px;
	width: 70%;
}

.ph-skeleton--meta {
	height: 14px;
	margin-bottom: 16px;
	width: 40%;
}

.ph-skeleton--desc {
	height: 14px;
	margin-bottom: 8px;
	width: 100%;
}

.ph-skeleton--desc-short {
	height: 14px;
	margin-bottom: 20px;
	width: 75%;
}

.ph-skeleton--footer {
	height: 32px;
	margin-top: 16px;
	width: 100%;
}

.ph-loading {
	align-items: center;
	color: var(--ph-text-muted);
	display: flex;
	font-size: 0.875rem;
	gap: 10px;
	justify-content: center;
	padding: 20px;
}

.ph-loading[hidden] {
	display: none;
}

.ph-spinner {
	animation: ph-spin 0.7s linear infinite;
	border: 2px solid #e5e5e5;
	border-radius: 50%;
	border-top-color: var(--ph-accent);
	display: inline-block;
	flex-shrink: 0;
	height: 18px;
	width: 18px;
}

@keyframes ph-spin {
	to {
		transform: rotate(360deg);
	}
}

.ph-no-plugins {
	color: var(--ph-text-muted);
	font-size: 0.9375rem;
	grid-column: 1 / -1;
	padding: 48px 16px;
	text-align: center;
}

/* Empty state */

.ph-empty-state {
	align-items: center;
	background: var(--ph-surface);
	border: 1px dashed var(--ph-border-strong);
	border-radius: var(--ph-radius);
	display: flex;
	flex-direction: column;
	grid-column: 1 / -1;
	padding: 48px 24px;
	text-align: center;
}

.ph-empty-state__icon {
	color: var(--ph-text-muted);
	font-size: 48px;
	height: 48px;
	margin-bottom: 16px;
	width: 48px;
}

.ph-empty-state__title {
	color: var(--ph-text);
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 8px;
}

.ph-empty-state__message {
	color: var(--ph-text-secondary);
	font-size: 0.9375rem;
	line-height: 1.55;
	margin: 0;
	max-width: 420px;
}

/* Load more */

.ph-load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 20px;
	padding: 0 24px;
}

.ph-load-more-btn {
	min-width: 180px;
}

@media (max-width: 640px) {
	.ph-load-more-wrap {
		padding: 0 16px;
	}
}

/* Pagination */

.ph-pagination {
	align-items: center;
	display: flex;
	gap: 16px;
	justify-content: center;
	margin-top: 28px;
	padding: 0 24px;
}

.ph-pagination__btn {
	background: var(--ph-surface);
	border: 1px solid var(--ph-border-strong);
	border-radius: var(--ph-radius-sm);
	color: var(--ph-text);
	cursor: pointer;
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	padding: 8px 16px;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ph-pagination__btn:hover:not(:disabled) {
	background: var(--ph-bg);
	border-color: var(--ph-accent);
	color: var(--ph-accent);
}

.ph-pagination__btn:disabled {
	cursor: not-allowed;
	opacity: 0.45;
}

.ph-pagination__info {
	color: var(--ph-text-muted);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
	.ph-pagination {
		padding: 0 16px;
	}
}

/* Login prompt */

.ph-login-prompt {
	background: var(--ph-surface);
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius);
	box-shadow: var(--ph-shadow-hover);
	margin: 32px auto;
	max-width: 420px;
	padding: 40px 32px;
	text-align: center;
}

.ph-login-prompt__message {
	color: var(--ph-text-secondary);
	font-size: 0.9375rem;
	line-height: 1.5;
	margin: 0 0 20px;
}

/* Modal */

.ph-modal[hidden] {
	display: none;
}

.ph-modal {
	inset: 0;
	position: fixed;
	z-index: 100000;
}

.ph-modal:not([hidden]) {
	display: block;
}

body.ph-modal-open {
	overflow: hidden;
}

.ph-modal-overlay {
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(4px);
	inset: 0;
	position: absolute;
}

.ph-modal-dialog {
	background: var(--ph-surface);
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius);
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.16);
	left: 50%;
	max-height: 85vh;
	max-width: 600px;
	overflow-y: auto;
	padding: 28px;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: calc(100% - 32px);
}

.ph-modal-close {
	background: var(--ph-bg);
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius-sm);
	color: var(--ph-text-secondary);
	cursor: pointer;
	font-size: 1.25rem;
	height: 32px;
	line-height: 1;
	padding: 0;
	position: absolute;
	right: 16px;
	top: 16px;
	width: 32px;
}

.ph-modal-close:hover {
	background: #f0f0f0;
	color: var(--ph-text);
}

.ph-modal-title {
	font-size: 1.125rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	margin: 0 40px 12px 0;
}

.ph-modal-meta {
	color: var(--ph-text-muted);
	font-size: 0.8125rem;
	margin-bottom: 20px;
}

.ph-modal-section {
	margin-bottom: 20px;
}

.ph-modal-section h4 {
	color: var(--ph-text-muted);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	margin: 0 0 8px;
	text-transform: uppercase;
}

.ph-modal-description {
	color: var(--ph-text-secondary);
	font-size: 0.9375rem;
	line-height: 1.65;
}

.ph-modal-changelog {
	background: var(--ph-bg);
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius-sm);
	color: var(--ph-text-secondary);
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	font-size: 0.8125rem;
	margin: 0;
	overflow-x: auto;
	padding: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}

.ph-plugin-card__details-source {
	display: none;
}
