/*
 * Module: Αναζήτηση προϊόντων — styles
 * ==================================================================
 * Only what the shared components (mcms-global.css) don't cover.
 * Tokens only, everything under .mcms-products.
 *
 * SECTIONS
 *   1. Page width, search boxes, tools
 *   2. Group chips (one scrolling line)
 *   3. Filters card
 *   4. Product row (.mcms-prow)
 *   5. Skeleton rows
 *   6. Phones
 * ================================================================== */

/* ==================================================================
   1. PAGE WIDTH, SEARCH BOXES, TOOLS
   A bit wider than the other screens: on a computer the row keeps
   photo · title · price · buttons on one line.
   ================================================================== */
.mcms-products .mcms-products__page {
	max-width: 1040px;
}

.mcms-products__boxes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.mcms-products__tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 18px;
}

.mcms-wrap .mcms-products__tools .mcms-check {
	font-size: var(--mcms-text-sm);
}

.mcms-wrap .mcms-products__reset {
	margin: 0 0 0 auto;
	padding: 8px 4px;
	border: 0;
	background: none;
	color: var(--mcms-brand-strong);
	font-size: var(--mcms-text-sm);
	font-weight: 600;
	cursor: pointer;
}

.mcms-products__count {
	min-height: 18px;
	font-size: var(--mcms-text-xs);
	font-weight: 600;
	color: var(--mcms-text-muted);
}

.mcms-wrap .mcms-products__error {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 100%;
	text-align: center;
}

/* ==================================================================
   2. GROUP CHIPS — one line that scrolls sideways (9 groups would
   take three lines on a phone)
   ================================================================== */
.mcms-products__groupbar {
	position: relative;
	margin: 0 calc(-1 * var(--mcms-pad));
}

.mcms-wrap .mcms-products__groups {
	position: relative; /* chips measure their place from here (markGroups in products.js) */
	flex-wrap: nowrap;
	overflow-x: auto;
	padding: 2px var(--mcms-pad) 4px;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.mcms-products__groups::-webkit-scrollbar {
	display: none;
}

.mcms-wrap .mcms-products__groups .mcms-chip {
	flex: 0 0 auto;
	white-space: nowrap;
}

/* Arrows at both ends of the line — computers only (a finger swipes). Each
   sits on a fade of the page background, so a chip under it looks cut, not
   hidden. Shown by products.js only when there is more on that side. */
.mcms-wrap .mcms-products__scroll {
	position: absolute;
	top: 0;
	bottom: 4px;
	z-index: 2;
	display: flex;
	align-items: center;
	width: 64px;
	margin: 0;
	padding: 0 6px;
	border: 0;
	cursor: pointer;
	color: var(--mcms-text);
}

.mcms-wrap .mcms-products__scroll--prev {
	left: 0;
	justify-content: flex-start;
	background: linear-gradient(90deg, var(--mcms-bg) 55%, transparent);
}

.mcms-wrap .mcms-products__scroll--next {
	right: 0;
	justify-content: flex-end;
	background: linear-gradient(270deg, var(--mcms-bg) 55%, transparent);
}

.mcms-products__scroll > span {
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid var(--mcms-line-strong);
	border-radius: 50%;
	background: var(--mcms-surface);
	box-shadow: var(--mcms-shadow);
	transition: border-color var(--mcms-ease), color var(--mcms-ease);
}

.mcms-wrap .mcms-products__scroll:hover > span {
	border-color: var(--mcms-brand);
	color: var(--mcms-brand-strong);
}

.mcms-products__scroll svg {
	width: 18px;
	height: 18px;
}

@media (hover: none), (pointer: coarse) {
	.mcms-wrap .mcms-products__scroll {
		display: none !important;
	}
}

/* ==================================================================
   3. FILTERS CARD
   ================================================================== */
.mcms-products__filters {
	padding: 12px var(--mcms-pad) 14px;
}

.mcms-products__fgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 12px;
}

.mcms-products__fgrid .mcms-field {
	gap: 4px;
	min-width: 0;
}

.mcms-wrap .mcms-products__fgrid .mcms-field__label {
	font-size: var(--mcms-text-xs);
	color: var(--mcms-text-muted);
}

.mcms-wrap .mcms-products__fgrid .mcms-input {
	min-height: 40px;
	padding-top: 7px;
	padding-bottom: 7px;
	font-size: var(--mcms-text-md);
}

/* A filter in use gets the brand border, so it's clear what narrows the list. */
.mcms-wrap .mcms-products__fgrid .mcms-field.is-set .mcms-input {
	border-color: var(--mcms-brand-strong);
}

.mcms-products__range {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--mcms-text-muted);
}

.mcms-products__fnote {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--mcms-text-muted);
	font-size: var(--mcms-text-sm);
}

/* ==================================================================
   4. PRODUCT ROW
   Computer: photo | title + SKU | price + stock | Προβολή Επεξεργασία
   Phone:    photo | title + SKU
                   | price · stock
                   | buttons (full width)
   ================================================================== */
