/* ====== 基础重置 ====== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ====== 首页 ====== */
.home-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-logo {
  text-align: center;
  margin-bottom: 40px;
}

.home-logo .icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.home-logo h1 {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.home-logo p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 8px;
}

.home-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  margin-bottom: 24px;
}

.input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.input-group input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: all 0.2s;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 6px;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.home-hint {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
}

.home-hint a {
  color: var(--primary);
  text-decoration: none;
}

.recent-pages {
  margin-top: 24px;
}

.recent-pages h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.recent-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.recent-item .count {
  background: var(--border);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

/* ====== 页面视图 ====== */
.page-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title .back-btn {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 22px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.page-title .back-btn:hover {
  background: var(--border);
  color: var(--text);
}

.page-title h1 {
  font-size: 24px;
  font-weight: 700;
}

.page-title .page-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.countdown-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--text-secondary);
}

.countdown-bar .timer {
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.countdown-bar .timer.warning {
  color: var(--warning);
}

.countdown-bar .timer.danger {
  color: var(--danger);
}

/* ====== 上传区域 ====== */
.upload-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 14px;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn:hover:not(.active) {
  background: #f8fafc;
}

.tab-content {
  padding: 24px;
}

.tab-panel {
  display: none;
}

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

/* 文本输入 */
.text-input-area {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: all 0.2s;
}

.text-input-area:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.text-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* 拖拽上传区域 */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}

.drop-zone:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: scale(1.01);
}

.drop-zone .drop-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

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

.drop-zone .hint {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 6px;
}

.file-input {
  display: none;
}

.upload-progress {
  margin-top: 16px;
  display: none;
}

.upload-progress.active {
  display: block;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}

.progress-item .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ====== 内容列表 ====== */
.content-section {
  margin-bottom: 24px;
}

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

.section-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.section-header .item-count {
  font-size: 13px;
  color: var(--text-light);
  background: var(--border);
  padding: 2px 10px;
  border-radius: 10px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.content-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 文本卡片 */
.text-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 16px;
  position: relative;
  transition: all 0.2s;
}

.text-card:hover {
  box-shadow: var(--shadow-lg);
}

.text-card .text-content {
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.text-card .card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.text-card .timestamp {
  font-size: 12px;
  color: var(--text-light);
}

.card-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
  color: var(--text-secondary);
}

.icon-btn:hover {
  background: var(--border);
}

.icon-btn.copy:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.icon-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* 图片卡片 */
.image-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  transition: all 0.2s;
}

.image-card:hover {
  box-shadow: var(--shadow-lg);
}

.image-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.image-card .image-info {
  padding: 10px 12px;
}

.image-card .image-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.image-card .image-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.image-card .file-size {
  font-size: 12px;
  color: var(--text-light);
}

.image-card .card-actions {
  gap: 4px;
}

/* 文件卡片 */
.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  transition: all 0.2s;
}

.file-card:hover {
  box-shadow: var(--shadow-lg);
}

.file-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: #f1f5f9;
  flex-shrink: 0;
}

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

.file-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

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

/* ====== 空状态 ====== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 15px;
}

/* ====== Toast 提示 ====== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* ====== 图片预览模态框 ====== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
  cursor: pointer;
}

.modal-overlay.show {
  display: flex;
}

.modal-overlay img {
  max-width: 95%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ====== 重置通知 ====== */
.reset-notice {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #92400e;
}

.reset-notice.show {
  display: flex;
  animation: slideDown 0.3s ease;
}

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

/* ====== 响应式 ====== */
@media (max-width: 640px) {
  .home-container {
    padding: 20px 16px;
  }

  .home-logo h1 {
    font-size: 26px;
  }

  .home-card {
    padding: 24px 20px;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group .btn {
    width: 100%;
  }

  .page-container {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .countdown-bar {
    width: 100%;
  }

  .content-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .tab-content {
    padding: 16px;
  }

  .drop-zone {
    padding: 24px 16px;
  }

  .page-title h1 {
    font-size: 20px;
  }
}

/* ====== 加载动画 ====== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading .spinner-lg {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ====== 淡入动画 ====== */
.fade-in {
  animation: fadeIn 0.3s ease;
}

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