/**
 * ClinicianCore Challenge Impact Flow Widget Styles
 *
 * @package ClinicianCore_Impact_Widget
 * @version 1.0.0
 */

/* ─── CSS Custom Properties ─────────────────────────────────────── */
.ccif-widget {
	--ccif-primary:     #0D98BA;
	--ccif-dark-blue:   #1A365D;
	--ccif-accent:      #2DC8D8;
	--ccif-coral:       #F6AD55;
	--ccif-light-bg:    #F7FAFC;
	--ccif-white:       #FFFFFF;
	--ccif-body-text:   #2D3748;
	--ccif-list-text:   #4A5568;
	--ccif-border:      #E2E8F0;
	--ccif-shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
	--ccif-shadow-md:   0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
	--ccif-shadow-lg:   0 8px 32px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);
	--ccif-radius:      12px;
	--ccif-transition:  0.28s cubic-bezier(0.4, 0, 0.2, 1);
	font-family: inherit;
	box-sizing: border-box;
}

.ccif-widget *,
.ccif-widget *::before,
.ccif-widget *::after {
	box-sizing: inherit;
}

/* ─── Flow Container ─────────────────────────────────────────────── */
.ccif-flow-container {
	width: 100%;
}

/* ─── Column Headers ─────────────────────────────────────────────── */
.ccif-col-headers {
	display: grid;
	grid-template-columns: 1fr 80px 1fr;
	gap: 0;
	margin-bottom: 16px;
	padding: 0 4px;
}

.ccif-col-header {
	display: flex;
	align-items: center;
}

.ccif-col-challenge {
	justify-content: flex-start;
}

.ccif-col-impact {
	justify-content: flex-start;
}

.ccif-col-spacer {
	/* empty spacer column for the connector area */
}

.ccif-col-label {
	font-size: 11px;
	font-weight: 700;
	color: var(--ccif-body-text);
	padding-bottom: 10px;
	border-bottom: 2px solid var(--ccif-border);
	display: block;
	width: 100%;
}

/* ─── Rows Container ─────────────────────────────────────────────── */
.ccif-rows {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ─── Individual Row ─────────────────────────────────────────────── */
.ccif-row {
	display: grid;
	grid-template-columns: 1fr 80px 1fr;
	align-items: center;
	gap: 0;
	transition: opacity var(--ccif-transition);
}

/* Dim inactive rows when any row is hovered */
.ccif-rows.has-active .ccif-row:not(.is-active) {
	opacity: 0.4;
}

/* ─── Cards ──────────────────────────────────────────────────────── */
.ccif-card {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 24px;
	background: var(--ccif-white);
	border: 1.5px solid var(--ccif-border);
	border-radius: var(--ccif-radius);
	box-shadow: var(--ccif-shadow-sm);
	transition:
		border-color var(--ccif-transition),
		background-color var(--ccif-transition),
		box-shadow var(--ccif-transition),
		transform var(--ccif-transition);
	cursor: default;
	position: relative;
	overflow: hidden;
}

.ccif-card::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	opacity: 0;
	transition: opacity var(--ccif-transition);
	pointer-events: none;
}

/* Challenge card active highlight stripe */
.ccif-challenge-card::before {
	background: linear-gradient(135deg, rgba(13, 152, 186, 0.06) 0%, transparent 60%);
}

/* Impact card active highlight stripe */
.ccif-impact-card::before {
	background: linear-gradient(135deg, rgba(246, 173, 85, 0.06) 0%, transparent 60%);
}

.ccif-row.is-active .ccif-card::before {
	opacity: 1;
}

/* Active challenge card */
.ccif-row.is-active .ccif-challenge-card {
	border-color: var(--ccif-primary);
	background-color: #EBF8FF;
	box-shadow: var(--ccif-shadow-md), 0 0 0 3px rgba(13, 152, 186, 0.12);
	transform: translateX(-2px);
}

/* Active impact card */
.ccif-row.is-active .ccif-impact-card {
	border-color: var(--ccif-coral);
	background-color: #FFFAF0;
	box-shadow: var(--ccif-shadow-md), 0 0 0 3px rgba(246, 173, 85, 0.12);
	transform: translateX(2px);
}

/* Row-level accent color override */
.ccif-row[style*="--ccif-row-accent"].is-active .ccif-challenge-card {
	border-color: var(--ccif-row-accent, var(--ccif-primary));
}

/* ─── Card Icon ──────────────────────────────────────────────────── */
.ccif-card-icon-wrap {
	flex-shrink: 0;
}

.ccif-card-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 10px;
	background: rgba(13, 152, 186, 0.08);
	color: var(--ccif-primary);
	font-size: 18px;
	transition: background-color var(--ccif-transition), color var(--ccif-transition);
}

.ccif-impact-card .ccif-card-icon {
	background: rgba(246, 173, 85, 0.10);
	color: var(--ccif-coral);
}

.ccif-card-icon svg {
	width: 20px;
	height: 20px;
}

.ccif-row.is-active .ccif-challenge-card .ccif-card-icon {
	background: rgba(13, 152, 186, 0.15);
}

.ccif-row.is-active .ccif-impact-card .ccif-card-icon {
	background: rgba(246, 173, 85, 0.18);
}

/* ─── Card Content ───────────────────────────────────────────────── */
.ccif-card-content {
	flex: 1;
	min-width: 0;
}

.ccif-card-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--ccif-dark-blue);
	margin: 0 0 6px;
	letter-spacing: -0.01em;
}

.ccif-card-desc {
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--ccif-list-text);
	margin: 0;
}