.mcms-prow {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr) 150px auto;
	grid-template-areas: "photo main side actions";
	align-items: center;
	gap: 14px;
	padding: 12px var(--mcms-pad);
	border-top: 1px solid var(--mcms-line);
	background: var(--mcms-surface);
	animation: mcms-prow-in .25s ease both;
	animation-delay: calc(var(--i, 0) * 20ms);
}

.mcms-prow:first-child {
	border-top: 0;
}

.mcms-prow.is-draft {
	background: var(--mcms-surface-muted);
}

.mcms-prow__photo {
	grid-area: photo;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	overflow: hidden;
	border: 1px solid var(--mcms-line);
	border-radius: var(--mcms-radius-sm);
	background: #fff;
}

.mcms-prow__photo img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.mcms-prow__nophoto {
	display: inline-flex;
	color: var(--mcms-line-strong);
}

.mcms-prow__main {
	grid-area: main;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

/* The whole title (they're long: "AEZ Crest dark 17x7.5 5x114.3 et48"). */
.mcms-prow__title {
	font-size: var(--mcms-text-md);
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.mcms-wrap .mcms-prow__sku {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 30px;
	margin: 0;
	padding: 0 8px;
	border: 1px solid var(--mcms-line-strong);
	border-radius: 6px;
	background: var(--mcms-surface-muted);
	color: var(--mcms-text);
	font-size: var(--mcms-text-sm);
	font-weight: 600;
	cursor: copy;
}

.mcms-wrap .mcms-prow__sku:hover {
	border-color: var(--mcms-brand);
	background: var(--mcms-brand-softer);
	color: var(--mcms-text);
}

.mcms-prow__sku svg {
	width: 14px;
	height: 14px;
	color: var(--mcms-text-muted);
}

.mcms-prow__id {
	font-size: var(--mcms-text-xs);
	color: var(--mcms-text-muted);
}

.mcms-prow__side {
	grid-area: side;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
}

.mcms-prow__price {
	font-size: var(--mcms-text-md);
	font-weight: 700;
	white-space: nowrap;
}

.mcms-prow__price small {
	font-size: var(--mcms-text-xs);
	font-weight: 400;
	color: var(--mcms-text-muted);
}

.mcms-prow__noprice {
	font-size: var(--mcms-text-sm);
	font-weight: 400;
	color: var(--mcms-text-muted);
}

.mcms-prow__actions {
	grid-area: actions;
	display: flex;
	gap: 6px;
}

.mcms-wrap .mcms-prow__actions .mcms-btn {
	min-height: 38px;
	padding: 0 12px;
}

@keyframes mcms-prow-in {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: none; }
}

/* ==================================================================
   5. SKELETON ROWS (while a page loads)
   ================================================================== */
.mcms-prow--skel {
	animation: none;
}

.mcms-skel {
	display: block;
	border-radius: 6px;
	background: linear-gradient(90deg, var(--mcms-line) 0%, var(--mcms-surface-muted) 45%, var(--mcms-line) 90%);
	background-size: 300% 100%;
	animation: mcms-skel 1.3s linear infinite;
}

.mcms-prow__photo.mcms-skel {
	border: 0;
}

.mcms-skel--l1    { height: 15px; width: 72%; }
.mcms-skel--l2    { height: 12px; width: 38%; margin-top: 6px; }
.mcms-skel--price { height: 15px; width: 72px; }
.mcms-skel--pill  { height: 20px; width: 96px; border-radius: 999px; }
.mcms-skel--btn   { height: 38px; width: 200px; border-radius: var(--mcms-radius-sm); }

@keyframes mcms-skel {
	from { background-position: 100% 0; }
	to   { background-position: -200% 0; }
}

/* ==================================================================
   6. PHONES
   ================================================================== */
@media (max-width: 760px) {
	.mcms-prow {
		grid-template-columns: 52px minmax(0, 1fr);
		grid-template-areas:
			"photo main"
			"photo side"
			"actions actions";
		gap: 8px 12px;
		align-items: start;
	}
	.mcms-prow__photo {
		width: 52px;
		height: 52px;
	}
	.mcms-prow__side {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	.mcms-prow__actions .mcms-btn {
		flex: 1;
	}
	/* The link button stays a square next to the two wide ones. */
	.mcms-wrap .mcms-prow__actions .mcms-prow__link {
		flex: 0 0 auto;
		min-width: 44px;
		padding: 0 10px;
	}
	.mcms-skel--btn {
		width: 100%;
	}
}

@media (max-width: 560px) {
	.mcms-products__boxes {
		grid-template-columns: 1fr;
	}
	/* Two filters per row, so the list starts higher up the screen;
	   the min–max pair (ET) gets a whole row. */
	.mcms-products__fgrid {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}
	.mcms-products__fgrid .mcms-field--range {
		grid-column: 1 / -1;
	}
}
