/* ========================================
   AppStore-Web Base Stylesheet
   极简风格：纯色、栅格、留白、无渐变
   ======================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --bg: #f8f9fa;
  --bg-white: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --max-width: 1200px;
  --gap: 20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ===== Layout ===== */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--gap); }

/* ===== Header ===== */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.site-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.site-logo:hover { color: var(--text); }
.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav a {
  padding: 6px 16px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}
.site-nav a:hover,
.site-nav a.active {
  background: var(--bg);
  color: var(--text);
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 60px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
  margin: 24px 0;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.15s;
}
.card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text-secondary);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-outline { background: var(--bg-white); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-white);
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 13px; color: var(--danger); margin-top: 4px; }
textarea.form-input { min-height: 100px; resize: vertical; }
select.form-input { appearance: none; }

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.alert-info { background: #f0f7ff; color: #1e40af; border-color: #bfdbfe; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.badge-pending { background: #fffbeb; color: #92400e; }
.badge-pass { background: #f0fdf4; color: #166534; }
.badge-reject { background: #fef2f2; color: #991b1b; }
.badge-active { background: #f0fdf4; color: #166534; }
.badge-archived { background: #f3f4f6; color: #6b7280; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead { background: var(--bg); }
th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  border-bottom: 2px solid var(--border);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:hover td { background: #f9fafb; }

/* ===== Search ===== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  max-width: 500px;
}
.search-bar .form-input { flex: 1; }

/* ===== Page Header ===== */
.page-header {
  padding: 32px 0 20px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 6px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-white);
  transition: background-color 0.15s;
}
.pagination a:hover { background: var(--bg); }
.pagination .active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== Install Wizard ===== */
.install-steps {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}
.install-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.install-step.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.install-step.done {
  color: var(--success);
  border-bottom-color: var(--success);
}
.install-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  background: var(--border);
  color: var(--text-muted);
}
.install-step.active .step-num { background: var(--primary); color: #fff; }
.install-step.done .step-num { background: var(--success); color: #fff; }

/* ===== Section ===== */
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .site-header .container { flex-wrap: wrap; height: auto; padding: 10px var(--gap); }
  .site-nav { width: 100%; justify-content: flex-start; margin-top: 8px; overflow-x: auto; }
  .card-grid { grid-template-columns: 1fr; }
  .page-header { padding: 20px 0 16px; }
  .page-header h1 { font-size: 20px; }
  .search-bar { max-width: 100%; flex-direction: column; }
}

/* ===== Logo placeholder ===== */
.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  margin-right: 8px;
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }

/* ===== Detail page ===== */
.detail-header {
  margin-bottom: 24px;
}
.detail-header h1 { font-size: 24px; font-weight: 700; }
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 10px;
}
.detail-content {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Admin sidebar ===== */
.admin-layout { display: flex; min-height: calc(100vh - 160px); }
.admin-sidebar {
  width: 220px;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
}
.admin-sidebar a {
  display: block;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background-color 0.15s, color 0.15s;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: var(--bg);
  color: var(--text);
}
.admin-main { flex: 1; padding: 24px 32px; min-width: 0; }
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; padding: 8px; }
  .admin-sidebar a { padding: 8px 14px; font-size: 13px; }
  .admin-main { padding: 16px; }
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ===== File upload area ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.upload-area:hover { border-color: var(--primary); background: #f8faff; }
