/**
 * Campaign Sections CSS
 *
 * Covers:
 *   1. Admin panel styles (tabs, toggles, FAQ builder, campaign picker, color picker)
 *   2. Frontend section styles (sticky CTA, FAQ accordion, related campaigns grid)
 *
 * Brand palette:
 *   Primary   #15803D
 *   Secondary #1E40AF
 *   Accent    #F59E0B
 *   BG        #F8FAFC
 *
 * @package CharityGlow Pro
 * @since   1.1.0
 */

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.cg-hidden {
	display: none !important;
}

.cg-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: cg-spin 0.65s linear infinite;
	vertical-align: middle;
}

.cg-spinner--sm {
	width: 13px;
	height: 13px;
}

@keyframes cg-spin {
	to { transform: rotate( 360deg ); }
}

/* ==========================================================================
   ADMIN PANEL — SECTIONS PANEL WRAPPER
   ========================================================================== */

.cg-sections-panel {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	margin-top: 24px;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cg-sections-panel__header {
	padding: 20px 24px 0;
	border-bottom: 1px solid #e2e8f0;
	background: #F8FAFC;
}

.cg-sections-panel__heading {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	color: #0f172a;
	margin: 0 0 6px;
}

.cg-sections-panel__description {
	font-size: 13px;
	color: #64748b;
	margin: 0 0 16px;
}

/* ==========================================================================
   ADMIN PANEL — BADGE
   ========================================================================== */

.cg-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 20px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.cg-badge--pro {
	background: linear-gradient( 135deg, #1E40AF, #15803D );
	color: #fff;
}

/* ==========================================================================
   ADMIN PANEL — TABS
   ========================================================================== */

.cg-sections-tabs {
	display: flex;
	gap: 2px;
	padding: 0 24px;
	background: #F8FAFC;
	border-bottom: 1px solid #e2e8f0;
}

.cg-sections-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 14px;
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	border-radius: 0;
	font-size: 13px;
	font-weight: 500;
	color: #64748b;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
	position: relative;
	top: 1px;
}

.cg-sections-tab:hover {
	color: #15803D;
}

.cg-sections-tab--active {
	color: #15803D;
	border-bottom-color: #15803D;
}

.cg-sections-tab__status {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	padding: 1px 5px;
	border-radius: 10px;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.4px;
}

.cg-sections-tab__status--on {
	background: #dcfce7;
	color: #15803D;
}

.cg-sections-tab__status--off {
	background: #f1f5f9;
	color: #94a3b8;
}

/* ==========================================================================
   ADMIN PANEL — TAB PANELS
   ========================================================================== */

.cg-sections-tab-panel {
	padding: 20px 24px;
}

.cg-sections-panel__body {
	/* No extra padding — tab panels handle their own */
}

/* ==========================================================================
   ADMIN PANEL — FIELD ROWS
   ========================================================================== */

.cg-field-row {
	margin-bottom: 16px;
}

.cg-field-row--2col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.cg-field-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cg-field-label {
	font-size: 13px;
	font-weight: 500;
	color: #374151;
}

.cg-field-input {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	color: #111827;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	box-sizing: border-box;
}

.cg-field-input:focus {
	outline: none;
	border-color: #15803D;
	box-shadow: 0 0 0 3px rgba( 21, 128, 61, 0.12 );
}

.cg-field-textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	color: #111827;
	resize: vertical;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	font-family: inherit;
}

.cg-field-textarea:focus {
	outline: none;
	border-color: #15803D;
	box-shadow: 0 0 0 3px rgba( 21, 128, 61, 0.12 );
}

.cg-field-hint {
	font-size: 12px;
	color: #6b7280;
	margin: 4px 0 0;
}

/* ==========================================================================
   ADMIN PANEL — TOGGLE SWITCH
   ========================================================================== */

.cg-toggle-label {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	user-select: none;
}

.cg-toggle {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
}

.cg-toggle__input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.cg-toggle__slider {
	position: absolute;
	inset: 0;
	background: #d1d5db;
	border-radius: 24px;
	transition: background 0.2s ease;
}

.cg-toggle__slider::before {
	content: '';
	position: absolute;
	left: 3px;
	top: 3px;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.2 );
	transition: transform 0.2s ease;
}

.cg-toggle__input:checked + .cg-toggle__slider {
	background: #15803D;
}

.cg-toggle__input:checked + .cg-toggle__slider::before {
	transform: translateX( 20px );
}

