/* ============================================================
   数字人语音交互 Demo - 样式
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4a90d9;
  --primary-dark: #357abd;
  --success: #52c41a;
  --success-dark: #45a518;
  --warning: #faad14;
  --warning-dark: #d99a0e;
  --danger: #ff4d4f;
  --danger-dark: #d9363e;
  --bg-dark: #1a1a2e;
  --bg-panel: #16213e;
  --bg-card: #0f3460;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0b0;
  --text-muted: #6c6c80;
  --border-color: #2a2a4a;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

/* ============================================================
   Main Container
   ============================================================ */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ============================================================
   Main Content (左侧主区域)
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  padding: 0;
}

/* ============================================================
   Avatar Stage
   ============================================================ */
.avatar-stage-section {
  flex: 0 0 48%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 8px;
  overflow: hidden;
}

.avatar-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  flex-shrink: 0;
}

.avatar-stage-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.avatar-stage-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.avatar-container {
  flex: 1;
  min-height: 0;
  background-color: #05070d;
  background-image: url('https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=realistic%20professional%20website%20background%20photo%20of%20the%20Shanghai%20Bund%20waterfront%20at%20blue%20hour%2C%20Huangpu%20River%2C%20historic%20Bund%20architecture%2C%20modern%20Lujiazui%20skyline%20in%20the%20distance%2C%20soft%20city%20lights%2C%20clean%20composition%2C%20no%20people%20in%20foreground%2C%20no%20text%2C%20high%20detail%2C%20photorealistic%2C%20cinematic%20lighting&image_size=landscape_16_9');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.avatar-container canvas,
.avatar-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

/* ============================================================
   Chat Log Section
   ============================================================ */
.chat-log-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: 8px 24px 12px;
  overflow: hidden;
}

.chat-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  flex-shrink: 0;
}

.chat-log-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-log-count {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-log-container {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
}

/* 空状态 */
.log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 8px;
}

.log-empty-icon {
  font-size: 40px;
  opacity: 0.35;
}

.log-empty p {
  font-size: 14px;
}

.log-empty-hint {
  font-size: 12px;
  opacity: 0.55;
}

/* 日志条目 */
.log-entry {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  background: var(--bg-dark);
  border-left: 3px solid transparent;
  word-break: break-word;
}

.log-entry.user {
  border-left-color: var(--primary);
}

.log-entry.avatar {
  border-left-color: var(--success);
}

.log-entry.system {
  border-left-color: var(--warning);
}

.log-entry.error {
  border-left-color: var(--danger);
}

.log-time {
  color: var(--text-muted);
  font-size: 10px;
  margin-right: 8px;
}

.log-text {
  color: var(--text-primary);
}

/* ============================================================
   Mode Comparison — 位于对话记录下方，紧凑展示
   ============================================================ */
.mode-comparison {
  flex-shrink: 0;
  padding: 12px 24px 18px;
  border-top: 1px solid var(--border-color);
}

.mode-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.mode-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.mode-card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.mode-tap2talk {
  border-top: 3px solid var(--primary);
}

.mode-duplex {
  border-top: 3px solid var(--success);
}

.mode-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
}

.mode-card-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.mode-icon {
  font-size: 18px;
}

.mode-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(74, 144, 217, 0.15);
  color: var(--primary);
  border: 1px solid rgba(74, 144, 217, 0.3);
  white-space: nowrap;
}

.mode-tag-highlight {
  background: rgba(82, 196, 26, 0.15);
  color: var(--success);
  border-color: rgba(82, 196, 26, 0.3);
}

.mode-card-body {
  padding: 10px 12px;
}

.mode-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mode-features li {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 12px;
  position: relative;
}

.mode-features li::before {
  content: '·';
  position: absolute;
  left: 2px;
  font-weight: 700;
  color: var(--text-muted);
}

.mode-features li strong {
  color: var(--text-primary);
}

/* 对比总结表格 */
.mode-summary {
  background: var(--bg-panel);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
}

.mode-summary h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.compare-table th,
.compare-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.compare-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
}

.compare-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.compare-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.compare-table td {
  color: var(--text-secondary);
}

.compare-table tr:last-child td {
  border-bottom: none;
}

.compare-table td:nth-child(2) {
  color: var(--primary);
}

.compare-table td:nth-child(3) {
  color: var(--success);
}

/* ============================================================
   Control Panel (右侧控制面板)
   ============================================================ */
.control-panel {
  width: 260px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.panel-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group {
  margin-bottom: 8px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
}

.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: var(--success-dark);
}

.btn-warning {
  background: var(--warning);
  color: #1a1a2e;
}

.btn-warning:hover:not(:disabled) {
  background: var(--warning-dark);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-dark);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-compact {
  padding: 4px 8px;
  font-size: 11px;
}

.usage-card {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.usage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.usage-label {
  font-size: 11px;
  color: var(--text-muted);
}

.usage-count-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.usage-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.usage-unit {
  font-size: 11px;
  color: var(--text-secondary);
}

.usage-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-control input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 4px;
}

#volumeValue {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}

/* ============================================================
   Performance Info
   ============================================================ */
.performance-info {
  display: flex;
  gap: 6px;
}

.perf-item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
}

.perf-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.perf-value {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 20px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer code {
  color: var(--primary);
  background: rgba(74, 144, 217, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
  }

  .control-panel {
    width: 100%;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }

  .mode-cards {
    grid-template-columns: 1fr;
  }
}
