/* ==========================================================================
   Voices of Hope Recorder — front-end styles
   ========================================================================== */

.voh-recorder {
	--voh-primary: #1e3a8a;
	--voh-primary-dark: #152a63;
	--voh-accent: #a3e635;
	--voh-accent-dark: #84cc16;
	--voh-text: #1a202c;
	--voh-text-muted: #64748b;
	--voh-bg: #ffffff;
	--voh-bg-soft: #f8fafc;
	--voh-border: #e2e8f0;
	--voh-error: #dc2626;
	--voh-radius: 16px;
	--voh-shadow: 0 10px 40px -10px rgba(30, 58, 138, 0.25);

	max-width: 620px;
	margin: 0 auto;
	background: var(--voh-bg);
	border-radius: var(--voh-radius);
	padding: 32px 28px;
	box-shadow: var(--voh-shadow);
	font-family: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
	color: var(--voh-text);
	box-sizing: border-box;
}

.voh-recorder *,
.voh-recorder *::before,
.voh-recorder *::after { box-sizing: border-box; }

/* ----- Header ----- */
.voh-recorder__header { text-align: center; margin-bottom: 22px; }
.voh-recorder__heading {
	color: var(--voh-primary);
	font-size: 28px;
	font-weight: 800;
	letter-spacing: -0.02em;
	margin: 0 0 8px;
	line-height: 1.15;
}
.voh-recorder__subheading {
	color: var(--voh-text-muted);
	font-size: 16px;
	line-height: 1.5;
	margin: 0;
}

/* ----- Mode tabs ----- */
.voh-recorder .voh-recorder__tabs {
	display: flex;
	gap: 8px;
	padding: 6px;
	background: rgba(30, 58, 138, 0.14);
	border-radius: 12px;
	margin-bottom: 20px;
}

/* High-specificity selector + !important on colors to override theme button styles */
.voh-recorder button.voh-recorder__tab {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 14px;
	border: none;
	background-color: transparent;
	color: var(--voh-primary) !important;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	border-radius: 8px;
	box-shadow: none;
	transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
	-webkit-tap-highlight-color: transparent;
	opacity: 1;
}

.voh-recorder button.voh-recorder__tab:hover:not(.is-active) {
	background-color: rgba(30, 58, 138, 0.08);
}

.voh-recorder button.voh-recorder__tab.is-active {
	background-color: var(--voh-primary);
	color: #ffffff !important;
	box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}

.voh-recorder button.voh-recorder__tab:focus-visible {
	outline: 2px solid var(--voh-primary);
	outline-offset: 2px;
}

/* ----- Mask-based icons (color follows text color via currentColor) ----- */
.voh-recorder__icon-mask {
	display: inline-block;
	background-color: currentColor;
	-webkit-mask-size: contain;
	        mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	        mask-repeat: no-repeat;
	-webkit-mask-position: center;
	        mask-position: center;
	flex-shrink: 0;
}
.voh-recorder__icon-mask--sm { width: 22px; height: 22px; }
.voh-recorder__icon-mask--lg { width: 46px; height: 46px; }