.cg-toggle__input:focus-visible + .cg-toggle__slider {
	box-shadow: 0 0 0 3px rgba( 21, 128, 61, 0.25 );
}

.cg-toggle-label__text {
	font-size: 13px;
	font-weight: 500;
	color: #374151;
}

/* ==========================================================================
   ADMIN PANEL — COLOR PICKER
   ========================================================================== */

.cg-color-field {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 38px;
}

.cg-color-field__input {
	width: 38px;
	height: 38px;
	padding: 2px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	cursor: pointer;
	background: #fff;
}

.cg-color-field__preview {
	width: 24px;
	height: 24px;
	border-radius: 4px;
	border: 1px solid #e2e8f0;
	cursor: pointer;
	flex-shrink: 0;
}

.cg-color-field__hex {
	flex: 1;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	font-family: 'Courier New', monospace;
	text-transform: uppercase;
}

/* ==========================================================================
   ADMIN PANEL — FAQ BUILDER
   ========================================================================== */

.cg-faq-builder {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: hidden;
}

.cg-faq-builder__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	background: #F8FAFC;
	border-bottom: 1px solid #e2e8f0;
}

.cg-faq-builder__count {
	font-size: 12px;
	color: #6b7280;
	font-weight: 500;
}

.cg-faq-builder__empty {
	padding: 32px 20px;
	text-align: center;
	color: #94a3b8;
}

.cg-faq-builder__empty svg {
	display: block;
	margin: 0 auto 10px;
	opacity: 0.5;
}

.cg-faq-builder__empty p {
	font-size: 13px;
	margin: 0;
}

/* FAQ Item */

.cg-faq-item {
	border-bottom: 1px solid #f1f5f9;
	transition: background 0.15s ease, opacity 0.25s ease, transform 0.25s ease;
}

.cg-faq-item:last-child {
	border-bottom: none;
}

.cg-faq-item--removing {
	opacity: 0;
	transform: translateX( -8px );
}

.cg-faq-item--placeholder {
	background: #f0fdf4;
	border: 2px dashed #15803D;
	opacity: 0.5;
}

.cg-faq-item__header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	cursor: default;
}

.cg-faq-item__drag {
	cursor: grab;
	color: #cbd5e1;
	flex-shrink: 0;
}

.cg-faq-item__drag:active {
	cursor: grabbing;
}

.cg-faq-item__preview {
	flex: 1;
	font-size: 13px;
	color: #374151;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cg-faq-item__actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.cg-faq-item__toggle {
	background: transparent;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: #6b7280;
	border-radius: 4px;
	transition: transform 0.2s ease, color 0.15s ease;
}

.cg-faq-item__toggle:hover {
	color: #15803D;
}

.cg-faq-item__toggle[aria-expanded="true"] svg {
	transform: rotate( 180deg );
}

.cg-faq-item__body {
	padding: 12px 14px 16px;
	background: #fafafa;
	border-top: 1px solid #f1f5f9;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ==========================================================================
   ADMIN PANEL — CAMPAIGN PICKER
   ========================================================================== */

.cg-campaign-picker {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: hidden;
}

.cg-campaign-picker__search-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: #F8FAFC;
	border-bottom: 1px solid #e2e8f0;
	color: #9ca3af;
}

.cg-campaign-picker__search {
	flex: 1;
	border: none;
	background: transparent;
	font-size: 13px;
	color: #111827;
	outline: none;
}

.cg-campaign-picker__search::placeholder {
	color: #9ca3af;
}

.cg-campaign-picker__list {
	max-height: 200px;
	overflow-y: auto;
}

.cg-campaign-picker__loading,
.cg-campaign-picker__empty,
.cg-campaign-picker__error {
	padding: 16px;
	font-size: 13px;
	color: #6b7280;
	text-align: center;
}

.cg-campaign-picker__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	cursor: pointer;
	transition: background 0.12s ease;
	border-bottom: 1px solid #f8fafc;
}

.cg-campaign-picker__item:last-child {
	border-bottom: none;
}

.cg-campaign-picker__item:hover {
	background: #f0fdf4;
}

.cg-campaign-picker__item--selected {
	background: #f0fdf4;
}

.cg-campaign-picker__img {
	width: 36px;
	height: 36px;
	border-radius: 4px;
	object-fit: cover;
	flex-shrink: 0;
}

.cg-campaign-picker__img--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #e2e8f0;
	color: #94a3b8;
	font-size: 14px;
}

