/* ==========================================================================
   TextCRM Unified Inbox Widget  —  "Every channel, one conversation."
   --------------------------------------------------------------------------
   A pinned scrollytelling section built on the Hero design system. A left
   editorial column (eyebrow pill → masked headline with an accent phrase → a
   vertical list of numbered steps) sits beside a right "app window" mock-up
   whose screen swaps panes as the visitor scrolls (or taps the steps). Each
   step lights up with an accent rail + progress fill while its matching pane of
   conversation rows / AI banner cross-fades into the window.

   Layout : two-column grid, pinned full-height on desktop (GSAP), stacked +
            tap-to-switch on mobile / in the editor.
   Type   : Space Grotesk (display) · Manrope (body + labels).
   Palette: accent #42c67a · ink #04211a · bg #0b1326 · surface #0f1a32
            (mirrors the TextCRM Hero).
   Motion : GSAP ScrollTrigger pin + scrubbed step driver, entrance reveal,
            staggered conversation rows. Degrades to a static, readable state
            without JS and under prefers-reduced-motion.

   Every visual token below is a CSS custom property so the Elementor Style tab
   (and the global Light color-mode layer) can override it without forking this
   file.
   ========================================================================== */

.textcrm-inbox {
	/* ---- Theme tokens (overridable from the Elementor Style tab) ---- */
	--ib-bg:           #0b1326;
	--ib-bg-2:         #0a1122;
	--ib-surface:      #0f1a32;
	--ib-surface-2:    #14223f;
	--ib-line:         rgba(255, 255, 255, 0.07);
	--ib-line-2:       rgba(255, 255, 255, 0.13);
	--ib-text:         #eaf0fb;
	--ib-muted:        #93a1bd;
	--ib-muted-2:      #5e6d8c;
	--ib-accent:       #42c67a;
	--ib-accent-2:     #00c98a;
	--ib-accent-dim:   rgba(66, 198, 122, 0.10);
	--ib-accent-border:rgba(66, 198, 122, 0.30);
	--ib-eyebrow:      #bfe9d2;
	--ib-ink:          #04211a;
	--ib-glow:         rgba(66, 198, 122, 0.20);

	--ib-font-display: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	--ib-font-body:    'Manrope', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	--ib-font-mono:    'Manrope', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	--ib-font-accent:  'Instrument Serif', 'Times New Roman', Georgia, serif;

	--ib-maxw:    1600px;
	--ib-gutter:  24px;
	--ib-radius:  14px;
	--ib-ease:    cubic-bezier(0.22, 0.61, 0.36, 1);
	/* Clears the fixed site header when the grid centers content full-height. */
	--ib-clear:   clamp(90px, 12vh, 140px);
	--ib-shadow:  0 40px 100px rgba(0, 0, 0, 0.5);

	/* Chip palette presets (used by the per-conversation chip styles). */
	--ib-chip-blue:   #8fb0ff;
	--ib-chip-blue-bg:rgba(94, 140, 255, 0.12);
	--ib-chip-blue-bd:rgba(94, 140, 255, 0.30);
	--ib-chip-purple: #c4a6ff;
	--ib-chip-purple-bg:rgba(166, 130, 255, 0.12);
	--ib-chip-purple-bd:rgba(166, 130, 255, 0.30);
	--ib-chip-amber:  #f4c77b;
	--ib-chip-amber-bg:rgba(244, 184, 80, 0.12);
	--ib-chip-amber-bd:rgba(244, 184, 80, 0.30);

	position: relative;
	width: 100%;
	overflow: hidden;
	box-sizing: border-box;
	background-color: var(--ib-bg);
	color: var(--ib-text);
	font-family: var(--ib-font-body);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	/* No hairlines by default; the Style → Borders toggles add a 1px border. */
	border-top: 0 solid var(--ib-line);
	border-bottom: 0 solid var(--ib-line);
}

.textcrm-inbox *,
.textcrm-inbox *::before,
.textcrm-inbox *::after {
	box-sizing: border-box;
}

.textcrm-inbox ::selection {
	background: var(--ib-accent);
	color: var(--ib-ink);
}

/* --------------------------------------------------------------------------
   Soft brand glow — a blurred accent wash behind the app window for depth.
   -------------------------------------------------------------------------- */
