/**
 * TSF Refurb Core — frontend styles (tiles, back pill, chips, badges,
 * finder). All colors/fonts come from Glozin CSS custom properties with
 * safe fallbacks, so everything follows the theme automatically.
 */

/* ---------- Section heading ---------- */

.tsf-section-heading {
	font-family: var(--gz-body-font, inherit);
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 16px;
	color: var(--gz-color-dark, #111);
}

/* ---------- Tile rows ---------- */

.tsf-tiles {
	margin: 0 0 24px;
}

.tsf-tiles__row {
	position: relative;
}

.tsf-tiles__track {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x proximity;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding: 4px 4px 6px;
}

.tsf-tiles__track::-webkit-scrollbar {
	display: none;
}

.tsf-tile {
	flex: 0 0 150px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	background: #fff;
	border: 1px solid rgba(17, 17, 17, 0.06);
	border-radius: 10px;
	padding: 12px 8px 12px;
	text-decoration: none !important;
	color: inherit;
	scroll-snap-align: start;
	transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
	min-height: 44px;
}

.tsf-tile:hover,
.tsf-tile:focus-visible {
	border-color: rgba(17, 17, 17, 0.2);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(17, 17, 17, 0.05);
	outline: none;
}

.tsf-tile__media {
	width: 100%;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 8px;
	overflow: hidden;
}

.tsf-tile__img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: transform .35s ease;
}

.tsf-tile:hover .tsf-tile__img,
.tsf-tile:focus-visible .tsf-tile__img {
	transform: scale(1.04);
}

.tsf-tile__placeholder {
	width: 46%;
	height: 46%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(17, 17, 17, 0.18);
}

.tsf-tile__placeholder svg {
	width: 100%;
	height: 100%;
}

.tsf-tile__label {
	display: block;
	font-family: var(--gz-body-font, inherit);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--gz-color-dark, #111);
}