/* ─── Connector ──────────────────────────────────────────────────── */
.ccif-connector {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	position: relative;
	height: 100%;
	min-height: 40px;
}

.ccif-connector-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--ccif-border);
	flex-shrink: 0;
	transition: background-color var(--ccif-transition), transform var(--ccif-transition);
}

.ccif-row.is-active .ccif-connector-dot {
	background: var(--ccif-primary);
	transform: scale(1.25);
}

.ccif-connector-line {
	flex: 1;
	height: 2px;
	background: var(--ccif-border);
	position: relative;
	overflow: hidden;
	transition: background-color var(--ccif-transition);
}

.ccif-row.is-active .ccif-connector-line {
	background: var(--ccif-primary);
}

/* Animated pulse on the connector line */
.ccif-connector-pulse {
	position: absolute;
	top: 0;
	left: -100%;
	width: 60%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent);
	transform: skewX(-20deg);
	opacity: 0;
	transition: none;
}

.ccif-row.is-active .ccif-connector-pulse {
	animation: ccif-pulse-flow 1.2s ease-in-out;
}

@keyframes ccif-pulse-flow {
	0%   { left: -60%; opacity: 0; }
	15%  { opacity: 1; }
	85%  { opacity: 1; }
	100% { left: 110%; opacity: 0; }
}

/* Arrow head */
.ccif-connector-arrow {
	width: 0;
	height: 0;
	border-top: 5px solid transparent;
	border-bottom: 5px solid transparent;
	border-left: 7px solid var(--ccif-border);
	flex-shrink: 0;
	transition: border-left-color var(--ccif-transition), transform var(--ccif-transition);
}

.ccif-row.is-active .ccif-connector-arrow {
	border-left-color: var(--ccif-primary);
	transform: scale(1.2);
}

/* Mobile arrow (hidden on desktop) */
.ccif-mobile-arrow {
	display: none;
	color: var(--ccif-border);
	transition: color var(--ccif-transition);
}

.ccif-row.is-active .ccif-mobile-arrow {
	color: var(--ccif-primary);
}

/* ─── Scroll Fade-In Animation ───────────────────────────────────── */
.ccif-scroll-anim .ccif-row {
	opacity: 0;
	transform: translateY(20px);
	transition:
		opacity 0.5s ease,
		transform 0.5s ease;
}

.ccif-scroll-anim .ccif-row.ccif-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Override: keep opacity at reduced level for dimming when visible */
.ccif-scroll-anim.ccif-rows-animated .ccif-rows.has-active .ccif-row:not(.is-active) {
	opacity: 0.4;
}

/* Stagger delays */
.ccif-scroll-anim .ccif-row:nth-child(1) { transition-delay: 0.00s; }
.ccif-scroll-anim .ccif-row:nth-child(2) { transition-delay: 0.08s; }
.ccif-scroll-anim .ccif-row:nth-child(3) { transition-delay: 0.16s; }
.ccif-scroll-anim .ccif-row:nth-child(4) { transition-delay: 0.24s; }
.ccif-scroll-anim .ccif-row:nth-child(5) { transition-delay: 0.32s; }
.ccif-scroll-anim .ccif-row:nth-child(6) { transition-delay: 0.40s; }
.ccif-scroll-anim .ccif-row:nth-child(7) { transition-delay: 0.48s; }
.ccif-scroll-anim .ccif-row:nth-child(8) { transition-delay: 0.56s; }

/* ─── Tablet ──────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	.ccif-col-headers {
		grid-template-columns: 1fr 56px 1fr;
	}

	.ccif-row {
		grid-template-columns: 1fr 56px 1fr;
	}

	.ccif-card {
		padding: 18px;
		gap: 12px;
	}

	.ccif-card-icon {
		width: 36px;
		height: 36px;
		font-size: 15px;
	}

	.ccif-card-title {
		font-size: 14px;
	}

	.ccif-card-desc {
		font-size: 13px;
	}
}

/* ─── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 767px) {
	/* Hide desktop column headers on mobile */
	.ccif-col-headers {
		display: none;
	}

	/* Stack rows vertically */
	.ccif-row {
		display: flex;
		flex-direction: column;
		gap: 0;
		align-items: stretch;
	}

	/* Override desktop active transforms on mobile */
	.ccif-row.is-active .ccif-challenge-card,
	.ccif-row.is-active .ccif-impact-card {
		transform: none;
	}

	/* Connector becomes vertical arrow on mobile */
	.ccif-connector {
		padding: 10px 0;
		justify-content: center;
		min-height: auto;
		height: auto;
	}

	.ccif-connector-dot,
	.ccif-connector-line,
	.ccif-connector-arrow {
		display: none;
	}

	.ccif-mobile-arrow {
		display: flex;
		justify-content: center;
		animation: none;
	}

	.ccif-row.is-active .ccif-mobile-arrow {
		animation: ccif-bounce-down 0.6s ease;
	}

	@keyframes ccif-bounce-down {
		0%, 100% { transform: translateY(0); }
		40%       { transform: translateY(5px); }
	}

	.ccif-card {
		padding: 20px;
	}

	.ccif-rows {
		gap: 24px;
	}

	/* Dim effect less aggressive on mobile */
	.ccif-rows.has-active .ccif-row:not(.is-active) {
		opacity: 0.55;
	}
}

/* ─── Elementor Editor Fix ───────────────────────────────────────── */
.elementor-editor-active .ccif-scroll-anim .ccif-row {
	opacity: 1 !important;
	transform: none !important;
}
