/**
 * Fardara Fundraiser - Frontend Styles
 * Fully responsive with CSS logical properties for RTL/LTR compatibility.
 */

:root {
	--fardara-fund-primary: #10b981;
	--fardara-fund-gradient-start: #00875a;
	--fardara-fund-gradient-mid: #10b981;
	--fardara-fund-gradient-end: #8ee000;
	--fardara-fund-pin-border: #8ee000;
	--fardara-fund-badge-bg: #00b87c;
	--fardara-fund-badge-text: #022c16;
	--fardara-fund-track-bg: #e6edf4;
	--fardara-fund-bg: #f8fafc;
	--fardara-fund-border: #e2e8f0;
	--fardara-fund-text: #1e293b;
	--fardara-fund-text-muted: #64748b;
	--fardara-fund-item-selected-border: #10b981;
	--fardara-fund-item-selected-bg: #ecfdf5;
}

/* Default Single Product Campaign Box */
.fardara-fund-campaign-box.fardara-fund-campaign-default {
	background-color: var(--fardara-fund-bg);
	border: 1px solid var(--fardara-fund-border);
	border-radius: 12px;
	padding: 1.25rem;
	margin-block: 1.25rem;
	margin-top: 0;
	color: var(--fardara-fund-text);
	font-family: inherit;
	/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); */
}

.fardara-fund-box-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.85rem;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.fardara-fund-amounts {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.fardara-fund-amounts bdi,
.fardara-fund-amounts .woocommerce-Price-amount bdi,
.fardara-fund-goal-wrapper bdi,
.fardara-fund-goal-wrapper .woocommerce-Price-amount bdi,
.fardara-fund-compact-amounts bdi,
.fardara-fund-compact-amounts .woocommerce-Price-amount bdi,
.fardara-fund-box-items bdi,
.fardara-fund-history-table bdi,
.fardara-fund-campaign-box .woocommerce-Price-amount bdi {
	/* direction: ltr !important; */
	unicode-bidi: isolate !important;
}

.fardara-fund-raised-amount {
	color: var(--fardara-fund-text);
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.25;
}

.fardara-fund-goal-wrapper {
	display: inline-flex;
	align-items: baseline;
	gap: 0.35rem;
}

.fardara-fund-raised-of {
	font-size: 0.875rem;
	font-weight: 400;
	color: var(--fardara-fund-text-muted);
}

.fardara-fund-goal-amount {
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--fardara-fund-text-muted);
}

/* Status Badges */
.fardara-fund-status-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.65rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: capitalize;
}

.fardara-fund-status-active {
	background-color: #ecfdf5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.fardara-fund-status-goal_reached {
	background-color: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}

.fardara-fund-status-ended {
	background-color: #f1f5f9;
	color: #475569;
	border: 1px solid #cbd5e1;
}

.fardara-fund-status-closed {
	background-color: #faf5ff;
	color: #6b21a8;
	border: 1px solid #e9d5ff;
}

/* Progress Bar */
.fardara-fund-progress-bar-wrapper {
	position: relative;
	padding-top: 36px;
	margin-block: 10px 16px;
	padding-inline: 4px;
}

.fardara-fund-progress-bar {
	position: relative;
	width: 100%;
	height: 14px;
	background-color: var(--fardara-fund-track-bg);
	border-radius: 9999px;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.fardara-fund-progress-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	height: 100%;
	border-radius: 9999px;
	background: linear-gradient(90deg, var(--fardara-fund-gradient-start) 0%, var(--fardara-fund-gradient-mid) 55%, var(--fardara-fund-gradient-end) 100%);
	transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
	animation: fardaraFillGrow 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	max-width: 100%;
}

/* Shimmer Light Ray Sweep */
.fardara-fund-progress-fill::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 9999px;
	background: linear-gradient(
		90deg,
		transparent 0%,
		rgba(255, 255, 255, 0.45) 50%,
		transparent 100%
	);
	background-size: 200% 100%;
	animation: fardaraShimmer 2.6s infinite linear;
	pointer-events: none;
}

@keyframes fardaraShimmer {
	0% { background-position: -200% 0; }
	100% { background-position: 200% 0; }
}

@keyframes fardaraFillGrow {
	from { width: 0%; }
}

/* Thumb Indicator (Pin) */
.fardara-fund-progress-thumb {
	position: absolute;
	top: 50%;
	right: 0;
	transform: translate(50%, -50%);
	pointer-events: none;
	z-index: 2;
}

.fardara-fund-progress-pin {
	width: 16px;
	height: 16px;
	background: #4CAF50;
	border: 3.5px solid var(--fardara-fund-pin-border);
	border-radius: 50%;
	box-sizing: border-box;
	box-shadow: 0 0 8px 1px rgba(142, 224, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.2);
	animation: fardaraPinPulse 2.2s infinite ease-out;
}

