/* ── Add-to-cart loading state ─────────────────────────────────────── */
a.cct-adding {
	opacity: 0.5;
	pointer-events: none;
	cursor: wait;
}

/* ── Cart Trigger ─────────────────────────────────────────────────── */
.cct-wrap {
	display: inline-flex;
	position: relative;
}

.cct-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	border: none;
	background-color: transparent;
	padding: 8px 14px;
	position: relative;
	text-decoration: none;
	transition: color 0.2s, background-color 0.2s, border-color 0.2s;
	line-height: 1;
}

.cct-trigger:hover,
.cct-trigger:focus,
.cct-trigger:active,
.cct-trigger:focus-visible {
	background-color: transparent;
}

.cct-trigger.cct-icon-right {
	flex-direction: row-reverse;
}

.cct-trigger-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.cct-trigger-icon svg,
.cct-trigger-icon i {
	display: block;
	color: currentColor;
}

.cct-trigger-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* ── Badge ─────────────────────────────────────────────────────────── */
.cct-badge {
	position: absolute;
	top: -6px;
	right: -6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #ee4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	pointer-events: none;
	transition: transform 0.2s, opacity 0.2s;
}

.cct-badge--hidden {
	opacity: 0;
	transform: scale(0);
}

/* ── Overlay ───────────────────────────────────────────────────────── */
.cct-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 100000;
	cursor: pointer;
}

.cct-overlay.cct-overlay--visible {
	display: block;
	animation: cctFadeIn 0.25s ease;
}

/* Push overlay below admin bar */
body.admin-bar .cct-overlay {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .cct-overlay {
		top: 46px;
	}
}

/* ── Panel ─────────────────────────────────────────────────────────── */
.cct-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	width: 380px;
	max-width: 100vw;
	background: #fff;
	z-index: 100001;
	display: flex;
	flex-direction: column;
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	overflow: hidden;
}

.cct-panel-right {
	right: 0;
	transform: translateX(100%);
}

.cct-panel-left {
	left: 0;
	transform: translateX(-100%);
}

.cct-panel.cct-panel--open {
	transform: translateX(0);
}

/* Push panel below admin bar — height adjusts automatically via bottom: 0 */
body.admin-bar .cct-panel {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .cct-panel {
		top: 46px;
	}
}

/* ── Panel Header ──────────────────────────────────────────────────── */
.cct-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	flex-shrink: 0;
}

.cct-panel-title-wrap {
	display: inline-flex;
	align-items: center;
	gap: 0;
}

.cct-panel-title-icon {
	display: inline-flex;
	align-items: center;
	line-height: 1;
	flex-shrink: 0;
}

.cct-panel-title-icon svg {
	display: block;
	fill: currentColor;
}

.cct-panel-title {
	font-size: 1.1rem;
	font-weight: 600;
}

.cct-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.cct-close svg {
	display: block;
	fill: currentColor;
}

/* ── Panel Body ────────────────────────────────────────────────────── */
.cct-panel-body {
	flex: 1;
	overflow-y: auto;
	padding: 0;
	-webkit-overflow-scrolling: touch;
}

/* ── Empty Message ─────────────────────────────────────────────────── */
.cct-empty {
	padding: 40px 20px;
	text-align: center;
	color: #999;
}

/* ── Cart Item ─────────────────────────────────────────────────────── */
.cct-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid #f0f0f0;
	position: relative;
	transition: opacity 0.2s;
}

.cct-item.cct-item--loading {
	opacity: 0.4;
	pointer-events: none;
}

.cct-item-image {
	flex-shrink: 0;
}

.cct-item-image img {
	width: 70px;
	height: 70px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}

