/**
 * Frontend styles: gift toggle/panel on the product page, cart gift summary.
 *
 * Ships 3 selectable panel styles (WooCommerce > Settings > SmartGift >
 * "Gift panel style"): classic, card, festive. The base block below defines
 * a set of CSS custom properties and the shared layout; each
 * .sgwc-style-{slug} block only redefines those properties plus a handful
 * of structural tweaks, so component rules further down stay in one place.
 *
 * @package WPBingo\GiftExperience\Free
 */

.sgwc-gift-toggle-wrap {
	--sgwc-accent: #2563eb;
	--sgwc-accent-soft: #eaf1ff;
	--sgwc-border: #e0e0e0;
	--sgwc-bg: #fafafa;
	--sgwc-radius: 10px;

	margin: 16px 0;
	padding: 16px 18px;
	border: 1px solid var(--sgwc-border);
	border-radius: var(--sgwc-radius);
	background: var(--sgwc-bg);
}

/* ---------------------------------------------------------------------
 * Style: Card — elevated, boxed, accent left border.
 * ------------------------------------------------------------------- */
.sgwc-style-card {
	--sgwc-accent: #7c3aed;
	--sgwc-accent-soft: #f3ecff;
	--sgwc-border: #e7e1f7;
	--sgwc-bg: #ffffff;
	--sgwc-radius: 14px;

	border-left: 4px solid var(--sgwc-accent);
	box-shadow: 0 2px 10px rgba(124, 58, 237, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ---------------------------------------------------------------------
 * Style: Festive — gift-wrap themed, dashed border, gradient top strip.
 * ------------------------------------------------------------------- */
.sgwc-style-festive {
	--sgwc-accent: #db2777;
	--sgwc-accent-soft: #ffe4f1;
	--sgwc-border: #f3b8d6;
	--sgwc-bg: #fff8fb;
	--sgwc-radius: 14px;

	position: relative;
	overflow: hidden;
	border-width: 2px;
	border-style: dashed;
}

.sgwc-style-festive::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 6px;
	background: linear-gradient(90deg, #db2777, #f59e0b, #db2777);
}

/* ---------------------------------------------------------------------
 * Toggle row (shared markup, themed via variables).
 * ------------------------------------------------------------------- */
.sgwc-gift-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	cursor: pointer;
}

.sgwc-gift-toggle input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--sgwc-accent);
}

/* Decorative switch: hidden in Classic (native checkbox stays visible). */
.sgwc-toggle-switch {
	display: none;
}

.sgwc-style-card .sgwc-gift-toggle input[type="checkbox"],
.sgwc-style-festive .sgwc-gift-toggle input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.sgwc-style-card .sgwc-toggle-switch,
.sgwc-style-festive .sgwc-toggle-switch {
	display: inline-block;
	position: relative;
	flex-shrink: 0;
	width: 38px;
	height: 22px;
	border-radius: 999px;
	background: #d9d9e3;
	transition: background-color 0.15s ease;
}

.sgwc-style-card .sgwc-toggle-switch::after,
.sgwc-style-festive .sgwc-toggle-switch::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease;
}

.sgwc-gift-toggle input[type="checkbox"]:checked ~ .sgwc-toggle-switch {
	background: var(--sgwc-accent);
}

.sgwc-gift-toggle input[type="checkbox"]:checked ~ .sgwc-toggle-switch::after {
	transform: translateX(16px);
}

.sgwc-gift-toggle input[type="checkbox"]:focus-visible ~ .sgwc-toggle-switch {
	outline: 2px solid var(--sgwc-accent);
	outline-offset: 2px;
}

.sgwc-style-festive .sgwc-gift-toggle-text::before {
	content: "🎁 ";
}

/* ---------------------------------------------------------------------
 * Panel body.
 * ------------------------------------------------------------------- */
.sgwc-gift-panel {
	position: relative;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px dashed var(--sgwc-border);
}

.sgwc-style-card .sgwc-gift-panel {
	border-top-style: solid;
}

.sgwc-field {
	margin-bottom: 14px;
}

.sgwc-field label,
.sgwc-field-label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
	font-size: 13px;
}

.sgwc-required {
	color: #c0392b;
}

.sgwc-style-card .sgwc-required,
.sgwc-style-festive .sgwc-required {
	color: var(--sgwc-accent);
}

