/* Satech Media Marketplace — frontend */

.smm-marketplace {
	--smm-gap: 1rem;
	--smm-cols: 4;
	--smm-cols-tablet: 3;
	--smm-cols-mobile: 1;
	--smm-ratio: 4 / 3;
	width: 100%;
}

body.smm-modal-open {
	overflow: hidden;
}

.smm-filters {
	margin-bottom: 1.5rem;
}

.smm-filters__search input[type="search"] {
	width: 100%;
	max-width: 560px;
	padding: 0.75rem 1rem;
	border: 1px solid #ddd;
	border-radius: 999px;
	font-size: 1rem;
}

.smm-filters__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	margin-top: 0.85rem;
}

.smm-filters__row select,
.smm-filters__row input[type="number"] {
	padding: 0.5rem 0.75rem;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	min-width: 130px;
}

.smm-grid {
	display: grid;
	grid-template-columns: repeat(var(--smm-cols, 4), minmax(0, 1fr));
	gap: var(--smm-gap);
	align-items: start;
}

/* ——— Cards: clean image, info on hover only ——— */

.smm-card {
	background: #fff;
	border: 1px solid #e8e8e8;
	border-radius: 10px;
	overflow: hidden;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.smm-card:hover {
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
	transform: translateY(-2px);
}

.smm-card__trigger {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	text-align: inherit;
	font: inherit;
}

.smm-card__thumb {
	position: relative;
	aspect-ratio: var(--smm-ratio, 4 / 3);
	overflow: hidden;
	background: #f7f7f7;
	line-height: 0;
}

.smm-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	background: #f7f7f7;
	user-select: none;
	-webkit-user-drag: none;
	image-rendering: auto;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

/* Natural aspect ratio — matches original image proportions */
.smm-ratio-auto .smm-card__thumb {
	aspect-ratio: var(--smm-card-ratio, auto);
	height: auto;
}

.smm-ratio-auto .smm-card__thumb img {
	width: 100%;
	height: auto;
	max-height: none;
	display: block;
	object-fit: contain;
}

.smm-fit-cover .smm-card__thumb img {
	object-fit: cover;
}

.smm-ratio-auto.smm-fit-cover .smm-card__thumb {
	overflow: hidden;
}

.smm-ratio-auto.smm-fit-cover .smm-card__thumb img {
	height: 100%;
	object-fit: cover;
}

.smm-card__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 0.85rem;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.2) 45%, transparent 100%);
	color: #fff;
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.smm-card:hover .smm-card__overlay,
.smm-card:focus-within .smm-card__overlay {
	opacity: 1;
	pointer-events: auto;
}

.smm-card__type {
	align-self: flex-start;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.2);
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	margin-bottom: auto;
}

.smm-card__overlay-body {
	margin-top: 0.5rem;
}

.smm-card__title {
	margin: 0 0 0.25rem;
	font-size: 0.92rem;
	line-height: 1.35;
	font-weight: 600;
}

.smm-card__meta {
	margin: 0;
	font-size: 0.78rem;
	opacity: 0.9;
}

.smm-card__price {
	margin-top: 0.35rem;
	font-weight: 700;
	font-size: 0.9rem;
}

.smm-card__fav-btn {
	position: absolute;
	top: 0.65rem;
	right: 0.65rem;
	width: 2rem;
	height: 2rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #999;
	font-size: 1rem;
	line-height: 2rem;
	text-align: center;
	cursor: pointer;
	pointer-events: auto;
	transition: color 0.2s ease, transform 0.2s ease;
}

.smm-card__fav-btn:hover,
.smm-card__fav-btn.is-active {
	color: #e11d48;
	transform: scale(1.08);
}

/* ——— Modal ——— */

.smm-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.smm-modal[hidden] {
	display: none;
}

.smm-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
}

.smm-modal__dialog {
	position: relative;
	width: min(1100px, 100%);
	max-height: min(90vh, 900px);
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
	display: flex;
	flex-direction: column;
}

.smm-modal__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	z-index: 3;
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.smm-modal__content {
	overflow: auto;
	max-height: min(90vh, 900px);
}

.smm-modal__loading {
	padding: 3rem;
	text-align: center;
	color: #666;
}

.smm-modal__grid {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
	min-height: 420px;
}

.smm-modal__preview {
	background: #f4f4f4;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 320px;
}