/* Inline SVG fallback icons in tabs use currentColor too */
.voh-recorder button.voh-recorder__tab svg {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

/* ----- Mode panels ----- */
.voh-recorder__mode { display: none; }
.voh-recorder__mode.is-active { display: block; }

/* ----- Audio stage ----- */
.voh-recorder__stage {
	position: relative;
	background: var(--voh-bg-soft);
	border-radius: 12px;
	padding: 32px 20px;
	margin-bottom: 20px;
}

.voh-recorder__controls {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	position: relative;
	z-index: 2;
}

/* ----- Record button ----- */
.voh-recorder__record-btn {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 150px;
	height: 150px;
	border-radius: 50%;
	border: none;
	background: var(--voh-primary);
	color: #ffffff;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 0;
	transition: transform 0.18s ease, background-color 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 8px 20px -6px rgba(30, 58, 138, 0.5);
	position: relative;
	z-index: 3;
	-webkit-tap-highlight-color: transparent;
}

.voh-recorder__record-btn:hover:not(:disabled) {
	background: var(--voh-primary-dark);
	transform: translateY(-2px);
	box-shadow: 0 12px 24px -6px rgba(30, 58, 138, 0.55);
}
.voh-recorder__record-btn:active:not(:disabled) { transform: translateY(0); }
.voh-recorder__record-btn:focus-visible {
	outline: 3px solid var(--voh-accent);
	outline-offset: 4px;
}
.voh-recorder__record-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.voh-recorder__phone-icon {
	display: inline-flex;
	transition: transform 0.3s ease;
	color: #ffffff;
}

/* Inline SVG fallback uses fill="currentColor" */
.voh-recorder__phone-icon svg {
	width: 46px;
	height: 46px;
}

/* Uploaded image icons are rendered as a mask span, forced white on the record btn */
.voh-recorder__phone-icon .voh-recorder__icon-mask {
	background-color: #ffffff;
}

.voh-recorder__btn-label {
	font-family: inherit;
	font-size: 14px;
	font-weight: 800;       /* ExtraBold */
	letter-spacing: 0;       /* 0 tracking */
	text-transform: none;
}

/* Recording state: red pulse */
.voh-recorder__stage[data-state="recording"] .voh-recorder__record-btn {
	background: #dc2626;
	box-shadow: 0 8px 20px -6px rgba(220, 38, 38, 0.55);
	animation: voh-recording-pulse 1.6s ease-in-out infinite;
}
.voh-recorder__stage[data-state="recording"] .voh-recorder__phone-icon {
	transform: rotate(135deg);
}

@keyframes voh-recording-pulse {
	0%, 100% { box-shadow: 0 8px 20px -6px rgba(220, 38, 38, 0.55), 0 0 0 0 rgba(220, 38, 38, 0.4); }
	50% { box-shadow: 0 8px 20px -6px rgba(220, 38, 38, 0.55), 0 0 0 24px rgba(220, 38, 38, 0); }
}

/* ----- Timer ----- */
.voh-recorder__timer {
	font-size: 32px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--voh-primary);
	letter-spacing: -0.01em;
	display: flex;
	align-items: baseline;
	gap: 8px;
}
.voh-recorder__timer-max { font-size: 16px; color: var(--voh-text-muted); font-weight: 500; }
.voh-recorder__stage[data-state="recording"] .voh-recorder__timer { color: #dc2626; }

/* ----- Pulse bars (while recording) ----- */
.voh-recorder__pulse { display: none; gap: 4px; height: 32px; align-items: flex-end; }
.voh-recorder__pulse span {
	display: block; width: 5px;
	background: var(--voh-accent);
	border-radius: 3px;
	animation: voh-bar 1s ease-in-out infinite;
}
.voh-recorder__pulse span:nth-child(1) { animation-delay: 0s;   height: 60%; }
.voh-recorder__pulse span:nth-child(2) { animation-delay: 0.2s; height: 100%; }
.voh-recorder__pulse span:nth-child(3) { animation-delay: 0.4s; height: 70%; }
@keyframes voh-bar { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }
.voh-recorder__stage[data-state="recording"] .voh-recorder__pulse { display: flex; }

/* ----- Playback ----- */
.voh-recorder__playback { display: none; flex-direction: column; gap: 14px; align-items: center; }
.voh-recorder__stage[data-state="review"] .voh-recorder__controls { display: none; }
.voh-recorder__stage[data-state="review"] .voh-recorder__playback { display: flex; }
.voh-recorder__audio { width: 100%; max-width: 420px; }

.voh-recorder__playback-actions { display: flex; gap: 12px; }
.voh-recorder__rerecord-btn {
	background: transparent;
	border: 2px solid var(--voh-primary);
	color: var(--voh-primary);
	padding: 10px 22px;
	border-radius: 999px;
	cursor: pointer;
	font-weight: 700;
	font-size: 14px;
	font-family: inherit;
	transition: background 0.2s ease, color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}
.voh-recorder__rerecord-btn:hover { background: var(--voh-primary); color: #ffffff; }

/* ----- Form ----- */
.voh-recorder__form {
	display: none;
	flex-direction: column;
	gap: 16px;
	padding-top: 8px;
	animation: voh-fade-in 0.4s ease;
}
.voh-recorder--has-content .voh-recorder__form { display: flex; }

@keyframes voh-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.voh-recorder__field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}
@media (max-width: 480px) {
	.voh-recorder__field-row { grid-template-columns: 1fr; }
}

.voh-recorder__field label,
.voh-recorder__consent-fieldset legend {
	display: block;
	font-weight: 700;
	font-size: 14px;
	color: var(--voh-text);
	margin-bottom: 6px;
	letter-spacing: 0;
}
.voh-recorder__field label span[aria-hidden] { color: var(--voh-accent-dark); }
.voh-recorder__optional {
	color: var(--voh-text-muted);
	font-weight: 400;
	font-size: 12px;
}

.voh-recorder__input,
.voh-recorder__textarea {
	width: 100%;
	border: 2px solid var(--voh-border);
	border-radius: 8px;
	padding: 11px 14px;
	font-size: 16px;
	font-family: inherit;
	color: var(--voh-text);
	background: var(--voh-bg);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.voh-recorder__input:focus,
.voh-recorder__textarea:focus {
	outline: none;
	border-color: var(--voh-primary);
	box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.12);
}
.voh-recorder__textarea { resize: vertical; min-height: 120px; }

/* ----- Consent radio group ----- */
.voh-recorder__consent-fieldset {
	border: 2px solid var(--voh-border);
	border-radius: 8px;
	padding: 14px 16px;
	background: var(--voh-bg-soft);
	margin: 0;
}
.voh-recorder__radio-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	color: var(--voh-text);
	cursor: pointer;
	padding: 6px 0;
}
.voh-recorder__radio-label input[type="radio"] {
	width: 18px;
	height: 18px;
	margin-top: 2px;
	accent-color: var(--voh-primary);
	cursor: pointer;
	flex-shrink: 0;
}

