/* Formidable Media Field — front-end control + builder styling.
   One field renders one of three modes (audio, camera, video). Control
   selectors are scoped under .frmmedia-field and the button visuals use
   !important on theme-prone properties (background, color, border, box-shadow,
   sizing) so a form theme's native <button> styles cannot override the design.

   CSS custom properties used here (both set inside .with_frm_style by
   custom_theme.css.php — available on the front end when a Formidable style
   is applied):
     --submit-bg-color      Primary action background (capture / play button)
     --submit-text-color    Primary action foreground (icon currentColor)
*/

.frmmedia-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: 420px;
}

.frmmedia-field [hidden] {
	display: none !important;
}

/* ---- Media stage (camera + video): live preview / still / playback. ---- */
.frmmedia-field .frmmedia-stage {
	position: relative;
	width: 100%;
	max-width: 420px;
	aspect-ratio: 4 / 3;
	box-sizing: border-box;
	background: #101828 !important;
	border: 1px solid #eaecf0 !important;
	border-radius: 12px !important;
	overflow: hidden;
}

.frmmedia-field .frmmedia-video,
.frmmedia-field .frmmedia-photo,
.frmmedia-field .frmmedia-playback {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #101828;
}

.frmmedia-field .frmmedia-canvas {
	display: none;
}

/* ---- Control bar (grey container). ---- */
.frmmedia-field .frmmedia-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	max-width: 420px;
	box-sizing: border-box;
	padding: 8px 14px 8px 8px;
	background: #f2f4f7 !important;
	border: 1px solid #eaecf0 !important;
	border-radius: 12px !important;
	box-shadow: none !important;
}

.frmmedia-field .frmmedia-controls {
	display: flex;
	align-items: center;
	gap: 8px;
}

.frmmedia-field .frmmedia-btn {
	-webkit-appearance: none !important;
	appearance: none !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 0 !important;
	flex: none;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	border-radius: 200px !important;
	border: 1px solid transparent !important;
	cursor: pointer;
	margin: 0 !important;
	padding: 0 !important;
	line-height: normal !important;
	text-shadow: none !important;
	transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.frmmedia-field .frmmedia-btn .frmmedia-icon {
	width: 20px;
	height: 20px;
	display: block;
}

.frmmedia-field .frmmedia-glyph[hidden] {
	display: none !important;
}

.frmmedia-field .frmmedia-glyph:not([hidden]) {
	display: inline-flex;
}

/* Primary transport — record / open / play. Follows the form's submit color. */
.frmmedia-field .frmmedia-transport {
	color: var(--submit-text-color, #fff) !important;
	background: var(--submit-bg-color, #4199fd) !important;
}

.frmmedia-field .frmmedia-transport:hover {
	background: var(--submit-bg-color, #1570ef) !important;
}

.frmmedia-field .frmmedia-transport:disabled {
	background: #b2ccf4 !important;
	cursor: not-allowed;
}

/* Live / recording — red with a soft pulsing halo. */
.frmmedia-field .frmmedia-transport.is-live,
.frmmedia-field .frmmedia-transport.is-live:hover {
	background: #f04438 !important;
	box-shadow: 0 0 0 0 rgba( 240, 68, 56, 0.4 );
	animation: frmmedia-pulse 1.6s ease-out infinite;
}

@keyframes frmmedia-pulse {
	0%   { box-shadow: 0 0 0 0 rgba( 240, 68, 56, 0.42 ); }
	70%  { box-shadow: 0 0 0 10px rgba( 240, 68, 56, 0 ); }
	100% { box-shadow: 0 0 0 0 rgba( 240, 68, 56, 0 ); }
}

/* Reset / re-record — secondary white button. */
.frmmedia-field .frmmedia-reset {
	background: #fff !important;
	border-color: #98a2b3 !important;
	color: #344054 !important;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.05 ) !important;
}

.frmmedia-field .frmmedia-reset:hover {
	background: #f9fafb !important;
	border-color: #667085 !important;
	color: #1d2939 !important;
}

.frmmedia-field .frmmedia-reset:disabled,
.frmmedia-field .frmmedia-reset.is-disabled {
	background: #f2f4f7 !important;
	border-color: #eaecf0 !important;
	color: #d0d5dd !important;
	box-shadow: none !important;
	cursor: not-allowed;
}

/* Right side: timer / live dot / status label. */
.frmmedia-field .frmmedia-readout {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 8px;
}

.frmmedia-field .frmmedia-timer {
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
	font-weight: 600;
	font-size: 16px;
	line-height: 24px;
	letter-spacing: -0.01em;
	color: #1d2939;
}

.frmmedia-field .frmmedia-timer.is-muted {
	color: #667085;
	font-weight: 500;
}

.frmmedia-field .frmmedia-label {
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-weight: 500;
	font-size: 13px;
	line-height: 18px;
	text-align: right;
	color: #667085;
}

.frmmedia-field .frmmedia-live-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #f04438;
	flex: none;
	animation: frmmedia-blink 1.2s steps( 1, end ) infinite;
}

@keyframes frmmedia-blink {
	50% { opacity: 0.25; }
}

/* ---- Secondary: notices, status, fallback. ---- */
.frmmedia-field .frmmedia-notice {
	padding: 8px 12px;
	border-radius: 8px;
	background: #fcf3d7;
	border: 1px solid #f0d68a;
	color: #6b5500;
	font-size: 13px;
}

.frmmedia-field .frmmedia-status {
	font-size: 13px;
	color: #667085;
	min-height: 1em;
}

.frmmedia-field .frmmedia-fallback {
	font-size: 13px;
}

.frmmedia-field .frmmedia-fallback-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border: 1px solid #98a2b3;
	border-radius: 8px;
	background: #fff;
	color: #344054;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.05 );
	transition: background 0.15s ease, border-color 0.15s ease;
}

.frmmedia-field .frmmedia-fallback-label:hover {
	background: #f9fafb;
	border-color: #667085;
	color: #1d2939;
}

.frmmedia-field .frmmedia-fallback-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* ---- Builder palette icon (mask in currentColor) — camera + play glyph. ---- */
.frmmedia-field-icon::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%222.5%22%20y%3D%225%22%20width%3D%2219%22%20height%3D%2214%22%20rx%3D%222.5%22%2F%3E%3Cpath%20d%3D%22M10%209.2v5.6l4.8-2.8z%22%2F%3E%3C%2Fsvg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%222.5%22%20y%3D%225%22%20width%3D%2219%22%20height%3D%2214%22%20rx%3D%222.5%22%2F%3E%3Cpath%20d%3D%22M10%209.2v5.6l4.8-2.8z%22%2F%3E%3C%2Fsvg%3E") no-repeat center / contain;
}

/* ---- Builder placeholder. ---- */
.frmmedia-builder-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 18px;
	border: 1px dashed #d0d5dd;
	border-radius: 12px;
	color: #667085;
	text-align: center;
}

.frmmedia-builder-placeholder .frmmedia-placeholder-icon {
	width: 26px;
	height: 26px;
}

.frmmedia-builder-label {
	font-weight: 600;
}

.frmmedia-builder-note {
	font-size: 12px;
}

/* ---- Builder settings. ---- */
.frmmedia-setting {
	margin-bottom: 12px;
}

.frmmedia-mode-group[hidden] {
	display: none !important;
}

/* ---- Submit button while a capture/upload is in flight. ---- */
.frmmedia-submit-disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
