/**
 * Voice Message Field Styles for Elementor Pro Form
 *
 * طراحی و توسعه توسط امیر پذیرا
 * وبسایت: https://amirpazira.ir
 *
 * @package NightSpark
 */

.ns-voice-field-wrapper,
.ns-voice-field-wrapper * {
	box-sizing: border-box !important;
}

.ns-voice-field-wrapper {
	width: 100% !important;
	display: block !important;
	font-family: inherit;
	line-height: normal;
	position: relative !important;
}

.ns-voice-field-wrapper .ns-voice-card,
.ns-voice-card {
	position: relative !important;
	width: 100% !important;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	padding: 16px 18px !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
	transition: all 0.25s ease-in-out;
	margin: 0 !important;
}

/* Dark Mode Support */
[data-theme="dark"] .ns-voice-card,
.ns-dark .ns-voice-card {
	background: #1e293b;
	border-color: #334155;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	color: #f1f5f9;
}

.ns-voice-has-error .ns-voice-card {
	border-color: #ef4444 !important;
	box-shadow: 0 0 0 1px #ef4444 !important;
}

/* ==========================================================================
   مدیریت قطعی وضعیت‌ها (جلوگیری ۱۰۰٪ از نمایش همزمان چند وضعیت)
   ========================================================================== */
.ns-voice-card .ns-voice-state {
	display: none !important;
	width: 100% !important;
	align-items: center !important;
	justify-content: space-between !important;
	gap: 12px !important;
	flex-wrap: wrap !important;
	transition: opacity 0.2s ease;
}

/* وضعیت فعال بر اساس صفت data-state ظرف کارت */
.ns-voice-card[data-state="idle"] .ns-voice-state-idle {
	display: flex !important;
}

.ns-voice-card[data-state="recording"] .ns-voice-state-recording {
	display: flex !important;
}

.ns-voice-card[data-state="processing"] .ns-voice-state-processing {
	display: flex !important;
}

.ns-voice-card[data-state="preview"] .ns-voice-state-preview {
	display: flex !important;
}

/* ==========================================================================
   ریست عمومی و پایه دکمه‌های کامپوننت جهت خنثی‌سازی استایل قالب‌ها
   ========================================================================== */
.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn,
.ns-voice-card .ns-voice-btn,
.ns-voice-btn {
	all: unset;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px !important;
	padding: 10px 18px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	border-radius: 10px !important;
	border: none !important;
	outline: none !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	user-select: none !important;
	text-decoration: none !important;
	line-height: 1.4 !important;
	margin: 0 !important;
	width: auto !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	font-family: inherit !important;
	box-shadow: none !important;
}

/* --------------------------------------------------------------------------
   ۱. وضعیت آماده ضبط (Idle)
   -------------------------------------------------------------------------- */
