/* Base Reset & Typography */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
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: #667eea; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 0;
  box-shadow: 0 2px 16px rgba(102,126,234,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-right a {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 20px;
  transition: all 0.3s;
  border: 1px solid rgba(255,255,255,0.3);
}
.header-right a:hover {
  background: rgba(255,255,255,0.15);
  color: white;
  text-decoration: none;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* File Grid */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.file-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  border: 1px solid #f0f0f0;
}
.file-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.file-card .file-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.file-card .file-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 8px;
  word-break: break-all;
}
.file-card .file-desc {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.file-card .file-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.file-card .file-price {
  font-size: 20px;
  font-weight: 700;
  color: #e74c3c;
}
.file-card .file-price small {
  font-size: 13px;
  font-weight: 400;
}
.file-card .file-size {
  font-size: 12px;
  color: #aaa;
}
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  text-align: center;
}
.btn-dl {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}
.btn-dl:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102,126,234,0.4);
  text-decoration: none;
  color: white;
}
.btn-green {
  background: linear-gradient(135deg, #11998e, #38ef7d);
  color: white;
}
.btn-green:hover {
  box-shadow: 0 4px 12px rgba(17,153,142,0.4);
  text-decoration: none;
  color: white;
}

/* Detail Page */
.detail-wrap {
  max-width: 680px;
  margin: 40px auto;
  padding: 0 20px;
}
.detail-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.detail-card h2 {
  font-size: 22px;
  color: #1a1a2e;
  margin-bottom: 12px;
}
.detail-card .desc {
  color: #666;
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.8;
  white-space: pre-wrap;
}
.detail-card .price-tag {
  font-size: 28px;
  font-weight: 700;
  color: #e74c3c;
  margin-bottom: 24px;
}
.qr-section {
  text-align: center;
  padding: 24px;
  background: #fafafa;
  border-radius: 12px;
  border: 1px dashed #ddd;
}
.qr-section img {
  max-width: 280px;
}
.qr-section p {
  color: #888;
  font-size: 13px;
  margin-top: 12px;
}
.pay-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.pay-tab {
  padding: 8px 24px;
  border-radius: 20px;
  border: 2px solid #e0e0e0;
  background: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}
.pay-tab.active {
  border-color: #667eea;
  color: #667eea;
  background: #f0f3ff;
}
.pay-tab.wechat-tab.active {
  border-color: #07c160;
  color: #07c160;
  background: #f0faf4;
}
.pay-tab.alipay-tab.active {
  border-color: #1677ff;
  color: #1677ff;
  background: #f0f5ff;
}
.pay-tab:hover { border-color: #667eea; }
.pay-tab.wechat-tab:hover { border-color: #07c160; }
.pay-tab.alipay-tab:hover { border-color: #1677ff; }
.paid-section {
  text-align: center;
  padding: 30px;
}
.paid-section .check {
  font-size: 64px;
  color: #27ae60;
  margin-bottom: 16px;
}
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-on { background: #e8f5e9; color: #2e7d32; }
.status-off { background: #fce4ec; color: #c62828; }

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty State */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: #aaa;
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }

/* Footer */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: #999;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .file-grid { grid-template-columns: 1fr; }
  .header h1 { font-size: 17px; }
  .detail-card { padding: 24px; }
  .detail-card h2 { font-size: 18px; }
  .container { padding: 16px 12px; }
}

/* Admin Styles */
.admin-nav {
  background: white;
  border-bottom: 1px solid #eee;
  padding: 0 20px;
}
.admin-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.admin-nav a {
  padding: 14px 24px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.3s;
}
.admin-nav a:hover, .admin-nav a.active {
  color: #667eea;
  border-bottom-color: #667eea;
  text-decoration: none;
}

.admin-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

.table-wrap {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}
th {
  background: #fafafa;
  color: #666;
  font-weight: 600;
  font-size: 13px;
}
tr:hover { background: #fafbff; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.toolbar h2 {
  font-size: 20px;
  color: #333;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}
.modal h3 { margin-bottom: 20px; color: #333; }
.modal .form-group { margin-bottom: 14px; }
.modal .form-group label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.modal .form-group input,
.modal .form-group textarea,
.modal .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
}
.modal .form-group input:focus,
.modal .form-group textarea:focus { border-color: #667eea; }
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}
.btn-cancel {
  padding: 10px 20px;
  background: #f5f5f5;
  color: #666;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn-cancel:hover { background: #eee; }
.btn-submit {
  padding: 10px 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn-submit:hover { box-shadow: 0 4px 12px rgba(102,126,234,0.4); }
.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-danger:hover { background: #c0392b; }
.btn-edit {
  background: #3498db;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  margin-right: 6px;
}
.btn-edit:hover { background: #2980b9; }

/* Stats */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-card .stat-label { font-size: 13px; color: #888; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #333; }
.stat-card .stat-value.money { color: #e74c3c; }

.period-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.period-tab {
  padding: 6px 16px;
  border-radius: 16px;
  border: 1px solid #e0e0e0;
  background: white;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s;
}
.period-tab.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}
