/**
 * Voice Recorder for Fluent Forms — compact "EvenBetter" theme.
 *
 * Small pill-style widget: icon-only round buttons, slim timer, mini
 * player. Brand palette: #380069 (deep purple), #9f9dcf (lavender),
 * #aed9da (aqua). All rules namespaced under .vrff-* to avoid theme
 * conflicts. Button labels stay in the DOM for screen readers but are
 * visually hidden.
 */

.vrff-recorder {
	--vrff-purple: #380069;
	--vrff-lavender: #9f9dcf;
	--vrff-aqua: #aed9da;
	--vrff-surface: #f7f6fb;   /* soft lavender tint */
	--vrff-danger: #b3261e;
	--vrff-success: #1d6b46;

	box-sizing: border-box;
	display: inline-block;
	max-width: 320px;
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--vrff-lavender);
	border-radius: 18px;
	background: var(--vrff-surface);
	color: var(--vrff-purple);
	font-size: 13px;
	line-height: 1.4;
}

.vrff-recorder *,
.vrff-recorder *::before,
.vrff-recorder *::after {
	box-sizing: inherit;
}

/* Header: small label + timer ----------------------------------------- */

.vrff-recorder__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}

.vrff-recorder__label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--vrff-purple);
}

.vrff-recorder__required {
	color: var(--vrff-danger);
}

.vrff-recorder__timer {
	font-variant-numeric: tabular-nums;
	font-size: 12px;
	font-weight: 600;
	color: var(--vrff-lavender);
	transition: color 0.2s ease;
}

.vrff-recorder[data-vrff-state="recording"] .vrff-recorder__timer {
	color: var(--vrff-purple);
}

/* Blinking dot while recording. */
.vrff-recorder[data-vrff-state="recording"] .vrff-recorder__timer::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 5px;
	border-radius: 50%;
	background: var(--vrff-danger);
	animation: vrff-blink 1s ease-in-out infinite;
}

/* Controls: small round icon buttons ----------------------------------- */

.vrff-recorder__controls {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.vrff-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	font: inherit;
	cursor: pointer;
	color: #ffffff;
	background: var(--vrff-purple);
	transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
	-webkit-tap-highlight-color: transparent;
	flex: none;
}

.vrff-btn:hover {
	background: #4b1a85;
}

.vrff-btn:active {
	transform: scale(0.94);
}

/* Visible, on-brand focus ring. */
.vrff-btn:focus-visible {
	outline: 3px solid var(--vrff-aqua);
	outline-offset: 2px;
}

.vrff-btn[disabled] {
	background: var(--vrff-lavender);
	cursor: not-allowed;
}

/* Keep labels for screen readers, hide them visually. */
.vrff-btn__text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.vrff-btn__icon {
	display: inline-flex;
	line-height: 0;
}

.vrff-btn__icon svg {
	width: 18px;
	height: 18px;
}