.cg-campaign-picker__info {
	flex: 1;
	min-width: 0;
}

.cg-campaign-picker__name {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: #111827;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cg-campaign-picker__pct {
	display: block;
	font-size: 11px;
	color: #6b7280;
}

.cg-campaign-picker__check {
	color: transparent;
	flex-shrink: 0;
}

.cg-campaign-picker__item--selected .cg-campaign-picker__check {
	color: #15803D;
}

.cg-campaign-picker__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 10px 12px;
	border-top: 1px solid #e2e8f0;
	background: #fafafa;
	min-height: 42px;
}

.cg-campaign-picker__empty-note {
	font-size: 12px;
	color: #9ca3af;
	padding: 8px 12px;
	margin: 0;
	border-top: 1px solid #e2e8f0;
}

/* Chips */

.cg-related-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px 3px 10px;
	background: #dcfce7;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 500;
	color: #15803D;
}

.cg-related-chip__name {
	max-width: 120px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cg-related-chip__remove {
	background: transparent;
	border: none;
	padding: 0;
	line-height: 1;
	cursor: pointer;
	color: #15803D;
	font-size: 14px;
	opacity: 0.7;
	border-radius: 50%;
}

.cg-related-chip__remove:hover {
	opacity: 1;
}

/* ==========================================================================
   ADMIN PANEL — BUTTONS
   ========================================================================== */

.cg-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	border: 1px solid transparent;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
	text-decoration: none;
	white-space: nowrap;
}

.cg-btn--primary {
	background: #15803D;
	color: #fff;
	border-color: #15803D;
}

.cg-btn--primary:hover {
	background: #166534;
}

.cg-btn--primary:focus-visible {
	box-shadow: 0 0 0 3px rgba( 21, 128, 61, 0.3 );
	outline: none;
}

.cg-btn--success {
	background: #166534 !important;
}

.cg-btn--outline {
	background: transparent;
	color: #15803D;
	border-color: #15803D;
}

.cg-btn--outline:hover {
	background: #f0fdf4;
}

.cg-btn--sm {
	padding: 5px 10px;
	font-size: 12px;
}

.cg-btn--lg {
	padding: 10px 20px;
	font-size: 14px;
}

.cg-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.cg-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 5px;
	border: none;
	background: transparent;
	cursor: pointer;
	transition: background 0.12s ease;
}

.cg-btn-icon--danger {
	color: #dc2626;
}

.cg-btn-icon--danger:hover {
	background: #fef2f2;
}

/* ==========================================================================
   ADMIN PANEL — FOOTER / SAVE BAR
   ========================================================================== */

.cg-sections-panel__footer {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 24px;
	border-top: 1px solid #e2e8f0;
	background: #F8FAFC;
}

.cg-sections-panel__save-msg {
	font-size: 13px;
	font-weight: 500;
}

.cg-msg--success {
	color: #15803D;
}

.cg-msg--error {
	color: #dc2626;
}

/* ==========================================================================
   ADMIN PANEL — PREVIEW NOTE
   ========================================================================== */

.cg-preview-note {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	padding: 10px 12px;
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	border-radius: 6px;
	font-size: 12px;
	color: #1e40af;
	margin-top: 4px;
}

/* ==========================================================================
   FRONTEND — COMMON SECTION STYLES
   ========================================================================== */

.cg-campaign-section {
	margin-top: 48px;
	padding-top: 48px;
	border-top: 1px solid #e2e8f0;
}

.cg-campaign-section__title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 22px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 28px;
}

.cg-campaign-section__title svg {
	color: #15803D;
	flex-shrink: 0;
}

/* ==========================================================================
   FRONTEND — STICKY CTA BAR
   ========================================================================== */

.cg-sticky-cta {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	padding: 14px 20px;
	box-shadow: 0 -4px 20px rgba( 0, 0, 0, 0.15 );
	transform: translateY( 100% );
	transition: transform 0.35s cubic-bezier( 0.4, 0, 0.2, 1 );
	will-change: transform;
}

.cg-sticky-cta--visible {
	transform: translateY( 0 );
}

.cg-sticky-cta--dismissed {
	transform: translateY( 100% );
	transition: transform 0.35s ease;
}

.cg-sticky-cta__inner {
	max-width: 1140px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}

.cg-sticky-cta__progress-wrap {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 120px;
}

.cg-sticky-cta__progress-bar {
	height: 6px;
	border-radius: 3px;
	overflow: hidden;
}