.cct-item-details {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cct-item-name {
	font-size: 0.9rem;
	font-weight: 500;
	color: inherit;
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cct-item-name:hover {
	text-decoration: underline;
}

.cct-name-nowrap .cct-item-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: block;
	-webkit-line-clamp: unset;
	-webkit-box-orient: unset;
}

.cct-item-price-row {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.cct-item-price {
	font-size: 0.85rem;
	font-weight: 600;
}

.cct-item-discount {
	font-size: 0.8rem;
	font-weight: 600;
	color: #2a9d5c;
}

/* ── Quantity Controls ─────────────────────────────────────────────── */
.cct-qty-wrap {
	display: inline-flex;
	align-items: center;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	background: #f7f7f7;
}

.cct-qty-btn {
	background: transparent;
	border: none;
	cursor: pointer;
	width: 28px;
	height: 28px;
	font-size: 1rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
	padding: 0;
	flex-shrink: 0;
}

.cct-qty-btn svg {
	width: 1em;
	height: 1em;
	display: block;
	fill: currentColor;
}

.cct-qty-btn:hover {
	background: rgba(0, 0, 0, 0.08);
}

.cct-qty-input {
	width: 36px;
	border: 0;
	text-align: center;
	font-size: 0.85rem;
	background: transparent;
	height: 28px;
	-moz-appearance: textfield;
	padding: 0;
	color: inherit;
	outline: none;
}

.cct-qty-input::-webkit-outer-spin-button,
.cct-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
}

/* ── Item Category ─────────────────────────────────────────────────── */
.cct-item-category {
	font-size: 0.75rem;
	color: #999;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* ── Quantity Row (beside_qty layout) ──────────────────────────────── */
.cct-qty-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* ── Remove Button ─────────────────────────────────────────────────── */
.cct-remove {
	background: none;
	border: none;
	cursor: pointer;
	color: #999;
	padding: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	flex-shrink: 0;
	transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.cct-remove:hover {
	color: #e44;
}

/* Remove position modifiers */
.cct-remove-top_right > .cct-remove {
	align-self: flex-start;
}

.cct-remove-bottom_right > .cct-remove {
	align-self: flex-end;
}

/* ── Panel Footer ──────────────────────────────────────────────────── */
.cct-panel-footer {
	padding: 0;
	border-top: 1px solid #e5e5e5;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.cct-subtotal {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.95rem;
	font-weight: 600;
}

.cct-shipping {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.9rem;
}

.cct-shipping-value {
	font-weight: 600;
}

.cct-discount {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.9rem;
}

.cct-discount-value {
	font-weight: 600;
	color: #2a9d5c;
}

/* ── Footer Buttons ────────────────────────────────────────────────── */
.cct-footer-buttons {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cct-cart_btn,
.cct-checkout_btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 12px 20px;
	border-radius: 4px;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	border: 2px solid transparent;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
	line-height: 1.3;
	gap: 6px;
	box-sizing: border-box;
}

/* ── Button icon wrapper ────────────────────────────────────────────── */
.cct-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	flex-shrink: 0;
}

.cct-btn-icon i {
	display: block;
}

.cct-btn-icon svg {
	display: block;
	fill: currentColor;
	width: 1em;
	height: 1em;
}

.cct-cart_btn {
	background: #f5f5f5;
	color: #333;
	border-color: #ddd;
}

.cct-cart_btn:hover {
	background: #e8e8e8;
}

.cct-checkout_btn {
	background: #333;
	color: #fff;
}

.cct-checkout_btn:hover {
	background: #111;
}

/* ── Loading Spinner ───────────────────────────────────────────────── */
.cct-spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: cctSpin 0.6s linear infinite;
	margin: 20px auto;
}

.cct-panel--loading .cct-spinner {
	display: block;
}

/* ── Keyframes ─────────────────────────────────────────────────────── */
@keyframes cctFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes cctSpin {
	to { transform: rotate(360deg); }
}

@keyframes cctIconBounce {
	0%, 100% { transform: translateY(0); }
	30%       { transform: translateY(-6px); }
	60%       { transform: translateY(-3px); }
}

@keyframes cctIconShake {
	0%, 100% { transform: translateX(0); }
	20%       { transform: translateX(-4px) rotate(-4deg); }
	40%       { transform: translateX(4px) rotate(4deg); }
	60%       { transform: translateX(-3px) rotate(-2deg); }
	80%       { transform: translateX(3px) rotate(2deg); }
}

@keyframes cctIconPulse {
	0%, 100% { transform: scale(1); }
	50%       { transform: scale(1.25); }
}

/* ── Icon Hover Animations ─────────────────────────────────────────── */
.cct-icon-anim-grow   .cct-trigger .cct-trigger-icon,
.cct-icon-anim-bounce .cct-trigger .cct-trigger-icon,
.cct-icon-anim-shake  .cct-trigger .cct-trigger-icon,
.cct-icon-anim-scale  .cct-trigger .cct-trigger-icon,
.cct-icon-anim-spin   .cct-trigger .cct-trigger-icon,
.cct-icon-anim-pulse  .cct-trigger .cct-trigger-icon {
	transition: transform 0.3s ease;
}

.cct-icon-anim-grow .cct-trigger:hover .cct-trigger-icon {
	transform: scale(1.1);
}

.cct-icon-anim-bounce .cct-trigger:hover .cct-trigger-icon {
	animation: cctIconBounce 0.5s ease;
}

.cct-icon-anim-shake .cct-trigger:hover .cct-trigger-icon {
	animation: cctIconShake 0.45s ease;
}

.cct-icon-anim-scale .cct-trigger:hover .cct-trigger-icon {
	transform: scale(1.2);
}

.cct-icon-anim-spin .cct-trigger:hover .cct-trigger-icon {
	transform: rotate(360deg);
	transition: transform 0.5s ease;
}

.cct-icon-anim-pulse .cct-trigger:hover .cct-trigger-icon {
	animation: cctIconPulse 0.5s ease;
}

/* ── Editor Preview ───────────────────────────────────────────────── */
/* When "Preview Open" is active in the Elementor editor, scope the    */
/* overlay to the widget wrapper so it doesn't cover the builder UI.   */
.cct-preview-open .cct-overlay {
	position: absolute;
	z-index: 1;
}

.cct-preview-open .cct-panel {
	position: absolute;
	z-index: 2;
	height: 100%;
	min-height: 400px;
}

/* ── Accessibility ─────────────────────────────────────────────────── */
.cct-panel:focus {
	outline: none;
}

body.cct-panel-open {
	overflow: hidden;
}
