/*
 * IP Checkout cart drawer. Colours follow the Elementor kit.
 * Everything inside the drawer is scoped to #ipco-drawer: the ID outranks the kit's global
 * button / heading / link rules (yellow pill buttons, big serif h2), which otherwise win.
 */

#ipco-drawer,
.ipco-cart-toggle {
	--ipco-accent: var(--e-global-color-primary, #12445a);
	--ipco-text: var(--e-global-color-text, #1f2933);
	--ipco-muted: #6b7280;
	--ipco-border: #e3e7ec;
	--ipco-soft: #f3f5f7;
	--ipco-error: #c62828;
	--ipco-cta: #f6f163;      /* FunnelKit cart's yellow Checkout button */
	--ipco-badge: #d6312b;   /* Header cart count */
}

html.ipco-drawer-lock,
html.ipco-drawer-lock body { overflow: hidden; }

/* ------------------------------------------------------------ header icon */

/* Sized to match the header's Support / My Account icons. Override --ipco-cart-icon if needed. */
.ipco-cart-toggle {
	--ipco-cart-icon: 30px;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	color: inherit;
	text-decoration: none;
	vertical-align: middle;
}

.ipco-cart-toggle svg {
	display: block;
	width: var(--ipco-cart-icon);
	height: var(--ipco-cart-icon);
}

.ipco-cart-count {
	position: absolute;
	top: -6px;
	right: -10px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--ipco-badge);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.ipco-cart-count[data-count="0"] { display: none; }

/* ----------------------------------------------------------------- shell */

/* Above the WP admin bar (99999) so nothing overlaps the drawer head. */
.ipco-drawer-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(15, 23, 42, 0.45);
	opacity: 0;
	transition: opacity 0.25s;
}

.ipco-drawer-overlay.is-open { opacity: 1; }

#ipco-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 100001;
	display: flex;
	width: 420px;
	max-width: 100vw;
	background: #fff;
	color: var(--ipco-text);
	font-size: 15px;
	line-height: 1.4;
	box-shadow: -8px 0 24px rgba(15, 23, 42, 0.15);
	transform: translateX(100%);
	transition: transform 0.25s ease;
}

#ipco-drawer.is-open { transform: none; }
#ipco-drawer[hidden], .ipco-drawer-overlay[hidden] { display: none !important; }
#ipco-drawer.is-busy .ipco-drawer__body,
#ipco-drawer.is-busy .ipco-drawer__foot { opacity: 0.55; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
	#ipco-drawer, .ipco-drawer-overlay { transition: none; }
}

#ipco-drawer *, #ipco-drawer *::before, #ipco-drawer *::after { box-sizing: border-box; }

/* Neutralise theme button styling; each button below sets what it needs. */
#ipco-drawer button,
#ipco-drawer button:hover,
#ipco-drawer button:focus {
	min-width: 0;
	min-height: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	transform: none;
}

#ipco-drawer button:focus-visible,
#ipco-drawer a:focus-visible { outline: 2px solid var(--ipco-accent); outline-offset: 2px; }

#ipco-drawer .ipco-drawer__inner { display: flex; flex-direction: column; width: 100%; height: 100%; }

#ipco-drawer .ipco-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 16px 10px 24px;
}

#ipco-drawer .ipco-drawer__title {
	margin: 0;
	padding: 0;
	color: var(--ipco-accent);
	font-family: inherit;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
}

#ipco-drawer .ipco-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border-radius: 50%;
	color: var(--ipco-accent);
	line-height: 1;
	cursor: pointer;
}

#ipco-drawer .ipco-drawer__close:hover { background: var(--ipco-soft); }

#ipco-drawer .ipco-drawer__body { flex: 1; overflow-y: auto; padding: 4px 24px 20px; }

#ipco-drawer .ipco-drawer__notice {
	margin: 12px 0 0;
	padding: 10px 12px;
	border-radius: 6px;
	background: #fdecea;
	color: var(--ipco-error);
	font-size: 14px;
}

#ipco-drawer .ipco-drawer__empty { padding: 48px 0; text-align: center; color: var(--ipco-muted); }

/* ----------------------------------------------------------------- items */

#ipco-drawer .ipco-drawer__items { margin: 0; padding: 0; list-style: none; }

/* FunnelKit layout: thumbnail (remove × on its corner) | name + quantity | price top right. */
#ipco-drawer .ipco-drawer__item {
	display: grid;
	grid-template-columns: 90px 1fr auto;
	align-items: start;
	gap: 16px;
	margin: 0;
	padding: 14px 0;
}

#ipco-drawer .ipco-drawer__thumb { position: relative; }

#ipco-drawer .ipco-drawer__thumb img {
	display: block;
	width: 90px;
	height: 90px;
	padding: 6px;
	object-fit: contain;
	border: 1px solid var(--ipco-border);
	border-radius: 6px;
	background: #fff;
}

#ipco-drawer .ipco-drawer__remove {
	position: absolute;
	top: -8px;
	left: -8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border-radius: 50%;
	background: #e2e4ee;
	color: var(--ipco-text);
	line-height: 1;
	cursor: pointer;
}

#ipco-drawer .ipco-drawer__remove:hover { background: #cfd2df; color: var(--ipco-error); }

