/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #f0f8f7;
  padding: 10px;
  min-height: 100vh;
  overflow-y: auto;
}
/* 整体容器 */
.app-container {
  display: flex;
  width: 100%;
  height: calc(100vh - 20px);
  gap: 5px;
}
/* 面板通用样式（三个区域） */
.panel {
  background: white;
  border: 2px solid #98DBC6;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease;
}
/* 面板收起状态 */
.panel.collapsed {
  width: 50px !important;
}
.panel.collapsed .panel-content {
  display: none;
}
.panel.collapsed .panel-header h3 {
  display: none;
}
/* 面板头部 */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: #e8f8f5;
  border-bottom: 2px solid #98DBC6;
}
.panel-header h3 {
  font-size: 16px;
  color: #333;
  margin: 0 auto;
}
.panel-collapse-btn {
  width: 25px;
  height: 25px;
  border: none;
  border-radius: 3px;
  background: #98DBC6;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 面板内容 */
.panel-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}
/* 区域缩放滑块 */
.resizer {
  width: 8px;
  background: #98DBC6;
  cursor: col-resize;
  height: 100%;
  transition: background 0.2s ease, width 0.1s ease;
  position: relative;
  z-index: 100;
  user-select: none;
}

.resizer::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 40px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  pointer-events: none;
}

.resizer:hover {
  background: #7cccb6;
  width: 10px;
}

.resizer:active {
  background: #5fa89c;
  width: 10px;
}
/* 左侧：稿件存储区 */
.storage-panel {
  width: 35%;
}
.storage-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.storage-tab {
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  background: #f0f8f7;
  color: #555;
  cursor: pointer;
  font-size: 14px;
  position: relative; /* 为伪元素定位 */
  display: inline-flex; /* 🔧 修复：使用flex布局确保对齐 */
  align-items: center; /* 🔧 修复：垂直居中对齐 */
  gap: 6px; /* 🔧 修复：使用gap替代margin-left */
}

/* 🔧 新增：保存状态指示点（默认绿色-已保存） */
.storage-tab::after {
  content: '';
  display: block; /* 🔧 修复：使用block而不是inline-block */
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #28a745; /* 默认绿色-已保存 */
  flex-shrink: 0; /* 🔧 修复：防止圆点被压缩 */
  transition: background-color 0.3s ease;
}

/* 🔧 新增：未保存状态（红色） */
.storage-tab.modified::after {
  background-color: #dc3545; /* 红色-未保存 */
  animation: pulse 2s infinite; /* 轻微脉动提示 */
}

/* 🔧 新增：已保存状态（绿色） */
.storage-tab.synced::after {
  background-color: #28a745; /* 绿色-已保存 */
}

/* 🔧 新增：脉动动画（未保存时提示用户） */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}
.storage-tab.active {
  background: #98DBC6;
  color: white;
}
.storage-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.storage-tools button {
  padding: 6px 10px;
  border: none;
  border-radius: 5px;
  background: #f0f8f7;
  color: #555;
  cursor: pointer;
  font-size: 14px;
}
.storage-content {
  display: none;
  min-height: 200px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 8px;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  contenteditable: true; /* 允许编辑输入 */
}
.storage-content.active {
  display: block;
}
.storage-content .highlight {
  background: #fffacd;
  padding: 2px 4px;
  border-radius: 2px;
}
.storage-content .red-mark {
  color: #e74c3c;
  font-weight: bold;
}
.sync-btn {
  margin-top: 12px;
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  background: #98DBC6;
  color: white;
  cursor: pointer;
  font-size: 14px;
}
/* 中间：面试神器区 */
.middle-panel {
  width: 30%;
}
.practice-theme {
  margin-bottom: 15px;
  text-align: center;
}

