/**
 * SAĞDAN AÇILAN SEPET ÇEKMECESİ
 * Tema dili: yumuşak köşeler, mevcut renk değişkenleri (--ce-green vb.).
 */

.ce-sidecart {
	--sc-border: #e9ebf0;
	--sc-text: #2e3a59;
	--sc-muted: #8a94a6;
	--sc-accent: var(--ce-green, #12a150);
	--sc-accent-dark: var(--ce-green-dark, #0d7d3e);
	--sc-accent-soft: var(--ce-green-light, #e7f6ee);
}

.ce-sidecart:not([hidden]) {
	position: fixed;
	inset: 0;
	z-index: 100050;
}

.ce-sidecart__overlay {
	position: absolute;
	inset: 0;
	background: rgba(18, 24, 40, 0.5);
	animation: ce-sc-fade 0.18s ease-out;
}

.ce-sidecart__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 400px;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	background: #fff;
	box-shadow: -8px 0 32px rgba(15, 22, 41, 0.18);
	animation: ce-sc-slide 0.18s ease-out;
}

@keyframes ce-sc-slide {
	from { transform: translateX(100%); }
	to { transform: translateX(0); }
}

@keyframes ce-sc-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* ---------- Başlık ---------- */
.ce-sidecart__head {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	border-bottom: 1px solid var(--sc-border);
}

.ce-sidecart__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	color: var(--sc-text);
	line-height: 1.3;
}

.ce-sidecart__count {
	font-weight: 500;
	font-size: 14px;
	color: var(--sc-muted);
}

.ce-sidecart__close {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ce-sidecart__close:hover {
	background: #f2f4f8;
}

.ce-sidecart__close svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: #6b7488;
	stroke-width: 1.9;
	stroke-linecap: round;
}

/* ---------- Bildirim (stok limiti vb.) ---------- */
.ce-sidecart__notice {
	flex-shrink: 0;
	margin: 0;
	padding: 11px 18px;
	background: #fdf2f4;
	border-bottom: 1px solid #f3c2cb;
	color: var(--ce-danger, #e0234e);
	font-size: 13px;
	line-height: 1.45;
}

.ce-sidecart__notice[hidden] {
	display: none;
}

/* ---------- Gövde ---------- */
.ce-sidecart__inner {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.ce-sidecart__items {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 8px 18px;
}

.ce-sidecart__item {
	display: flex;
	gap: 12px;
	padding: 14px 0;
	border-bottom: 1px solid var(--sc-border);
	transition: opacity 0.15s ease;
}

.ce-sidecart__item:last-child {
	border-bottom: 0;
}

/* İnce durum göstergesi: satır iyimser olarak zaten güncellendi, istek arka
   planda sürüyor. Satır soldurulmaz ve TIKLAMAYA KAPATILMAZ — art arda +/-
   tıklamaları debounce ile tek isteğe iniyor. */
.ce-sidecart__item.is-busy {
	position: relative;
}

.ce-sidecart__item.is-busy::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--ce-green, #12a150), transparent);
	background-size: 40% 100%;
	background-repeat: no-repeat;
	animation: ce-sidecart-pulse 0.9s linear infinite;
}

@keyframes ce-sidecart-pulse {
	from { background-position: -40% 0; }
	to   { background-position: 140% 0; }
}

@media (prefers-reduced-motion: reduce) {
	.ce-sidecart__item.is-busy::after {
		animation: none;
		background: var(--ce-green, #12a150);
		opacity: 0.4;
	}
}

.ce-sidecart__thumb {
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	border-radius: 10px;
	overflow: hidden;
	background: var(--ce-bg-soft, #f7f7f7);
	line-height: 0;
}

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

.ce-sidecart__info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.ce-sidecart__name {
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--sc-text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ce-sidecart__name a {
	color: inherit;
	text-decoration: none;
}

.ce-sidecart__name a:hover {
	text-decoration: underline;
}

.ce-sidecart__price {
	font-size: 14px;
	font-weight: 700;
	color: var(--sc-text);
}

.ce-sidecart__price .woocommerce-Price-amount {
	color: inherit;
}

.ce-sidecart__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 2px;
}

/* Adet stepper */
.ce-sidecart__qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--sc-border);
	border-radius: 8px;
	overflow: hidden;
}

.ce-sidecart__qty--fixed {
	padding: 0 12px;
	height: 32px;
	line-height: 30px;
	font-size: 13px;
	color: var(--sc-text);
}

.ce-sidecart__step {
	width: 30px;
	height: 32px;
	border: 0;
	background: #fff;
	color: var(--sc-text);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.ce-sidecart__step:hover {
	background: var(--sc-accent-soft);
	color: var(--sc-accent-dark);
}

.ce-sidecart__qtyval {
	min-width: 30px;
	text-align: center;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--sc-text);
}

.ce-sidecart__remove {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border: 0;
	background: transparent;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease;
}

.ce-sidecart__remove:hover {
	background: #fdf2f4;
}

.ce-sidecart__remove svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: var(--sc-muted);
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: stroke 0.15s ease;
}

.ce-sidecart__remove:hover svg {
	stroke: var(--ce-danger, #e0234e);
}

/* ---------- Alt: ara toplam + butonlar ---------- */
.ce-sidecart__foot {
	flex-shrink: 0;
	padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--sc-border);
	background: #fff;
}

.ce-sidecart__subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
	font-size: 15px;
	color: var(--sc-text);
}