.cg-sticky-cta__progress-fill {
	height: 100%;
	border-radius: 3px;
	transition: width 0.5s ease;
}

.cg-sticky-cta__progress-label {
	font-size: 11px;
	font-weight: 600;
	opacity: 0.85;
}

.cg-sticky-cta__text {
	flex: 1;
	font-size: 14px;
	font-weight: 500;
	min-width: 120px;
}

.cg-sticky-cta__btn {
	display: inline-flex;
	align-items: center;
	padding: 9px 20px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity 0.15s ease;
	flex-shrink: 0;
}

.cg-sticky-cta__btn:hover {
	opacity: 0.9;
}

.cg-sticky-cta__close {
	background: transparent;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: 0.7;
	transition: opacity 0.15s ease;
	flex-shrink: 0;
}

.cg-sticky-cta__close:hover {
	opacity: 1;
}

@media ( max-width: 600px ) {
	.cg-sticky-cta__progress-wrap {
		display: none;
	}

	.cg-sticky-cta__text {
		font-size: 13px;
	}
}

/* ==========================================================================
   FRONTEND — FAQ ACCORDION
   ========================================================================== */

.cg-faq__list {
	display: flex;
	flex-direction: column;
	gap: 0;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
}

.cg-faq__item {
	border-bottom: 1px solid #f1f5f9;
}

.cg-faq__item:last-child {
	border-bottom: none;
}

.cg-faq__question {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px;
	background: #fff;
	border: none;
	cursor: pointer;
	text-align: left;
	font-size: 15px;
	font-weight: 600;
	color: #111827;
	transition: background 0.12s ease, color 0.12s ease;
}

.cg-faq__question:hover {
	background: #f8fafc;
	color: #15803D;
}

.cg-faq__item--open .cg-faq__question {
	background: #f0fdf4;
	color: #15803D;
}

.cg-faq__icon {
	flex-shrink: 0;
	color: #94a3b8;
	transition: transform 0.25s ease, color 0.12s ease;
}

.cg-faq__item--open .cg-faq__icon {
	transform: rotate( 180deg );
	color: #15803D;
}

.cg-faq__answer {
	background: #fafafa;
	border-top: 1px solid #f1f5f9;
}

.cg-faq__answer-inner {
	padding: 16px 20px;
	font-size: 14px;
	line-height: 1.7;
	color: #374151;
}

/* ==========================================================================
   FRONTEND — RELATED CAMPAIGNS GRID
   ========================================================================== */

.cg-related__grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 20px;
}

@media ( max-width: 900px ) {
	.cg-related__grid {
		grid-template-columns: repeat( 2, 1fr );
	}
}

@media ( max-width: 560px ) {
	.cg-related__grid {
		grid-template-columns: 1fr;
	}
}

.cg-related__card {
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
	display: flex;
	flex-direction: column;
}

.cg-related__card:hover {
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.1 );
	transform: translateY( -2px );
}

.cg-related__image-link {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
}

.cg-related__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.cg-related__card:hover .cg-related__image {
	transform: scale( 1.04 );
}

.cg-related__image--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient( 135deg, #f0fdf4, #dcfce7 );
	color: #15803D;
	width: 100%;
	height: 100%;
}

.cg-related__body {
	padding: 16px;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cg-related__title {
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	margin: 0;
	line-height: 1.35;
}

.cg-related__title a {
	color: inherit;
	text-decoration: none;
}

.cg-related__title a:hover {
	color: #15803D;
}

.cg-related__excerpt {
	font-size: 13px;
	color: #64748b;
	line-height: 1.6;
	margin: 0;
	flex: 1;
}

.cg-related__progress {
	margin-top: auto;
}

.cg-related__progress-bar {
	height: 6px;
	background: #e2e8f0;
	border-radius: 3px;
	overflow: hidden;
	margin-bottom: 6px;
}

.cg-related__progress-fill {
	height: 100%;
	background: linear-gradient( 90deg, #15803D, #22c55e );
	border-radius: 3px;
	transition: width 0.5s ease;
}

.cg-related__meta {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
}

.cg-related__raised {
	color: #374151;
	font-weight: 600;
}

.cg-related__raised small {
	font-weight: 400;
	color: #6b7280;
	margin-left: 2px;
}

.cg-related__percent {
	color: #15803D;
	font-weight: 700;
}

.cg-related__btn {
	margin-top: 8px;
	justify-content: center;
}