.textcrm-inbox__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.textcrm-inbox__glow {
	position: absolute;
	top: 50%;
	right: -4%;
	width: 620px;
	height: 520px;
	max-width: 70vw;
	transform: translateY(-50%);
	border-radius: 50%;
	background: var(--ib-glow);
	filter: blur(150px);
	pointer-events: none;
	will-change: transform;
}

/* --------------------------------------------------------------------------
   Container + grid
   -------------------------------------------------------------------------- */
/* The container vertically centres the centered header + the two-column grid as
   one block, so the pinned section reads as a single composed screen. */
.textcrm-inbox__container {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	width: 100%;
	max-width: var(--ib-maxw);
	min-height: 100vh;
	min-height: 100svh;
	margin: 0 auto;
	padding-left: var(--ib-gutter);
	padding-right: var(--ib-gutter);
	/* Kept tight so the centered header + grid fit one viewport while pinned. */
	padding-block: clamp(48px, 6vh, 88px);
}

/* Editorial header — eyebrow + headline, left-aligned at the top of the left
   column (mirrors the #inbox split layout of the landing redesign). */
.textcrm-inbox__head {
	text-align: left;
	margin-bottom: clamp(28px, 4vw, 40px);
}

.textcrm-inbox__grid {
	display: grid;
	grid-template-columns: 0.85fr 1.15fr;
	gap: clamp(32px, 5vw, 80px);
	align-items: center;
}

/* --------------------------------------------------------------------------
   Left column — steps  ·  Header — eyebrow + headline
   -------------------------------------------------------------------------- */
.textcrm-inbox__left {
	position: relative;
	min-width: 0;
}

.textcrm-inbox__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	margin-bottom: 22px;
	padding: 7px 15px;
	border: 1px solid var(--ib-accent-border);
	border-radius: 999px;
	background: var(--ib-accent-dim);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--ib-eyebrow);
	line-height: 1;
}

.textcrm-inbox__eyebrow-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ib-accent);
	box-shadow: 0 0 0 0 rgba(66, 198, 122, 0.55);
	animation: textcrm-inbox-pulse 2.4s ease-out infinite;
	flex-shrink: 0;
}

@keyframes textcrm-inbox-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(66, 198, 122, 0.5); }
	70%  { box-shadow: 0 0 0 8px rgba(66, 198, 122, 0); }
	100% { box-shadow: 0 0 0 0 rgba(66, 198, 122, 0); }
}

.textcrm-inbox__eyebrow-text {
	font-family: var(--ib-font-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Headline — mirrors the TextCRM Benefits widget: Space Grotesk display with an
   elegant Instrument Serif italic accent phrase (the Hero highlight treatment). */
.textcrm-inbox__title {
	margin: 0;
	max-width: 14ch;
	font-family: var(--ib-font-display);
	font-weight: 700;
	font-size: clamp(34px, 4.6vw, 60px);
	line-height: 1.04;
	letter-spacing: -0.02em;
	color: var(--ib-text);
}

.textcrm-inbox__title-accent {
	font-family: var(--ib-font-accent);
	font-style: italic;
	font-weight: 400;
	font-size: 1.1em;
	letter-spacing: 0;
	color: var(--ib-accent);
}

/* --------------------------------------------------------------------------
   Steps — a vertical list that doubles as a scroll-progress rail
   -------------------------------------------------------------------------- */
.textcrm-inbox__steps {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.textcrm-inbox__step {
	--ib-step-progress: 0;
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 18px 20px;
	border: 0;
	border-radius: 0 10px 10px 0;
	background: transparent;
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background 0.4s var(--ib-ease);
}

/* Base rail + animated accent fill on the left edge. */
.textcrm-inbox__step::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 2px;
	background: var(--ib-line-2);
}

.textcrm-inbox__step::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 2px;
	height: calc(var(--ib-step-progress) * 100%);
	background: linear-gradient(var(--ib-accent), var(--ib-accent-2));
	transition: height 0.25s linear;
}

.textcrm-inbox__step:hover {
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent);
}

.textcrm-inbox__step.is-active {
	--ib-step-progress: 1;
	background: linear-gradient(90deg, var(--ib-accent-dim), transparent);
}

.textcrm-inbox__step:focus-visible {
	outline: 2px solid var(--ib-accent);
	outline-offset: 2px;
}

