/* ════════════════════════════════════════════
   admin.css — 管理控制台样式
   设计：浅色现代后台 (Dashboard 风格)
   ════════════════════════════════════════════ */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: #2a4a6e;
  background: #f5f7fb;
  line-height: 1.6;
}
input, button, select, textarea {
  font: inherit; color: inherit; outline: none;
}
button { cursor: pointer; }
a { color: inherit; text-decoration: none; cursor: pointer; }
code { font-family: 'SF Mono', Consolas, monospace; background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* ════════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════════ */
.login-page {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #4a9eff 0%, #2a72c8 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4a9eff, #2a72c8);
  color: #fff;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.login-title { text-align: center; font-size: 24px; font-weight: 800; }
.login-sub { text-align: center; color: #5a7a9e; margin-bottom: 32px; font-size: 13px; }
.login-form .form-group {
  margin-bottom: 18px;
}
.login-form label {
  display: block; font-size: 13px; color: #5a7a9e; margin-bottom: 6px;
}
.login-form input {
  width: 100%; padding: 12px 16px;
  border: 2px solid #e8eef5;
  border-radius: 12px;
  background: #f9fafc;
  transition: border-color 0.15s;
}
.login-form input:focus { border-color: #4a9eff; background: #fff; }
.login-error {
  background: #fee; color: #c0392b;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; margin-bottom: 16px;
}
.login-form button {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #4a9eff, #2a72c8);
  color: #fff; border: none;
  border-radius: 12px;
  font-size: 16px; font-weight: 700;
  transition: transform 0.15s;
}
.login-form button:hover { transform: translateY(-1px); }
.login-note {
  text-align: center; color: #8a9aae;
  font-size: 12px; margin-top: 24px;
}

/* ════════════════════════════════════════════
   APP LAYOUT
════════════════════════════════════════════ */
.admin-app {
  display: flex; height: 100vh; overflow: hidden;
}

/* — Sidebar — */
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: #1c2438;
  color: #fff;
  display: flex; flex-direction: column;
}
.sidebar-header {
  padding: 24px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4a9eff, #2a72c8);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.sidebar-title { font-size: 15px; font-weight: 700; }
.sidebar-sub { font-size: 11px; color: rgba(255, 255, 255, 0.5); }

.sidebar-nav {
  flex: 1; padding: 16px 12px; overflow-y: auto;
}
.nav-item {
  display: block; padding: 12px 16px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px; font-weight: 500;
  margin-bottom: 4px;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, #4a9eff, #2a72c8);
  color: #fff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; gap: 12px;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8a5b, #ef476f);
  color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: rgba(255, 255, 255, 0.5); }

.btn-ghost {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 8px;
  font-size: 12px;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); }
.btn-sm { padding: 6px 10px !important; font-size: 12px !important; }

/* — Main — */
.admin-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.admin-header {
  padding: 20px 32px;
  background: #fff;
  border-bottom: 1px solid #e8eef5;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-header h2 { font-size: 22px; font-weight: 800; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: #e6f9ed; color: #1d8348;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.status-dot {
  width: 8px; height: 8px;
  background: #1d8348;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.admin-page {
  flex: 1; padding: 32px;
  overflow-y: auto;
  display: none;
}
.admin-page.active { display: block; }

/* ════════════════════════════════════════════
   CARDS / GRIDS
════════════════════════════════════════════ */
.content-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
}
.content-card h3 {
  font-size: 16px; font-weight: 700;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.content-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.muted { color: #8a9aae; font-size: 13px; }

/* — Stats grid — */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  border-radius: 50%; opacity: 0.06;
}
.stat-card-primary::before { background: #4a9eff; }
.stat-card-success::before { background: #1d8348; }
.stat-card-warning::before { background: #f1c40f; }
.stat-card-info::before    { background: #9b7fd4; }

.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.stat-card-primary .stat-card-icon { background: rgba(74, 158, 255, 0.12); color: #4a9eff; }
.stat-card-success .stat-card-icon { background: rgba(29, 131, 72, 0.12); color: #1d8348; }
.stat-card-warning .stat-card-icon { background: rgba(241, 196, 15, 0.18); color: #d4a017; }
.stat-card-info    .stat-card-icon { background: rgba(155, 127, 212, 0.14); color: #9b7fd4; }

.stat-card-num { font-size: 28px; font-weight: 800; color: #1c2438; }
.stat-card-lbl { font-size: 13px; color: #5a7a9e; margin-top: 2px; }
.stat-card-trend { font-size: 11px; color: #8a9aae; margin-top: 4px; }

.content-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .content-grid-2 { grid-template-columns: 1fr; }
}

.chart-area {
  height: 240px;
  display: flex; align-items: center; justify-content: center;
  color: #8a9aae;
  background: #f9fafc;
  border-radius: 8px;
}

.event-stream {
  max-height: 320px; overflow-y: auto;
}
.event-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f3f7;
  font-size: 13px;
}
.event-item:last-child { border-bottom: none; }
.event-time { color: #8a9aae; font-family: 'SF Mono', monospace; flex-shrink: 0; }
.event-tag {
  padding: 2px 10px;
  background: rgba(74, 158, 255, 0.12);
  color: #4a9eff;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════
   TABLES & FORMS
════════════════════════════════════════════ */
.filter-bar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
  padding: 8px 12px;
  border: 1px solid #e8eef5;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  text-align: left;
  padding: 12px 14px;
  background: #f9fafc;
  color: #5a7a9e;
  font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid #e8eef5;
}
.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f3f7;
}
.data-table tbody tr:hover { background: #f9fafc; }
.data-table .empty { text-align: center; color: #8a9aae; padding: 32px !important; }
.data-table input[type="text"] {
  width: 100%; padding: 6px 10px;
  border: 1px solid #e8eef5;
  border-radius: 6px; font-size: 12px;
  font-family: 'SF Mono', monospace;
}

/* — Switch toggle — */
.switch {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; cursor: pointer;
  inset: 0;
  background: #d1d8e0;
  border-radius: 22px;
  transition: 0.2s;
}
.switch span::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + span { background: #4a9eff; }
.switch input:checked + span::before { transform: translateX(18px); }

.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #4a9eff, #2a72c8);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* — Settings rows — */
.settings-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f3f7;
}
.settings-row:last-child { border-bottom: none; }
.settings-row label:first-child {
  flex-shrink: 0; min-width: 180px;
  color: #5a7a9e; font-size: 13px; font-weight: 600;
}
.settings-row input[type="text"],
.settings-row input[type="password"],
.settings-row input[type="number"] {
  flex: 1; max-width: 360px;
  padding: 8px 12px;
  border: 1px solid #e8eef5;
  border-radius: 8px;
  font-family: 'SF Mono', monospace;
}

/* — Image upload — */
.upload-area {
  border: 2px dashed #c8d3e0;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.upload-area:hover, .upload-area.dragover {
  border-color: #4a9eff;
  background: rgba(74, 158, 255, 0.04);
}
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-text { font-size: 14px; font-weight: 600; }
.upload-sub { font-size: 12px; color: #8a9aae; margin-top: 4px; }

.upload-list {
  margin-top: 16px;
}
.upload-list .upload-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #f9fafc;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.upload-item .name { flex: 1; }
.upload-item .progress {
  width: 120px; height: 6px;
  background: #e8eef5;
  border-radius: 999px; overflow: hidden;
}
.upload-item .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a9eff, #2a72c8);
  transition: width 0.2s;
}
.upload-item .status { color: #5a7a9e; font-size: 12px; }
.upload-item.done .status { color: #1d8348; }
.upload-item.error .status { color: #c0392b; }

.img-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.img-grid .img-tile {
  aspect-ratio: 1;
  background: #f9fafc;
  border-radius: 8px;
  overflow: hidden; position: relative;
}
.img-grid .img-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.img-grid .img-tile .name {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 4px 8px;
  background: rgba(28, 36, 56, 0.7);
  color: #fff; font-size: 11px;
}
.img-grid .empty { grid-column: 1 / -1; text-align: center; color: #8a9aae; padding: 32px; }

/* — Content list — */
.content-list .content-item {
  padding: 14px;
  border: 1px solid #e8eef5;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.content-list .content-item .meta {
  color: #8a9aae; font-size: 11px; margin-bottom: 4px;
}
.content-list .content-item .title {
  font-weight: 600; color: #2a4a6e;
}
.content-list .empty { text-align: center; color: #8a9aae; padding: 48px; }

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 768px) {
  .admin-sidebar { width: 60px; }
  .sidebar-header > div, .sidebar-nav .nav-item, .user-info > div, .sidebar-sub { display: none; }
  .sidebar-header { justify-content: center; padding: 16px 0; }
  .sidebar-nav { padding: 8px 4px; }
  .nav-item { padding: 12px; text-align: center; font-size: 18px; }
  .admin-page { padding: 16px; }
  .admin-header { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
}