/* 录制计时器：放在面板header右侧 */
#recording-status {
  margin-left: 10px;
}
.practice-theme h4 {
  font-size: 15px;
  color: #333;
  margin-bottom: 8px;
}
.theme-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.theme-buttons button {
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  background: #f0f8f7;
  color: #333;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}
/* 主题按钮激活状态（深色） */
.theme-buttons button.active {
  background: #98DBC6;
  color: white; /* 与存储区激活色一致 */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#current-theme {
  font-size: 15px;
  color: #555;
}
#video-container {
  width: 100%;
  height: 500px;
  border: 2px solid #98DBC6;
  border-radius: 5px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9f9f9;
  position: relative;
}
#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}
.controls button {
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  background: #98DBC6;
  color: white;
  cursor: pointer;
  font-size: 14px;
}
.controls button:disabled {
  background: #ccc;
  cursor: not-allowed;
}
.countdown {
  margin: 12px 0;
  text-align: center;
  position: relative;
  z-index: 10;
}
.countdown h4 {
  font-size: 15px;
  color: #333;
  margin-bottom: 8px;
}
.countdown input {
  width: 80%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #98DBC6;
  border-radius: 5px;
  font-size: 14px;
}
/* 开始倒计时按钮样式 */
#countdown-btn {
  background: #edb066; /* 按钮背景色（和语音合成按钮同色） */
  color: #fff; /* 文字白色 */
  border: none; /* 去掉默认边框 */
  padding: 8px 16px; /* 内边距，和输入框匹配 */
  border-radius: 5px; /* 圆角，和输入框匹配 */
  font-size: 14px; /* 字体大小，和输入框匹配 */
  cursor: pointer; /* 鼠标移上去变手型 */
  margin-right: 8px; /* 和停止按钮隔开一点 */
}
/* 停止倒计时按钮样式（配套） */
#stop-countdown-btn {
  background: #f5f5f5; /* 浅灰色背景 */
  color: #333; /* 黑色文字 */
  border: 1px solid #98DBC6; /* 和输入框同色边框 */
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
}
#timer-display {
  font-size: 16px;
  color: #555;
  margin-top: 8px;
}
.contact-info {
  margin-top: auto;
  font-size: 14px;
  color: #555;
  text-align: center;
}
.wechat-qrcode {
  width: 120px;
  height: auto;
  border: 2px solid #98DBC6;
  border-radius: 8px;
  margin: 12px auto;
  display: block;
}
/* 右侧：稿件生成区 */
.right-panel {
  width: 35%;
}
.panel-title {
  font-size: 15px;
  color: #333;
  margin-bottom: 10px;
  border-bottom: 2px solid #98DBC6;
  padding-bottom: 5px;
  text-align: center; /* 标题居中 */
}
.info-input {
  margin-bottom: 15px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.info-item {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}
.info-label {
  color: #555;
  margin-bottom: 2px;
  cursor: pointer;
  position: relative;
}
/* 输入框hover全显文字 */
/* 给标题容器加hover触发 */
.info-item:hover .info-input-box {
  white-space: normal; 
  overflow: visible; 
  height: auto; 
  z-index: 10;
  position: relative;
  background: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  padding: 5px;
}
.info-input-box {
  width: 100%;
  padding: 5px;
  border: 1px solid #98DBC6;
  border-radius: 3px;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s ease;
  min-height: 25px; /* 保证默认高度 */
  cursor: pointer; /* 鼠标悬浮时显示小手，提示可点击 */
}
.command-output-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}
.command-buttons {
  width: 35%;
}
.command-buttons button {
  width: 100%;
  padding: 8px;
  margin-bottom: 6px;
  border: none;
  border-radius: 3px;
  background: #f0f8f7;
  color: #555;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background 0.2s ease;
}
/* 指令按钮激活状态（深色） */
.command-buttons button.active {
  background: #98DBC6;
  color: white; /* 与存储区激活色一致 */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.output-area {
  width: 65%;
  border: 1px solid #98DBC6;
  border-radius: 8px;
  padding: 10px;
  background: #e8f8f5;
  min-height: 180px;
}
.output-content {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
}
.input-area {
  border: 1px solid #98DBC6;
  border-radius: 8px;
  padding: 10px;
  background: #f9e6f2;
}
.input-area textarea {
  width: 100%;
  min-height: 60px;
  max-height: 120px;
  padding: 8px;
  border: 1px solid #98DBC6;
  border-radius: 3px;
  font-size: 12px;
  resize: vertical;
}
.send-btn {
  padding: 6px 15px;
  border: none;
  border-radius: 3px;
  background: #98DBC6;
  color: white;
  cursor: pointer;
  margin-top: 8px;
  font-size: 12px;
}

/* 稿件存储区核心样式（最终版） */
/* 隐藏后台存储容器（仅存数据） */
.storage-content {
  display: none !important;
}
/* 编辑区容器（拖拽核心） */
#editor-wrapper {
  box-sizing: border-box;
  background: white;
  overflow: hidden;
}
/* 可编辑区域样式 */
#storage-editor {
  width: 100%;
  height: 100%;
  min-height: 200px;
  padding: 10px;
  border: none; /* 容器已有边框，编辑区无边框 */
  outline: none;
  background: white;
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
  overflow-y: auto;
}
/* 新增：确保高亮/标红样式生效 */
#storage-editor .highlight-mark {
  background-color: #FFFF00 !important; /* !important防止被覆盖 */
  padding: 0 2px !important;
  display: inline !important; /* 保持行内排版 */
}
#storage-editor .red-mark {
  color: #DC143C !important;
  font-weight: bold !important;
  display: inline !important;
}
/* 拖拽手柄样式 */
#editor-resizer {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: #98DBC6;
  cursor: se-resize;
  border-top-left-radius: 5px;
  z-index: 10;
}
#editor-resizer:hover {
  background: #7cccb6;
}