.tsf-tile:hover .tsf-tile__label,
.tsf-tile:focus-visible .tsf-tile__label {
	color: var(--gz-color-primary, #d0473e);
}

.tsf-tile__price {
	margin-top: 3px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--gz-color-primary, #d0473e);
}

.tsf-tile__price .amount {
	font-size: inherit;
}

.tsf-tile__count {
	margin-top: 2px;
	font-size: 11.5px;
	color: var(--gz-color-grey, #888);
}

/* Row arrows (desktop only, hover reveal) */

.tsf-tiles__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	width: 36px;
	height: 36px;
	background: #fff;
	border: 1px solid rgba(17, 17, 17, 0.1);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--gz-color-dark, #111);
	padding: 0;
	box-shadow: 0 2px 8px rgba(17, 17, 17, 0.08);
	transition: opacity .2s ease, background-color .15s ease, color .15s ease;
	opacity: 0;
	pointer-events: none;
}

.tsf-tiles__arrow[hidden] {
	display: none;
}

.tsf-tiles__arrow--prev { left: -14px; }
.tsf-tiles__arrow--next { right: -14px; }

.tsf-tiles__row:hover .tsf-tiles__arrow,
.tsf-tiles__arrow:focus-visible {
	opacity: 1;
	pointer-events: auto;
}

.tsf-tiles__arrow:disabled {
	opacity: 0.3 !important;
	pointer-events: none;
	cursor: not-allowed;
}

.tsf-tiles__arrow:hover:not(:disabled),
.tsf-tiles__arrow:focus-visible:not(:disabled) {
	background: var(--gz-color-dark, #111);
	border-color: var(--gz-color-dark, #111);
	color: #fff;
	outline: none;
}

/* ---------- Back pill ---------- */

.tsf-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 16px;
	padding: 8px 14px 8px 10px;
	background: var(--gz-color-light-grey, #f5f5f5);
	color: var(--gz-color-dark, #111);
	font-family: var(--gz-body-font, inherit);
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none !important;
	border-radius: 999px;
	transition: background-color .15s ease, color .15s ease;
	min-height: 32px;
}

.tsf-back:hover,
.tsf-back:focus-visible {
	background: var(--gz-color-dark, #111);
	color: #fff;
	outline: none;
}

.tsf-back__arrow {
	display: inline-flex;
	transition: transform .15s ease;
}

.tsf-back:hover .tsf-back__arrow {
	transform: translateX(-2px);
}

.tsf-back__label strong {
	font-weight: 600;
	margin-left: 2px;
}

/* ---------- Quick chips ---------- */

.tsf-chips {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
	margin: 0 0 18px;
	padding: 2px;
}

.tsf-chips::-webkit-scrollbar {
	display: none;
}

.tsf-chip {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 14px;
	background: #fff;
	border: 1px solid rgba(17, 17, 17, 0.12);
	border-radius: 999px;
	color: var(--gz-color-dark, #111);
	font-family: var(--gz-body-font, inherit);
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none !important;
	white-space: nowrap;
	transition: border-color .15s ease, background-color .15s ease, color .15s ease;
	min-height: 36px;
}

.tsf-chip:hover,
.tsf-chip:focus-visible {
	border-color: var(--gz-color-dark, #111);
	outline: none;
}

.tsf-chip--active {
	background: var(--gz-color-dark, #111);
	border-color: var(--gz-color-dark, #111);
	color: #fff;
}

.tsf-chip__x {
	font-size: 15px;
	line-height: 1;
}

/* ---------- Savings badge (loop cards) ---------- */

.tsf-badge--savings {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 3;
	display: inline-block;
	padding: 4px 8px;
	background: var(--gz-color-primary, #d0473e);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	border-radius: 4px;
	pointer-events: none;
}

/* ---------- Empty-archive note ---------- */

.tsf-empty-note {
	margin: 8px 0 24px;
	font-family: var(--gz-body-font, inherit);
	color: var(--gz-color-grey, #777);
}

/* ---------- Device finder ---------- */

.tsf-finder {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 16px 18px;
	margin: 0 0 24px;
	background: var(--gz-color-light-grey, #f7f7f7);
	border-radius: 12px;
	font-family: var(--gz-body-font, inherit);
}

.tsf-finder__heading {
	font-size: 14px;
	font-weight: 600;
	color: var(--gz-color-dark, #111);
}

.tsf-finder__row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.tsf-finder__select {
	appearance: none;
	-webkit-appearance: none;
	background: #fff;
	border: 1px solid rgba(17, 17, 17, 0.1);
	border-radius: 8px;
	padding: 11px 36px 11px 14px;
	font-size: 13px;
	font-weight: 500;
	color: var(--gz-color-dark, #111);
	font-family: inherit;
	cursor: pointer;
	min-width: 160px;
	min-height: 44px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 12px;
	transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.tsf-finder__select:focus {
	outline: none;
	border-color: var(--gz-color-primary, #d0473e);
	box-shadow: 0 0 0 3px rgba(208, 71, 62, 0.1);
}

.tsf-finder__select:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.tsf-finder__go {
	padding: 11px 20px;
	min-height: 44px;
	background: var(--gz-color-dark, #111);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s ease, opacity .15s ease;
}

.tsf-finder__go:hover:not(:disabled),
.tsf-finder__go:focus-visible {
	background: var(--gz-color-primary, #d0473e);
	outline: none;
}

.tsf-finder__go:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* ---------- Deals section ---------- */

.tsf-deals {
	margin: 0 0 24px;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
	.tsf-tiles__arrow { display: none !important; }
	.tsf-tile { flex-basis: 128px; }
}

@media (max-width: 600px) {
	.tsf-tile { flex-basis: 116px; padding: 10px 6px; }
	.tsf-tile__label { font-size: 12px; }
	.tsf-section-heading { font-size: 17px; }
	.tsf-finder__row { flex-direction: column; align-items: stretch; }
	.tsf-finder__select,
	.tsf-finder__go { width: 100%; min-width: 0; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.tsf-tiles__track { scroll-behavior: auto; }
	.tsf-tile,
	.tsf-tile__img,
	.tsf-tiles__arrow,
	.tsf-back,
	.tsf-back__arrow,
	.tsf-chip {
		transition: none !important;
	}
	.tsf-tile:hover { transform: none; }
}
