/* Tinyplugs Greeting Card — cart/checkout control */

.tpgc-wrap {
	margin: 10px 0;
}

/* Width-100% children (the textarea in particular) must respect the card's
   padding on themes that leave inputs on content-box sizing. */
.tpgc-wrap,
.tpgc-wrap * {
	box-sizing: border-box;
}

/* Promo card */
.tpgc-card {
	border: 1px solid #e4e7e7;
	border-radius: 10px;
	padding: 14px 15px;
	background: #fff;
	max-width: 420px;
	box-sizing: border-box;
	transition: border-color 0.15s ease;
}

.tpgc-card.is-added {
	border-color: #2e7d32;
}

.tpgc-card-main {
	display: flex;
	align-items: center;
	gap: 12px;
}

.tpgc-card-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: #1e3a5f;
	color: #fff;
}

.tpgc-card.is-added .tpgc-card-icon {
	background: #2e7d32;
}

.tpgc-card-body {
	flex: 1 1 auto;
	min-width: 0;
}

.tpgc-card-title {
	font-weight: 600;
	line-height: 1.3;
}

.tpgc-card-sub {
	font-size: 0.9em;
	color: #666;
	margin-top: 2px;
}

.tpgc-card-price {
	font-weight: 600;
	margin-top: 3px;
	display: inline-block;
}

/* Simple add button (no designs configured) */
.tpgc-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #1e3a5f !important;
	color: #fff !important;
	border: none !important;
	border-radius: 4px;
	padding: 9px 16px !important;
	cursor: pointer;
	line-height: 1.3;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.tpgc-btn.is-added {
	background: #2e7d32 !important;
}

.tpgc-btn.tpgc-loading,
.tpgc-lb-trigger.tpgc-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Lightbox trigger */
.tpgc-lightbox {
	margin-top: 10px;
}

.tpgc-wrap .tpgc-lb-trigger {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	background: #fff !important;
	color: #333 !important;
	border: 1px solid #d5d8dc !important;
	border-radius: 8px;
	padding: 8px 12px !important;
	min-height: 0 !important;
	box-shadow: none !important;
	cursor: pointer;
	text-align: left;
	line-height: 1.3;
	transition: border-color 0.15s ease;
	box-sizing: border-box;
}

.tpgc-wrap .tpgc-lb-trigger:hover {
	border-color: #1e3a5f !important;
}

.tpgc-wrap.is-added .tpgc-lb-trigger {
	border-color: #2e7d32 !important;
}

.tpgc-lb-current {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.tpgc-lb-placeholder,
.tpgc-lb-edit {
	color: #777 !important;
}

.tpgc-lb-edit {
	flex: 0 0 auto;
	margin-left: auto;
	opacity: 0.7;
}

/* Lightbox modal */
.tpgc-lb-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

/* The closed state must not depend on the theme: display:flex above beats the
   browser's built-in [hidden] rule, so on themes that ship no [hidden] reset
   the modal would render permanently open on page load. */
.tpgc-lb-modal[hidden] {
	display: none !important;
}

.tpgc-lb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.tpgc-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);
}

.tpgc-wrap .tpgc-lb-close {
	position: absolute;
	top: 10px;
	right: 12px;
	border: none !important;
	background: none !important;
	box-shadow: none !important;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: #555 !important;
	padding: 0 !important;
	min-height: 0 !important;
}

.tpgc-lb-title {
	font-weight: 600;
	font-size: 1.1em;
	margin-bottom: 14px;
	padding-right: 24px;
	color: #333;
}

.tpgc-lb-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* Options (theme-proofed: themes style buttons aggressively, so re-assert the
   neutral palette with !important). */
.tpgc-wrap .tpgc-lb-option {
	background: #fff !important;
	color: #333 !important;
	border: 1px solid #e4e7e7 !important;
	box-shadow: none !important;
	border-radius: 10px;
	cursor: pointer;
}

.tpgc-wrap .tpgc-lb-none {
	flex: 1 1 100%;
	padding: 10px 12px !important;
	text-align: left;
}

.tpgc-wrap .tpgc-lb-none.is-selected,
.tpgc-wrap .tpgc-lb-none:hover {
	border-color: #2e7d32 !important;
}

.tpgc-wrap .tpgc-design-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	width: 128px;
	padding: 12px !important;
	text-align: center;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tpgc-wrap .tpgc-design-card:hover {
	border-color: #1e3a5f !important;
}

.tpgc-wrap .tpgc-design-card.is-selected {
	border-color: #2e7d32 !important;
	box-shadow: 0 0 0 1px #2e7d32 !important;
}