/* Mic button: the hero. Gentle pulse invites a tap. */
.vrff-btn--record {
	background: var(--vrff-purple);
	box-shadow: 0 0 0 0 rgba(56, 0, 105, 0.35);
	animation: vrff-pulse 2.4s ease-out infinite;
}
.vrff-btn--record:hover { background: #4b1a85; }

.vrff-btn--stop { background: var(--vrff-danger); }
.vrff-btn--stop:hover { background: #8f1d17; }

.vrff-btn--pause { background: var(--vrff-lavender); color: var(--vrff-purple); }
.vrff-btn--pause:hover { background: #8b89c4; }

.vrff-btn--delete {
	background: transparent;
	color: var(--vrff-purple);
	border: 2px solid var(--vrff-lavender);
	width: 36px;
	height: 36px;
}
.vrff-btn--delete:hover { background: rgba(159, 157, 207, 0.18); }

.vrff-btn--retry {
	background: transparent;
	color: var(--vrff-purple);
	border: 2px solid var(--vrff-aqua);
	width: 36px;
	height: 36px;
}
.vrff-btn--retry:hover { background: rgba(174, 217, 218, 0.25); }

/* Waveform animation while recording ----------------------------------- */

.vrff-recorder__wave {
	display: flex;
	align-items: center;
	gap: 3px;
	height: 22px;
	margin-top: 8px;
}

.vrff-recorder__wave span {
	width: 4px;
	height: 6px;
	border-radius: 2px;
	background: var(--vrff-lavender);
	animation: vrff-wave 0.9s ease-in-out infinite;
}

.vrff-recorder__wave span:nth-child(odd) { background: var(--vrff-purple); }
.vrff-recorder__wave span:nth-child(2) { animation-delay: 0.12s; }
.vrff-recorder__wave span:nth-child(3) { animation-delay: 0.24s; }
.vrff-recorder__wave span:nth-child(4) { animation-delay: 0.36s; }
.vrff-recorder__wave span:nth-child(5) { animation-delay: 0.48s; }

/* Mini player ----------------------------------------------------------- */

.vrff-recorder__player {
	margin-top: 8px;
}

.vrff-recorder__player audio {
	width: 100%;
	height: 32px;
	display: block;
}

/* Upload progress -------------------------------------------------------- */

.vrff-recorder__progress {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	font-size: 12px;
	color: var(--vrff-purple);
}

.vrff-recorder__spinner {
	width: 14px;
	height: 14px;
	border: 2px solid var(--vrff-aqua);
	border-top-color: var(--vrff-purple);
	border-radius: 50%;
	animation: vrff-spin 0.8s linear infinite;
	flex: none;
}

/* Status line ------------------------------------------------------------ */

.vrff-recorder__status {
	margin: 6px 0 0;
	min-height: 0;
	font-size: 12px;
}

.vrff-recorder__status:empty {
	display: none;
}

.vrff-recorder__status[data-tone="success"] { color: var(--vrff-success); font-weight: 600; }
.vrff-recorder__status[data-tone="error"] { color: var(--vrff-danger); font-weight: 600; }
.vrff-recorder__status[data-tone="warn"] { color: #7a5b00; }
.vrff-recorder__status[data-tone="info"] { color: var(--vrff-lavender); }

/* Unsupported browsers --------------------------------------------------- */

.vrff-recorder--unsupported {
	background: #ffffff;
}

/* Animations ------------------------------------------------------------- */

@keyframes vrff-blink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.25; }
}

@keyframes vrff-wave {
	0%, 100% { height: 6px; }
	50% { height: 18px; }
}

@keyframes vrff-spin {
	to { transform: rotate(360deg); }
}

@keyframes vrff-pulse {
	0% { box-shadow: 0 0 0 0 rgba(56, 0, 105, 0.35); }
	70% { box-shadow: 0 0 0 9px rgba(56, 0, 105, 0); }
	100% { box-shadow: 0 0 0 0 rgba(56, 0, 105, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.vrff-recorder__wave span,
	.vrff-btn--record,
	.vrff-recorder[data-vrff-state="recording"] .vrff-recorder__timer::before {
		animation: none;
	}
}

/* Small screens: keep it compact, just ensure comfy touch targets. ------- */

@media (max-width: 480px) {
	.vrff-recorder {
		max-width: 100%;
	}

	.vrff-btn {
		width: 44px;
		height: 44px;
	}

	.vrff-btn--delete,
	.vrff-btn--retry {
		width: 40px;
		height: 40px;
	}
}

/* ======================================================================
   Journal mic pill (.vrff-mic) — overlays the textarea, EvenBetter brand
   ====================================================================== */

.vrff-mic {
	--vrff-purple: #380069;
	--vrff-lavender: #9f9dcf;
	--vrff-aqua: #aed9da;
	--vrff-danger: #b3261e;
	--vrff-success: #1d6b46;

	box-sizing: border-box;
	font-size: 13px;
	line-height: 1.4;
	color: var(--vrff-purple);
}

.vrff-mic *,
.vrff-mic *::before,
.vrff-mic *::after {
	box-sizing: inherit;
}

/* Overlay mode: pinned to the textarea's bottom-right corner. */
.vrff-mic--overlay {
	position: absolute;
	right: 10px;
	bottom: 10px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	max-width: calc(100% - 20px);
	z-index: 2;
}

/* The pill itself. */
.vrff-mic__pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 14px;
	border: 1px solid var(--vrff-lavender);
	border-radius: 999px;
	background: var(--vrff-lavender);
	color: #ffffff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(56, 0, 105, 0.18);
	transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
	-webkit-tap-highlight-color: transparent;
}

.vrff-mic__pill:hover {
	background: #8b89c4;
}

.vrff-mic__pill:active {
	transform: scale(0.96);
}

.vrff-mic__pill:focus-visible {
	outline: 3px solid var(--vrff-aqua);
	outline-offset: 2px;
}

.vrff-mic__pill[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
}

.vrff-mic__icon {
	display: inline-flex;
	line-height: 0;
	color: currentColor;
}

/* Icon-only once the invitation is dismissed. */
.vrff-mic--compact .vrff-mic__pill {
	padding: 8px;
	width: 42px;
	height: 42px;
	justify-content: center;
}

/* While recording: pill goes brand-purple, timer shows, gentle pulse. */
.vrff-mic[data-vrff-state="recording"] .vrff-mic__pill {
	background: var(--vrff-purple);
	border-color: var(--vrff-purple);
	color: #ffffff;
	width: auto;
	padding: 8px 14px;
	animation: vrff-pulse 2s ease-out infinite;
}

.vrff-mic[data-vrff-state="recording"] .vrff-mic__icon {
	color: #ffffff;
}

.vrff-mic__timer {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.vrff-mic__timer::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 5px;
	border-radius: 50%;
	background: var(--vrff-aqua);
	animation: vrff-blink 1s ease-in-out infinite;
}

/* Saved result: mini player + trash. */
.vrff-mic__result {
	display: flex;
	align-items: center;
	gap: 6px;
	background: #ffffff;
	border: 1px solid var(--vrff-lavender);
	border-radius: 999px;
	padding: 4px 6px;
	box-shadow: 0 1px 4px rgba(56, 0, 105, 0.12);
	max-width: 100%;
}

.vrff-mic__result audio {
	height: 30px;
	max-width: 210px;
}

.vrff-mic__trash {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--vrff-danger);
	cursor: pointer;
}

.vrff-mic__trash:hover {
	background: rgba(179, 38, 30, 0.08);
}

.vrff-mic__trash:focus-visible {
	outline: 3px solid var(--vrff-aqua);
	outline-offset: 1px;
}

/* Status text under the pill. */
.vrff-mic__status {
	margin: 0;
	font-size: 12px;
	text-align: right;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 8px;
	padding: 1px 6px;
}

.vrff-mic__status:empty {
	display: none;
}

.vrff-mic__status[data-tone="success"] { color: var(--vrff-success); font-weight: 600; }
.vrff-mic__status[data-tone="error"] { color: var(--vrff-danger); font-weight: 600; }
.vrff-mic__status[data-tone="warn"] { color: #7a5b00; }
.vrff-mic__status[data-tone="info"] { color: var(--vrff-purple); }

@media (max-width: 480px) {
	.vrff-mic__result audio {
		max-width: 150px;
	}
}

/* ======================================================================
   [my_recordings] member library
   ====================================================================== */

.vrff-recordings {
	--vrff-purple: #380069;
	--vrff-lavender: #9f9dcf;
	--vrff-aqua: #aed9da;
	--vrff-danger: #b3261e;

	box-sizing: border-box;
	max-width: 680px;
	color: #1f1233;
}

.vrff-recordings *,
.vrff-recordings *::before,
.vrff-recordings *::after {
	box-sizing: inherit;
}

.vrff-recordings__title {
	color: var(--vrff-purple);
	margin: 0 0 14px;
}

.vrff-recordings__empty,
.vrff-recordings__login {
	color: var(--vrff-purple);
	background: #f7f6fb;
	border: 1px solid var(--vrff-lavender);
	border-radius: 12px;
	padding: 14px 16px;
}

.vrff-recordings__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.vrff-recordings__item {
	background: #ffffff;
	border: 1px solid var(--vrff-lavender);
	border-left: 4px solid var(--vrff-purple);
	border-radius: 12px;
	padding: 12px 14px;
}

.vrff-recordings__meta {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin-bottom: 8px;
}

.vrff-recordings__question {
	font-weight: 600;
	color: var(--vrff-purple);
}

.vrff-recordings__date {
	font-size: 12px;
	color: var(--vrff-lavender);
}

.vrff-recordings__item audio {
	width: 100%;
	height: 32px;
	display: block;
}

.vrff-recordings__actions {
	display: flex;
	gap: 14px;
	margin-top: 8px;
	font-size: 13px;
}

.vrff-recordings__download {
	display: inline-block;
	background: var(--vrff-purple);
	color: #ffffff;
	font-weight: 600;
	text-decoration: none;
	border-radius: 999px;
	padding: 5px 14px;
	line-height: 1.4;
}

.vrff-recordings__download:hover {
	background: #4b1a85;
	color: #ffffff;
}

.vrff-recordings__delete {
	background: transparent;
	border: 2px solid var(--vrff-danger);
	padding: 3px 12px;
	border-radius: 999px;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--vrff-danger);
	cursor: pointer;
	line-height: 1.4;
}

.vrff-recordings__delete:hover {
	background: rgba(179, 38, 30, 0.08);
}

.vrff-recordings__delete:focus-visible,
.vrff-recordings__download:focus-visible {
	outline: 3px solid var(--vrff-aqua);
	outline-offset: 2px;
}

.vrff-recordings__transcript {
	margin-top: 8px;
	font-size: 13px;
}

.vrff-recordings__transcript summary {
	cursor: pointer;
	color: var(--vrff-purple);
	font-weight: 600;
}

.vrff-recordings__transcript p {
	margin: 6px 0 0;
	color: #3d2b52;
	background: #f7f6fb;
	border-radius: 8px;
	padding: 8px 10px;
}