.textcrm-inbox__step-n {
	display: block;
	margin-bottom: 7px;
	font-family: var(--ib-font-mono);
	font-size: 12px;
	letter-spacing: 0.08em;
	color: var(--ib-muted-2);
	transition: color 0.4s var(--ib-ease);
}

.textcrm-inbox__step.is-active .textcrm-inbox__step-n {
	color: var(--ib-accent);
}

.textcrm-inbox__step-title {
	display: block;
	margin: 0 0 6px;
	font-family: var(--ib-font-display);
	font-weight: 600;
	font-size: 19px;
	line-height: 1.25;
	color: var(--ib-text);
}

.textcrm-inbox__step-desc {
	display: block;
	margin: 0;
	max-width: 42ch;
	font-size: 14.5px;
	line-height: 1.55;
	color: var(--ib-muted);
}

/* --------------------------------------------------------------------------
   Right column — the app window mock-up
   -------------------------------------------------------------------------- */
.textcrm-inbox__right {
	position: relative;
	min-width: 0;
}

.textcrm-inbox__stage {
	display: flex;
	align-items: center;
	justify-content: center;
	/* Fills the right column so the window / image reads as the dominant visual
	   in the split layout (matches the #inbox section of the landing redesign). */
	width: 100%;
	margin-inline: auto;
	perspective: 1200px;
}

.textcrm-inbox__card {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--ib-line-2);
	border-radius: var(--ib-radius);
	background: var(--ib-surface);
	box-shadow: var(--ib-shadow);
	aspect-ratio: 4 / 3;
	will-change: transform;
	backface-visibility: hidden;
}

/* Subtle top sheen so the window reads as glossy glass. */
.textcrm-inbox__card::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 18%);
}

.textcrm-inbox__card-head {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	padding: 14px 16px;
	border-bottom: 1px solid var(--ib-line);
}

.textcrm-inbox__dot {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: var(--ib-muted-2);
	opacity: 0.5;
}

.textcrm-inbox__card-title {
	margin-left: 10px;
	font-family: var(--ib-font-mono);
	font-size: 12px;
	color: var(--ib-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.textcrm-inbox__card-status {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-left: auto;
	flex-shrink: 0;
	font-family: var(--ib-font-mono);
	font-size: 10.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ib-accent);
}

.textcrm-inbox__card-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ib-accent);
	box-shadow: 0 0 0 0 rgba(66, 198, 122, 0.5);
	animation: textcrm-inbox-pulse 2.4s ease-out infinite;
}

/* Screen — holds the absolutely-stacked panes. */
.textcrm-inbox__screen {
	position: relative;
	flex: 1;
	min-height: 0;
}

.textcrm-inbox__pane {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	gap: 11px;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	overflow: hidden;
	transition: opacity 0.5s var(--ib-ease), visibility 0.5s var(--ib-ease);
}

.textcrm-inbox__pane.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Conversation rows
   -------------------------------------------------------------------------- */
.textcrm-inbox__conv {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 12px 14px;
	border-radius: 9px;
	background: var(--ib-bg-2);
	border: 1px solid var(--ib-line);
	will-change: transform, opacity;
}

.textcrm-inbox__av {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--ib-surface-2), var(--ib-accent-dim));
	border: 1px solid var(--ib-line);
	font-family: var(--ib-font-display);
	font-size: 13px;
	font-weight: 700;
	color: var(--ib-text);
}

.textcrm-inbox__conv-meta {
	flex: 1;
	min-width: 0;
}

.textcrm-inbox__conv-name {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--ib-text);
}

