/**
 * 语音识别组件样式
 * 配合 speechRecognitionMixin.js 使用
 */

/* 语音输入包装器 */
.speech-input-wrapper {
	position: relative;
	width: 100%;
}

.speech-input-wrapper .el-textarea,
.speech-input-wrapper .el-input {
	width: 100%;
}

/* 语音按钮包装器 */
.speech-btn-wrapper {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 10;
}

/* 语音按钮 */
.speech-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
	border: none;
	outline: none;
}

.speech-btn:hover {
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.speech-btn:active {
	transform: scale(0.95);
}

.speech-btn i {
	font-size: 18px;
	line-height: 1;
}

/* 语音按钮 - 识别中状态 */
.speech-btn.listening {
	background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
	animation: speech-pulse 1.5s infinite;
}

.speech-btn.listening i {
	animation: speech-mic-pulse 1s infinite;
}

/* 语音状态提示 */
.speech-status {
	position: absolute;
	right: 45px;
	top: 50%;
	transform: translateY(-50%);
	white-space: nowrap;
	font-size: 12px;
	color: #f5576c;
	font-weight: 500;
	background: rgba(255, 255, 255, 0.95);
	padding: 4px 10px;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	pointer-events: none;
}

/* 脉冲动画 */
@keyframes speech-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.7);
	}
	70% {
		box-shadow: 0 0 0 15px rgba(245, 87, 108, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(245, 87, 108, 0);
	}
}

/* 麦克风图标脉冲动画 */
@keyframes speech-mic-pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.2);
	}
}

/* ============================================
   以下是可选的扩展样式
   ============================================ */

/* 语音按钮 - 小尺寸 */
.speech-btn.speech-btn-sm {
	width: 28px;
	height: 28px;
}

.speech-btn.speech-btn-sm i {
	font-size: 14px;
}

/* 语音按钮 - 大尺寸 */
.speech-btn.speech-btn-lg {
	width: 48px;
	height: 48px;
}

.speech-btn.speech-btn-lg i {
	font-size: 24px;
}

/* 语音按钮 - 不同颜色主题 */
.speech-btn.speech-btn-primary {
	background: linear-gradient(135deg, #409eff 0%, #53a8ff 100%);
	box-shadow: 0 2px 8px rgba(64, 158, 255, 0.4);
}

.speech-btn.speech-btn-primary:hover {
	box-shadow: 0 4px 12px rgba(64, 158, 255, 0.6);
}

.speech-btn.speech-btn-success {
	background: linear-gradient(135deg, #67c23a 0%, #85ce61 100%);
	box-shadow: 0 2px 8px rgba(103, 194, 58, 0.4);
}

.speech-btn.speech-btn-success:hover {
	box-shadow: 0 4px 12px rgba(103, 194, 58, 0.6);
}

/* 语音按钮 - 禁用状态 */
.speech-btn.disabled,
.speech-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
}

.speech-btn.disabled:hover,
.speech-btn:disabled:hover {
	transform: none;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* 语音按钮包装器 - 左侧定位 */
.speech-btn-wrapper.left {
	right: auto;
	left: 10px;
}

/* 语音按钮包装器 - 顶部定位 */
.speech-btn-wrapper.top {
	bottom: auto;
	top: 10px;
}

/* 行内语音输入 - 配合 el-input 使用 */
.speech-input-inline {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.speech-input-inline .el-input,
.speech-input-inline .el-textarea {
	flex: 1;
}

.speech-input-inline .speech-btn {
	flex-shrink: 0;
}

/* 带标签的语音输入 */
.speech-input-labeled {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.speech-input-labeled .speech-label {
	font-size: 14px;
	color: #606266;
	display: flex;
	align-items: center;
	gap: 4px;
}

.speech-input-labeled .speech-label .speech-hint {
	font-size: 12px;
	color: #909399;
}

/* ============================================
   自动绑定模式样式
   ============================================ */

/* 自动绑定按钮包装器 */
.speech-auto-btn-wrapper {
	position: absolute;
	display: flex;
	align-items: center;
	gap: 8px;
	pointer-events: auto;
}

/* 自动绑定按钮 */
.speech-auto-btn {
	opacity: 0.85;
	transition: opacity 0.2s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.speech-auto-btn:hover {
	opacity: 1;
}

/* 自动绑定状态文字 */
.speech-auto-status {
	position: relative;
	right: auto;
	top: auto;
	transform: none;
	order: -1;
}

/* 自动绑定按钮 - 左侧位置时状态文字在右边 */
.speech-auto-btn-wrapper[data-position="left"] .speech-auto-status {
	order: 1;
}

/* 自动绑定模式下的动画入场效果 */
.speech-auto-btn-wrapper {
	animation: speech-auto-fade-in 0.2s ease;
}

@keyframes speech-auto-fade-in {
	from {
		opacity: 0;
		transform: translateY(-50%) scale(0.8);
	}
	to {
		opacity: 1;
		transform: translateY(-50%) scale(1);
	}
}