/* 修复最后的CSS代码，确保括号正确闭合 */
#storage-editor span {
  display: inline; /* 确保行内显示，不破坏排版 */
}

/* 强制生效：编辑区内的高亮/标红样式 */
#storage-editor .highlight-mark {
  background-color: #FFFF00 !important;
  padding: 0 2px !important;
  display: inline !important;
  /* 再加一行：确保继承字体，避免样式错位 */
  font-family: inherit !important;
  font-size: inherit !important;
}

#storage-editor .red-mark {
  color: #DC143C !important;
  font-weight: bold !important;
  display: inline !important;
  font-family: inherit !important;
  font-size: inherit !important;
}

/* 额外：确保编辑区本身不剥离样式 */
#storage-editor {
  white-space: pre-wrap !important; /* 保留换行 */
  word-wrap: break-word !important; /* 换行不截断 */
}

/* 修复按钮换行问题 */
#countWordsBtn, #clear-text-btn {
  white-space: nowrap !important; /* 防止文字换行 */
  display: inline-block !important;
  vertical-align: baseline !important;
  margin-top: 0 !important;
  height: 36px !important; /* 固定高度，确保底边对齐 */
  box-sizing: border-box !important;
  padding: 8px 16px !important;
}

#clear-text-btn {
  margin-left: 4px !important;
}

/* 同步按钮和撤销按钮也设置相同高度 */
.sync-btn, #undoSyncBtn {
  height: 36px !important;
  vertical-align: baseline !important;
  margin-top: 0 !important;
  box-sizing: border-box !important;
  padding: 8px 16px !important;
}

/* 确保语音合成按钮在下一行且间距合适 */
#tts-btn {
  margin-top: 15px !important;
  display: block !important;
}

#tts-preview-btn.active {
  background: #98DBC6; /* 试听当前参数 点击后背景变浅绿（匹配边框色，更醒目） */
  color: #fff; /* 文字变白，对比更明显 */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================================= */
/* 面试练习计时统计区域样式 */
/* ================================= */

/* 标题栏：应试模式和面试练习计时统计在同一行 */
.countdown-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 15px;
  background: #f5f5f5;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

