/* ========== 基础 & 变量 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface-2: #22223a;
  --border: #2a2a45;
  --primary: #6c5ce7;
  --primary-glow: rgba(108, 92, 231, 0.25);
  --success: #00d2a0;
  --danger: #ff6b6b;
  --text: #e0e0f0;
  --text-muted: #8888aa;
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, 'Microsoft YaHei', 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ========== 头部 ========== */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px 8px;
}

.header-icon { font-size: 24px; }

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-left: 4px;
  padding-top: 5px;
}

.header-counter {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.header-counter strong {
  color: var(--primary);
  font-weight: 700;
}

.header-help {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'SF Mono', 'Consolas', monospace;
}
.header-help:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ========== 容器 ========== */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ========== 标签页 ========== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.tab:hover:not(.active) {
  color: var(--text);
  background: var(--surface-2);
}

/* ========== 面板 ========== */
.panel { display: none; flex-direction: column; gap: 16px; }
.panel.active { display: flex; }

/* ========== 拖拽区 ========== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 30px var(--primary-glow);
}

.dropzone-icon { color: var(--text-muted); margin-bottom: 12px; transition: var(--transition); }
.dropzone:hover .dropzone-icon { color: var(--primary); }
.dropzone-text { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.dropzone-hint { font-size: 12px; color: var(--text-muted); }

/* ========== 文件列表 ========== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
}

.file-item-icon { font-size: 18px; flex-shrink: 0; }

.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-size {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.file-item-remove {
  width: 24px; height: 24px;
  border: none; border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-item-remove:hover { background: var(--danger); color: #fff; }

.file-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.file-list-count {
  font-size: 12px;
  color: var(--text-muted);
}
.file-list-clear {
  font-size: 12px;
  color: var(--danger);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  transition: var(--transition);
}
.file-list-clear:hover { opacity: 0.8; }

/* ========== 分隔线 ========== */
.divider {
  display: flex; align-items: center; gap: 14px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.divider span { font-size: 12px; color: var(--text-muted); }

/* ========== 文字输入 ========== */
.text-area-wrapper { position: relative; }

.text-area {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: var(--transition);
  line-height: 1.6;
}

.text-area::placeholder { color: var(--text-muted); }
.text-area:focus {
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
}

.text-count {
  position: absolute;
  bottom: 8px; right: 12px;
  font-size: 11px; color: var(--text-muted);
}

/* ========== 按钮 ========== */
.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.5px;
}
.btn-primary:hover {
  background: #7d6ff0;
  box-shadow: 0 8px 30px var(--primary-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none;
}

#btn-receive { width: auto; padding: 14px 24px; white-space: nowrap; }

/* ========== 进度条 ========== */
.upload-progress { text-align: center; }
.progress-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%; width: 0%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; }
}
.progress-text { font-size: 12px; color: var(--text-muted); }

/* ========== 接收面板 ========== */
.receive-desc {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.code-input-group { display: flex; gap: 10px; }
.code-input-wrapper { flex: 1; position: relative; }

.code-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  text-align: center;
  letter-spacing: 8px;
  outline: none;
  transition: var(--transition);
}
.code-input::placeholder {
  letter-spacing: 1px; font-size: 14px; font-weight: 400; color: var(--text-muted);
}
.code-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 25px var(--primary-glow);
}

.code-input-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.code-input-clear.visible { display: flex; }
.code-input-clear:hover {
  background: var(--danger);
  color: #fff;
}

/* ========== 结果卡片 ========== */
.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  min-height: 120px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-content { display: none; }
.result-content.show { display: block; }

/* 文字内容 */
.text-content {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.7;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

/* 文件内容 */
.file-content { text-align: center; }

.file-preview-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.file-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.file-meta-name { font-size: 14px; font-weight: 500; word-break: break-all; }
.file-meta-info { font-size: 12px; color: var(--text-muted); }
.file-meta-expiry { font-size: 12px; color: var(--success); }
.file-meta-expiry.urgent { color: #ffa500; }
.file-meta-expiry.critical { color: var(--danger); }

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-download, .btn-copy-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-download:hover, .btn-copy-text:hover {
  background: #7d6ff0;
  box-shadow: 0 6px 25px var(--primary-glow);
}
.btn-download-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  flex-shrink: 0;
  transition: var(--transition);
}
.btn-download-sm:hover {
  background: #7d6ff0;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-copy-text.copied {
  background: var(--success);
}

/* 错误 */
.error-content {
  text-align: center; padding: 20px; color: var(--danger);
}
.error-content .error-icon { font-size: 36px; margin-bottom: 10px; }
.error-content .error-text { font-size: 14px; }

/* ========== 弹窗 ========== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 380px;
  width: 90%;
}

@keyframes modalIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 24px; font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-title { font-size: 18px; margin-bottom: 6px; }
.modal-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }

.modal-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-code {
  font-size: 42px; font-weight: 800;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  letter-spacing: 10px;
  color: var(--primary);
  text-shadow: 0 0 30px var(--primary-glow);
}
.modal-code-sm {
  font-size: 30px;
  letter-spacing: 6px;
}
.modal-code-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.modal-code-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.btn-copy, .btn-share {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-copy:hover, .btn-share:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-copy.copied, .btn-share.copied {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

/* ========== 帮助弹窗 ========== */
.help-modal {
  max-width: 440px;
  text-align: left;
  padding: 30px 32px;
}

.help-modal .modal-title {
  text-align: center;
  margin-bottom: 16px;
}

.help-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

.help-body p {
  margin-bottom: 10px;
  color: var(--text-muted);
}

.help-section {
  margin-bottom: 14px;
}

.help-section h4 {
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text);
}

.help-section ul {
  list-style: none;
  padding: 0;
}

.help-section li {
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0;
  padding-left: 12px;
  position: relative;
}

.help-section li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary);
}

.help-site {
  text-align: center;
  margin-top: 6px;
  margin-bottom: 18px !important;
}

.help-site a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.help-site a:hover {
  text-decoration: underline;
}

.help-qr {
  text-align: center;
}

.help-qr h4 {
  text-align: center;
}

.qr-img {
  width: 140px;
  height: 140px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.modal-warn { font-size: 12px; color: #ffa500; margin-bottom: 20px; }
.btn-modal { width: auto; padding: 10px 40px; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 40px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid var(--border);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== 响应式 ========== */
@media (max-width: 480px) {
  .container { padding: 0 14px 30px; }
  .code-input-group { flex-direction: column; }
  #btn-receive { width: 100%; }
  .modal { padding: 28px 24px; }
  .modal-code { font-size: 32px; letter-spacing: 6px; }
}
