/*
 * Checkout Upsell Modal — Base Styles v1.1.0
 * Theme-neutral. Override with the provided Petratide theme snippet.
 */

/* ── Overlay ─────────────────────────────────────────────── */
.cum-overlay {
	display: none;          /* JS sets to flex when showing */
	position: fixed;
	inset: 0;
	z-index: 999999;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.6);
	padding: 16px;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.cum-overlay.is-open {
	opacity: 1;
}

/* ── Modal Box ─────────────────────────────────────────────
   Flex column so header + body scroll + footer stay in place.
   ────────────────────────────────────────────────────────── */
.cum-modal {
	position: relative;
	background: #ffffff;
	border-radius: 16px;
	max-width: 800px;
	width: 100%;
	/* Fixed max-height with flex column = footer always visible */
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;        /* children handle their own scroll */
	transform: translateY(28px) scale(0.97);
	transition: transform 0.38s cubic-bezier(0.34, 1.46, 0.64, 1);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

.cum-overlay.is-open .cum-modal {
	transform: translateY(0) scale(1);
}

/* ── Close Button ────────────────────────────────────────── */
.cum-close-btn {
	position: absolute !important;
	top: 14px !important;
	right: 14px !important;
	z-index: 100;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f3f4f6;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	color: #6b7280;
	transition: background 0.15s, color 0.15s;
	padding: 0;
	flex-shrink: 0;
}

.cum-close-btn:hover {
	background: #e5e7eb;
	color: #111827;
}

/* ── Modal Header ────────────────────────────────────────── */
.cum-modal-header {
	flex-shrink: 0;
	text-align: center;
	padding: 32px 36px 20px;
	border-bottom: 1px solid #f3f4f6;
}

.cum-heading {
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 8px;
	color: #111827;
	line-height: 1.2;
}

.cum-subheading {
	font-size: 14px;
	color: #6b7280;
	margin: 0;
	line-height: 1.5;
}

/* ── Modal Body — scrolls independently ─────────────────── */
.cum-modal-body {
	flex: 1;
	overflow-y: auto;
	padding: 24px 28px;
	overscroll-behavior: contain;
}

.cum-modal-body::-webkit-scrollbar { width: 5px; }
.cum-modal-body::-webkit-scrollbar-track { background: transparent; }
.cum-modal-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* ── Sections ────────────────────────────────────────────── */
.cum-section {
	margin-bottom: 28px;
}

.cum-section:last-child {
	margin-bottom: 0;
}

.cum-section-title {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: #9ca3af;
	margin: 0 0 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid #f3f4f6;
}

/* ── Product Grid ────────────────────────────────────────── */
.cum-products {
	display: grid;
	gap: 14px;
}

.cum-cols-1 { grid-template-columns: 1fr; }
.cum-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cum-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cum-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Product Card ────────────────────────────────────────── */
.cum-product-card {
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 14px 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-align: center;
	transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
	position: relative;
	overflow: hidden;
}

.cum-product-card:hover {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
	transform: translateY(-3px);
}

/* Card pulse on ATC success */
@keyframes cumCardPulse {
	0%   { box-shadow: 0 0 0 0   rgba(5, 150, 105, 0.4); }
	50%  { box-shadow: 0 0 0 10px rgba(5, 150, 105, 0); }
	100% { box-shadow: 0 0 0 0   rgba(5, 150, 105, 0); }
}

.cum-product-card.cum-card-pulse {
	animation: cumCardPulse 0.7s ease-out;
}

/* ── Product Image ───────────────────────────────────────── */
.cum-product-img {
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 8px;
	background: #f9fafb;
}

.cum-product-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.cum-product-card:hover .cum-product-img img {
	transform: scale(1.04);
}

/* ── Product Info ────────────────────────────────────────── */
.cum-product-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cum-product-name {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
	margin: 0;
	line-height: 1.35;
}

.cum-product-price {
	font-size: 14px;
	color: #374151;
	margin: 0;
	font-weight: 600;
}

.cum-product-price del {
	color: #9ca3af;
	font-weight: 400;
	font-size: 12px;
	margin-right: 3px;
}

.cum-product-price ins {
	text-decoration: none;
}

/* ── Out of Stock Card ───────────────────────────────────── */
.cum-product-card.cum-product-oos {
	opacity: 0.6;
}

.cum-product-card.cum-product-oos .cum-product-img img {
	filter: grayscale(40%);
}

.cum-oos-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	background: rgba(0, 0, 0, 0.65);
	color: #ffffff;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 3px 8px;
	border-radius: 4px;
	pointer-events: none;
	z-index: 2;
	line-height: 1.5;
}

