/* ═══════════════════════════════════════════════
   CSS 变量 - 主题
   ═══════════════════════════════════════════════ */
:root {
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: rgba(99, 102, 241, 0.1);
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;

  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fafb;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --bg-input: #f3f4f6;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-on-primary: #ffffff;

  --border-color: #e5e7eb;
  --border-radius: 14px;
  --border-radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-input: #334155;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;

  --border-color: #334155;
  --color-primary-light: rgba(99, 102, 241, 0.15);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.5);
}

/* ═══════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
svg { width: 24px; height: 24px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.header-right { display: flex; align-items: center; gap: 4px; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
}

.logo svg { width: 24px; height: 24px; }

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background var(--transition);
}

.status-dot.connected { background: var(--color-success); animation: pulse 2s infinite; }
.status-dot.connecting { background: var(--color-warning); }
.status-dot.disconnected { background: var(--color-danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.icon-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

#theme-btn .icon-moon { display: none; }
[data-theme="dark"] #theme-btn .icon-sun { display: none; }
[data-theme="dark"] #theme-btn .icon-moon { display: block; }

/* ═══════════════════════════════════════════════
   Main Layout
   ═══════════════════════════════════════════════ */
.app-main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.section { margin-bottom: 32px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 18px; font-weight: 600; }
.section-subtitle { font-size: 13px; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════
   Drop Zone
   ═══════════════════════════════════════════════ */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 40px 20px;
  text-align: center;
  transition: all var(--transition);
  margin-bottom: 24px;
  background: var(--bg-card);
}

.drop-zone.dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: scale(1.01);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.drop-zone svg { width: 48px; height: 48px; color: var(--text-tertiary); }

.drop-zone p {
  color: var(--text-secondary);
  font-size: 14px;
}

.drop-zone-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ═══════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--color-primary); color: var(--text-on-primary); }
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary { background: var(--bg-input); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-card-hover); }

.btn-text { padding: 6px 12px; color: var(--text-secondary); font-size: 13px; }
.btn-text:hover { color: var(--color-primary); }

.btn-block { width: 100%; margin-top: 12px; }

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

/* ═══════════════════════════════════════════════
   Device Grid
   ═══════════════════════════════════════════════ */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.device-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  position: relative;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.device-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.device-card.removing {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: scale(0.9); }
}

.device-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.device-icon svg { width: 28px; height: 28px; }

.device-card.local .device-icon { opacity: 0.5; }

.device-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.device-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.device-badge-lan {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-success);
  color: #fff;
  font-weight: 500;
}

.device-badge-room {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-warning);
  color: #fff;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state svg { width: 64px; height: 64px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 500; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }
.empty-state .hint { font-size: 13px; color: var(--text-tertiary); margin-top: 4px; }

/* ═══════════════════════════════════════════════
   Transfer List
   ═══════════════════════════════════════════════ */
.transfer-list { display: flex; flex-direction: column; gap: 12px; }

.transfer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  animation: fadeIn 0.3s ease;
}

.transfer-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.transfer-icon.send { background: var(--color-primary-light); color: var(--color-primary); }
.transfer-icon.receive { background: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.transfer-icon svg { width: 20px; height: 20px; }

.transfer-info { flex: 1; min-width: 0; }

.transfer-file-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-file-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.transfer-progress-bar {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.transfer-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.transfer-item.complete .transfer-progress-fill { background: var(--color-success); }
.transfer-item.error .transfer-progress-fill { background: var(--color-danger); }

.transfer-action {
  flex-shrink: 0;
}

.transfer-status {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   Modal
   ═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-sm { max-width: 360px; }

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-body { padding: 24px; }

.modal-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions .btn { flex: 1; }

/* ═══════════════════════════════════════════════
   Tabs
   ═══════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--border-radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.tab.active { background: var(--bg-card); color: var(--text-primary); font-weight: 500; box-shadow: var(--shadow-sm); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════════════════
   Room / QR
   ═══════════════════════════════════════════════ */
.qr-container {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #fff;
  border-radius: var(--border-radius-sm);
  margin-bottom: 16px;
}

.qr-container img, .qr-container canvas {
  display: block;
}

.room-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.room-code-display .label { font-size: 14px; color: var(--text-secondary); }
.room-code-display .code {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--color-primary);
  font-family: 'Courier New', monospace;
}

.room-link-row {
  display: flex;
  gap: 8px;
}

.room-link-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 13px;
}

.room-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
}

.room-input:focus { outline: none; border-color: var(--color-primary); }