.ce-sidecart__subtotal strong {
	font-size: 19px;
	font-weight: 800;
}

.ce-sidecart__subtotal .woocommerce-Price-amount {
	color: inherit;
}

.ce-sidecart__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.ce-sidecart__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 46px;
	padding: 0 12px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.ce-sidecart__btn--ghost {
	background: #fff;
	color: var(--sc-accent);
	border: 1px solid var(--sc-accent);
}

.ce-sidecart__btn--ghost:hover {
	background: var(--sc-accent-soft);
	color: var(--sc-accent-dark);
	border-color: var(--sc-accent-dark);
}

.ce-sidecart__btn--primary {
	background: var(--sc-accent);
	color: #fff;
	border: 1px solid var(--sc-accent);
}

.ce-sidecart__btn--primary:hover {
	background: var(--sc-accent-dark);
	border-color: var(--sc-accent-dark);
	color: #fff;
}

/* ---------- Boş durum ---------- */
.ce-sidecart__empty {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 40px 24px;
	text-align: center;
}

.ce-sidecart__empty svg {
	width: 46px;
	height: 46px;
	fill: none;
	stroke: #ccd2de;
	stroke-width: 1.4;
	stroke-linejoin: round;
}

.ce-sidecart__empty p {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--sc-muted);
}

.ce-sidecart__empty .ce-sidecart__btn {
	min-width: 200px;
}

/* Fragment tazelemesi ARKA PLANDA sürer: içerik zaten ekranda ve
   kullanılabilir kalır, bloklayıcı örtü yoktur. Yalnız panelin üstünde
   ince bir çizgi görünür. */
.ce-sidecart.is-loading .ce-sidecart__panel::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	z-index: 2;
	background: linear-gradient(90deg, transparent, var(--ce-green, #12a150), transparent);
	background-size: 40% 100%;
	background-repeat: no-repeat;
	animation: ce-sidecart-pulse 0.9s linear infinite;
}

/* Arka plan scroll kilidi */
body.ce-sidecart-open {
	overflow: hidden;
}

/* ---------- Mobil ---------- */
@media (max-width: 768px) {
	.ce-sidecart__panel {
		width: 100%;
		max-width: calc(100% - 32px);
	}

	.ce-sidecart__head {
		padding: 14px 15px;
	}

	.ce-sidecart__title {
		font-size: 16px;
	}

	.ce-sidecart__items {
		padding: 6px 15px;
	}

	.ce-sidecart__thumb {
		width: 56px;
		height: 56px;
	}

	.ce-sidecart__foot {
		padding: 14px 15px calc(14px + env(safe-area-inset-bottom));
	}

	.ce-sidecart__btn {
		height: 44px;
		font-size: 13.5px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ce-sidecart__panel,
	.ce-sidecart__overlay {
		animation: none;
	}
}
