/* Modal preview styles (isolated) */

#itemPreviewModal {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 5000;
}

#itemPreviewModal.is-open {
	display: flex;
}

.item-preview-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.item-preview-dialog {
	position: relative;
	width: min(1000px, 92vw);
	height: min(720px, 90vh);
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 15px 45px rgba(0, 0, 0, 0.28);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.item-preview-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	background: #111827;
	color: #fff;
}

.item-preview-close {
	border: none;
	background: transparent;
	color: #fff;
	font-size: 16px;
	cursor: pointer;
}

#itemPreviewBody {
	flex: 1;
	overflow: auto;
	padding: 16px;
}

.preview-modal,
.preview-modal * {
	box-sizing: border-box;
}

.preview-modal a {
	color: inherit;
}

.preview-modal .preview-grid {
	display: grid;
	grid-template-columns: 1.25fr 1fr;
	gap: 16px;
}

.preview-modal .preview-left {
	min-width: 0; /* allow thumbs row to scroll without widening grid */
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 16px;
}

.preview-modal .preview-right {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: 420px;
	width: 100%;
	align-self: flex-start;
}

.preview-modal .item-preview-meta {
	margin: 0;
}

.preview-modal .item-preview-carousel__main {
	height: 400px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.preview-modal .item-preview-main-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.preview-modal .item-preview-carousel__thumbs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 6px 34px;
	margin-top: 8px;
	max-width: 100%;
}

.preview-modal .item-preview-carousel__thumbs img {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border: 2px solid transparent;
	border-radius: 6px;
	cursor: pointer;
}

.preview-modal .item-preview-carousel__thumbs-wrap {
	position: relative;
	max-width: 100%;
}

.preview-modal .item-preview-carousel__thumbs-wrap::before,
.preview-modal .item-preview-carousel__thumbs-wrap::after {
	content: "";
	position: absolute;
	top: 8px;
	bottom: 8px;
	width: 28px;
	pointer-events: none;
	opacity: 0;
	transition: opacity .15s ease;
}

.preview-modal .item-preview-carousel__thumbs-wrap::before {
	left: 0;
	background: linear-gradient(90deg, rgba(249, 250, 251, 1), rgba(249, 250, 251, 0));
}

.preview-modal .item-preview-carousel__thumbs-wrap::after {
	right: 0;
	background: linear-gradient(270deg, rgba(249, 250, 251, 1), rgba(249, 250, 251, 0));
}

.preview-modal .item-preview-thumbs-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 26px;
	height: 26px;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.18);
	background: rgba(255, 255, 255, 0.8);
	color: #111827;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s ease, background .15s ease, transform .15s ease;
	z-index: 2;
}

.preview-modal .item-preview-thumbs-btn--left { left: 4px; }
.preview-modal .item-preview-thumbs-btn--right { right: 4px; }

.preview-modal .item-preview-carousel__thumbs-wrap.is-scrollable .item-preview-thumbs-btn,
.preview-modal .item-preview-carousel__thumbs-wrap.is-scrollable::before,
.preview-modal .item-preview-carousel__thumbs-wrap.is-scrollable::after {
	opacity: 1;
	pointer-events: auto;
}

.preview-modal .item-preview-thumbs-btn:hover {
	background: rgba(255, 255, 255, 0.95);
}

.preview-modal .item-preview-thumbs-btn.is-disabled {
	opacity: 0.35;
	pointer-events: none;
}

.preview-modal .item-preview-carousel__thumbs img.is-active {
	border-color: #111827;
}

.preview-modal .item-preview-title {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
}

.preview-modal .item-preview-priceblock {
	text-align: right;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
}

.preview-modal .preview-sale-message {
	color: #b91c1c;
	font-weight: 700;
	font-size: 16px;
	margin-bottom: 2px;
}

.preview-modal .preview-price-sale {
	font-size: 20px;
	font-weight: 800;
	color: #b91c1c;
	line-height: 1.1;
}

.preview-modal .preview-price-regular {
	font-size: 18px;
	font-weight: 800;
	color: #111827;
	line-height: 1.1;
}

.preview-modal .preview-price-original {
	font-size: 13px;
	color: #9ca3af;
	text-decoration: line-through;
	margin-top: 0;
}

.preview-modal .preview-actions {
	display: flex;
	flex-wrap: nowrap;
	gap: 10px;
	align-items: center;
	margin-top: 2px;
}

