/*
 * Gift Wrap Donation — unified styles for both the cart UI and the public page.
 * Uses Bootstrap-aliased CSS variables consistent with the rest of the plugin.
 */

/* ============================================================
   CSS Variables
   ============================================================ */
:root {
	--gwd-primary:       var(--bs-primary,   #2271b1);
	--gwd-primary-dark:  var(--bs-secondary, #1a5a99);
	--gwd-accent:        #f59e0b;       /* warm amber for donation / charity feel */
	--gwd-accent-dark:   #d97706;
	--gwd-success:       var(--bs-success,   #198754);
	--gwd-danger:        var(--bs-danger,    #dc3545);
	--gwd-border:        #e0e0e0;
	--gwd-border-active: var(--gwd-primary);
	--gwd-bg:            #fff;
	--gwd-bg-hover:      #f8fafc;
	--gwd-bg-active:     #eef3fb;
	--gwd-text:          #2c3338;
	--gwd-text-muted:    #6c757d;
	--gwd-radius:        8px;
	--gwd-transition:    0.18s ease;
}

/* ============================================================
   ---- CART UI ----
   ============================================================ */

/* Section wrapper */
.nb-gwd-cart-section {
	margin: 24px 0 8px;
	padding: 24px 28px;
	background: var(--gwd-bg);
	border: 1px solid var(--gwd-border);
	border-radius: var(--gwd-radius);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Header */
.nb-gwd-cart-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 4px;
}

.nb-gwd-cart-icon {
	font-size: 1.4em;
	line-height: 1;
}

.nb-gwd-cart-title {
	margin: 0;
	font-size: 1.1em;
	font-weight: 600;
	color: var(--gwd-text);
}

.nb-gwd-cart-intro {
	margin: 0 0 18px;
	font-size: 0.9em;
	color: var(--gwd-accent-dark);
	font-weight: 500;
}

/* Radio options */
.nb-gwd-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 18px;
}

.nb-gwd-option {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border: 1.5px solid var(--gwd-border);
	border-radius: var(--gwd-radius);
	cursor: pointer;
	transition:
		border-color var(--gwd-transition),
		background var(--gwd-transition),
		box-shadow var(--gwd-transition);
	background: var(--gwd-bg);
	user-select: none;
}

.nb-gwd-option:hover {
	background: var(--gwd-bg-hover);
	border-color: var(--gwd-primary);
}

.nb-gwd-option--active {
	border-color: var(--gwd-border-active);
	background: var(--gwd-bg-active);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
}

.nb-gwd-option input[type="radio"] {
	appearance: none;
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	min-width: 18px;
	border: 2px solid #adb5bd;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	transition:
		border-color var(--gwd-transition),
		background var(--gwd-transition);
}

.nb-gwd-option input[type="radio"]:checked {
	border-color: var(--gwd-primary);
	background: var(--gwd-primary);
	box-shadow: inset 0 0 0 3px #fff;
}

.nb-gwd-option-label {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
}

.nb-gwd-option-title {
	font-weight: 600;
	color: var(--gwd-text);
	font-size: 0.97em;
}

.nb-gwd-option-desc {
	font-size: 0.85em;
	color: var(--gwd-text-muted);
}

.nb-gwd-option-price {
	margin-left: auto;
	font-weight: 700;
	color: var(--gwd-primary-dark);
	font-size: 0.97em;
	white-space: nowrap;
}

/* Per-item list */
.nb-gwd-items-list {
	border: 1px dashed var(--gwd-border);
	border-radius: var(--gwd-radius);
	padding: 16px 18px;
	margin-bottom: 18px;
	background: #fafbfc;
}

.nb-gwd-items-heading {
	margin: 0 0 12px;
	font-size: 0.88em;
	font-weight: 600;
	color: var(--gwd-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.nb-gwd-item-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 6px;
	cursor: pointer;
	transition: background var(--gwd-transition);
	border: 1.5px solid transparent;
	margin-bottom: 6px;
	background: #fff;
}

.nb-gwd-item-row:last-child {
	margin-bottom: 0;
}

.nb-gwd-item-row:hover {
	background: var(--gwd-bg-hover);
	border-color: var(--gwd-border);
}

.nb-gwd-item-row--selected,
.nb-gwd-item-row:has(input:checked) {
	background: var(--gwd-bg-active);
	border-color: var(--gwd-border-active);
}

.nb-gwd-item-checkbox {
	appearance: none;
	-webkit-appearance: none;
	width: 17px;
	height: 17px;
	min-width: 17px;
	border: 2px solid #adb5bd;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	transition:
		border-color var(--gwd-transition),
		background var(--gwd-transition);
	position: relative;
}

.nb-gwd-item-checkbox:checked {
	background: var(--gwd-primary);
	border-color: var(--gwd-primary);
}

.nb-gwd-item-checkbox:checked::after {
	content: '';
	position: absolute;
	left: 3px;
	top: 0px;
	width: 5px;
	height: 9px;
	border: 2px solid #fff;
	border-top: none;
	border-left: none;
	transform: rotate(42deg);
	display: block;
}

.nb-gwd-item-name {
	flex: 1;
	font-size: 0.95em;
	color: var(--gwd-text);
}

.nb-gwd-item-qty {
	color: var(--gwd-text-muted);
	font-size: 0.88em;
	margin-left: 4px;
}

.nb-gwd-item-price {
	font-size: 0.9em;
	font-weight: 600;
	color: var(--gwd-primary-dark);
}

/* Preview */
.nb-gwd-preview {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-radius: 6px;
	background: #fff8e7;
	border: 1px solid #fcd34d;
	margin-bottom: 16px;
	font-size: 0.93em;
}

.nb-gwd-preview-label {
	color: var(--gwd-text-muted);
	font-weight: 500;
}

.nb-gwd-preview-amount {
	font-weight: 700;
	color: var(--gwd-accent-dark);
}

/* Actions */
.nb-gwd-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.nb-gwd-apply-btn {
	padding: 9px 22px !important;
	background: var(--gwd-primary) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 5px !important;
	cursor: pointer;
	font-size: 0.93em !important;
	font-weight: 600 !important;
	transition: background var(--gwd-transition);
	line-height: 1.4 !important;
	height: auto !important;
}

.nb-gwd-apply-btn:hover:not(:disabled) {
	background: var(--gwd-primary-dark) !important;
}

.nb-gwd-apply-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.nb-gwd-status {
	font-size: 0.9em;
	font-weight: 500;
}

.nb-gwd-status--success { color: var(--gwd-success); }
.nb-gwd-status--error   { color: var(--gwd-danger); }

/* ============================================================
   ---- PUBLIC DONATION PAGE ----
   ============================================================ */

.nb-gwd-page {
	max-width: 860px;
	margin: 0 auto;
	padding: 0 16px 60px;
}

/* Hero */
.nb-gwd-hero {
	background: #fff;
	border-radius: 14px;
	margin: 32px 0 36px;
	padding: 48px 40px;
	text-align: center;
}

.nb-gwd-hero-badge {
	font-size: 3em;
	margin-bottom: 12px;
	line-height: 1;
}

.nb-gwd-hero-title {
	margin: 0 0 10px;
	font-size: 2em;
	font-weight: 700;
	color: var(--gwd-text);
	letter-spacing: -0.02em;
}

.nb-gwd-hero-subtitle {
	margin: 0 0 32px;
	font-size: 1.05em;
	color: var(--gwd-text-muted);
}

.nb-gwd-metrics {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	background: #f8fafc;
	border: 1px solid var(--gwd-border);
	border-radius: 10px;
	padding: 24px 32px;
	max-width: 480px;
	margin: 0 auto;
}

.nb-gwd-metric {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	flex: 1;
}

.nb-gwd-metric-divider {
	width: 1px;
	height: 48px;
	background: var(--gwd-border);
	margin: 0 24px;
}

.nb-gwd-metric-value {
	font-size: 2.2em;
	font-weight: 800;
	line-height: 1.1;
	color: var(--gwd-primary);
}

.nb-gwd-metric-value .amount,
.nb-gwd-metric-value .woocommerce-Price-amount {
	color: var(--gwd-primary);
	font-size: 1em;
}

.nb-gwd-metric-label {
	font-size: 0.78em;
	color: var(--gwd-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* Message section */
.nb-gwd-message {
	margin-bottom: 36px;
}

.nb-gwd-message-inner {
	padding: 36px 40px;
	background: #fff;
	border-radius: var(--gwd-radius);
	font-size: 1.2em;
	line-height: 1.8;
	color: var(--gwd-text);
}

.nb-gwd-message-inner p {
	margin-top: 0;
	font-size: 1em;
}

.nb-gwd-message-inner p:last-child {
	margin-bottom: 0;
}

/* ============================================================
   Charities — horizontal auto-scroll ticker
   ============================================================ */

.nb-gwd-charities {
	margin-bottom: 40px;
}

.nb-gwd-charities-inner {
	padding: 32px 0;
	background: var(--gwd-bg);
	border-radius: var(--gwd-radius);
	overflow: hidden;
}

.nb-gwd-charities-title {
	margin: 0 0 28px;
	padding: 0 32px;
	font-size: 1.2em;
	font-weight: 700;
	color: var(--gwd-text);
}

/* Viewport: clips the scrolling track and adds edge fades */
.nb-gwd-charities-viewport {
	position: relative;
	overflow: hidden;
	width: 100%;
}

/* Fade edges */
.nb-gwd-charities-viewport::before,
.nb-gwd-charities-viewport::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	width: 80px;
	z-index: 2;
	pointer-events: none;
}

.nb-gwd-charities-viewport::before {
	left: 0;
	background: linear-gradient(to right, #fff 0%, transparent 100%);
}

.nb-gwd-charities-viewport::after {
	right: 0;
	background: linear-gradient(to left, #fff 0%, transparent 100%);
}

/* Scrolling track: two identical sets of items side by side */
.nb-gwd-charities-track {
	list-style: none;
	margin: 0;
	padding: 12px 0;
	display: flex;
	gap: 20px;
	width: max-content;
	animation: nb-gwd-scroll 28s linear infinite;
}

.nb-gwd-charities-track:hover {
	animation-play-state: paused;
}

@keyframes nb-gwd-scroll {
	0%   { transform: translateX(0); }
	100% { transform: translateX(-50%); }
}

/* Individual charity card */
.nb-gwd-charity-item {
	flex: 0 0 220px;
	width: 220px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 16px;
	padding: 32px 20px 28px;
	border-radius: 14px;
	font-weight: 600;
	color: var(--gwd-text);
	transition: box-shadow var(--gwd-transition);
}

.nb-gwd-charity-item:hover {
	box-shadow: 0 4px 16px rgba(34, 113, 177, 0.12);
}

/* Logo container */
.nb-gwd-charity-logo-wrap {
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 80px;
}

.nb-gwd-charity-logo {
	max-width: 150px;
	max-height: 150px;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* Emoji fallback */
.nb-gwd-charity-icon {
	font-size: 2em;
}

/* Name */
.nb-gwd-charity-name {
	font-size: 1em;
	line-height: 1.4;
}

/* ---- Admin: charity repeatable rows ---- */
.nb-gwd-charity-row {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 14px 16px;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	margin-bottom: 10px;
}

.nb-gwd-charity-logo-col {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	min-width: 100px;
}

.nb-gwd-charity-preview {
	width: 80px;
	height: 60px;
	border: 1px dashed #ccc;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	overflow: hidden;
}

.nb-gwd-charity-preview:empty {
	background: #f5f5f5;
}

.nb-gwd-charity-logo-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.nb-gwd-charity-name-col {
	flex: 1;
	padding-top: 6px;
}

.nb-gwd-charity-name-col input {
	width: 100%;
}

.nb-gwd-charity-delete-col {
	padding-top: 8px;
	font-size: 1.1em;
}

/* CTA */
.nb-gwd-cta {
	text-align: center;
	padding: 40px 20px;
	background: var(--gwd-bg-active);
	border-radius: var(--gwd-radius);
}

.nb-gwd-cta-inner p {
	margin: 0 0 20px;
	font-size: 1.05em;
	color: var(--gwd-text-muted);
}

.nb-gwd-cta-btn {
	display: inline-block;
	padding: 14px 32px;
	background: var(--gwd-primary);
	color: #fff !important;
	font-weight: 700;
	font-size: 1em;
	border-radius: 6px;
	text-decoration: none;
	transition: background var(--gwd-transition);
}

.nb-gwd-cta-btn:hover {
	background: var(--gwd-primary-dark);
	color: #fff !important;
	text-decoration: none;
}

/* Admin panel card */
.nb-gwd-admin-panel {
	background: #fff;
	border: 1px solid #ccd0d4;
	border-top: none;
	border-radius: 0 0 4px 4px;
	padding: 24px 28px;
	margin-bottom: 24px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
	.nb-gwd-cart-section {
		padding: 18px 16px;
	}

	.nb-gwd-option {
		padding: 12px 13px;
	}

	.nb-gwd-actions {
		flex-direction: column;
		align-items: flex-start;
	}

	.nb-gwd-apply-btn {
		width: 100%;
		text-align: center;
	}

	.nb-gwd-hero {
		padding: 32px 20px;
	}

	.nb-gwd-hero-title {
		font-size: 1.5em;
	}

	.nb-gwd-metrics {
		flex-direction: column;
		gap: 16px;
		padding: 20px;
	}

	.nb-gwd-metric-divider {
		width: 80px;
		height: 1px;
		margin: 0;
	}

	.nb-gwd-charity-item {
		flex: 0 0 180px;
		width: 180px;
		padding: 24px 16px 20px;
	}

	.nb-gwd-charities-viewport::before,
	.nb-gwd-charities-viewport::after {
		width: 40px;
	}

	.nb-gwd-message-inner {
		padding: 24px 20px;
		font-size: 1.05em;
	}
}
