/* =============================================================================
   PCM Frontend Styles
   ============================================================================= */

/* ---- CSS Custom Properties ---- */
:root {
	--pcm-primary: #c9962d;
	--pcm-radius: 12px;
	--pcm-shadow: 0 2px 12px rgba(0, 0, 0, .08);
	--pcm-gap-small: 8px;
	--pcm-gap-medium: 16px;
	--pcm-gap-large: 24px;
	--pcm-columns: 4;
	--pcm-columns-tablet: 2;
	--pcm-columns-mobile: 1;
	--pcm-transition: transform .2s ease, box-shadow .2s ease;
	--pcm-modal-z: 99999;
	--pcm-spinner-color: #fff;
}

/* ---- Grid Wrapper ---- */
.pcm-grid-wrapper {
	width: 100%;
	contain: layout style;
	box-sizing: border-box;
}

/* ---- Grid ---- */
.pcm-grid {
	display: grid;
	grid-template-columns: repeat(var(--pcm-columns, 4), 1fr);
	gap: var(--pcm-gap-medium);
}

.pcm-gap-small  { gap: var(--pcm-gap-small); }
.pcm-gap-medium { gap: var(--pcm-gap-medium); }
.pcm-gap-large  { gap: var(--pcm-gap-large); }

/* ---- Base Card ---- */
.pcm-card {
	position: relative;
	cursor: pointer;
	overflow: hidden;
	border-radius: var(--pcm-radius);
	box-shadow: var(--pcm-shadow);
	transition: var(--pcm-transition);
	background: #fff;
}

.pcm-card:focus-visible {
	outline: 3px solid var(--pcm-primary);
	outline-offset: 2px;
}

.pcm-card figure {
	margin: 0;
	aspect-ratio: 3 / 4;
	overflow: hidden;
}

.pcm-card figure img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pcm-card-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

/* ---- Card Name Bar ---- */
.pcm-card-name {
	padding: 10px 14px;
	font-size: .85rem;
	font-weight: 600;
	line-height: 1.4;
	background: var(--pcm-primary);
	color: #fff;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---- Search Bar ---- */
.pcm-search-bar {
	margin-bottom: 16px;
}

.pcm-search-input {
	width: 100%;
	max-width: 400px;
	padding: 8px 14px;
	border: 1px solid #d0d0d0;
	border-radius: 6px;
	font-size: .95rem;
	box-sizing: border-box;
	transition: border-color .2s ease;
}

.pcm-search-input:focus {
	border-color: var(--pcm-primary);
	outline: none;
	box-shadow: 0 0 0 2px rgba(201, 150, 45, .15);
}

/* ---- Filter Chips ---- */
.pcm-filter-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}

.pcm-filter-chip {
	padding: 6px 14px;
	border: 1px solid #d0d0d0;
	border-radius: 20px;
	background: transparent;
	cursor: pointer;
	font-size: .85rem;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.pcm-filter-chip:hover,
.pcm-filter-chip--active {
	background: var(--pcm-primary);
	border-color: var(--pcm-primary);
	color: #fff;
}

/* ---- Empty State ---- */
.pcm-empty-state {
	text-align: center;
	padding: 48px 24px;
	color: #888;
}

.pcm-empty-state__message {
	font-size: 1.1rem;
	margin-bottom: 16px;
}

.pcm-empty-state__cta {
	display: inline-block;
	padding: 10px 22px;
	background: var(--pcm-primary);
	color: #fff;
	border-radius: 6px;
	text-decoration: none;
	font-weight: 600;
	transition: opacity .2s ease;
}

.pcm-empty-state__cta:hover {
	opacity: .85;
	color: #fff;
}

/* ---- Pagination ---- */
.pcm-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 24px;
}

.pcm-pagination__page,
.pcm-pagination__prev,
.pcm-pagination__next {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	text-decoration: none;
	color: #333;
	font-size: .9rem;
	transition: background .15s ease;
}

.pcm-pagination__page:hover,
.pcm-pagination__prev:hover,
.pcm-pagination__next:hover {
	background: var(--pcm-primary);
	border-color: var(--pcm-primary);
	color: #fff;
}

.pcm-pagination__page--current {
	background: var(--pcm-primary);
	border-color: var(--pcm-primary);
	color: #fff;
	font-weight: 700;
}

.pcm-pagination__ellipsis {
	padding: 6px 4px;
	color: #999;
}

.pcm-load-more-btn {
	display: block;
	margin: 24px auto 0;
	padding: 10px 28px;
	background: var(--pcm-primary);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 1rem;
	cursor: pointer;
	transition: opacity .2s ease;
}

.pcm-load-more-btn:hover {
	opacity: .85;
}