.preview-modal .preview-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 30px;
	border-radius: 6px;
	padding: 0 12px;
	text-decoration: none;
	font-size: 14px;
	line-height: 1;
	white-space: nowrap;
}

.preview-modal .preview-btn--cart {
	background: #7ab3b5;
	border: 1px solid #6aa0a2;
	color: #fff;
	min-width: 0;
	padding: 0 14px;
	height: 34px;
}

.preview-modal .preview-btn--cart::before {
	content: "\f07a";
	margin-right: 6px;
	font-family: FontAwesome;
	font-weight: 900;
}

.preview-modal .preview-btn--fav {
	background: #fff;
	border: 1px solid #d1d5db;
	color: #d16b6b;
	width: 44px;
	padding: 0;
	font-size: 18px;
}

.preview-modal .preview-btn--detail {
	background: #fff;
	border: 1px solid #1f2937;
	color: #111827;
	min-width: 110px;
}

.preview-modal .preview-soldout {
	border: none;
	padding: 0;
	margin: 0;
	background: transparent;
	color: #8a8a8a;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	display: block;
	width: 100%;
	text-align: center;
}

.preview-modal .item-preview-meta-group {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 2px;
}

.preview-modal .preview-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #fff;
	padding: 4px 10px;
	line-height: 1.2;
	font-size: 12px;
	font-weight: 400;
	color: #4b5563;
}

.preview-modal .preview-chip__label {
	font-size: 12px;
	font-weight: 400;
	color: #6b7280;
}

.preview-modal .preview-chip__value {
	font-size: 13px;
	font-weight: 400;
	color: #111827;
}

.preview-modal .item-preview-code {
	margin-top: 4px;
	color: #4b5563;
}

.preview-modal .item-preview-meta {
	font-size: 13px;
	color: #4b5563;
	line-height: 1.5;
}

.preview-modal .preview-desc {
	white-space: pre-line;
}

.preview-modal .item-preview-meta-label {
	font-weight: 600;
	margin-right: 4px;
}

.preview-modal .item-preview-size {
	width: 100%;
}

.preview-modal .item-preview-detail-link {
	text-align: right;
	margin-top: 6px;
}

.preview-modal .soldout-badge {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	padding: 10px 18px;
	border-radius: 6px;
	background: rgba(145, 0, 0, 0.78);
	color: #fff;
	font-weight: 900;
	letter-spacing: 0.16em;
}

.item-preview-loader,
.preview-modal .item-preview-loader {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 260px;
}

.item-preview-spinner,
.preview-modal .item-preview-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid rgba(17, 24, 39, 0.25);
	border-top-color: #111827;
	border-radius: 50%;
	animation: itemlist-spin 0.8s linear infinite;
}

.preview-modal .item-preview-error {
	padding: 12px;
	font-size: 14px;
	color: #111827;
}

.preview-modal .item-preview-error a {
	color: #2563eb;
	text-decoration: underline;
}

.preview-modal .preview-size-table {
	width: 100%;
	font-size: .9em;
	border-collapse: collapse;
}

.preview-modal .preview-size-table th {
	background: #a9a099;
	color: #fff;
	width: 35%;
	padding: 6px;
	border: 1px solid #8c847d;
	text-align: center;
	font-weight: 600;
}

.preview-modal .preview-size-table td {
	padding: 6px 8px;
	border: 1px solid #8c847d;
	background: #fff;
	width: 65%;
}

.preview-modal .preview-size-table--tools {
	table-layout: fixed;
}

.preview-modal .preview-size-table--tools th,
.preview-modal .preview-size-table--tools td {
	padding: 6px 6px;
	font-size: 12px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.preview-modal .preview-size-table--tools th:first-child {
	width: 30%;
}

.preview-modal .preview-size-table--tools th:not(:first-child),
.preview-modal .preview-size-table--tools td {
	width: auto;
}

.preview-modal .preview-size-block {
	margin-top: 8px;
	width: 100%;
}

.preview-modal .preview-size-heading {
	font-size: 13px;
	color: #374151;
	margin-bottom: 4px;
}

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

@media (max-width: 900px) {
	.preview-modal .preview-grid {
		grid-template-columns: 1fr;
	}
	.preview-modal .item-preview-carousel__main {
		height: 300px;
	}
	.preview-modal .preview-actions {
		flex-wrap: wrap;
	}
}