.textcrm-inbox__conv-text {
	display: block;
	font-size: 12.5px;
	color: var(--ib-muted-2);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.textcrm-inbox__chip {
	flex-shrink: 0;
	font-family: var(--ib-font-mono);
	font-size: 9.5px;
	letter-spacing: 0.08em;
	padding: 4px 8px;
	border-radius: 20px;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Chip colour variants. */
.textcrm-inbox__chip--green {
	background: var(--ib-accent-dim);
	color: var(--ib-accent);
	border: 1px solid var(--ib-accent-border);
}
.textcrm-inbox__chip--accent {
	background: var(--ib-accent);
	color: var(--ib-ink);
	border: 1px solid var(--ib-accent);
}
.textcrm-inbox__chip--blue {
	background: var(--ib-chip-blue-bg);
	color: var(--ib-chip-blue);
	border: 1px solid var(--ib-chip-blue-bd);
}
.textcrm-inbox__chip--purple {
	background: var(--ib-chip-purple-bg);
	color: var(--ib-chip-purple);
	border: 1px solid var(--ib-chip-purple-bd);
}
.textcrm-inbox__chip--amber {
	background: var(--ib-chip-amber-bg);
	color: var(--ib-chip-amber);
	border: 1px solid var(--ib-chip-amber-bd);
}
.textcrm-inbox__chip--grey {
	background: var(--ib-surface-2);
	color: var(--ib-muted);
	border: 1px solid var(--ib-line);
}

/* --------------------------------------------------------------------------
   AI banner (per pane)
   -------------------------------------------------------------------------- */
.textcrm-inbox__ai {
	display: flex;
	gap: 11px;
	align-items: flex-start;
	padding: 14px;
	border-radius: 9px;
	background: var(--ib-accent-dim);
	border: 1px solid var(--ib-accent-border);
	will-change: transform, opacity;
}

.textcrm-inbox__ai-ic {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	flex-shrink: 0;
	border-radius: 7px;
	background: var(--ib-accent);
	color: var(--ib-ink);
	font-family: var(--ib-font-display);
	font-size: 12px;
	font-weight: 700;
}

.textcrm-inbox__ai-text {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ib-text);
}

.textcrm-inbox__ai-text b {
	color: var(--ib-accent);
	font-weight: 700;
}

/* --------------------------------------------------------------------------
   Image variant — a premium framed showcase that replaces the app window. A
   glass frame (sheen + accent glow), an optional floating stat badge, and GSAP
   tilt / float / reveal (see JS). Falls back to a clean static frame.
   -------------------------------------------------------------------------- */
.textcrm-inbox__media {
	position: relative;
	width: 100%;
	margin: 0;
}

.textcrm-inbox__media-frame {
	position: relative;
	z-index: 1;
	overflow: hidden;
	/* Height is driven by the image itself (the first slide flows in normal
	   layout below) so the frame hugs the artwork — no fixed-aspect letterbox. */
	border: 1px solid var(--ib-line-2);
	border-radius: var(--ib-img-radius, 18px);
	background: var(--ib-surface);
	box-shadow: var(--ib-shadow);
	transform-style: preserve-3d;
	will-change: transform;
	backface-visibility: hidden;
}

/* Per-step image slides, stacked and swapped on scroll (the image equivalent of
   the window's panes). GSAP owns the reveal; CSS provides the resting/no-JS and
   reduced-motion crossfade. */
.textcrm-inbox__media-slide {
	position: absolute;
	inset: 0;
	z-index: 1;
	opacity: 0;
	visibility: hidden;
	overflow: hidden;
	border-radius: inherit;
}

/* The first slide flows in normal layout so its natural image height sets the
   frame's height (the others stack absolutely on top and cross-fade over it). */
.textcrm-inbox__media-slide:first-child {
	position: relative;
}

.textcrm-inbox__media-slide:first-child .textcrm-inbox__media-img {
	height: auto;
}

/* GSAP owns the reveal when present; this is the resting / no-JS / reduced-motion
   state (instant swap). */
.textcrm-inbox__media-slide.is-active {
	opacity: 1;
	visibility: visible;
}

.textcrm-inbox__media-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
}

/* Glossy diagonal sheen sweeping the frame. */
.textcrm-inbox__media-sheen {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	border-radius: inherit;
	background: linear-gradient(125deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.05) 100%);
}

/* Soft accent glow blooming behind the frame. */
.textcrm-inbox__media-glow {
	position: absolute;
	z-index: 0;
	left: 50%;
	bottom: -36px;
	width: 78%;
	height: 130px;
	transform: translateX(-50%);
	border-radius: 9999px;
	background: var(--ib-glow);
	filter: blur(80px);
	pointer-events: none;
}

/* Floating stat badge (glass card, idle-float via JS). */
.textcrm-inbox__media-badge {
	position: absolute;
	z-index: 4;
	left: -14px;
	bottom: 22px;
	max-width: 60%;
}

