/* ==========================================================================
   Baidu Push Manager - Stylesheet
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #e0e7ff;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --orange: #f59e0b;
  --orange-light: #fef3c7;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --gray-border: #e5e7eb;

  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #94a3b8;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #4f46e5;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --sidebar-w: 220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

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

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo-icon { font-size: 22px; }
.logo-text { font-size: 16px; font-weight: 700; color: #fff; }

.sidebar-nav { flex: 1; padding: 12px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 2px;
  transition: all .15s;
  cursor: pointer;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,.08); }

.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px 28px;
  min-width: 0;
}

.sidebar-toggle {
  display: none;
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-bottom: 12px;
  color: var(--text);
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-actions { display: flex; gap: 8px; }

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-blue { background: var(--blue-light); color: var(--blue); }
.stat-green { background: var(--green-light); color: var(--green); }
.stat-orange { background: var(--orange-light); color: var(--orange); }
.stat-purple { background: var(--purple-light); color: var(--purple); }

.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* ---- Mini Stats (site detail) ---- */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.mini-stat {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}
.mini-stat-label { font-size: 13px; color: var(--text-muted); }

/* ---- Card ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--gray-light);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--gray-border);
}
.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-border);
  vertical-align: middle;
}
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--gray-light); color: var(--gray); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--gray-border); }
.btn-ghost:hover { background: var(--gray-light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.req { color: var(--red); }
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
  color: var(--text);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea.form-input { resize: vertical; font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 13px; }
select.form-input { cursor: pointer; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ---- URL Input Area ---- */
.url-input-area {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  border-bottom: 1px solid var(--gray-border);
}
.url-input-area textarea { flex: 1; }

/* ---- Modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- Alert ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error { background: var(--red-light); color: var(--red); }

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease;
  max-width: 380px;
}
.toast-success { background: var(--green); color: #fff; }
.toast-error { background: var(--red); color: #fff; }
.toast-info { background: var(--blue); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Pagination ---- */
.pagination {
  padding: 16px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.page-info { font-size: 13px; color: var(--text-muted); }

/* ---- Login Page ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  text-align: center;
}
.login-logo { margin-bottom: 8px; }
.login-logo .logo-icon { font-size: 40px; }
.login-logo h1 { font-size: 20px; font-weight: 700; margin-top: 8px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .content {
    margin-left: 0;
    padding: 16px;
  }
  .sidebar-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-row { flex-wrap: wrap; }
  .form-row { flex-direction: column; }
  .page-actions { width: 100%; }
  .url-input-area { flex-direction: column; }
  .url-input-area textarea { width: 100%; }
}
