/* Gift Wrapping for WooCommerce – Cart & Checkout — front-end styles */

.cgwfw-wrap {
	margin-top: 8px;
	font-size: 0.9em;
}

.cgwfw-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	border: none;
	padding: 6px 12px;
	line-height: 1.3;
	background: var(--cgwfw-btn-bg, #b5651d);
	color: var(--cgwfw-btn-color, #fff);
	border-radius: var(--cgwfw-btn-radius, 4px);
	transition: background-color 0.15s ease, opacity 0.15s ease;
	/* Align with the adjacent tooltip icon (also vertical-align: middle). */
	vertical-align: middle;
}

.cgwfw-btn:hover {
	opacity: 0.9;
}

.cgwfw-btn.is-wrapped {
	background: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-btn-fee {
	opacity: 0.85;
	font-size: 0.9em;
}

.cgwfw-btn.cgwfw-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Theme compatibility: some themes (e.g. Flatsome) force uppercase text,
   their own button colours and letter-spacing onto every button. Re-assert
   the plugin's own styling so the admin colour settings always apply and the
   label/price render as intended. */
.cgwfw-wrap .cgwfw-btn,
.cgwfw-wrap .cgwfw-btn:hover,
.cgwfw-wrap .cgwfw-btn:focus {
	text-transform: none !important;
	letter-spacing: normal !important;
	color: var(--cgwfw-btn-color, #fff) !important;
	background: var(--cgwfw-btn-bg, #b5651d) !important;
	text-shadow: none !important;
}

.cgwfw-wrap .cgwfw-btn.is-wrapped {
	background: var(--cgwfw-btn-bg-added, #5a7d2a) !important;
}

.cgwfw-wrap .cgwfw-btn .cgwfw-btn-label,
.cgwfw-wrap .cgwfw-btn .cgwfw-btn-fee,
.cgwfw-wrap .cgwfw-btn .cgwfw-btn-fee * {
	color: inherit !important;
	text-transform: none !important;
}

/* Keep the dropdown trigger/options free of theme uppercasing too. */
.cgwfw-wrap .cgwfw-dd-trigger,
.cgwfw-wrap .cgwfw-dd-option {
	text-transform: none !important;
	letter-spacing: normal !important;
}

/* Small button size option */
.cgwfw-btn.cgwfw-size-small {
	padding: 4px 8px;
	font-size: 14px;
}

/* "Gift icon + text" style: identical to the simple button (background and
   text colours come from the admin settings) with a leading gift icon that
   inherits the button text colour. */
.cgwfw-icon-symbol {
	display: inline-flex;
	align-items: center;
}

/* "Gift wrapping included" badge for pre-wrapped products */
.cgwfw-included {
	display: flex;
	width: fit-content;
	max-width: 100%;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	padding: 5px 12px;
	border-radius: 999px;
	background: #e6f4ea;
	color: #2f6b3d;
	font-size: 0.9em;
	line-height: 1.3;
}

.cgwfw-included-icon {
	display: inline-flex;
	color: #2f6b3d;
}

/* Wrap design dropdown (compact trigger + expandable list of designs) */
.cgwfw-order-heading {
	font-weight: 600;
	margin-bottom: 8px;
}

/* Smaller gift icon on the design cards (8px padding around a 24px symbol). */
.cgwfw-designs-wrap .cgwfw-card-main {
	margin-bottom: 10px;
}

.cgwfw-designs-wrap .cgwfw-card-icon {
	width: auto;
	height: auto;
	padding: 8px;
}

.cgwfw-designs-wrap .cgwfw-card-icon svg {
	width: 24px;
	height: 24px;
}

.cgwfw-design-img {
	background: #f6f7f7 center/cover no-repeat;
	border-radius: 4px;
}

.cgwfw-dropdown {
	position: relative;
	max-width: 340px;
	margin: 4px 0;
}

.cgwfw-dd-trigger {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	background: #fff;
	border: 1px solid #d5d8dc;
	border-radius: 8px;
	padding: 8px 12px;
	cursor: pointer;
	text-align: left;
	line-height: 1.3;
	transition: border-color 0.15s ease;
}

.cgwfw-dd-trigger:hover {
	border-color: var(--cgwfw-btn-bg, #b5651d);
}

.cgwfw-dd-trigger.cgwfw-loading {
	opacity: 0.6;
	pointer-events: none;
}

.cgwfw-designs-wrap.is-wrapped .cgwfw-dd-trigger {
	border-color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-dd-current {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
}

.cgwfw-dd-placeholder {
	color: #777;
}

.cgwfw-dd-caret {
	flex: 0 0 auto;
	color: #777;
}

.cgwfw-dd-thumb {
	width: 28px;
	height: 28px;
	flex: 0 0 auto;
}

.cgwfw-dd-option-name {
	font-weight: 600;
}

.cgwfw-dd-option-price {
	margin-left: auto;
	color: var(--cgwfw-btn-bg, #b5651d);
}

.cgwfw-dd-panel {
	position: absolute;
	z-index: 1000;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #d5d8dc;
	border-radius: 8px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
	max-height: 280px;
	overflow: auto;
	padding: 4px;
}

.cgwfw-dd-option {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	background: none;
	border: none;
	border-radius: 6px;
	padding: 7px 8px;
	cursor: pointer;
	text-align: left;
}

.cgwfw-dd-option:hover {
	background: #f3f4f5;
}

.cgwfw-dd-option.is-selected {
	background: #eef3e8;
}

.cgwfw-dd-option .cgwfw-dd-thumb {
	width: 36px;
	height: 36px;
}

/* Info tooltip ("?" icon with a black box / white text on hover or focus) */
.cgwfw-tip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	margin-left: 6px;
	border-radius: 50%;
	background: #555;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	cursor: help;
	position: relative;
	vertical-align: middle;
}

.cgwfw-tip::after {
	content: attr(data-cgwfw-tip);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	background: #000;
	color: #fff;
	padding: 7px 10px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.4;
	text-align: left;
	white-space: normal;
	width: max-content;
	max-width: 220px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.12s ease;
	z-index: 1000;
	pointer-events: none;
}

.cgwfw-tip::before {
	content: "";
	position: absolute;
	bottom: calc(100% + 3px);
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #000;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.12s ease;
	z-index: 1000;
	pointer-events: none;
}

.cgwfw-tip:hover::after,
.cgwfw-tip:focus::after,
.cgwfw-tip:focus-visible::after,
.cgwfw-tip:hover::before,
.cgwfw-tip:focus::before,
.cgwfw-tip:focus-visible::before {
	opacity: 1;
	visibility: visible;
}

.cgwfw-message-wrap {
	margin-top: 6px;
}

.cgwfw-message-label {
	display: block;
	font-size: 0.95em;
}

.cgwfw-message {
	display: block;
	width: 100%;
	max-width: 320px;
	margin-top: 3px;
	box-sizing: border-box;
}

/* Per-order row inside cart totals */
.cgwfw-order-row .cgwfw-order-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: normal;
}

/* Per-item switch box (single compact row: icon · label · price · toggle) */
.cgwfw-switchbox {
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid #e4e7e7;
	border-radius: 8px;
	padding: 6px 12px;
	cursor: pointer;
	max-width: 340px;
	margin: 0;
}

.cgwfw-style-switch.is-wrapped .cgwfw-switchbox {
	border-color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-switch-icon {
	flex: 0 0 auto;
	color: var(--cgwfw-btn-bg, #b5651d);
	display: flex;
	align-items: center;
}

.cgwfw-switch-icon svg {
	width: 18px;
	height: 18px;
}

.cgwfw-style-switch.is-wrapped .cgwfw-switch-icon {
	color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-switchbox-body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	line-height: 1.25;
}

.cgwfw-switchbox-label {
	font-weight: 600;
}

.cgwfw-switchbox-price {
	font-size: 0.95em;
	color: inherit;
}

/* Toggle switch */
.cgwfw-switch {
	flex: 0 0 auto;
	position: relative;
	width: 38px;
	height: 22px;
}

.cgwfw-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.cgwfw-switch-slider {
	position: absolute;
	inset: 0;
	background: #c9cfce;
	border-radius: 26px;
	transition: background-color 0.15s ease;
}

.cgwfw-switch-slider::before {
	content: "";
	position: absolute;
	height: 16px;
	width: 16px;
	left: 3px;
	top: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.15s ease;
}

.cgwfw-switch input:checked + .cgwfw-switch-slider {
	background: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-switch input:checked + .cgwfw-switch-slider::before {
	transform: translateX(16px);
}

/* Per-order promo card */
.cgwfw-card {
	border: 1px solid #e4e7e7;
	border-radius: 12px;
	padding: 16px 18px;
	margin: 18px 0 18px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	width: 100%;
	max-width: none;
	box-sizing: border-box;
}

/* Block checkout: even spacing on all sides of the card. */
.woocommerce-checkout .cgwfw-card.cgwfw-blocks {
	width: auto;
	margin: 15px;
}

/* Classic checkout: the card renders inside the order-review column (before the
   payment box), so keep it at the column's full width with only vertical
   spacing — no horizontal inset that would misalign it with the totals table. */
.woocommerce-checkout .cgwfw-card:not(.cgwfw-blocks) {
	width: auto;
	margin: 15px 0;
}

.cgwfw-card.is-wrapped {
	border-color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-card-main {
	display: flex;
	align-items: center;
	gap: 14px;
}

.cgwfw-card-icon {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--cgwfw-btn-bg, #b5651d);
	color: var(--cgwfw-btn-color, #fff);
}

.cgwfw-card.is-wrapped .cgwfw-card-icon {
	background: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-card-body {
	flex: 1 1 auto;
	min-width: 0;
}

.cgwfw-card-title {
	font-weight: 600;
	font-size: 1.02em;
	line-height: 1.25;
}

.cgwfw-card-sub {
	color: #777;
	font-size: 0.88em;
	margin-top: 1px;
}

.cgwfw-card-price {
	margin-top: 4px;
	font-weight: 700;
	color: var(--cgwfw-btn-bg, #b5651d);
}

.cgwfw-card.is-wrapped .cgwfw-card-price {
	color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-card-btn {
	flex: 0 0 auto;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-size: 0.85em;
	padding: 9px 16px;
}

.cgwfw-card .cgwfw-message-wrap {
	margin-top: 12px;
}

.cgwfw-card .cgwfw-message {
	max-width: 100%;
}

@media (max-width: 480px) {
	.cgwfw-card-main { flex-wrap: wrap; }
	.cgwfw-card-btn { width: 100%; justify-content: center; }
}

/* Block cart/checkout: card spans the full order-summary width with comfortable
   horizontal padding, and a larger white parcel icon. */
.cgwfw-card.cgwfw-blocks {
	width: 100%;
	max-width: none;
	padding: 16px 15px;
	margin: 10px 0;
	box-sizing: border-box;
}

.cgwfw-card.cgwfw-blocks .cgwfw-card-icon {
	width: 60px;
	height: 60px;
}

/* Single product page control */
.cgwfw-pp {
	margin: 12px 0 16px;
	padding: 12px 14px;
	border: 1px solid #e4e7e7;
	border-radius: 10px;
	max-width: 360px;
	font-size: 0.95em;
	transition: border-color 0.15s ease;
}

/* Highlight the box in the brand "added" colour once wrapping is chosen. */
.cgwfw-pp:has(.cgwfw-pp-check:checked) {
	border-color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

/* Checkbox (simple) style: the original product-page control. */
.cgwfw-pp-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	margin: 0;
}

.cgwfw-pp-toggle .cgwfw-pp-check {
	flex: 0 0 auto;
	margin: 0;
	/* Use the admin-configured colour for the checked checkbox. */
	accent-color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

/* Some themes draw a coloured ring (outline / box-shadow) around the native
   checkbox when it is focused or checked, which looks like a box around the
   tick. Clear it so only the checkbox itself shows — but keep a clean outline
   for keyboard focus, so accessibility is preserved. */
.cgwfw-pp-toggle .cgwfw-pp-check,
.cgwfw-pp-toggle .cgwfw-pp-check:focus,
.cgwfw-pp-toggle .cgwfw-pp-check:checked {
	outline: none;
	box-shadow: none;
}

.cgwfw-pp-toggle .cgwfw-pp-check:focus-visible {
	outline: 2px solid var(--cgwfw-btn-bg-added, #5a7d2a);
	outline-offset: 1px;
}

.cgwfw-pp-label {
	font-weight: 600;
}

/* Product-page fee uses the normal text colour (no brand colour). */
.cgwfw-pp-fee,
.cgwfw-pp-fee .woocommerce-Price-amount {
	color: inherit;
}

.cgwfw-pp-heading {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

/* Product-page display styles (icon / switch). The product page ships no
   JavaScript, so the wrapped state is reflected purely with :has() on the
   underlying checkbox. */

/* Gift icon + text: the whole label is a coloured button toggling a hidden box. */
.cgwfw-pp-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	cursor: pointer;
	padding: 8px 14px;
	line-height: 1.3;
	background: var(--cgwfw-btn-bg, #b5651d);
	color: var(--cgwfw-btn-color, #fff);
	border-radius: var(--cgwfw-btn-radius, 4px);
	transition: background-color 0.15s ease;
}

.cgwfw-pp-btn .cgwfw-pp-check {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	margin: 0;
	pointer-events: none;
}

.cgwfw-pp-btn .cgwfw-btn-label,
.cgwfw-pp-btn .cgwfw-btn-fee {
	color: inherit;
}

.cgwfw-pp-btn .cgwfw-btn-fee {
	opacity: 0.85;
	margin-left: 4px;
}

.cgwfw-pp-btn .cgwfw-pp-off,
.cgwfw-pp-btn .cgwfw-pp-on {
	display: inline-flex;
	align-items: center;
}

/* Wrapped state: "added" colour, and swap the off/on labels. */
.cgwfw-pp-btn:has( .cgwfw-pp-check:checked ) {
	background: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-pp-btn .cgwfw-pp-on {
	display: none;
}

.cgwfw-pp-btn:has( .cgwfw-pp-check:checked ) .cgwfw-pp-off {
	display: none;
}

.cgwfw-pp-btn:has( .cgwfw-pp-check:checked ) .cgwfw-pp-on {
	display: inline-flex;
}

/* Keep the hidden checkbox keyboard-focusable: show focus on the button. */
.cgwfw-pp-btn:has( .cgwfw-pp-check:focus-visible ) {
	outline: 2px solid var(--cgwfw-btn-bg-added, #5a7d2a);
	outline-offset: 2px;
}

/* Switch box on the product page: reuse the cart switch box, but drop its own
   border and width cap since the .cgwfw-pp container already frames it. */
.cgwfw-pp .cgwfw-switchbox {
	border: none;
	padding: 0;
	max-width: none;
}

.cgwfw-pp-select {
	display: block;
	width: 100%;
	box-sizing: border-box;
}

.cgwfw-pp-message {
	margin-top: 10px;
}

/* In flat-fee mode the message field appears only once wrapping is ticked. */
.cgwfw-pp:not(.cgwfw-pp-designs) .cgwfw-pp-message {
	display: none;
}

.cgwfw-pp:has(.cgwfw-pp-check:checked) .cgwfw-pp-message {
	display: block;
}

.cgwfw-pp-message-label {
	display: block;
	font-size: 0.95em;
	margin-bottom: 3px;
}

.cgwfw-pp-message-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
}

/* Wrap design lightbox (trigger + modal grid of design cards) */
.cgwfw-lightbox {
	max-width: 340px;
	margin: 4px 0;
}

.cgwfw-lb-trigger {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	background: #fff;
	border: 1px solid #d5d8dc;
	border-radius: 8px;
	padding: 8px 12px;
	cursor: pointer;
	text-align: left;
	line-height: 1.3;
	transition: border-color 0.15s ease;
}

.cgwfw-lb-trigger:hover {
	border-color: var(--cgwfw-btn-bg, #b5651d);
}

.cgwfw-designs-wrap.is-wrapped .cgwfw-lb-trigger {
	border-color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-lb-edit {
	flex: 0 0 auto;
	margin-left: auto;
	opacity: 0.7;
}

.cgwfw-lb-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.cgwfw-lb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.cgwfw-lb-box {
	position: relative;
	background: #fff;
	border-radius: 12px;
	padding: 20px;
	width: 100%;
	max-width: 560px;
	max-height: 85vh;
	overflow: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.cgwfw-lb-close {
	position: absolute;
	top: 10px;
	right: 12px;
	border: none;
	background: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: #555;
}

.cgwfw-lb-title {
	font-weight: 600;
	font-size: 1.1em;
	margin-bottom: 14px;
	padding-right: 24px;
}

.cgwfw-lb-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.cgwfw-lb-none {
	flex: 1 1 100%;
	background: none;
	border: 1px solid #e4e7e7;
	border-radius: 8px;
	padding: 10px 12px;
	cursor: pointer;
	text-align: left;
}

.cgwfw-lb-none.is-selected,
.cgwfw-lb-none:hover {
	border-color: var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-design-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	width: 120px;
	background: #fff;
	border: 1px solid #e4e7e7;
	border-radius: 10px;
	padding: 12px;
	cursor: pointer;
	text-align: center;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cgwfw-design-card:hover {
	border-color: var(--cgwfw-btn-bg, #b5651d);
}

.cgwfw-design-card.is-selected {
	border-color: var(--cgwfw-btn-bg-added, #5a7d2a);
	box-shadow: 0 0 0 1px var(--cgwfw-btn-bg-added, #5a7d2a);
}

.cgwfw-design-card .cgwfw-dd-thumb {
	width: 84px;
	height: 84px;
}

.cgwfw-design-card .cgwfw-dd-option-price {
	margin-left: 0;
}
