/* ============================================================
   IFAD Cart — add-to-cart buttons + slide-out drawer.
   Brand navy #0E0E31. Drawer slides from the right (LTR) /
   left (RTL). No WooCommerce.
   ============================================================ */

:root { --ifad-navy: #0e0e31; --ifad-line: #e5e5ea; --ifad-muted: #6b6b76; }

/* ---------------- Add-to-cart buttons ---------------- */
.ifad-addcart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	margin-top: 0;
	padding: 10px 16px;
	background: var(--ifad-navy);
	border: 1px solid var(--ifad-navy);
	border-radius: 5px;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.ifad-addcart:hover { background: #fff; color: var(--ifad-navy); }
.ifad-addcart.is-loading { opacity: .6; pointer-events: none; }
.ifad-addcart.is-incart { background: #fff; color: var(--ifad-navy); }
.ifad-addcart.is-reserved {
	background: #f4f4f7;
	border-color: #e2e2ea;
	color: var(--ifad-muted);
	cursor: default;
}
.ifad-addcart.is-reserved:hover { background: #f4f4f7; color: var(--ifad-muted); }
/* Single product uses the theme `.ifad-btn` for layout so it sits in one row
   with Consultation / Request. These only add the cart states. */
.is-loading { opacity: .6; pointer-events: none; }
.ifad-btn.is-reserved { background: #f4f4f7 !important; border-color: #e2e2ea !important; color: var(--ifad-muted) !important; cursor: default; }

/* ---------------- Drawer ---------------- */
.ifad-drawer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100000; display: flex; justify-content: flex-end; overflow: hidden; }
.ifad-drawer[hidden] { display: none; }

/* RTL: the drawer slides in from the LEFT (mirrors LTR's right). Force the flex
   container to LTR so flex-start resolves to the physical left deterministically,
   then restore RTL on the panel content. */
[dir="rtl"] .ifad-drawer { direction: ltr; justify-content: flex-start; }
[dir="rtl"] .ifad-drawer__panel { direction: rtl; transform: translateX(-100%); box-shadow: 14px 0 40px rgba(8, 8, 26, .18); }
[dir="rtl"] .ifad-drawer.is-open .ifad-drawer__panel { transform: none; }
.ifad-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(8, 8, 26, .45);
	opacity: 0;
	transition: opacity .28s ease;
}
.ifad-drawer.is-open .ifad-drawer__overlay { opacity: 1; }
.ifad-drawer__panel {
	position: relative;
	flex: 0 0 400px;
	width: 400px;
	max-width: 90vw;
	height: 100vh;
	height: 100dvh;      /* dynamic viewport height — excludes the mobile browser
	                        toolbar so the footer + checkout button stay reachable */
	max-height: 100vh;
	max-height: 100dvh;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	background: #fff;
	box-shadow: -14px 0 40px rgba(8, 8, 26, .18);
	transform: translateX(100%);
	transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}
.ifad-drawer.is-open .ifad-drawer__panel { transform: none; }

.ifad-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 22px;
	border-bottom: 1px solid var(--ifad-line);
}
.ifad-drawer__title { margin: 0; font-size: 17px; font-weight: 600; color: var(--ifad-navy); text-transform: uppercase; letter-spacing: .02em; }
.ifad-drawer__close { display: inline-flex; padding: 4px; border: 0; background: none; color: var(--ifad-navy); cursor: pointer; border-radius: 5px; }
.ifad-drawer__close:hover { background: #f4f4f7; }

.ifad-drawer__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 10px 22px; }
.ifad-cart-empty { color: var(--ifad-muted); text-align: center; padding: 48px 0; }

.ifad-cart-item { display: flex; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--ifad-line); }
.ifad-cart-item__img { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 5px; overflow: hidden; background: #f1f1f3; display: block; }
.ifad-cart-item__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ifad-cart-item__info { flex: 1 1 auto; min-width: 0; }
.ifad-cart-item__title { display: block; font-size: 14px; line-height: 1.3; color: var(--ifad-navy); text-decoration: none; }
.ifad-cart-item__title:hover { color: var(--ifad-muted); }
.ifad-cart-item__price { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--ifad-navy); }
.ifad-cart-item__remove { flex: 0 0 auto; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--ifad-muted); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 50%; }
.ifad-cart-item__remove:hover { background: #f4f4f7; color: var(--ifad-navy); }

/* ---------------- Order-placed success panel ---------------- */
.ifad-cart-success { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100%; padding: 24px 6px; text-align: center; }
.ifad-cart-success__icon { color: #1a7f37; margin: 0 0 18px; }
.ifad-cart-success__msg { margin: 0 0 26px; font-size: 15px; line-height: 1.55; color: var(--ifad-navy); max-width: 320px; }
.ifad-cart-success__actions { display: flex; gap: 12px; width: 100%; max-width: 340px; }
.ifad-cart-success__btn {
	flex: 1 1 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 13px 10px;
	border: 1px solid var(--ifad-navy);
	border-radius: 5px;
	background: var(--ifad-navy);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .02em;
	text-decoration: none;
	cursor: pointer;
	font-size: 14px;
	font-weight: 400;
	transition: background .15s ease, color .15s ease;
}
.ifad-cart-success__btn:hover { background: #fff; color: var(--ifad-navy); }
.ifad-cart-success__btn--ghost { background: #fff; color: var(--ifad-navy); }
.ifad-cart-success__btn--ghost:hover { background: var(--ifad-navy); color: #fff; }
/* After checkout the cart is empty → foot is hidden anyway; keep it hidden. */
.ifad-drawer.is-done .ifad-drawer__foot { display: none; }

.ifad-drawer__foot { padding: 18px 22px 22px; border-top: 1px solid var(--ifad-line); }
.ifad-drawer__subtotal { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 15px; font-weight: 700; color: var(--ifad-navy); }
.ifad-drawer__subtotal strong { font-size: 18px; font-weight: 700; }
/* Promo code (broker referral discount) */
.ifad-drawer__discount { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 12px; font-size: 14px; color: #1a7f37; }
.ifad-drawer__discount strong { font-weight: 700; }
.ifad-drawer__discount[hidden] { display: none; }
.ifad-drawer__discount-left { display: inline-flex; align-items: center; gap: 7px; }
.ifad-drawer__promo-remove { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: #e6f3ea; color: #1a7f37; font-size: 16px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ifad-drawer__promo-remove:hover { background: #1a7f37; color: #fff; }
.ifad-drawer__grandtotal { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; font-size: 16px; color: var(--ifad-navy); font-weight: 700; }
.ifad-drawer__grandtotal strong { font-size: 19px; font-weight: 700; }
.ifad-drawer__grandtotal[hidden] { display: none; }
.ifad-drawer__promo { display: flex; gap: 8px; margin: 0 0 8px; }
.ifad-drawer__promo-input { flex: 1 1 auto; min-width: 0; padding: 10px 12px; border: 1px solid var(--ifad-line); border-radius: 6px; font: inherit; font-size: 14px; text-transform: uppercase; letter-spacing: 0.03em; }
.ifad-drawer__promo-input:focus { outline: none; border-color: var(--ifad-navy); }
.ifad-drawer__promo-apply { flex: 0 0 auto; padding: 10px 18px; border: 1px solid var(--ifad-navy); border-radius: 6px; background: #fff; color: var(--ifad-navy); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ifad-drawer__promo-apply:hover { background: var(--ifad-navy); color: #fff; }
.ifad-drawer__promo-msg { font-size: 12.5px; color: #1a7f37; margin: 0 0 8px; }
.ifad-drawer__promo-msg.is-error { color: #9b0303; }
.ifad-drawer__promo-msg:empty { margin: 0; }
.ifad-drawer__checkout {
	display: block;
	width: 100%;
	box-sizing: border-box;   /* width:100% + padding + border must fit the footer */
	padding: 14px 9px;
	background: var(--ifad-navy);
	border: 1px solid var(--ifad-navy);
	border-radius: 5px;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none;
	transition: background .15s ease, color .15s ease;
}
.ifad-drawer__checkout:hover { background: #fff; color: var(--ifad-navy); }
.ifad-drawer.is-empty .ifad-drawer__foot { display: none; }

/* Header cart count badge shows only when > 0. */
.ifad-cart-count[hidden] { display: none; }

/* ---------------- RTL: drawer from the left ---------------- */
[dir="rtl"] .ifad-drawer { justify-content: flex-start; }
[dir="rtl"] .ifad-drawer__panel { transform: translateX(-100%); box-shadow: 14px 0 40px rgba(8, 8, 26, .18); }
[dir="rtl"] .ifad-drawer.is-open .ifad-drawer__panel { transform: none; }

/* ---------------- Responsive ---------------- */
@media ( max-width: 480px ) {
	.ifad-drawer__panel { width: 100%; max-width: 100%; }
}

/* ---------------- Stone spec + certificate on cart items ---------------- */
.ifad-cart-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0 0; }
.ifad-cart-item__spec { font-size: 12px; color: var(--ifad-muted); line-height: 1.3; }
.ifad-cart-item__cert { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ifad-navy); text-decoration: none; }
.ifad-cart-item__cert:hover { color: #3434a7; }

/* ---------------- Trust badges (drawer + checkout) ---------------- */
.ifad-trust { list-style: none; margin: 14px 0 0; padding: 13px 0 13px; border-top: 1px solid var(--ifad-line); display: flex; flex-direction: column; gap: 9px; }
.ifad-trust li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; line-height: 1.3; color: var(--ifad-navy); }
.ifad-trust li svg { color: var(--ifad-navy); flex-shrink: 0; }