.room-devices {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ═══════════════════════════════════════════════
   Receive Dialog
   ═══════════════════════════════════════════════ */
.receive-from {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.receive-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.receive-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
}

.receive-file-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receive-file-item .size { color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════
   Settings
   ═══════════════════════════════════════════════ */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-row label { font-size: 14px; font-weight: 500; }

.setting-row input[type="text"] {
  width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  text-align: right;
}

.setting-row input[type="text"]:focus { outline: none; border-color: var(--color-primary); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-input);
  border-radius: 12px;
  transition: var(--transition);
}
.slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .slider { background: var(--color-primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.setting-info {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.8;
}

/* ═══════════════════════════════════════════════
   Toast
   ═══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 360px;
}

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); }
.toast.info { background: var(--color-primary); }

.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(20px); }
}

/* ═══════════════════════════════════════════════
   房间配对区域
   ═══════════════════════════════════════════════ */
.pairing-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pairing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  text-align: center;
  /* 固定高度防止二维码生成后溢出 */
  min-height: 380px;
  max-height: 380px;
  overflow: hidden;
}

.pairing-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.pairing-card-icon svg { width: 24px; height: 24px; }

.pairing-card h3 { font-size: 16px; font-weight: 600; }
.pairing-card p { font-size: 13px; color: var(--text-tertiary); margin-bottom: 8px; }

.qr-display {
  padding: 10px;
  background: #fff;
  border-radius: var(--border-radius-sm);
  margin: 8px 0;
  flex-shrink: 0;
}
.qr-display img, .qr-display canvas { display: block; width: 128px !important; height: 128px !important; }

.room-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.room-code-row .label { font-size: 13px; color: var(--text-secondary); }
.room-code-row .code {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--color-primary);
  font-family: 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════
   聊天窗口
   ═══════════════════════════════════════════════ */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--bg-overlay);
  display: flex;
  align-items: stretch;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.chat-window {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-peer-select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  max-width: 220px;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-conn-status {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.chat-conn-status.connected { color: var(--color-success); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* 消息气泡 */
.chat-bubble-row {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 发送方：整体右对齐 */
.chat-bubble-row.sent { justify-content: flex-end; }
/* 接收方：整体左对齐 */
.chat-bubble-row.received { justify-content: flex-start; }

/* 头像 */
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-avatar svg { width: 20px; height: 20px; }

.chat-avatar.sent {
  background: var(--color-primary);
  color: #fff;
}

.chat-avatar.received {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.chat-bubble {
  max-width: 60%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

/* 发送方气泡：绿色（类似微信） */
.chat-bubble.sent {
  background: #95ec69;
  color: #1a1a1a;
  border-radius: 16px 4px 16px 16px;
}

/* 接收方气泡：白色 */
.chat-bubble.received {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px 16px 16px 16px;
}

[data-theme="dark"] .chat-bubble.sent {
  background: #2b5e1e;
  color: #e0e0e0;
}

.chat-bubble-text {
  white-space: pre-wrap;
}

.chat-bubble-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
  text-align: right;
}

/* 聊天中的文件消息 */
.chat-file-msg {
  max-width: 65%;
  padding: 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: msgIn 0.2s ease;
}

.chat-file-msg.sent {
  background: #95ec69;
  color: #1a1a1a;
  border-radius: 16px 4px 16px 16px;
}

[data-theme="dark"] .chat-file-msg.sent {
  background: #2b5e1e;
  color: #e0e0e0;
}

.chat-file-msg.received {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px 16px 16px 16px;
}

.chat-file-icon { font-size: 28px; flex-shrink: 0; }

.chat-file-info { flex: 1; min-width: 0; }
.chat-file-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-file-size { font-size: 11px; color: var(--text-tertiary); }

.chat-file-progress {
  height: 3px;
  background: var(--bg-input);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.chat-file-progress-fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 2px;
}
.chat-file-msg.complete .chat-file-progress-fill { background: var(--color-success); width: 100%; }

.chat-file-status {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  white-space: nowrap;
}

.chat-file-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.chat-file-actions .btn {
  padding: 4px 12px;
  font-size: 12px;
}

/* 聊天输入栏 */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-input-bar.disabled { opacity: 0.5; pointer-events: none; }

.chat-file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.chat-file-btn:hover { background: var(--bg-card-hover); color: var(--color-primary); }
.chat-file-btn svg { width: 22px; height: 22px; }

.chat-text-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.chat-text-input:focus { border-color: var(--color-primary); }
.chat-text-input::placeholder { color: var(--text-tertiary); }
.chat-text-input:disabled { opacity: 0.5; }

.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  flex-shrink: 0;
  transition: all var(--transition);
}

.chat-send-btn:hover:not(:disabled) { background: var(--color-primary-hover); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-send-btn svg { width: 20px; height: 20px; }

/* 拖拽提示 */
.chat-drop-hint {
  position: absolute;
  inset: 0;
  background: rgba(99, 102, 241, 0.15);
  border: 2px dashed var(--color-primary);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.chat-drop-hint p {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-primary);
}

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  .app-header { padding: 0 16px; }
  .logo span { font-size: 18px; }
  .connection-status { display: none; }
  .app-main { padding: 16px 12px 48px; }
  .device-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
  .modal { max-width: 100%; }
  .room-code-display .code { font-size: 24px; }

  /* 配对区域移动端单列 */
  .pairing-container { grid-template-columns: 1fr; }

  /* 聊天窗口全屏 */
  .chat-window { max-width: 100%; }
  .chat-peer-select { max-width: 160px; }
  .chat-bubble { max-width: 85%; }
  .chat-file-msg { max-width: 90%; }
}
