/* ========== 全局样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: #1890ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ========== 前端首页 ========== */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px;
}

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

.header h1 {
  font-size: 2rem;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.subtitle {
  color: #666;
  font-size: 1rem;
}

/* 搜索框 */
.search-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 160px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: #fafafa;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #1890ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(24,144,255,0.1);
}

.btn-group {
  flex: 0 0 auto;
  min-width: auto;
}

.help-text {
  font-size: 0.82rem;
  color: #888;
  margin-top: 4px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
  background: linear-gradient(135deg, #1890ff, #096dd9);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #40a9ff, #1890ff);
}

.btn-download {
  background: linear-gradient(135deg, #52c41a, #389e0d);
  color: #fff;
  padding: 8px 20px;
  font-size: 0.9rem;
}

.btn-download:hover {
  background: linear-gradient(135deg, #73d13d, #52c41a);
}

.btn-danger {
  background: #ff4d4f;
  color: #fff;
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-danger:hover {
  background: #ff7875;
}

.btn-info {
  background: #faad14;
  color: #fff;
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-info:hover {
  background: #ffc53d;
}

.btn-warning {
  background: #ff7a45;
  color: #fff;
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-warning:hover {
  background: #ff9c6e;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-block {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 1.05rem;
  margin-top: 8px;
}

/* ========== 提示框 ========== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error {
  background: #fff2f0;
  border: 1px solid #ffccc7;
  color: #cf1322;
}

.alert-success {
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  color: #389e0d;
}

.alert-icon {
  font-size: 1.1rem;
}

/* ========== 搜索结果 ========== */
.results {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.results-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.results-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.results-header h2 {
  font-size: 1.2rem;
  color: #389e0d;
  margin-bottom: 4px;
}

.results-info {
  color: #666;
  font-size: 0.9rem;
}

.file-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #fafafa;
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  transition: all 0.2s;
}

.file-card:hover {
  border-color: #1890ff;
  background: #f0f7ff;
}

.file-icon {
  font-size: 2rem;
  width: 48px;
  text-align: center;
}

.file-info {
  flex: 1;
}

.file-info h3 {
  font-size: 1rem;
  color: #1a1a2e;
  margin-bottom: 2px;
}

.file-meta {
  font-size: 0.82rem;
  color: #888;
}

/* ========== 页脚 ========== */
.footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #e8e8e8;
  color: #999;
  font-size: 0.85rem;
}

.friend-links {
  margin-bottom: 10px;
  color: #666;
  line-height: 1.9;
}

.friend-links-label {
  font-weight: 600;
  color: #444;
}

.friend-link-item {
  color: #1677ff;
}

.friend-link-item:hover {
  color: #4096ff;
  text-decoration: underline;
}

/* 下载次数标签 */
.download-count {
  display: inline-block;
  background: #e6f7ff;
  color: #1890ff;
  border: 1px solid #91d5ff;
  border-radius: 12px;
  padding: 1px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 32px;
  text-align: center;
}

.footer a {
  color: #1890ff;
}

/* ========== 登录页 ========== */
.login-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-box h1 {
  text-align: center;
  font-size: 1.6rem;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.login-box .form-group {
  margin-bottom: 16px;
}

.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.login-box input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
}

/* ========== 后台导航 ========== */
.admin-nav {
  background: #1a1a2e;
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-brand {
  font-size: 1.05rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: rgba(255,255,255,0.7);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.nav-links a.active {
  color: #fff;
  background: rgba(24,144,255,0.4);
}

.nav-user {
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  margin-left: 8px;
}

.btn-logout {
  color: #ff7875 !important;
  font-size: 0.82rem;
}

/* ========== 后台容器 ========== */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

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

.admin-header h1 {
  font-size: 1.4rem;
  color: #1a1a2e;
}

.badge {
  background: #1890ff;
  color: #fff;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: normal;
  vertical-align: middle;
  margin-left: 8px;
}

.admin-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-inline {
  display: flex;
  gap: 6px;
}

.search-inline input {
  padding: 6px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.88rem;
  width: 200px;
}

.search-inline input:focus {
  outline: none;
  border-color: #1890ff;
}

/* ========== 表格 ========== */
.table-wrap {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: #fafafa;
  padding: 12px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  text-align: left;
  border-bottom: 2px solid #f0f0f0;
}

.data-table td {
  padding: 12px 14px;
  font-size: 0.88rem;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #f9fbff;
}

.filename {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.82rem;
  color: #666;
}

.empty-row {
  text-align: center;
  padding: 40px !important;
  color: #999;
}

.empty-row a {
  color: #1890ff;
  font-weight: 600;
}

/* ========== 标签 ========== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.tag-blue {
  background: #e6f7ff;
  color: #1890ff;
  border: 1px solid #91d5ff;
}

.tag-green {
  background: #f6ffed;
  color: #389e0d;
  border: 1px solid #b7eb8f;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-info {
  font-size: 0.88rem;
  color: #666;
  min-width: 120px;
  text-align: center;
}

.btn-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.jump-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 6px 8px;
}

.jump-label {
  font-size: 0.82rem;
  color: #666;
}

.jump-input {
  width: 76px;
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.jump-input:focus {
  outline: none;
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24,144,255,0.12);
}

/* ========== 上传表单 ========== */
.upload-form {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  max-width: 600px;
}

.upload-form .form-group {
  margin-bottom: 20px;
}

.upload-form input,
.upload-form select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95rem;
}

.upload-form input:focus,
.upload-form select:focus {
  outline: none;
  border-color: #1890ff;
  box-shadow: 0 0 0 3px rgba(24,144,255,0.1);
}

.upload-form input[type="file"] {
  padding: 8px;
  border-style: dashed;
  background: #fafafa;
}

.code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.88rem;
  color: #d4380d;
}

/* ========== 批量上传结果 ========== */
.results-section {
  margin-top: 32px;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.results-section h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: #1a1a2e;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.result-success {
  background: #f6ffed;
  border: 1px solid #b7eb8f;
}

.result-error {
  background: #fff2f0;
  border: 1px solid #ffccc7;
}

.result-icon {
  font-size: 1rem;
}

.result-file {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.82rem;
  color: #555;
  min-width: 200px;
}

.result-msg {
  color: #666;
}

.results-summary {
  text-align: center;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  font-size: 0.9rem;
  color: #555;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }

  .btn-group {
    width: 100%;
  }

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

  .results-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-nav {
    height: auto;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

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

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }

  .filename {
    max-width: 120px;
  }

  .jump-form {
    width: 100%;
    justify-content: center;
  }
}