#ipco-drawer .ipco-drawer__name { font-size: 20px; font-weight: 400; line-height: 1.4; color: var(--ipco-accent); }
#ipco-drawer .ipco-drawer__name a { color: inherit; text-decoration: none; }
#ipco-drawer .ipco-drawer__meta { font-size: 13px; color: var(--ipco-muted); }
#ipco-drawer .ipco-drawer__meta:empty { display: none; }
#ipco-drawer .ipco-drawer__meta dl { margin: 2px 0 0; }
#ipco-drawer .ipco-drawer__meta dt, #ipco-drawer .ipco-drawer__meta dd { display: inline; margin: 0; }
#ipco-drawer .ipco-drawer__meta dd p { display: inline; margin: 0; }

#ipco-drawer .ipco-drawer__price { color: var(--ipco-accent); font-size: 18px; line-height: 1.4; white-space: nowrap; }

#ipco-drawer .ipco-qty {
	display: inline-flex;
	align-items: stretch;
	height: 38px;
	margin-top: 10px;
	border: 1px solid var(--ipco-border);
	border-radius: 6px;
	overflow: hidden;
}

#ipco-drawer .ipco-qty__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: auto;
	padding: 0;
	color: var(--ipco-accent);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

#ipco-drawer .ipco-qty__btn:hover { background: var(--ipco-soft); }
#ipco-drawer .ipco-qty__btn[disabled] { opacity: 0.35; cursor: default; background: none; }
#ipco-drawer .ipco-qty__val {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	border-right: 1px solid var(--ipco-border);
	border-left: 1px solid var(--ipco-border);
	color: var(--ipco-accent);
	font-size: 17px;
}

@media (max-width: 480px) {
	#ipco-drawer .ipco-drawer__item { grid-template-columns: 72px 1fr auto; gap: 12px; }
	#ipco-drawer .ipco-drawer__thumb img { width: 72px; height: 72px; }
	#ipco-drawer .ipco-drawer__name { font-size: 17px; }
	#ipco-drawer .ipco-drawer__price { font-size: 16px; }
}

/* --------------------------------------------------------------- upsells */

#ipco-drawer .ipco-upsells { margin-top: 20px; }

#ipco-drawer .ipco-upsells__title {
	margin: 0 0 10px;
	color: var(--ipco-text);
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
}

#ipco-drawer .ipco-upsells__list { margin: 0; padding: 0; list-style: none; }

#ipco-drawer .ipco-upsell {
	display: grid;
	grid-template-columns: 56px 1fr auto;
	align-items: center;
	gap: 10px;
	margin: 0 0 8px;
	padding: 10px;
	border: 1px solid var(--ipco-border);
	border-radius: 8px;
}

#ipco-drawer .ipco-upsell__thumb img { display: block; width: 56px; height: 56px; object-fit: contain; }
#ipco-drawer .ipco-upsell__name { display: block; color: inherit; font-size: 14px; font-weight: 600; line-height: 1.3; text-decoration: none; }
#ipco-drawer .ipco-upsell__price { font-size: 13px; color: var(--ipco-muted); }

#ipco-drawer .ipco-upsell__add {
	display: inline-block;
	padding: 7px 14px;
	border: 1px solid var(--ipco-accent);
	border-radius: 6px;
	background: #fff;
	color: var(--ipco-accent);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

#ipco-drawer .ipco-upsell__add:hover { background: var(--ipco-accent); color: #fff; }

/* ---------------------------------------------------------------- footer */

#ipco-drawer .ipco-drawer__foot { padding: 12px 24px 18px; background: #fff; }
#ipco-drawer .ipco-drawer__line { display: flex; justify-content: space-between; margin-bottom: 8px; }
#ipco-drawer .ipco-drawer__line--discount { color: #2e7d32; font-size: 14px; }

/* Yellow pill "Checkout  $29.00" */
#ipco-drawer .ipco-drawer__btn,
#ipco-drawer .ipco-drawer__btn:visited {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	min-height: 60px;
	padding: 12px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--ipco-cta);
	color: var(--ipco-accent);
	font-size: 22px;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

#ipco-drawer .ipco-drawer__btn:hover,
#ipco-drawer .ipco-drawer__btn:focus { background: var(--ipco-cta); color: var(--ipco-accent); filter: brightness(0.96); }

#ipco-drawer .ipco-drawer__link,
#ipco-drawer .ipco-drawer__link:hover,
#ipco-drawer .ipco-drawer__link:focus {
	display: block;
	width: 100%;
	margin-top: 12px;
	padding: 4px;
	color: #555;
	font-size: 17px;
	text-align: center;
	cursor: pointer;
}

#ipco-drawer .ipco-drawer__link:hover { color: var(--ipco-accent); }

@media (max-width: 480px) {
	#ipco-drawer .ipco-drawer__btn { min-height: 54px; font-size: 19px; }
}

@media (max-width: 480px) {
	#ipco-drawer { width: 100vw; }
}

/* While the cart is open, the Tidio chat bubble moves left, onto the page next to the drawer, so the
   Checkout / Continue Shopping buttons stay at the bottom. Narrow screens (no room beside the 420px drawer): hidden until it closes. */
html.ipco-drawer-lock #tidio-chat iframe,
html.ipco-drawer-lock #tidio-chat-iframe {
	right: 420px !important;
	transition: right 0.25s ease;
}
@media (max-width: 760px) {
	html.ipco-drawer-lock #tidio-chat,
	html.ipco-drawer-lock #tidio-chat-iframe { display: none !important; }
}