.smm-modal__media {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.smm-modal__media img {
	max-width: 100%;
	max-height: min(70vh, 640px);
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
}

.smm-modal__media--video .smm-modal__play {
	position: absolute;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	pointer-events: none;
}

.smm-modal__media--video .smm-modal__play::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 12px 0 12px 18px;
	border-color: transparent transparent transparent #fff;
}

.smm-modal__video-note {
	position: absolute;
	bottom: 1rem;
	left: 1rem;
	padding: 0.35rem 0.65rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 0.75rem;
}

.smm-modal__sidebar {
	padding: 1.75rem 1.5rem;
	overflow-y: auto;
}

.smm-modal__title {
	margin: 0 0 0.5rem;
	font-size: 1.35rem;
	line-height: 1.3;
}

.smm-modal__price {
	font-size: 1.25rem;
	font-weight: 700;
	margin-bottom: 1rem;
}

.smm-modal__facts {
	list-style: none;
	padding: 0;
	margin: 0 0 1rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.smm-modal__facts li {
	padding: 0.35rem 0.65rem;
	background: #f3f3f3;
	border-radius: 999px;
	font-size: 0.82rem;
}

.smm-modal__keywords,
.smm-modal__cats,
.smm-modal__desc {
	font-size: 0.9rem;
	color: #555;
	margin: 0 0 0.75rem;
}

.smm-modal__notice {
	font-size: 0.82rem;
	color: #888;
	margin: 0 0 1.25rem;
}

.smm-modal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	align-items: center;
}

.smm-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.65rem 1.1rem;
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	border: 1px solid transparent;
	transition: background 0.2s ease, color 0.2s ease;
}

.smm-btn--primary {
	background: #111;
	color: #fff;
	border-color: #111;
}

.smm-btn--primary:hover {
	background: #333;
}

.smm-btn--primary:disabled {
	opacity: 0.6;
	cursor: wait;
}

.smm-btn--ghost {
	background: #fff;
	color: #333;
	border-color: #ddd;
}

.smm-btn--ghost.is-active,
.smm-btn--ghost:hover {
	border-color: #e11d48;
	color: #e11d48;
}

.smm-btn--link {
	background: transparent;
	color: #555;
	border-color: transparent;
	text-decoration: underline;
	padding-left: 0;
}

.smm-modal__cart-msg {
	margin-top: 0.75rem;
	font-size: 0.88rem;
	color: #22744a;
}

.smm-modal__stock {
	color: #b91c1c;
	font-weight: 600;
}

.smm-empty,
.smm-marketplace__status {
	padding: 2rem;
	text-align: center;
	color: #666;
}

.smm-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-top: 2rem;
}

.smm-page {
	min-width: 2.25rem;
	height: 2.25rem;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}

.smm-page.is-active {
	background: #111;
	color: #fff;
	border-color: #111;
}

/* ——— Single product page (fallback) ——— */

.smm-single {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
	gap: 2rem;
	max-width: 1200px;
	margin: 2rem auto;
	padding: 0 1rem;
}

.smm-single__preview {
	position: relative;
	border-radius: 16px;
	overflow: hidden;
	background: #f4f4f4;
}

.smm-single__image {
	display: block;
	width: 100%;
	height: auto;
	user-select: none;
}

.smm-single__video-badge {
	position: absolute;
	top: 1rem;
	left: 1rem;
	z-index: 2;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	font-size: 0.78rem;
}

.smm-single__meta h1 {
	margin-top: 0;
}

.smm-single__keywords {
	color: #666;
}

.smm-single__facts {
	list-style: none;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.smm-single__facts li {
	padding: 0.35rem 0.65rem;
	background: #f3f3f3;
	border-radius: 999px;
	font-size: 0.85rem;
}

.smm-single__notice {
	font-size: 0.88rem;
	color: #666;
}

@media (max-width: 1024px) {
	.smm-grid {
		grid-template-columns: repeat(var(--smm-cols-tablet, 3), minmax(0, 1fr));
	}

	.smm-modal__grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.smm-grid {
		grid-template-columns: repeat(var(--smm-cols-mobile, 1), minmax(0, 1fr));
	}

	.smm-filters__row select,
	.smm-filters__row input[type="number"] {
		flex: 1 1 calc(50% - 0.65rem);
		min-width: 0;
	}

	.smm-modal {
		padding: 0;
	}

	.smm-modal__dialog {
		width: 100%;
		max-height: 100vh;
		border-radius: 0;
	}

	.smm-single {
		grid-template-columns: 1fr;
	}
}