@keyframes fardaraPinPulse {
	0% {
		box-shadow: 0 0 0 0 rgba(142, 224, 0, 0.75), 0 1px 3px rgba(0, 0, 0, 0.2);
	}
	70% {
		box-shadow: 0 0 0 9px rgba(142, 224, 0, 0), 0 1px 3px rgba(0, 0, 0, 0.2);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(142, 224, 0, 0), 0 1px 3px rgba(0, 0, 0, 0.2);
	}
}

/* Floating Tooltip Badge */
.fardara-fund-progress-badge {
	position: absolute;
	bottom: calc(100% + 9px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--fardara-fund-badge-bg);
	color: #fff;
	padding: 2.5px 8px;
	border-radius: 7px;
	font-size: 0.8125rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	white-space: nowrap;
	box-shadow: 0 4px 12px rgba(0, 184, 124, 0.4);
	animation: fardaraBadgePop 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.3s backwards;
}

.fardara-fund-progress-badge::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-width: 5px 5px 0 5px;
	border-style: solid;
	border-color: var(--fardara-fund-badge-bg) transparent transparent transparent;
}

.fardara-fund-progress-percentage {
	font-size: inherit;
	font-weight: inherit;
	color: inherit;
	display: inline-block;
}

@keyframes fardaraBadgePop {
	0% {
		opacity: 0;
		transform: translateX(-50%) translateY(4px) scale(0.7);
	}
	100% {
		opacity: 1;
		transform: translateX(-50%) translateY(0) scale(1);
	}
}

/* Footer Stats */
.fardara-fund-box-footer {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
	padding-top: 0.85rem;
	border-top: 1px solid var(--fardara-fund-border);
}

.fardara-fund-stat-item {
	display: flex;
	flex-direction: column;
}

.fardara-fund-stat-backers {
	flex-direction: row;
	align-items: baseline;
	gap: 0.35rem;
	white-space: nowrap;
}

.fardara-fund-stat-backers .fardara-fund-stat-label {
	margin-top: 0;
	font-size: 0.875rem;
}

.fardara-fund-stat-number {
	font-size: 1rem;
	font-weight: 700;
	color: var(--fardara-fund-text);
}

.fardara-fund-stat-label {
	font-size: 0.75rem;
	color: var(--fardara-fund-text-muted);
	margin-top: 2px;
}

/* Compact Style (Shop Archive / Widgets) */
.fardara-fund-campaign-box.fardara-fund-campaign-compact {
	margin-block: 0.6rem;
	font-size: 0.8125rem;
}

.fardara-fund-campaign-compact .fardara-fund-progress-bar-wrapper {
	padding-top: 30px;
	margin-block: 0.25rem 0.5rem;
}

.fardara-fund-campaign-compact .fardara-fund-progress-bar {
	height: 10px;
}

.fardara-fund-campaign-compact .fardara-fund-progress-pin {
	width: 13px;
	height: 13px;
	border-width: 2.5px;
}

.fardara-fund-campaign-compact .fardara-fund-progress-badge {
	font-size: 0.75rem;
	padding: 1.5px 6px;
	bottom: calc(100% + 7px);
}

.fardara-fund-compact-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.35rem 0.75rem;
	color: var(--fardara-fund-text-muted);
	font-size: 0.75rem;
	margin-top: 0.35rem;
}

.fardara-fund-compact-amounts {
	display: inline-flex;
	align-items: baseline;
	gap: 0.25rem;
}

.fardara-fund-compact-raised {
	font-weight: 700;
	color: var(--fardara-fund-text);
}

.fardara-fund-compact-sep,
.fardara-fund-item-sep {
	opacity: 0.6;
	margin-inline: 0.15rem;
}

.fardara-fund-compact-extra {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.75rem;
	color: var(--fardara-fund-text-muted);
}

.fardara-fund-compact-backers {
	display: inline-flex;
	align-items: baseline;
	gap: 0.2rem;
}

.fardara-fund-compact-backers-count {
	font-weight: 700;
	color: var(--fardara-fund-text);
}

.fardara-fund-compact-dot {
	opacity: 0.5;
	font-size: 0.7rem;
	line-height: 1;
}

.fardara-fund-compact-timer {
	font-weight: 500;
}

/* Frontend Campaign History */
.fardara-fund-frontend-history {
	margin: 1rem 0;
	padding-top: 0.85rem;
	border-top: 1px dashed var(--fardara-fund-border);
	font-size: 0.8125rem;
}

.fardara-fund-frontend-history.fardara-fund-history-shortcode {
	border-top: none;
	padding-top: 0;
}

