/*
 * Checkout Upsell Modal — High Desert Sciences Theme v1.2.0
 * Brand: Burn Orange #bf5a2a | Navy #0c1d7a
 * Accent driven by --cum-accent (output inline by PHP from saved setting).
 */

/* ── CSS Custom Properties (HDS defaults) ────────────────── */
.cum-overlay {
	--cum-accent:        #bf5a2a;
	--cum-accent-dark:   #a34a22;
	--cum-accent-light:  #fff3ed;
	--cum-accent-shadow: rgba(191, 90, 42, 0.22);
	--cum-heading:       #0c1d7a;
}

/* ── Overlay ─────────────────────────────────────────────── */
.cum-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.58);
	padding: 16px;
	opacity: 0;
	transition: opacity 0.3s ease;
}
.cum-overlay.is-open { opacity: 1; }

/* ── Modal Box ───────────────────────────────────────────── */
.cum-modal {
	position: relative;
	background: #ffffff;
	border-radius: 16px;
	max-width: 800px;
	width: 100%;
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	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,.18), 0 0 0 1px rgba(12,29,122,.06);
}
.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: #f4f5f7;
	border: none; border-radius: 8px;
	cursor: pointer; color: #6b7280;
	transition: background .15s, color .15s;
	padding: 0; flex-shrink: 0;
}
.cum-close-btn:hover { background: var(--cum-accent-light); color: var(--cum-accent); }

/* ── Modal Header ────────────────────────────────────────── */
.cum-modal-header {
	flex-shrink: 0;
	text-align: center;
	padding: 32px 36px 20px;
	border-bottom: 2px solid var(--cum-accent-light);
	background: linear-gradient(to bottom, #fdf8f5 0%, #ffffff 100%);
}
.cum-heading {
	font-size: 22px; font-weight: 700;
	margin: 0 0 8px;
	color: var(--cum-heading);
	line-height: 1.2;
}
.cum-subheading { font-size: 14px; color: #6b7280; margin: 0; line-height: 1.5; }

/* ── Modal Body ──────────────────────────────────────────── */
.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: .09em;
	color: var(--cum-accent);
	margin: 0 0 14px; padding-bottom: 10px;
	border-bottom: 1px solid var(--cum-accent-light);
}

/* ── 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 #e8eaed;
	border-radius: 12px;
	padding: 14px 12px;
	display: flex; flex-direction: column; gap: 10px;
	text-align: center;
	transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
	position: relative; overflow: hidden;
}
.cum-product-card:hover {
	box-shadow: 0 6px 20px var(--cum-accent-shadow);
	border-color: var(--cum-accent);
	transform: translateY(-3px);
}
@keyframes cumCardPulse {
	0%   { box-shadow: 0 0 0 0   rgba(5,150,105,.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 .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 .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: var(--cum-heading); margin: 0; font-weight: 700; }
.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 ────────────────────────────────────────── */
.cum-product-card.cum-product-oos { opacity: .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,.65); color: #fff;
	font-size: 10px; font-weight: 700; text-transform: uppercase;
	letter-spacing: .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: #fff !important;
	border: none !important; cursor: not-allowed !important; opacity: .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: var(--cum-accent);
	color: #fff; border: none; border-radius: 8px;
	font-size: 12px; font-weight: 700;
	cursor: pointer; text-align: center; text-decoration: none;
	transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
	line-height: 1.4; min-height: 36px; letter-spacing: .02em;
}
.cum-atc-btn:hover {
	background: var(--cum-accent-dark); color: #fff; text-decoration: none;
	box-shadow: 0 4px 12px var(--cum-accent-shadow);
}
.cum-atc-btn:active { transform: scale(.96); }
.cum-atc-btn:disabled { cursor: not-allowed; opacity: .75; }
.cum-atc-btn.cum-state-loading { background: var(--cum-accent-dark); }
.cum-atc-btn.cum-state-added { background: #059669; animation: cumBtnSuccess .3s ease; }
@keyframes cumBtnSuccess {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.06); }
	100% { transform: scale(1); }
}
.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,.35); border-top-color: #fff;
	border-radius: 50%; animation: cumSpin .65s linear infinite; flex-shrink: 0;
}
@keyframes cumSpin { to { transform: rotate(360deg); } }

/* ── Modal Footer ────────────────────────────────────────── */
.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 #f0f0f2;
	background: #fdf8f5;
}

/* ── 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 .18s ease;
	border: none; line-height: 1; white-space: nowrap;
}
.cum-btn-back {
	background: #fff; color: #6b7280;
	border: 1px solid #e5e7eb; font-size: 13px;
}
.cum-btn-back:hover { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.cum-btn-checkout {
	background: var(--cum-accent); color: #fff !important;
	padding: 14px 28px; font-size: 15px; font-weight: 700;
	box-shadow: 0 4px 14px var(--cum-accent-shadow);
	letter-spacing: .02em;
}
.cum-btn-checkout:hover {
	background: var(--cum-accent-dark); color: #fff !important;
	text-decoration: none; transform: translateY(-1px);
	box-shadow: 0 6px 20px var(--cum-accent-shadow);
}
.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: #fff;
	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,.28);
	opacity: 0; pointer-events: none;
	transition: opacity .25s ease, transform .3s cubic-bezier(.34,1.5,.64,1);
}
.cum-toast.cum-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.cum-toast.cum-toast--success { background: #064e3b; border: 1px solid rgba(52,211,153,.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,.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; }
}