.ns-voice-state-idle {
	justify-content: space-between !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-record,
.ns-voice-card .ns-voice-btn-record,
.ns-voice-btn-record {
	background-color: #2481cc;
	background-image: linear-gradient(135deg, #2AABEE 0%, #2481cc 100%);
	color: #ffffff !important;
	box-shadow: 0 2px 8px rgba(36, 129, 204, 0.3) !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-record:hover,
.ns-voice-card .ns-voice-btn-record:hover,
.ns-voice-btn-record:hover {
	background-image: linear-gradient(135deg, #229ED9 0%, #1c6ba8 100%);
	color: #ffffff !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(36, 129, 204, 0.4) !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-record:active,
.ns-voice-card .ns-voice-btn-record:active,
.ns-voice-btn-record:active {
	transform: translateY(0);
}

.ns-voice-icon-mic {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	line-height: 1 !important;
}

.ns-voice-icon-mic svg,
.ns-voice-card svg {
	display: block !important;
	flex-shrink: 0 !important;
	fill: currentColor;
}

.ns-voice-btn-label {
	display: inline-block !important;
	color: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
	line-height: inherit !important;
}

.ns-voice-meta {
	display: inline-flex !important;
	align-items: center !important;
}

.ns-voice-badge {
	font-size: 12px !important;
	color: #64748b !important;
	background-color: #f1f5f9;
	padding: 5px 12px !important;
	border-radius: 20px !important;
	font-weight: 500 !important;
	line-height: 1.4 !important;
}

[data-theme="dark"] .ns-voice-badge,
.ns-dark .ns-voice-badge {
	background-color: #0f172a;
	color: #94a3b8 !important;
}

/* --------------------------------------------------------------------------
   ۲. وضعیت در حال ضبط (Recording - با حس و حال مدرن تلگرامی)
   -------------------------------------------------------------------------- */
.ns-voice-state-recording {
	background: #f8fafc;
	border: 1px solid #f1f5f9;
	border-radius: 10px;
	padding: 10px 14px !important;
}

[data-theme="dark"] .ns-voice-state-recording,
.ns-dark .ns-voice-state-recording {
	background: #0f172a;
	border-color: #334155;
}

.ns-voice-recording-info {
	display: inline-flex !important;
	align-items: center !important;
	gap: 12px !important;
	flex-wrap: wrap !important;
}

.ns-voice-live-indicator {
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	color: #ef4444;
}

.ns-voice-pulsing-dot {
	width: 10px !important;
	height: 10px !important;
	background-color: #ef4444;
	border-radius: 50% !important;
	display: inline-block !important;
	animation: ns-voice-pulse 1.3s infinite ease-in-out;
}

@keyframes ns-voice-pulse {
	0% {
		transform: scale(0.9);
		box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
	}
	70% {
		transform: scale(1.15);
		box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
	}
	100% {
		transform: scale(0.9);
		box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
	}
}

/* امواج صوتی تعاملی */
.ns-voice-waveform {
	display: flex !important;
	align-items: center !important;
	gap: 3px !important;
	height: 22px !important;
	padding-inline: 6px !important;
	margin: 0 !important;
}

.ns-voice-wave-bar {
	width: 3px !important;
	height: 6px;
	background: #ef4444;
	border-radius: 3px !important;
	transition: height 0.08s ease;
	min-height: 4px;
	max-height: 22px;
	display: inline-block !important;
}

.ns-voice-timer-wrap {
	display: inline-flex !important;
	align-items: baseline !important;
	gap: 4px !important;
	font-size: 13px !important;
	font-variant-numeric: tabular-nums !important;
	font-weight: 700 !important;
	color: #1e293b;
	direction: ltr !important;
}

[data-theme="dark"] .ns-voice-timer-wrap,
.ns-dark .ns-voice-timer-wrap {
	color: #f1f5f9;
}

.ns-voice-timer-max {
	font-size: 11px !important;
	font-weight: 500 !important;
	color: #94a3b8 !important;
}

.ns-voice-recording-actions {
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
}

/* دکمه تأیید و ذخیره صوت (به رنگ سبز مثبت و اطمینان‌بخش) */
.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-stop,
.ns-voice-card .ns-voice-btn-stop,
.ns-voice-btn-stop {
	background-color: #10b981;
	background-image: linear-gradient(135deg, #10b981 0%, #059669 100%);
	color: #ffffff !important;
	padding: 8px 16px !important;
	font-size: 13px !important;
	border-radius: 8px !important;
	box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-stop:hover,
.ns-voice-card .ns-voice-btn-stop:hover,
.ns-voice-btn-stop:hover {
	background-image: linear-gradient(135deg, #059669 0%, #047857 100%);
	box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45) !important;
	transform: translateY(-1px);
}

.ns-voice-icon-check {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
}

/* دکمه لغو و انصراف از ضبط */
.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-cancel,
.ns-voice-card .ns-voice-btn-cancel,
.ns-voice-btn-cancel {
	background-color: transparent !important;
	color: #64748b !important;
	border: 1px solid #cbd5e1 !important;
	padding: 8px 12px !important;
	border-radius: 8px !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 4px !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-cancel:hover,
.ns-voice-card .ns-voice-btn-cancel:hover,
.ns-voice-btn-cancel:hover {
	background-color: #fee2e2 !important;
	border-color: #fca5a5 !important;
	color: #ef4444 !important;
}

[data-theme="dark"] .ns-voice-btn-cancel,
.ns-dark .ns-voice-btn-cancel {
	border-color: #475569 !important;
	color: #94a3b8 !important;
}

[data-theme="dark"] .ns-voice-btn-cancel:hover,
.ns-dark .ns-voice-btn-cancel:hover {
	background-color: rgba(239, 68, 68, 0.15) !important;
	border-color: rgba(239, 68, 68, 0.4) !important;
	color: #f87171 !important;
}

/* --------------------------------------------------------------------------
   ۳. وضعیت پردازش و تبدیل (Processing)
   -------------------------------------------------------------------------- */
.ns-voice-state-processing {
	justify-content: center !important;
	padding: 12px 0 !important;
	gap: 10px !important;
}

.ns-voice-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid #e2e8f0;
	border-top-color: #2481cc;
	border-radius: 50%;
	animation: ns-voice-spin 0.7s infinite linear;
}

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

.ns-voice-processing-text {
	font-size: 13px;
	color: #64748b;
	font-weight: 500;
}

/* --------------------------------------------------------------------------
   ۴. وضعیت پیام صوتی ثبت‌شده (Preview - طراحی شبیه پیام صوتی تلگرام)
   -------------------------------------------------------------------------- */
.ns-voice-state-preview {
	flex-direction: column !important;
	align-items: stretch !important;
	gap: 14px !important;
}

/* نوار بالای تاییدیه تلگرامی */
.ns-voice-preview-banner {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	border-radius: 10px;
	padding: 6px 12px !important;
}

[data-theme="dark"] .ns-voice-preview-banner,
.ns-dark .ns-voice-preview-banner {
	background: rgba(16, 185, 129, 0.1);
	border-color: rgba(16, 185, 129, 0.3);
}

.ns-voice-success-pill {
	display: inline-flex !important;
	align-items: center !important;
	gap: 6px !important;
	color: #065f46;
	font-size: 12px !important;
	font-weight: 600 !important;
}

[data-theme="dark"] .ns-voice-success-pill,
.ns-dark .ns-voice-success-pill {
	color: #6ee7b7;
}

.ns-voice-check-icon {
	color: #10b981;
	display: inline-flex !important;
	align-items: center !important;
}

.ns-voice-file-badge {
	display: inline-flex !important;
	align-items: center !important;
	gap: 6px !important;
}

.ns-voice-badge-tag {
	background-color: #10b981;
	color: #ffffff !important;
	font-size: 10px !important;
	font-weight: 700 !important;
	padding: 2px 6px !important;
	border-radius: 4px !important;
	letter-spacing: 0.5px;
	line-height: 1.2 !important;
}

.ns-voice-file-size {
	color: #065f46;
	font-weight: 600;
	font-size: 11px;
}

[data-theme="dark"] .ns-voice-file-size,
.ns-dark .ns-voice-file-size {
	color: #a7f3d0;
}

/* پلیر صوتی تلگرامی */
.ns-voice-player {
	display: flex !important;
	align-items: center !important;
	gap: 12px !important;
	width: 100% !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-play,
.ns-voice-card .ns-voice-btn-play,
.ns-voice-btn-play {
	all: unset;
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	max-width: 44px !important;
	min-height: 44px !important;
	max-height: 44px !important;
	border-radius: 50% !important;
	background-color: #2481cc;
	background-image: linear-gradient(135deg, #2AABEE 0%, #2481cc 100%);
	color: #ffffff !important;
	border: none !important;
	outline: none !important;
	padding: 0 !important;
	margin: 0 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	flex-shrink: 0 !important;
	transition: all 0.2s ease !important;
	box-shadow: 0 3px 10px rgba(36, 129, 204, 0.35) !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-play:hover,
.ns-voice-card .ns-voice-btn-play:hover,
.ns-voice-btn-play:hover {
	background-image: linear-gradient(135deg, #229ED9 0%, #1c6ba8 100%);
	color: #ffffff !important;
	transform: scale(1.05);
}

.ns-voice-progress-container {
	flex-grow: 1;
	display: flex !important;
	flex-direction: column !important;
	gap: 5px !important;
}

.ns-voice-progress-bar {
	position: relative !important;
	width: 100% !important;
	height: 8px !important;
	background-color: #e2e8f0;
	border-radius: 4px !important;
	cursor: pointer !important;
	overflow: hidden !important;
	margin: 0 !important;
	padding: 0 !important;
}

[data-theme="dark"] .ns-voice-progress-bar,
.ns-dark .ns-voice-progress-bar {
	background-color: #334155;
}

.ns-voice-progress-fill {
	position: absolute !important;
	inset-inline-start: 0 !important;
	top: 0 !important;
	height: 100% !important;
	background: #2481cc;
	border-radius: 4px !important;
	transition: width 0.05s linear;
}

.ns-voice-player-time {
	display: flex !important;
	align-items: center !important;
	gap: 4px !important;
	font-size: 11px !important;
	color: #64748b;
	direction: ltr !important;
	font-variant-numeric: tabular-nums !important;
	font-weight: 600 !important;
}

[data-theme="dark"] .ns-voice-player-time,
.ns-dark .ns-voice-player-time {
	color: #94a3b8;
}

.ns-voice-time-divider {
	color: #cbd5e1;
	margin-inline: 2px;
}

/* فوتر عملیات پیش‌نمایش */
.ns-voice-preview-actions {
	display: flex !important;
	align-items: center !important;
	justify-content: flex-end !important;
	gap: 8px !important;
	border-top: 1px dashed #e2e8f0;
	padding-top: 10px !important;
}

[data-theme="dark"] .ns-voice-preview-actions,
.ns-dark .ns-voice-preview-actions {
	border-top-color: #334155;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-action,
.ns-voice-card .ns-voice-btn-action,
.ns-voice-btn-action {
	all: unset;
	display: inline-flex !important;
	align-items: center !important;
	gap: 5px !important;
	background-color: #f8fafc !important;
	border: 1px solid #e2e8f0 !important;
	border-radius: 6px !important;
	padding: 5px 12px !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	color: #475569 !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	line-height: 1 !important;
	font-family: inherit !important;
	box-shadow: none !important;
}

[data-theme="dark"] .ns-voice-btn-action,
.ns-dark .ns-voice-btn-action {
	background-color: #0f172a !important;
	border-color: #334155 !important;
	color: #cbd5e1 !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-retake:hover,
.ns-voice-card .ns-voice-btn-retake:hover,
.ns-voice-btn-retake:hover {
	background-color: #f1f5f9 !important;
	color: #0f172a !important;
}

[data-theme="dark"] .ns-voice-btn-retake:hover,
.ns-dark .ns-voice-btn-retake:hover {
	background-color: #334155 !important;
	color: #f8fafc !important;
}

.ns-voice-field-wrapper .ns-voice-card button.ns-voice-btn-delete:hover,
.ns-voice-card .ns-voice-btn-delete:hover,
.ns-voice-btn-delete:hover {
	background-color: #fee2e2 !important;
	color: #ef4444 !important;
	border-color: #fca5a5 !important;
}

[data-theme="dark"] .ns-voice-btn-delete:hover,
.ns-dark .ns-voice-btn-delete:hover {
	background-color: rgba(239, 68, 68, 0.2) !important;
	color: #f87171 !important;
	border-color: #ef4444 !important;
}

/* --------------------------------------------------------------------------
   ۵. باکس خطاهای اعتبارسنجی
   -------------------------------------------------------------------------- */
.ns-voice-error-notice {
	margin-top: 10px !important;
	font-size: 12px !important;
	line-height: 1.5 !important;
	padding: 8px 12px !important;
	border-radius: 8px !important;
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
	box-sizing: border-box !important;
}

[data-theme="dark"] .ns-voice-error-notice,
.ns-dark .ns-voice-error-notice {
	background: rgba(239, 68, 68, 0.15);
	color: #fca5a5;
	border-color: rgba(239, 68, 68, 0.3);
}

/* --------------------------------------------------------------------------
   واکنش‌گرایی (Responsive)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
	.ns-voice-card {
		padding: 12px !important;
	}
	.ns-voice-state {
		flex-direction: column !important;
		align-items: stretch !important;
	}
	.ns-voice-state-idle .ns-voice-btn-record {
		width: 100% !important;
	}
	.ns-voice-state-idle .ns-voice-meta {
		justify-content: center !important;
		margin-top: 4px !important;
	}
	.ns-voice-recording-actions {
		width: 100% !important;
		justify-content: space-between !important;
	}
	.ns-voice-btn-stop {
		flex-grow: 1 !important;
	}
}
