/*
 * Rota Mağaza shopper tools: card buttons, favourites, comparison, quick view,
 * recently viewed, compare bar and messages. Colours come from the theme presets.
 */
:root {
	--rs-base: var(--wp--preset--color--base, #fff);
	--rs-base-2: var(--wp--preset--color--base-2, #f7f7f5);
	--rs-base-3: var(--wp--preset--color--base-3, #efeee9);
	--rs-line: var(--wp--preset--color--line, #e5e3dd);
	--rs-text: var(--wp--preset--color--contrast, #1d1d1b);
	--rs-muted: var(--wp--preset--color--contrast-3, #6b6b66);
	--rs-primary: var(--wp--preset--color--primary, #2f4a3a);
	--rs-on-primary: var(--wp--preset--color--on-primary, #fff);
	--rs-soft: var(--wp--preset--color--primary-soft, #e9efe9);
	--rs-sale: var(--wp--preset--color--sale, #b5532e);
	--rs-success: var(--wp--preset--color--success, #2f7d4f);
	--rs-radius: var(--wp--custom--radius--lg, 16px);
	--rs-radius-md: var(--wp--custom--radius--md, 10px);
	--rs-pill: var(--wp--custom--radius--pill, 999px);
}

/* ===== Buttons on product cards ===== */
.wc-block-components-product-image:has(.rota-card-tools) {
	position: relative;
}

.rota-card-tools {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.rota-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	border: 0;
	cursor: pointer;
	font: inherit;
	color: var(--rs-text);
	background: transparent;
	transition: background-color 0.18s, color 0.18s, transform 0.18s, opacity 0.18s, box-shadow 0.18s;
}

.rota-card-tools .rota-tool {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--rs-base);
	box-shadow: 0 2px 10px rgba(16, 20, 28, 0.14);
}

.rota-card-tools .rota-tool:hover {
	background: var(--rs-primary);
	color: var(--rs-on-primary);
	transform: scale(1.06);
}

.rota-tool:focus-visible {
	outline: 2px solid var(--rs-primary);
	outline-offset: 2px;
}

.rota-tool.is-on {
	color: var(--rs-sale);
}

.rota-tool-wishlist.is-on .rota-svg {
	fill: currentColor;
}

.rota-tool-compare.is-on {
	color: var(--rs-primary);
}

.rota-card-tools .rota-tool-compare.is-on {
	background: var(--rs-primary);
	color: var(--rs-on-primary);
}

/* Desktop: the tools slide in on hover; a saved favourite always shows. */
@media (hover: hover) and (min-width: 782px) {
	.rota-card-tools .rota-tool {
		opacity: 0;
		transform: translateX(8px);
	}

	.rota-card-tools .rota-tool.is-on,
	.wc-block-product:hover .rota-card-tools .rota-tool,
	.rota-card-tools .rota-tool:focus-visible,
	.rota-card-tools:focus-within .rota-tool {
		opacity: 1;
		transform: none;
	}

	.rota-card-tools .rota-tool:nth-child(2) {
		transition-delay: 0.03s;
	}

	.rota-card-tools .rota-tool:nth-child(3) {
		transition-delay: 0.06s;
	}
}

@media (max-width: 781px) {
	.rota-card-tools .rota-tool-quickview {
		display: none;
	}

	.rota-card-tools .rota-tool {
		width: 36px;
		height: 36px;
	}
}

/* ===== Buttons on the product page ===== */
.rota-product-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	margin-top: 14px;
}

.rota-product-tools .rota-tool,
.rota-qv-tools .rota-tool {
	padding: 6px 0;
	font-size: var(--wp--preset--font-size--small, 0.9rem);
	font-weight: 600;
	color: var(--rs-text);
}

.rota-product-tools .rota-tool:hover,
.rota-qv-tools .rota-tool:hover {
	color: var(--rs-primary);
}

.rota-product-tools .rota-tool.is-on,
.rota-qv-tools .rota-tool.is-on {
	color: var(--rs-sale);
}

.rota-product-tools .rota-tool-compare.is-on,
.rota-qv-tools .rota-tool-compare.is-on {
	color: var(--rs-primary);
}

/* ===== Header link ===== */
.rota-wish-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	color: inherit;
	text-decoration: none;
}

.rota-wish-link:hover {
	color: var(--rs-primary);
}

.rota-wish-count {
	position: absolute;
	top: 4px;
	right: 2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	box-sizing: border-box;
	border-radius: 999px;
	background: var(--wp--preset--color--accent, var(--rs-primary));
	color: var(--wp--preset--color--on-accent, #fff);
	border: 2px solid var(--rs-base);
	font-size: 10px;
	font-weight: 700;
	line-height: 14px;
	text-align: center;
}

/* ===== Shared buttons ===== */
.rota-shoplist .rota-btn,
.rota-qv .rota-btn,
.rota-cmp-bar .rota-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 20px;
	border: 1.5px solid var(--rs-primary);
	border-radius: var(--rs-pill);
	background: var(--rs-primary);
	color: var(--rs-on-primary);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--small, 0.9rem);
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.18s, transform 0.18s;
}

.rota-shoplist .rota-btn:hover,
.rota-qv .rota-btn:hover,
.rota-cmp-bar .rota-btn:hover {
	background: var(--wp--preset--color--primary-strong, var(--rs-primary));
	color: var(--rs-on-primary);
}

.rota-shoplist .rota-btn-outline,
.rota-qv .rota-btn-outline {
	background: var(--rs-base);
	color: var(--rs-text);
	border-color: var(--wp--preset--color--line-strong, var(--rs-line));
}

.rota-btn.is-busy {
	opacity: 0.65;
	pointer-events: none;
}

.rota-muted {
	color: var(--rs-muted);
}

/* ===== Product cards (favourites, recently viewed) ===== */
.rota-cards {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 24px;
}

.rota-pcard {
	position: relative;
	display: flex;
	flex-direction: column;
	margin: 0;
}

.rota-pcard-img {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: var(--rs-radius);
	background: var(--rs-base-3);
}

.rota-pcard-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.rota-pcard:hover .rota-pcard-img img {
	transform: scale(1.04);
}

.rota-pcard-sale {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 5px 11px;
	border-radius: var(--rs-pill);
	background: var(--rs-sale);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.rota-pcard-remove {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--rs-base);
	color: var(--rs-text);
	box-shadow: 0 2px 10px rgba(16, 20, 28, 0.14);
	cursor: pointer;
}

.rota-pcard-remove:hover {
	background: var(--rs-sale);
	color: #fff;
}

.rota-pcard-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
	padding-top: 12px;
}

.rota-pcard-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--body, inherit);
	font-size: var(--wp--preset--font-size--medium, 1rem);
	font-weight: 600;
	line-height: 1.35;
}

.rota-pcard-title a {
	color: var(--rs-text);
	text-decoration: none;
}

.rota-pcard-title a:hover {
	color: var(--rs-primary);
}

.rota-pcard-price,
.rota-cmp-price,
.rota-qv-price {
	font-weight: 700;
	color: var(--rs-text);
}

.rota-pcard-price del,
.rota-cmp-price del,
.rota-qv-price del {
	color: var(--rs-muted);
	font-weight: 400;
	font-size: 0.9em;
}

.rota-pcard-price ins,
.rota-cmp-price ins,
.rota-qv-price ins {
	color: var(--rs-sale);
	text-decoration: none;
}

.rota-pcard-stock {
	margin: 0;
	color: var(--rs-sale);
	font-size: 0.85rem;
	font-weight: 600;
}

.rota-pcard .rota-btn {
	margin-top: auto;
	width: 100%;
	box-sizing: border-box;
}

.rota-stars {
	--rota-star-on: #c58b1c;
	--rota-star-off: color-mix(in srgb, #c58b1c 25%, transparent);
	display: inline-block;
	width: 84px;
	height: 16px;
	vertical-align: -2px;
	background: linear-gradient(90deg, var(--rota-star-on) var(--rota-stars, 0%), var(--rota-star-off) var(--rota-stars, 0%));
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") 0 0 / 16.8px 16px repeat-x;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") 0 0 / 16.8px 16px repeat-x;
}

.rota-stars-n {
	font-weight: 600;
	font-size: 0.88rem;
}

/* Recently viewed: one scrolling row */
.rota-recent {
	margin-top: var(--wp--preset--spacing--70, 48px);
}

.rota-recent-title {
	margin: 0 0 20px;
}

.rota-cards-row {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 8px;
	scrollbar-width: thin;
}

.rota-cards-row .rota-pcard {
	flex: 0 0 min(240px, 70vw);
	scroll-snap-align: start;
}

/* Loading and empty states */
.rota-shoplist.is-pending {
	min-height: 26rem;
}

.rota-shoplist.is-loading .rota-cards,
.rota-shoplist.is-loading .rota-cmp-table-wrap {
	opacity: 0.4;
	transition: opacity 0.2s;
}

.rota-shoplist-empty {
	max-width: 520px;
	margin: 24px auto;
	padding: 40px 24px;
	text-align: center;
	border: 1px dashed var(--wp--preset--color--line-strong, var(--rs-line));
	border-radius: var(--rs-radius);
	background: var(--rs-base-2);
}

.rota-shoplist-empty-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	margin-bottom: 12px;
	border-radius: 50%;
	background: var(--rs-soft);
	color: var(--rs-primary);
}

.rota-shoplist-empty h2 {
	margin: 0 0 6px;
	font-size: var(--wp--preset--font-size--x-large, 1.5rem);
}

.rota-shoplist-empty p {
	margin: 0 0 18px;
	color: var(--rs-muted);
}

.rota-shoplist-error {
	color: var(--rs-sale);
}

/* ===== Comparison table ===== */
.rota-cmp-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--rs-line);
	border-radius: var(--rs-radius);
	background: var(--rs-base);
}

.rota-cmp-table-wrap:empty {
	display: none;
}

.rota-cmp-table-wrap:focus-visible {
	outline: 2px solid var(--rs-primary);
	outline-offset: 2px;
}

.rota-cmp-table {
	width: 100%;
	min-width: calc(170px + var(--rota-cmp-n, 3) * 200px);
	border-collapse: collapse;
	table-layout: fixed;
}

.rota-cmp-table :is(th, td) {
	padding: 14px 16px;
	border-bottom: 1px solid var(--rs-line);
	text-align: left;
	vertical-align: top;
	font-size: var(--wp--preset--font-size--small, 0.92rem);
	line-height: 1.5;
}

.rota-cmp-table tbody th {
	width: 170px;
	background: var(--rs-base-2);
	font-weight: 600;
	color: var(--rs-text);
	position: sticky;
	left: 0;
	z-index: 1;
}

.rota-cmp-table .rota-cmp-corner {
	width: 170px;
	background: var(--rs-base-2);
	position: sticky;
	left: 0;
	z-index: 1;
}

.rota-cmp-table tbody tr:last-child :is(th, td) {
	border-bottom: 0;
}

.rota-cmp-table tbody tr.is-diff td {
	background: color-mix(in srgb, var(--rs-soft) 45%, transparent);
}

.rota-cmp-head {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.rota-cmp-head .rota-pcard-remove {
	top: 6px;
	right: 6px;
}

.rota-cmp-img {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: var(--rs-radius-md);
	background: var(--rs-base-3);
}

.rota-cmp-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rota-cmp-name {
	color: var(--rs-text);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--medium, 1rem);
	text-decoration: none;
	line-height: 1.35;
}

.rota-cmp-head .rota-btn {
	min-height: 40px;
	padding: 0 14px;
}

.rota-cmp-in {
	color: var(--rs-success);
	font-weight: 600;
}

.rota-cmp-out {
	color: var(--rs-sale);
	font-weight: 600;
}

/* ===== Compare bar ===== */
.rota-cmp-bar {
	position: fixed;
	left: 50%;
	bottom: calc(18px + var(--rota-cookie-h, 0px));
	z-index: 90;
	transform: translateX(-50%);
	width: max-content;
	max-width: calc(100vw - 32px);
	animation: rota-up 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rota-cmp-bar[hidden] {
	display: none;
}

.rota-cmp-bar-in {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 8px 8px 20px;
	border-radius: var(--rs-pill);
	background: var(--wp--preset--color--dark, #1d1d1b);
	color: var(--wp--preset--color--on-dark, #fff);
	box-shadow: 0 16px 40px -12px rgba(16, 20, 28, 0.5);
}

.rota-cmp-bar-text {
	font-weight: 600;
	font-size: 0.92rem;
	white-space: nowrap;
}

.rota-cmp-clear {
	padding: 6px 8px;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--on-dark-2, #ccc);
	font: inherit;
	font-size: 0.85rem;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.rota-cmp-bar .rota-btn {
	min-height: 40px;
	background: var(--rs-base);
	color: var(--rs-text);
	border-color: var(--rs-base);
}

.rota-cmp-bar .rota-btn:hover {
	background: var(--rs-soft);
	color: var(--rs-text);
}

/* ===== Messages ===== */
.rota-toast {
	position: fixed;
	left: 50%;
	bottom: calc(24px + var(--rota-cookie-h, 0px));
	z-index: 100001;
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: calc(100vw - 32px);
	padding: 12px 18px;
	border-radius: var(--rs-radius-md);
	background: var(--wp--preset--color--dark, #1d1d1b);
	color: var(--wp--preset--color--on-dark, #fff);
	box-shadow: 0 16px 40px -12px rgba(16, 20, 28, 0.5);
	font-size: 0.92rem;
	font-weight: 600;
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 16px);
	transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
	pointer-events: none;
}

.rota-toast.is-on {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
	pointer-events: auto;
}

.has-rota-cmp-bar .rota-toast {
	bottom: 88px;
}

body.has-rota-cmp-bar {
	padding-bottom: 84px;
}

.has-rota-cmp-bar .rota-top {
	bottom: 88px !important;
}

.rota-toast a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

/* ===== Quick view ===== */
html.rota-qv-open {
	overflow: hidden;
}

.rota-qv {
	width: min(980px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	padding: 0;
	border: 0;
	border-radius: var(--rs-radius);
	background: var(--rs-base);
	color: var(--rs-text);
	box-shadow: 0 30px 80px -20px rgba(16, 20, 28, 0.45);
	overflow: auto;
}

.rota-qv::backdrop {
	background: rgba(16, 20, 28, 0.55);
	backdrop-filter: blur(2px);
}

.rota-qv[open] {
	animation: rota-pop 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rota-qv-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--rs-base-2);
	color: var(--rs-text);
	cursor: pointer;
}

.rota-qv-close:hover {
	background: var(--rs-base-3);
}

.rota-qv-body {
	min-height: 200px;
}

.rota-qv-loading {
	height: 420px;
	background: linear-gradient(90deg, var(--rs-base-2), var(--rs-base-3), var(--rs-base-2));
	background-size: 200% 100%;
	animation: rota-shimmer 1.2s linear infinite;
}

.rota-qv-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.rota-qv-media {
	padding: 20px;
	background: var(--rs-base-2);
}

.rota-qv-main {
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: var(--rs-radius-md);
	background: var(--rs-base-3);
}

.rota-qv-img {
	display: none;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.rota-qv-img.is-active,
.rota-qv-main > img:only-child {
	display: block;
}

.rota-qv-thumbs {
	display: flex;
	gap: 8px;
	margin-top: 10px;
}

.rota-qv-thumb {
	width: 64px;
	height: 64px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--wp--custom--radius--sm, 6px);
	overflow: hidden;
	background: none;
	cursor: pointer;
	opacity: 0.7;
}

.rota-qv-thumb.is-active {
	border-color: var(--rs-primary);
	opacity: 1;
}

.rota-qv-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rota-qv-info {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 36px 32px 28px;
}

.rota-qv-cat {
	margin: 0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--rs-primary);
}

.rota-qv-title {
	margin: 0;
	padding-right: 36px;
	font-size: var(--wp--preset--font-size--xx-large, 1.9rem);
	line-height: 1.15;
}

.rota-qv-title:focus {
	outline: none;
}

.rota-qv-price {
	font-size: var(--wp--preset--font-size--x-large, 1.5rem);
}

.rota-qv-short {
	color: var(--wp--preset--color--contrast-2, var(--rs-muted));
	line-height: 1.6;
}

.rota-qv-short p {
	margin: 0;
}

.rota-qv-stock {
	margin: 0;
	font-weight: 600;
	font-size: 0.9rem;
}

.rota-qv-stock.is-in {
	color: var(--rs-success);
}

.rota-qv-stock.is-out {
	color: var(--rs-sale);
}

.rota-qv-cart {
	display: flex;
	gap: 10px;
	margin: 6px 0 0;
}

.rota-qv-qty {
	width: 84px;
	min-height: 50px;
	box-sizing: border-box;
	padding: 0 10px;
	border: 1.5px solid var(--wp--preset--color--line-strong, var(--rs-line));
	border-radius: var(--rs-pill);
	text-align: center;
	font: inherit;
	font-weight: 700;
	background: var(--rs-base);
	color: var(--rs-text);
}

.rota-qv-submit {
	flex: 1;
	min-height: 50px !important;
	font-size: var(--wp--preset--font-size--medium, 1rem) !important;
}

.rota-qv-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 18px;
	padding-top: 12px;
	border-top: 1px solid var(--rs-line);
}

.rota-qv-more {
	margin-left: auto;
	color: var(--rs-primary);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small, 0.9rem);
	text-decoration: none;
}

.rota-qv-more:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

@media (max-width: 781px) {
	.rota-qv-grid {
		grid-template-columns: 1fr;
	}

	.rota-qv-info {
		padding: 20px;
	}

	.rota-qv-title {
		font-size: var(--wp--preset--font-size--x-large, 1.5rem);
	}

	.rota-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 16px;
	}

	.rota-cmp-table {
		min-width: calc(110px + var(--rota-cmp-n, 3) * 160px);
	}

	.rota-cmp-table tbody th,
	.rota-cmp-table .rota-cmp-corner {
		width: 110px;
	}

	.rota-cmp-bar {
		bottom: 12px;
	}
}

@keyframes rota-up {
	from {
		opacity: 0;
		transform: translate(-50%, 20px);
	}

	to {
		opacity: 1;
		transform: translate(-50%, 0);
	}
}

@keyframes rota-pop {
	from {
		opacity: 0;
		transform: scale(0.96);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes rota-shimmer {
	to {
		background-position: -200% 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rota-tool,
	.rota-pcard-img img,
	.rota-toast,
	.rota-cmp-bar,
	.rota-qv[open],
	.rota-qv-loading {
		transition: none;
		animation: none;
	}
}

/* Messages sit above the compare bar. */
body:has(.rota-cmp-bar:not([hidden])) .rota-toast {
	bottom: calc(92px + var(--rota-cookie-h, 0px));
}

/* The compare bar stays out of the way while paying. */
body.woocommerce-cart .rota-cmp-bar,
body.woocommerce-checkout .rota-cmp-bar {
	display: none !important;
}