/* Collapsible Details */
.fardara-fund-history-details {
	border: 1px solid var(--fardara-fund-border);
	border-radius: 8px;
	background-color: #ffffff;
	overflow: hidden;
	transition: all 0.2s ease;
}

.fardara-fund-history-details[open] {
	border-color: #cbd5e1;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fardara-fund-history-summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.65rem 0.85rem;
	cursor: pointer;
	user-select: none;
	font-weight: 600;
	color: var(--fardara-fund-text);
	list-style: none;
}

.fardara-fund-history-summary::-webkit-details-marker {
	display: none;
}

.fardara-fund-history-summary:hover {
	background-color: #f1f5f9;
}

.fardara-fund-history-summary-title {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.fardara-fund-history-icon {
	color: var(--fardara-fund-text-muted);
	flex-shrink: 0;
}

.fardara-fund-history-arrow {
	color: var(--fardara-fund-text-muted);
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.fardara-fund-history-details[open] .fardara-fund-history-arrow {
	transform: rotate(180deg);
}

/* Open Style */
.fardara-fund-history-open {
	border: 1px solid var(--fardara-fund-border);
	border-radius: 8px;
	background-color: #ffffff;
	overflow: hidden;
}

.fardara-fund-history-open-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.65rem 0.85rem;
	font-weight: 600;
	color: var(--fardara-fund-text);
	background-color: #f8fafc;
	border-bottom: 1px solid var(--fardara-fund-border);
}

.fardara-fund-history-heading {
	margin: 0;
	font-size: 0.8125rem;
	font-weight: 600;
}

/* History Content & Table */
.fardara-fund-history-content {
	padding: 0.5rem 0.85rem 0.75rem;
}

.fardara-fund-frontend-history-table-wrapper {
	width: 100%;
	overflow-x: auto;
	margin-top: 0.25rem;
}

.fardara-fund-frontend-history-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.75rem;
	line-height: 1.4;
	text-align: start;
	border: none;
	margin: 0;
}

.fardara-fund-frontend-history-table th {
	font-weight: 600;
	color: var(--fardara-fund-text-muted);
	padding: 0.4rem 0.5rem;
	border-bottom: 1px solid var(--fardara-fund-border);
	text-align: start;
	white-space: nowrap;
	background: transparent;
}

.fardara-fund-frontend-history-table td {
	padding: 0.45rem 0.5rem;
	border-bottom: 1px solid #f1f5f9;
	color: var(--fardara-fund-text);
	vertical-align: middle;
	white-space: nowrap;
	text-align: start;
}

.fardara-fund-frontend-history-table tr:last-child td {
	border-bottom: none;
}

.fardara-fund-history-raised-val {
	font-weight: 600;
}

.fardara-fund-history-pct {
	color: var(--fardara-fund-text-muted);
	font-size: 0.7rem;
	margin-inline-start: 2px;
}

.fardara-fund-history-current-tag {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.2;
	padding: 0.15rem 0.35rem;
	border-radius: 4px;
	background: #ecfdf5;
	color: #059669;
	margin-inline-start: 4px;
	vertical-align: middle;
}

/* Multi-Item Campaign: Campaign Box Summary */
.fardara-fund-box-items-summary {
	margin-top: 1rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--fardara-fund-border);
}

.fardara-fund-box-items-heading {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--fardara-fund-text);
	margin: 0 0 0.5rem;
}

.fardara-fund-box-items-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.fardara-fund-box-item-row {
	padding: 0.4rem 0.5rem;
	background: #f8fafc;
	border: 1px solid var(--fardara-fund-border);
	border-radius: 6px;
}

.fardara-fund-box-item-row.is-funded {
	background: #f1f5f9;
	opacity: 0.85;
}

.fardara-fund-box-item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--fardara-fund-text);
	margin-bottom: 0.25rem;
}

.fardara-fund-box-item-bar {
	height: 6px;
	background: var(--fardara-fund-track-bg, #e2e8f0);
	border-radius: 9999px;
	overflow: hidden;
	margin-bottom: 0.25rem;
}

.fardara-fund-box-item-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--fardara-fund-gradient-start, #00875a) 0%, var(--fardara-fund-gradient-mid, #10b981) 55%, var(--fardara-fund-gradient-end, #8ee000) 100%);
	border-radius: 9999px;
	transition: width 0.6s ease;
}

.fardara-fund-box-item-row.is-funded .fardara-fund-box-item-fill {
	background: linear-gradient(90deg, #10b981 0%, #8ee000 100%);
}

.fardara-fund-box-item-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.7rem;
	color: var(--fardara-fund-text-muted);
}

.fardara-fund-funded-pill {
	display: inline-block;
	font-size: 0.65rem;
	font-weight: 700;
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
	background: #d1fae5;
	color: #065f46;
	text-transform: uppercase;
}

