/* PetPal Admin - Linear Purple Style */
:root {
  --bg: #f0ecf8;
  --bg-card: #ffffff;
  --primary: #5e6ad2;
  --primary-light: rgba(94,106,210,0.08);
  --primary-hover: #4f5ac0;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #8a8aa0;
  --border: rgba(94,106,210,0.12);
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login Page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 48px; width: 400px; box-shadow: var(--shadow-lg); text-align: center; }
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-title { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-error { background: #fef2f2; color: var(--danger); padding: 10px 16px; border-radius: var(--radius); font-size: 13px; text-align: left; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-logo { font-size: 28px; }
.sidebar-title { font-size: 16px; font-weight: 700; color: var(--text); }
.sidebar-subtitle { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; }
.nav-section { margin-bottom: 4px; }
.nav-section-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 12px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); color: var(--text-secondary); cursor: pointer; transition: var(--transition); font-size: 14px; }
.nav-item:hover { background: var(--primary-light); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-footer .nav-item { font-size: 13px; }

.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; }
.main-header { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; }
.main-title { font-size: 20px; font-weight: 700; }
.main-content { flex: 1; padding: 24px 32px; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--border); transition: var(--transition); }
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.stat-today { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-today .up { color: var(--success); }

/* Charts Row */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--border); }
.chart-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.chart-container { position: relative; height: 200px; }

/* Data Table */
.data-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.data-toolbar .search-input { flex: 1; min-width: 200px; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg-card); color: var(--text); }
.data-toolbar .search-input:focus { outline: none; border-color: var(--primary); }
.data-toolbar select { height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg-card); color: var(--text); cursor: pointer; }
.data-table-wrap { overflow-x: auto; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); background: #faf9fe; }
.data-table td { padding: 12px 16px; font-size: 13px; color: var(--text); border-bottom: 1px solid rgba(0,0,0,0.03); }
.data-table tr:hover td { background: var(--primary-light); }
.data-table .cell-bold { font-weight: 600; }
.data-table .cell-muted { color: var(--text-muted); font-size: 12px; }
.data-table .tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: var(--primary-light); color: var(--primary); margin: 1px; }
.data-table .tag.danger { background: #fef2f2; color: var(--danger); }
.data-table .tag.success { background: #f0fdf4; color: var(--success); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; }
.pagination button { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 13px; transition: var(--transition); }
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page-info { font-size: 13px; color: var(--text-muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: var(--transition); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; background: transparent; border: none; cursor: pointer; font-size: 16px; border-radius: var(--radius); transition: var(--transition); }
.btn-icon:hover { background: var(--primary-light); }
.btn-group { display: flex; gap: 8px; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px; width: 90%; max-width: 700px; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.modal-body { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg-card); color: var(--text); transition: var(--transition); }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); }
.form-textarea { min-height: 80px; resize: vertical; font-family: inherit; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Map Search */
.map-search-row { display: flex; gap: 8px; align-items: center; }
.map-search-row .form-input { flex: 1; }
.map-search-row .btn { flex-shrink: 0; }
.map-search-results { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-card); }
.map-search-item:hover { background: rgba(94,106,210,0.06); }
.map-search-item:last-child { border-bottom: none !important; }

/* Markdown Editor */
.md-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; height: 400px; }
.md-editor textarea { width: 100%; height: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; font-family: 'SF Mono', 'Cascadia Code', monospace; line-height: 1.6; resize: none; background: #faf9fe; }
.md-editor textarea:focus { outline: none; border-color: var(--primary); }
.md-preview { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; background: var(--bg-card); font-size: 13px; line-height: 1.8; }
.md-preview h2 { font-size: 18px; font-weight: 700; margin: 16px 0 8px; color: var(--text); }
.md-preview h3 { font-size: 15px; font-weight: 600; margin: 12px 0 6px; color: var(--text); }
.md-preview p { margin-bottom: 8px; color: var(--text-secondary); }
.md-preview ul, .md-preview ol { padding-left: 20px; margin-bottom: 8px; }
.md-preview li { margin-bottom: 4px; }
.md-preview table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.md-preview th, .md-preview td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; font-size: 12px; }
.md-preview th { background: #faf9fe; font-weight: 600; }

/* Detail Modal */
.detail-section { margin-bottom: 16px; }
.detail-section-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.detail-row { display: flex; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,0.03); }
.detail-label { width: 120px; font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.detail-value { flex: 1; font-size: 13px; color: var(--text); }

/* Empty State */
.empty-state { text-align: center; padding: 48px 0; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 14px; }

/* Toast */
.toast { position: fixed; top: 16px; right: 16px; padding: 12px 20px; border-radius: var(--radius); color: #fff; font-size: 13px; font-weight: 500; z-index: 9999; animation: slideIn 0.3s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--text-muted); font-size: 14px; }
.loading::after { content: ''; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; margin-left: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .sidebar-title, .sidebar .sidebar-subtitle, .sidebar .nav-section-title, .sidebar .nav-item span:not(.nav-icon) { display: none; }
  .main { margin-left: 60px; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .md-editor { grid-template-columns: 1fr; height: auto; }
  .md-editor textarea { height: 200px; }
  .md-preview { height: 200px; }
}

/* ===== ICP 备案号 ===== */
.sidebar-icp {
  font-size: 11px;
  color: #8b8ba3;
  text-align: center;
  padding: 10px 8px 4px;
  line-height: 1.4;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 6px;
}
.login-icp {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  font-size: 12px;
  color: #9a9ab0;
  z-index: 5;
}