.cum-atc-btn--oos {
	background: #9ca3af !important;
	color: #ffffff !important;
	border: none !important;
	cursor: not-allowed !important;
	opacity: 0.7 !important;
}

/* ── Add to Cart Button ──────────────────────────────────── */
.cum-atc-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 9px 10px;
	background: #111827;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
	line-height: 1.4;
	min-height: 36px;
}

.cum-atc-btn:hover {
	background: #1f2937;
	color: #ffffff;
	text-decoration: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cum-atc-btn:active {
	transform: scale(0.96);
}

.cum-atc-btn:disabled {
	cursor: not-allowed;
	opacity: 0.75;
}

/* Loading state */
.cum-atc-btn.cum-state-loading {
	background: #374151;
}

/* Success state */
.cum-atc-btn.cum-state-added {
	background: #059669;
	animation: cumBtnSuccess 0.3s ease;
}

@keyframes cumBtnSuccess {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.06); }
	100% { transform: scale(1); }
}

/* Error state */
.cum-atc-btn.cum-state-error {
	background: #dc2626;
}

/* ── Spinner ─────────────────────────────────────────────── */
.cum-spinner {
	display: inline-block;
	width: 13px;
	height: 13px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: cumSpin 0.65s linear infinite;
	flex-shrink: 0;
}

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

/* ── Modal Footer — always pinned ───────────────────────────
   flex-shrink: 0 keeps it at the bottom of the flex column.
   ────────────────────────────────────────────────────────── */
.cum-modal-footer {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 28px 22px;
	border-top: 1px solid #f3f4f6;
	background: transparent; /* inherits modal bg so no jarring color break */
}

/* ── Footer Buttons ──────────────────────────────────────── */
.cum-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 12px 24px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.18s ease;
	border: none;
	line-height: 1;
	white-space: nowrap;
}

/* Keep Shopping */
.cum-btn-back {
	background: #f9fafb;
	color: #6b7280;
	border: 1px solid #e5e7eb;
	font-size: 13px;
}

.cum-btn-back:hover {
	background: #f3f4f6;
	color: #374151;
	border-color: #d1d5db;
}

/* Continue to Checkout */
.cum-btn-checkout {
	background: #111827;
	color: #ffffff !important;
	padding: 14px 28px;
	font-size: 15px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.cum-btn-checkout:hover {
	background: #1f2937;
	color: #ffffff !important;
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.26);
}

.cum-btn-checkout:active {
	transform: translateY(0);
}

/* ── Toast ───────────────────────────────────────────────── */
.cum-toast {
	position: fixed;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%) translateY(16px);
	z-index: 9999999;
	background: #1f2937;
	color: #ffffff;
	padding: 12px 20px;
	border-radius: 50px;
	font-size: 13px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.5, 0.64, 1);
}

.cum-toast.cum-toast--visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
	pointer-events: auto;
}

.cum-toast.cum-toast--success {
	background: #065f46;
	border: 1px solid rgba(52, 211, 153, 0.3);
	color: #d1fae5;
}

.cum-toast.cum-toast--success svg {
	color: #34d399;
	flex-shrink: 0;
}

.cum-toast.cum-toast--error {
	background: #7f1d1d;
	border: 1px solid rgba(252, 165, 165, 0.3);
	color: #fee2e2;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
	.cum-modal-header {
		padding: 26px 20px 16px;
	}

	.cum-modal-body {
		padding: 18px 16px;
	}

	.cum-cols-3,
	.cum-cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}

	.cum-modal-footer {
		padding: 14px 16px 18px;
		gap: 10px;
	}

	.cum-btn-back {
		padding: 11px 16px;
		font-size: 13px;
	}

	.cum-btn-checkout {
		padding: 12px 20px;
		font-size: 14px;
	}

	.cum-toast {
		bottom: 16px;
		font-size: 12px;
		padding: 10px 16px;
		max-width: calc(100vw - 32px);
		white-space: normal;
	}
}

@media (max-width: 400px) {
	.cum-cols-2 { grid-template-columns: 1fr; }
	.cum-modal-footer { flex-direction: column-reverse; }
	.cum-btn { width: 100%; justify-content: center; }
}