/* Multi-Item Campaign: Add to Cart Selection Pills */
.fardara-fund-item-selector {
	margin: 1rem 0;
}
.fardara-fund-item-selector-heading {
	display: block;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--fardara-fund-text, #1e293b);
	margin-bottom: 0.75rem;
}

.fardara-fund-items-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	width: 100%;
}

.fardara-fund-item-card {
	min-width: fit-content;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	padding: 0.75rem 1.15rem;
	min-height: 48px;
	background: #ffffff;
	border: 1.5px solid #e5e7eb;
	border-radius: 14px;
	cursor: pointer;
	text-align: center;
	user-select: none;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
	gap: 0.4rem;
	box-sizing: border-box;
}

.fardara-fund-item-card:hover:not(.is-funded):not(.is-selected) {
	border-color: #cbd5e1;
	background: #f9fafb;
}

.fardara-fund-item-card.is-selected,
.fardara-fund-item-card:has(.fardara-fund-item-radio:checked),
.fardara-fund-item-card:has(.fardara-fund-item-checkbox:checked) {
	border: 1px solid var(--fardara-fund-item-selected-border, #10b981);
	background-color: var(--fardara-fund-item-selected-bg, #ecfdf5);
	box-shadow: 0 0 0 1px var(--fardara-fund-item-selected-border, #10b981);
}

.fardara-fund-item-card:focus-within {
	outline: none;
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.fardara-fund-item-card.is-funded {
	opacity: 0.55;
	cursor: not-allowed;
	background: #f1f5f9;
	border: 1.5px dashed #cbd5e1;
	box-shadow: none;
}

.fardara-fund-item-card-title {
	font-size: 0.9375rem;
	/* font-weight: 600; */
	color: var(--fardara-fund-text, #1e293b);
	line-height: 1.4;
	text-align: center;
}

.fardara-fund-item-card.is-selected .fardara-fund-item-card-title,
.fardara-fund-item-card:has(.fardara-fund-item-radio:checked) .fardara-fund-item-card-title,
.fardara-fund-item-card:has(.fardara-fund-item-checkbox:checked) .fardara-fund-item-card-title {
	/* font-weight: 700; */
	color: #065f46;
}

.fardara-fund-item-card.is-funded .fardara-fund-item-card-title {
	color: #94a3b8;
}

.fardara-fund-item-radio,
.fardara-fund-item-checkbox {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
	margin: 0;
}

.fardara-fund-item-check {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	border: 1.5px solid #cbd5e1;
	border-radius: 5px;
	background: #ffffff;
	transition: border-color 0.15s ease, background-color 0.15s ease;
	box-sizing: border-box;
	position: relative;
}

.fardara-fund-item-card.is-selected .fardara-fund-item-check,
.fardara-fund-item-card:has(.fardara-fund-item-checkbox:checked) .fardara-fund-item-check {
	border-color: var(--fardara-fund-item-selected-border, #10b981);
	background: var(--fardara-fund-item-selected-border, #10b981);
}

.fardara-fund-item-card.is-selected .fardara-fund-item-check::after,
.fardara-fund-item-card:has(.fardara-fund-item-checkbox:checked) .fardara-fund-item-check::after {
	content: "";
	width: 4px;
	height: 8px;
	border: solid #ffffff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
	margin-top: -2px;
}

.fardara-fund-item-card-badge {
	font-size: 0.65rem;
	font-weight: 700;
	padding: 0.15rem 0.35rem;
	border-radius: 6px;
	background: #e2e8f0;
	color: #475569;
}

/* RTL Support for Progress Bar */
[dir="rtl"] .fardara-fund-progress-fill,
.rtl .fardara-fund-progress-fill {
	left: auto;
	right: 0;
	background: linear-gradient(270deg, var(--fardara-fund-gradient-start) 0%, var(--fardara-fund-gradient-mid) 55%, var(--fardara-fund-gradient-end) 100%);
}

[dir="rtl"] .fardara-fund-progress-thumb,
.rtl .fardara-fund-progress-thumb {
	right: auto;
	left: 0;
	transform: translate(-50%, -50%);
}

[dir="rtl"] .fardara-fund-progress-fill::after,
.rtl .fardara-fund-progress-fill::after {
	animation-direction: normal;
}

[dir="rtl"] .fardara-fund-box-item-fill,
.rtl .fardara-fund-box-item-fill {
	background: linear-gradient(270deg, var(--fardara-fund-gradient-start) 0%, var(--fardara-fund-gradient-mid) 55%, var(--fardara-fund-gradient-end) 100%);
}

/* Accessible Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.fardara-fund-progress-fill {
		animation: none !important;
		transition: none !important;
	}
	.fardara-fund-progress-fill::after,
	.fardara-fund-progress-pin,
	.fardara-fund-progress-badge {
		animation: none !important;
	}
}