.sgwc-field input[type="text"],
.sgwc-field input[type="tel"],
.sgwc-field input[type="email"],
.sgwc-field input[type="date"],
.sgwc-field select,
.sgwc-field textarea {
	width: 100%;
	max-width: 420px;
	padding: 9px 11px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: 14px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sgwc-style-card .sgwc-field input[type="text"],
.sgwc-style-card .sgwc-field input[type="tel"],
.sgwc-style-card .sgwc-field input[type="email"],
.sgwc-style-card .sgwc-field input[type="date"],
.sgwc-style-card .sgwc-field select,
.sgwc-style-card .sgwc-field textarea,
.sgwc-style-festive .sgwc-field input[type="text"],
.sgwc-style-festive .sgwc-field input[type="tel"],
.sgwc-style-festive .sgwc-field input[type="email"],
.sgwc-style-festive .sgwc-field input[type="date"],
.sgwc-style-festive .sgwc-field select,
.sgwc-style-festive .sgwc-field textarea {
	border-radius: 8px;
	border-color: var(--sgwc-border);
	background: #fff;
}

.sgwc-field input:focus,
.sgwc-field select:focus,
.sgwc-field textarea:focus {
	outline: none;
	border-color: var(--sgwc-accent);
	box-shadow: 0 0 0 3px var(--sgwc-accent-soft);
}

.sgwc-field textarea {
	resize: vertical;
	min-height: 70px;
}

.sgwc-char-counter {
	display: inline-block;
	margin-top: 4px;
	font-size: 12px;
	color: #777;
}

.sgwc-char-counter.sgwc-char-counter-warning {
	color: #c0392b;
	font-weight: 600;
}

/* ---------------------------------------------------------------------
 * AI suggestions.
 * ------------------------------------------------------------------- */
.sgwc-ai-suggest-btn {
	margin-top: 8px;
	border-radius: 999px !important;
	border-color: var(--sgwc-accent) !important;
	color: var(--sgwc-accent) !important;
}

.sgwc-ai-suggest-btn:hover {
	background: var(--sgwc-accent-soft) !important;
}

.sgwc-ai-suggestions {
	margin-top: 10px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sgwc-ai-suggestion-chip {
	text-align: left;
	padding: 9px 12px;
	border: 1px solid var(--sgwc-border);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	font-size: 13px;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sgwc-ai-suggestion-chip:hover,
.sgwc-ai-suggestion-chip:focus {
	background: var(--sgwc-accent-soft);
	border-color: var(--sgwc-accent);
}

.sgwc-ai-suggestion-chip:active {
	transform: scale(0.98);
}

.sgwc-ai-suggestions-loading,
.sgwc-ai-suggestions-error {
	font-size: 12px;
	color: #777;
}

.sgwc-ai-suggestions-error {
	color: #c0392b;
}

/* ---------------------------------------------------------------------
 * Gift wrap options — selectable tiles (image + name).
 * ------------------------------------------------------------------- */
.sgwc-field-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 8px;
}

.sgwc-field-wrap .sgwc-field-label {
	width: 100%;
	margin-bottom: 2px;
}

.sgwc-wrap-fee-note {
	width: 100%;
	margin: -4px 0 4px;
	font-size: 12px;
	color: #777;
}

.sgwc-wrap-option {
	display: block;
	cursor: pointer;
	font-weight: 400;
}

.sgwc-wrap-option[hidden] {
	display: none;
}

.sgwc-wrap-option input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.sgwc-wrap-option-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 92px;
	padding: 12px 10px;
	border: 1.5px solid var(--sgwc-border);
	border-radius: 12px;
	background: #fff;
	text-align: center;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.sgwc-wrap-option:hover .sgwc-wrap-option-card {
	border-color: var(--sgwc-accent);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.sgwc-wrap-option input:checked ~ .sgwc-wrap-option-card {
	border-color: var(--sgwc-accent);
	background: var(--sgwc-accent-soft);
	box-shadow: 0 0 0 3px var(--sgwc-accent-soft);
}

.sgwc-wrap-option input:focus-visible ~ .sgwc-wrap-option-card {
	outline: 2px solid var(--sgwc-accent);
	outline-offset: 2px;
}

.sgwc-wrap-option-image {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 8px;
	object-fit: cover;
	background: #f2f2f2;
}

.sgwc-wrap-option-name {
	display: -webkit-box;
	overflow: hidden;
	width: 100%;
	font-size: 12px;
	line-height: 1.3;
	color: #444;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.sgwc-wrap-option input:checked ~ .sgwc-wrap-option-card .sgwc-wrap-option-name {
	color: #1a1a1a;
	font-weight: 600;
}

.sgwc-wrap-ai-badge {
	display: inline-block;
	padding: 1px 6px;
	border-radius: 999px;
	background: var(--sgwc-accent-soft);
	color: var(--sgwc-accent);
	font-size: 10px;
	font-weight: 700;
	white-space: nowrap;
}

.sgwc-wrap-ai-badge[hidden] {
	display: none;
}

/* ---------------------------------------------------------------------
 * Gift wrap image zoom (hover/tap icon + "selected" badge).
 * ------------------------------------------------------------------- */
.sgwc-wrap-option-image-wrap {
	position: relative;
	width: 64px;
	height: 64px;
}

.sgwc-wrap-zoom-btn {
	position: absolute;
	right: 4px;
	bottom: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	font-size: 11px;
	line-height: 1;
	cursor: zoom-in;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.12s ease, background-color 0.12s ease;
}

.sgwc-wrap-zoom-btn:hover,
.sgwc-wrap-zoom-btn:focus-visible {
	background: #fff;
	transform: scale(1.1);
}

.sgwc-wrap-selected-badge {
	position: absolute;
	top: -6px;
	left: -6px;
	display: none;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--sgwc-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sgwc-wrap-option input:checked ~ .sgwc-wrap-option-card .sgwc-wrap-selected-badge {
	display: flex;
}

/* ---------------------------------------------------------------------
 * Zoom popup: centered white card over a dimmed backdrop.
 * ------------------------------------------------------------------- */
.sgwc-wrap-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(15, 15, 20, 0.7);
	animation: sgwc-lightbox-fade 0.15s ease;
}

.sgwc-wrap-lightbox[hidden] {
	display: none;
}

.sgwc-wrap-lightbox-panel {
	position: relative;
	width: 100%;
	max-width: min(92vw, 440px);
	padding: 20px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	animation: sgwc-lightbox-pop 0.18s ease;
}

.sgwc-wrap-lightbox-figure {
	margin: 0;
	text-align: center;
}

.sgwc-wrap-lightbox-image {
	display: block;
	width: 100%;
	max-height: 60vh;
	margin: 0 auto;
	border-radius: 10px;
	object-fit: contain;
	background: #f5f5f5;
}

.sgwc-wrap-lightbox-caption {
	margin-top: 12px;
	font-size: 14px;
	font-weight: 600;
	color: #333;
}

.sgwc-wrap-lightbox-close {
	position: absolute;
	top: -14px;
	right: -14px;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: #fff;
	color: #333;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.sgwc-wrap-lightbox-close:hover {
	background: #f0f0f0;
	transform: scale(1.05);
}

@keyframes sgwc-lightbox-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes sgwc-lightbox-pop {
	from {
		opacity: 0;
		transform: scale(0.92);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* ---------------------------------------------------------------------
 * Field icons — Festive style only, purely decorative.
 * ------------------------------------------------------------------- */
.sgwc-style-festive .sgwc-field-recipient-name > label::before {
	content: "🙂 ";
}

.sgwc-style-festive .sgwc-field-recipient-phone > label::before {
	content: "📞 ";
}

.sgwc-style-festive .sgwc-field-recipient-email > label::before {
	content: "✉️ ";
}

.sgwc-style-festive .sgwc-field-occasion > label::before {
	content: "🎉 ";
}

.sgwc-style-festive .sgwc-field-message > label::before {
	content: "💌 ";
}

.sgwc-style-festive .sgwc-field-wrap .sgwc-field-label::before {
	content: "🎀 ";
}

/* ---------------------------------------------------------------------
 * Cart / checkout gift summary block (unaffected by panel style choice).
 * ------------------------------------------------------------------- */
.sgwc-cart-gift-summary {
	margin-top: 8px;
	padding: 8px 10px;
	background: #f5f8ff;
	border: 1px solid #d8e3ff;
	border-radius: 6px;
	font-size: 12px;
}

.sgwc-cart-gift-badge {
	font-weight: 600;
}

.sgwc-cart-gift-message {
	margin: 6px 0;
	font-style: italic;
	color: #444;
}

.sgwc-cart-gift-edit-link {
	font-size: 12px;
	text-decoration: underline;
}