/* 应试模式按钮：橙色背景，较大尺寸 */
.mode-btn {
  background: #edb066; /* 橙色背景 */
  color: #fff;
  border: none;
  padding: 10px 20px; /* 较大尺寸 */
  border-radius: 8px;
  font-size: 16px; /* 较大字体 */
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.mode-btn:hover {
  background: #d99d4d;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(237, 176, 102, 0.4);
}

/* 应试模式按钮激活状态 */
.mode-btn.active {
  background: #ff9800;
  box-shadow: 0 2px 10px rgba(255, 152, 0, 0.5);
}

/* 标题文字：添加图标并居中 */
.countdown-title-row h4 {
  font-size: 16px;
  color: #333;
  margin: 0;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 双列布局容器 */
.countdown-inner {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

/* 倒计时区域 */
.countdown-section {
  flex: 1;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  min-width: 200px;
}

.countdown-section h4 {
  font-size: 15px;
  color: #333;
  margin-bottom: 10px;
  font-weight: bold;
}

.countdown-section label {
  display: block;
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
}

.countdown-section input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #98DBC6;
  border-radius: 5px;
  font-size: 14px;
  box-sizing: border-box;
}

.timer-buttons {
  display: flex;
  gap: 8px;
}

/* 录制统计区域 */
.stats-section {
  flex: 1;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.stats-header span {
  font-size: 15px;
  font-weight: bold;
  color: #333;
}

.reset-btn {
  background: #f5f5f5;
  border: 1px solid #98DBC6;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  background: #98DBC6;
  color: white;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  font-size: 14px;
  color: #555;
  padding: 10px;
  background: white;
  border-radius: 4px;
  border: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  height: auto;
}

.stat-row span {
  font-weight: bold;
  color: #2d3748;
  font-size: 16px;
  min-width: 50px;
  text-align: right;
  display: inline-block;
  flex-shrink: 0;
  margin-right: -5px;
}

/* 历史记录：响应式网格布局 */
.history {
  margin-top: 15px;
}

.history h4 {
  font-size: 15px;
  color: #333;
  margin-bottom: 10px;
}

.history ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); /* 更窄的最小宽度 */
  gap: 12px;
  padding: 0;
}

.history li {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.history li:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-color: #98DBC6;
}

/* 录制时间：两行显示（日期在上，时间在下），垂直居中 */
.history li .record-time {
  font-size: 13px;
  color: #555;
  margin-bottom: 8px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
}

.history li .record-time .date {
  font-size: 12px;
  color: #666;
}

.history li .record-time .time {
  font-size: 14px;
  color: #333;
  font-weight: bold;
}

/* 视频容器 */
.history li .video-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.history li video,
.history li img {
  width: 100%;
  max-width: 200px; /* 更窄的视频宽度 */
  border-radius: 5px;
}

.history li button {
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  transition: all 0.2s ease;
}

.history li button:hover {
  background: #ff6b6b;
  color: white;
  border-color: #ff6b6b;
}

/* 评分+评论 */
.history li .score-group {
  margin-top: 8px;
  font-size: 13px;
}

.history li .ai-score {
  color: #e74c3c;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 4px;
}

.history li .ai-suggest {
  font-size: 13px;
  color: #444;
  line-height: 1.5;
  text-align: justify;
}

/* 响应式：窄屏时单列显示 */
@media (max-width: 768px) {
  .countdown-inner {
    flex-direction: column;
  }

  .countdown-section,
  .stats-section {
    min-width: 100%;
  }

  .history ul {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   保存状态提示样式 - 匹配自我介绍神器风格
   ======================================== */

/* 方案1：导航栏右侧状态提示 */
.auto-save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

/* 保存中状态 - 使用橙黄色 */
.auto-save-status.saving {
  opacity: 1;
  background: rgba(237, 176, 102, 0.15);
  color: #d99d4d;
  border: 1px solid rgba(237, 176, 102, 0.3);
}

.auto-save-status.saving .status-icon {
  animation: rotate 1s linear infinite;
}

/* 已保存状态 - 使用薄荷绿 */
.auto-save-status.saved {
  opacity: 1;
  background: rgba(152, 219, 198, 0.15);
  color: #5fb89a;
  border: 1px solid rgba(152, 219, 198, 0.4);
}

/* 保存失败状态 - 使用红色 */
.auto-save-status.error {
  opacity: 1;
  background: rgba(244, 67, 54, 0.1);
  color: #e53935;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

/* 旋转动画（保存中） */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 方案2：小圆点指示器 */
.save-indicator {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: help;
  margin-left: 5px;
}

.save-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #98DBC6; /* 薄荷绿 = 已保存 */
  transition: all 0.3s ease;
  box-shadow: 0 0 0 0 rgba(152, 219, 198, 0.4);
}

/* 保存中 - 橙黄色脉冲 */
.save-indicator.saving .dot {
  background: #edb066;
  animation: pulse 1.5s ease-in-out infinite;
}

/* 保存失败 - 红色 */
.save-indicator.error .dot {
  background: #e53935;
}

/* 脉冲动画 */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(237, 176, 102, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(237, 176, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(237, 176, 102, 0);
  }
}

/* 悬停显示详细信息 */
.save-indicator::after {
  content: attr(data-status);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: rgba(45, 55, 72, 0.95);
  color: white;
  font-size: 11px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 小三角箭头 */
.save-indicator::before {
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid rgba(45, 55, 72, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10001;
}

.save-indicator:hover::after,
.save-indicator:hover::before {
  opacity: 1;
}
