/**
 * CF7 Voice Recorder — front-end styles.
 *
 * The recorder is a single dark pill: a white circular microphone button on
 * the left, a live waveform filling the middle, elapsed time on the right.
 * Every colour is a custom property, so a theme can retune it without
 * touching these rules.
 */

.cf7vr-control {
	--cf7vr-bar-from: #1a1330;
	--cf7vr-bar-to: #2e1533;
	--cf7vr-wave: rgba( 255, 255, 255, 0.55 );
	--cf7vr-wave-active: #ff5f8f;
	--cf7vr-circle: #ffffff;
	--cf7vr-circle-ink: #2e1533;
	--cf7vr-live: #ff5f8f;
	--cf7vr-ink: #1d2430;
	--cf7vr-muted: #6b7280;
	--cf7vr-line: #d7dce3;
	--cf7vr-bar-height: 64px;

	display: block;
	box-sizing: border-box;
}

.cf7vr-control *,
.cf7vr-control *::before,
.cf7vr-control *::after {
	box-sizing: inherit;
}

.cf7vr-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
	border: 0;
}

/* The pill ---------------------------------------------------------------- */

.cf7vr-bar {
	display: flex;
	align-items: center;
	gap: 14px;
	height: var( --cf7vr-bar-height );
	padding: 0 22px 0 8px;
	border-radius: calc( var( --cf7vr-bar-height ) / 2 );
	background: linear-gradient( 100deg, var( --cf7vr-bar-from ), var( --cf7vr-bar-to ) );
	overflow: hidden;
}

.cf7vr-circle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc( var( --cf7vr-bar-height ) - 16px );
	height: calc( var( --cf7vr-bar-height ) - 16px );
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var( --cf7vr-circle );
	color: var( --cf7vr-circle-ink );
	cursor: pointer;
	appearance: none;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.3 );
}

.cf7vr-circle[hidden] {
	display: none;
}

.cf7vr-circle svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
	pointer-events: none;
}

.cf7vr-circle:hover {
	background: #f4f0f7;
}

.cf7vr-circle:focus-visible {
	outline: 2px solid var( --cf7vr-live );
	outline-offset: 3px;
}

.cf7vr-circle-stop {
	color: var( --cf7vr-live );
}

.cf7vr-canvas {
	flex: 1 1 auto;
	min-width: 0;
	height: calc( var( --cf7vr-bar-height ) - 24px );
}

.cf7vr-timer {
	flex: 0 0 auto;
	min-width: 3.2em;
	text-align: right;
	font-variant-numeric: tabular-nums;
	font-size: 14px;
	letter-spacing: 0.02em;
	color: rgba( 255, 255, 255, 0.7 );
}

.cf7vr-control[data-state="recording"] .cf7vr-timer {
	color: #fff;
}

/* Everything below the pill ---------------------------------------------- */

.cf7vr-preview {
	display: block;
	width: 100%;
	margin: 12px 0 0;
}

.cf7vr-preview[hidden] {
	display: none;
}

.cf7vr-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0 0;
}

.cf7vr-buttons:empty {
	margin: 0;
}

.cf7vr-btn {
	margin: 0;
	padding: 7px 14px;
	border: 1px solid var( --cf7vr-line );
	border-radius: 999px;
	background: #fff;
	color: var( --cf7vr-ink );
	font: inherit;
	font-size: 14px;
	line-height: 1.3;
	cursor: pointer;
	appearance: none;
}

.cf7vr-btn[hidden] {
	display: none;
}

.cf7vr-btn:hover {
	border-color: var( --cf7vr-bar-to );
}

.cf7vr-btn:focus-visible {
	outline: 2px solid var( --cf7vr-bar-to );
	outline-offset: 2px;
}

.cf7vr-btn-delete {
	color: var( --cf7vr-live );
}

.cf7vr-hint {
	margin: 10px 0 0;
	font-size: 13px;
	color: var( --cf7vr-muted );
}

.cf7vr-status {
	margin: 4px 0 0;
	min-height: 1.4em;
	font-size: 13px;
	color: var( --cf7vr-muted );
}

.cf7vr-status.is-error {
	color: #c0392b;
}

.cf7vr-status.is-ok {
	color: #1f7a54;
}

/* File input: hidden while recording works, shown as the fallback ---------- */

.cf7vr-file {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
	border: 0;
}

.cf7vr-is-fallback .cf7vr-file {
	position: static;
	width: auto;
	height: auto;
	margin: 6px 0 0;
	overflow: visible;
	clip: auto;
	white-space: normal;
}

.cf7vr-is-fallback .cf7vr-bar,
.cf7vr-is-fallback .cf7vr-buttons {
	display: none;
}

.cf7vr-fallback[hidden] {
	display: none;
}

.cf7vr-fallback label {
	display: block;
	font-size: 14px;
	font-weight: 600;
}

/* Validation -------------------------------------------------------------- */

.cf7vr-control.cf7vr-invalid .cf7vr-bar,
.cf7vr-control.wpcf7-not-valid .cf7vr-bar {
	box-shadow: 0 0 0 2px var( --cf7vr-live );
}

@media ( max-width: 480px ) {
	.cf7vr-control {
		--cf7vr-bar-height: 56px;
	}

	.cf7vr-bar {
		gap: 10px;
		padding-right: 16px;
	}

	.cf7vr-buttons .cf7vr-btn {
		flex: 1 1 auto;
		text-align: center;
	}
}