.tpgc-design-img {
	display: inline-block;
	width: 96px;
	height: 96px;
	border-radius: 6px;
	background-color: #f6f7f7;
	background-size: cover;
	background-position: center;
	flex: 0 0 auto;
}

/* Trigger shows a compact thumbnail */
.tpgc-lb-current .tpgc-design-img {
	width: 34px;
	height: 34px;
}

.tpgc-wrap .tpgc-option-name {
	color: #333 !important;
	font-size: 0.95em;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

/* Message field */
.tpgc-message-wrap {
	margin-top: 10px;
}

.tpgc-message-label {
	display: block;
	font-size: 0.95em;
}

.tpgc-message {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin-top: 4px;
	resize: vertical;
}

.tpgc-message-hint {
	display: block;
	font-size: 0.82em;
	color: #777;
	margin-top: 3px;
}

/* --- Box styles ----------------------------------------------------------
   card      — the default promo card (icon circle, subtitle, price).
   compact   — one slim row: small icon, title and price inline, no subtitle.
   highlight — compact, but on an accent background so it stands out. */

.tpgc-style-compact .tpgc-card-sub,
.tpgc-style-highlight .tpgc-card-sub {
	display: none;
}

.tpgc-style-compact.tpgc-card,
.tpgc-style-highlight.tpgc-card {
	padding: 10px 14px;
}

.tpgc-style-compact .tpgc-card-icon,
.tpgc-style-highlight .tpgc-card-icon {
	width: 34px;
	height: 34px;
}

.tpgc-style-compact .tpgc-card-icon svg,
.tpgc-style-highlight .tpgc-card-icon svg {
	width: 19px;
	height: 19px;
}

.tpgc-style-compact .tpgc-card-body,
.tpgc-style-highlight .tpgc-card-body {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

.tpgc-style-compact .tpgc-card-price,
.tpgc-style-highlight .tpgc-card-price {
	margin-top: 0;
	margin-left: auto;
}

.tpgc-style-compact .tpgc-lightbox,
.tpgc-style-highlight .tpgc-lightbox {
	margin-top: 8px;
}

.tpgc-style-highlight.tpgc-card {
	background: #eef7ef;
	border: 2px solid #2e7d32;
}

.tpgc-style-highlight .tpgc-card-title {
	font-size: 1.05em;
}

/* --- Banner style --------------------------------------------------------
   Mirrors the shop's campaign banners: colored box, gift icon, promo text
   and a full-width pill button (the design-picker trigger). All colors come
   from the admin settings via CSS variables. */

.tpgc-style-banner.tpgc-card {
	background: var(--tpgc-box-bg, #d9edf7);
	border: none;
	border-radius: 14px;
	padding: 16px 18px;
	width: 100%;
	max-width: none;
}

.tpgc-style-banner .tpgc-card-sub {
	display: none;
}

/* Both selectors carry the .tpgc-card class so they outrank the generic
   ".tpgc-card.is-added .tpgc-card-icon" green-circle rule — without that,
   the admin-chosen icon colors stopped applying once a card was added. */
.tpgc-card.tpgc-style-banner .tpgc-card-icon,
.tpgc-card.tpgc-style-banner.is-added .tpgc-card-icon {
	background: var(--tpgc-icon-bg, #d9edf7);
	color: var(--tpgc-icon-color, #f28a3d);
	width: 48px;
	height: 48px;
}

/* Breathing room between the gift icon and the circle's edge. */
.tpgc-style-banner .tpgc-card-icon svg {
	width: 36px;
	height: 36px;
}

.tpgc-style-banner .tpgc-card-title {
	color: var(--tpgc-box-text, #1d6a96);
	font-weight: 600;
	font-size: 1.05em;
}

.tpgc-style-banner .tpgc-card-price {
	color: var(--tpgc-box-text, #1d6a96);
	opacity: 0.8;
	font-size: 0.9em;
	font-weight: 500;
	margin-top: 2px;
}

.tpgc-style-banner .tpgc-message-label,
.tpgc-style-banner .tpgc-message-hint {
	color: var(--tpgc-box-text, #1d6a96);
}

/* The pill: both the design-picker trigger and the no-designs add button. */
.tpgc-style-banner .tpgc-lb-trigger,
.tpgc-style-banner .tpgc-card-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	gap: 8px;
	background: var(--tpgc-btn-bg, #9fe8cf) !important;
	color: var(--tpgc-btn-color, #0e5f55) !important;
	border: none !important;
	border-radius: 999px;
	padding: 12px 18px !important;
	font-weight: 600;
	cursor: pointer;
	margin-top: 10px;
	transition: filter 0.15s ease;
	box-sizing: border-box;
}

.tpgc-style-banner .tpgc-lb-trigger:hover,
.tpgc-style-banner .tpgc-card-btn:hover {
	filter: brightness(0.95);
}

.tpgc-style-banner .tpgc-lb-placeholder,
.tpgc-style-banner .tpgc-lb-edit,
.tpgc-style-banner .tpgc-lb-trigger .tpgc-option-name,
.tpgc-style-banner .tpgc-btn-label {
	color: var(--tpgc-btn-color, #0e5f55) !important;
	font-weight: 600;
}

.tpgc-style-banner .tpgc-lb-edit {
	margin-left: 4px;
	flex: 0 0 auto;
	opacity: 1;
	font-size: 1.3em;
	line-height: 1;
}

/* Chosen design in the pill: keep it compact and centered. */
.tpgc-style-banner .tpgc-lb-current {
	justify-content: center;
}

.tpgc-style-banner .tpgc-lb-current .tpgc-design-img {
	width: 28px;
	height: 28px;
	border-radius: 50%;
}

.tpgc-style-banner .tpgc-lightbox {
	margin-top: 0;
}

/* --- Button style --------------------------------------------------------
   A single narrow pill button and nothing else (mirroring the gift-wrapping
   plugin's control): the add prompt with the fee, turning green with the
   chosen card's name once one is picked. Colors come from the banner button
   variables; the message field renders under the button as usual. */

.tpgc-style-button.tpgc-card,
.tpgc-style-button.tpgc-card.tpgc-blocks {
	background: transparent;
	border: none;
	border-radius: 0;
	padding: 0;
	max-width: none;
	width: auto;
}

.tpgc-style-button .tpgc-lightbox {
	margin-top: 0;
}

.tpgc-wrap.tpgc-style-button .tpgc-lb-trigger,
.tpgc-wrap.tpgc-style-button .tpgc-card-btn {
	display: inline-flex;
	align-items: center;
	width: auto;
	gap: 6px;
	background: var(--tpgc-btn-bg, #9fe8cf) !important;
	color: var(--tpgc-btn-color, #0e5f55) !important;
	border: none !important;
	border-radius: 6px;
	padding: 10px 16px !important;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: filter 0.15s ease, background-color 0.15s ease;
	box-sizing: border-box;
}

.tpgc-wrap.tpgc-style-button .tpgc-lb-trigger:hover,
.tpgc-wrap.tpgc-style-button .tpgc-card-btn:hover {
	filter: brightness(0.95);
}

.tpgc-wrap.tpgc-style-button.is-added .tpgc-lb-trigger,
.tpgc-wrap.tpgc-style-button .tpgc-card-btn.is-added {
	background: #2e7d32 !important;
	color: #fff !important;
}

.tpgc-style-button .tpgc-btn-label {
	color: inherit !important;
	font-weight: 600;
}

.tpgc-style-button .tpgc-btn-price {
	font-weight: 400;
	opacity: 0.9;
}

/* Read-only checkout summary (cart-only mode) */
.tpgc-review {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	font-size: 0.95em;
}

.tpgc-review-thumb {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 6px;
	background-color: #f6f7f7;
	background-size: cover;
	background-position: center;
}

.tpgc-review-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.tpgc-review-body em {
	color: #666;
	overflow-wrap: anywhere;
}

.tpgc-review-edit {
	font-size: 0.88em;
}

.tpgc-review.tpgc-blocks {
	margin: 10px 15px;
}

/* Block cart/checkout: span the full order-summary width, with roomier
   inner padding so content never crowds the frame. */
.tpgc-card.tpgc-blocks {
	width: 100%;
	max-width: none;
	margin: 10px 0;
	padding: 18px 20px;
}

.tpgc-style-compact.tpgc-card.tpgc-blocks,
.tpgc-style-highlight.tpgc-card.tpgc-blocks {
	padding: 12px 16px;
}

.tpgc-card.tpgc-blocks .tpgc-message-wrap {
	margin-top: 12px;
}

.woocommerce-checkout .tpgc-wrap.tpgc-blocks {
	width: auto;
	margin: 15px;
}

@media ( max-width: 480px ) {
	.tpgc-card-main {
		flex-wrap: wrap;
	}
	.tpgc-lb-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
	}
	.tpgc-wrap .tpgc-lb-none {
		grid-column: 1 / -1;
	}
	.tpgc-wrap .tpgc-design-card {
		width: auto;
		box-sizing: border-box;
	}
}