/* ---- Modal ---- */
.pcm-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: var(--pcm-modal-z);
	align-items: center;
	justify-content: center;
}

.pcm-modal[aria-hidden="false"] {
	display: flex;
}

.pcm-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .85);
}

.pcm-modal-container {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 90vw;
	max-height: 90vh;
}

.pcm-modal-content {
	position: relative;
	text-align: center;
}

.pcm-modal-image {
	max-width: 80vw;
	max-height: 80vh;
	object-fit: contain;
	display: block;
	border-radius: 4px;
}

.pcm-modal-title {
	color: #fff;
	font-size: 1rem;
	margin-top: 12px;
	text-align: center;
}

/* Close button */
.pcm-modal-close {
	position: fixed;
	top: 18px;
	right: 22px;
	z-index: 2;
	background: rgba(0, 0, 0, .5);
	border: none;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	color: #fff;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease;
}

.pcm-modal-close:hover {
	background: rgba(0, 0, 0, .8);
}

/* Prev / Next */
.pcm-modal-prev,
.pcm-modal-next {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	background: rgba(0, 0, 0, .4);
	border: none;
	border-radius: 4px;
	color: #fff;
	font-size: 2.5rem;
	line-height: 1;
	padding: 12px 16px;
	cursor: pointer;
	transition: background .15s ease;
	user-select: none;
}

.pcm-modal-prev:hover,
.pcm-modal-next:hover {
	background: rgba(0, 0, 0, .75);
}

.pcm-modal-prev { left: 12px; }
.pcm-modal-next { right: 12px; }

.pcm-modal-prev[hidden],
.pcm-modal-next[hidden] {
	display: none;
}

/* Spinner */
.pcm-modal-spinner {
	display: none;
	width: 40px;
	height: 40px;
	border: 4px solid rgba(255, 255, 255, .2);
	border-top-color: var(--pcm-spinner-color);
	border-radius: 50%;
	animation: pcm-spin .7s linear infinite;
	margin: 0 auto 16px;
}

.pcm-modal-spinner--visible {
	display: block;
}

@keyframes pcm-spin {
	to { transform: rotate(360deg); }
}

/* Body scroll lock when modal open */
body.pcm-modal-open {
	overflow: hidden;
}

/* ---- Zoom Toolbar ---- */
.pcm-zoom-toolbar {
	position: fixed;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%);
	z-index: calc(var(--pcm-modal-z) + 1);
	display: flex;
	align-items: center;
	gap: 2px;
	background: rgba(18, 18, 18, .78);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-radius: 40px;
	padding: 5px 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, .45);
}

.pcm-zoom-toolbar[hidden] { display: none; }

.pcm-zoom-btn {
	background: none;
	border: none;
	color: #fff;
	font-size: 1.15rem;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease;
	padding: 0;
	line-height: 1;
}

.pcm-zoom-btn:hover:not(:disabled) {
	background: rgba(255, 255, 255, .18);
}

.pcm-zoom-btn:disabled {
	opacity: .3;
	cursor: not-allowed;
}

.pcm-zoom-level {
	color: #fff;
	font-size: .8rem;
	min-width: 42px;
	text-align: center;
	font-variant-numeric: tabular-nums;
	letter-spacing: .03em;
}

.pcm-zoom-divider {
	display: inline-block;
	width: 1px;
	height: 18px;
	background: rgba(255, 255, 255, .25);
	margin: 0 4px;
}

/* ---- Hidden cards (search / filter) ---- */
.pcm-card--hidden {
	display: none;
}

/* ---- Responsive: Tablet ---- */
@media (max-width: 768px) {
	.pcm-grid {
		grid-template-columns: repeat(var(--pcm-columns-tablet, 2), 1fr);
	}
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 480px) {
	.pcm-grid {
		grid-template-columns: repeat(var(--pcm-columns-mobile, 1), 1fr);
	}

	.pcm-modal-prev { left: 4px; }
	.pcm-modal-next { right: 4px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	.pcm-card,
	.pcm-filter-chip,
	.pcm-pagination__page,
	.pcm-modal-close,
	.pcm-modal-prev,
	.pcm-modal-next {
		transition: none;
	}

	.pcm-modal-spinner {
		animation: none;
	}
}

/* ---- Print ---- */
@media print {
	.pcm-grid-wrapper {
		display: none;
	}

	.pcm-modal[aria-hidden="false"] {
		position: static;
		display: block;
	}

	.pcm-modal-backdrop,
	.pcm-modal-close,
	.pcm-modal-prev,
	.pcm-modal-next {
		display: none;
	}

	.pcm-modal-image {
		max-width: 100%;
		max-height: none;
	}
}