.textcrm-inbox__media-badge-inner {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 16px;
	border: 1px solid var(--ib-line-2);
	border-radius: 14px;
	background: rgba(15, 26, 50, 0.72);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.55);
	will-change: transform;
}

.textcrm-inbox__media-badge-ic {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	border-radius: 10px;
	background: var(--ib-accent-dim);
	border: 1px solid var(--ib-accent-border);
	color: var(--ib-accent);
	font-family: var(--ib-font-display);
	font-size: 15px;
	font-weight: 700;
}

.textcrm-inbox__media-badge-text {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.textcrm-inbox__media-badge-value {
	font-family: var(--ib-font-display);
	font-weight: 700;
	font-size: 18px;
	line-height: 1.1;
	color: var(--ib-accent);
}

.textcrm-inbox__media-badge-label {
	font-family: var(--ib-font-mono);
	font-size: 10.5px;
	letter-spacing: 0.04em;
	line-height: 1.3;
	color: var(--ib-muted);
}

/* --------------------------------------------------------------------------
   Entrance pre-hidden states — only while JS hasn't claimed the widget. Once
   GSAP runs it adds `.is-gsap` and owns these via inline styles. The <noscript>
   failsafe + the reduced-motion block force the resting state.
   -------------------------------------------------------------------------- */
.textcrm-inbox--reveal:not(.is-gsap) .textcrm-inbox__animate {
	opacity: 0;
	transform: translateY(22px);
}

.textcrm-inbox--reveal:not(.is-gsap) .textcrm-inbox__card,
.textcrm-inbox--reveal:not(.is-gsap) .textcrm-inbox__media-frame,
.textcrm-inbox--reveal:not(.is-gsap) .textcrm-inbox__media-badge {
	opacity: 0;
	transform: translateY(34px) scale(0.97);
}

/* --------------------------------------------------------------------------
   Responsive — below the breakpoint the section drops the pinned full-height
   layout, the grid stacks and the visual drops below the steps. JS switches to
   tap-to-change (no pin); without JS the first pane / slide shows. The window
   relaxes its aspect ratio so rows never clip.
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
	.textcrm-inbox__container {
		min-height: 0;
		padding-block: clamp(56px, 9vh, 96px);
	}
	.textcrm-inbox__grid {
		grid-template-columns: 1fr;
		gap: 40px;
	}
	.textcrm-inbox__title {
		max-width: 22ch;
	}
	.textcrm-inbox__glow {
		top: 75%;
		right: -20%;
	}
	.textcrm-inbox__card {
		aspect-ratio: auto;
		min-height: 380px;
	}
}

@media (max-width: 600px) {
	.textcrm-inbox {
		--ib-gutter: 16px;
		font-size: 15px;
	}
	.textcrm-inbox__grid {
		gap: 30px;
	}
	.textcrm-inbox__step {
		padding: 15px 16px;
	}
	.textcrm-inbox__step-title {
		font-size: 17px;
	}
	.textcrm-inbox__eyebrow-text {
		white-space: normal;
	}
	.textcrm-inbox__card {
		min-height: 360px;
	}
	.textcrm-inbox__pane {
		padding: 14px;
		gap: 9px;
	}
	.textcrm-inbox__conv {
		padding: 10px 12px;
	}
	.textcrm-inbox__media-badge {
		left: 0;
		bottom: 14px;
		max-width: 72%;
	}
	.textcrm-inbox__media-badge-inner {
		padding: 11px 13px;
		gap: 10px;
	}
	.textcrm-inbox__media-badge-ic {
		width: 32px;
		height: 32px;
	}
}

/* --------------------------------------------------------------------------
   Reduced motion — show the resting state immediately, no motion. The active
   pane/step stay class-driven so tapping still works.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.textcrm-inbox *,
	.textcrm-inbox *::before,
	.textcrm-inbox *::after {
		animation: none !important;
		transition: none !important;
	}
	.textcrm-inbox--reveal .textcrm-inbox__animate,
	.textcrm-inbox--reveal .textcrm-inbox__card,
	.textcrm-inbox--reveal .textcrm-inbox__media-frame,
	.textcrm-inbox--reveal .textcrm-inbox__media-badge {
		opacity: 1 !important;
		transform: none !important;
	}
}