/* ----- Submit button ----- */
.voh-recorder__submit-btn {
	background: var(--voh-accent);
	color: var(--voh-primary);
	border: none;
	padding: 16px 24px;
	border-radius: 10px;
	font-size: 16px;
	font-weight: 800;
	letter-spacing: 0;
	cursor: pointer;
	font-family: inherit;
	margin-top: 4px;
	transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: 0 6px 16px -4px rgba(163, 230, 53, 0.5);
	-webkit-tap-highlight-color: transparent;
}
.voh-recorder__submit-btn:hover:not(:disabled) {
	background: var(--voh-accent-dark);
	transform: translateY(-1px);
	box-shadow: 0 10px 20px -4px rgba(132, 204, 22, 0.5);
}
.voh-recorder__submit-btn:active:not(:disabled) { transform: translateY(0); }
.voh-recorder__submit-btn:focus-visible {
	outline: 3px solid var(--voh-primary);
	outline-offset: 3px;
}
.voh-recorder__submit-btn:disabled { opacity: 0.7; cursor: progress; }

/* ----- Status + success ----- */
.voh-recorder__status {
	margin-top: 14px;
	padding: 0;
	font-size: 14px;
	line-height: 1.45;
	text-align: center;
}
.voh-recorder__status:not(:empty) { padding: 12px 16px; border-radius: 8px; }
.voh-recorder__status--error { background: #fef2f2; color: var(--voh-error); border: 1px solid #fecaca; }
.voh-recorder__status--info { background: #eff6ff; color: var(--voh-primary); border: 1px solid #bfdbfe; }

.voh-recorder__note {
	margin-top: 14px;
	text-align: center;
	font-size: 13px;
	color: var(--voh-text-muted);
}

.voh-recorder__success {
	display: none;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 40px 20px;
	color: var(--voh-primary);
}
.voh-recorder--success .voh-recorder__tabs,
.voh-recorder--success .voh-recorder__mode,
.voh-recorder--success .voh-recorder__form,
.voh-recorder--success .voh-recorder__status { display: none; }
.voh-recorder--success .voh-recorder__success { display: flex; animation: voh-fade-in 0.5s ease; }
.voh-recorder__success svg { color: var(--voh-accent-dark); margin-bottom: 12px; }
.voh-recorder__success h4 {
	font-size: 24px; font-weight: 800; margin: 0 0 8px; color: var(--voh-primary);
}
.voh-recorder__success p { margin: 0; color: var(--voh-text-muted); font-size: 16px; line-height: 1.5; }

/* ----- Mobile ----- */
@media (max-width: 480px) {
	.voh-recorder { padding: 24px 18px; border-radius: 12px; }
	.voh-recorder__heading { font-size: 24px; }
	.voh-recorder__stage { padding: 26px 14px; }
	.voh-recorder__record-btn { width: 134px; height: 134px; }
	.voh-recorder__phone-icon svg,
	.voh-recorder__phone-icon .voh-recorder__icon-mask { width: 40px; height: 40px; }
	.voh-recorder__timer { font-size: 28px; }
	.voh-recorder__tab span { font-size: 13px; }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
	.voh-recorder__stage[data-state="recording"] .voh-recorder__record-btn { animation: none; }
	.voh-recorder__pulse span { animation: none; transform: scaleY(0.7); }
	.voh-recorder__form,
	.voh-recorder__success { animation: none; }
}
