/* Wire — Feed Publishing Tracker */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --sidebar-hover: #1e293b;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --muted: #6b7280;
  --muted-bg: #f3f4f6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w: 240px;
}

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

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1e293b;
}
.brand-icon {
  color: var(--brand);
  font-size: 24px !important;
}
.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #f1f5f9; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item .material-icons-round { font-size: 18px !important; opacity: .85; }
.nav-item.active .material-icons-round { opacity: 1; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-text); }
.btn-logout {
  background: none; border: none; cursor: pointer;
  color: var(--sidebar-text); padding: 6px;
  border-radius: 6px; transition: background .15s, color .15s;
  display: flex; align-items: center;
}
.btn-logout:hover { background: #1e293b; color: #f87171; }

/* ── Main Content ─────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

.page-header { margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-body {}

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Stat Cards ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-icon { 
  width: 44px; height: 44px;
  border-radius: 10px;
  background: #eff6ff;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}
.stat-icon .material-icons-round { font-size: 22px !important; }
.stat-card.green .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.red .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.yellow .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.gray .stat-icon { background: var(--muted-bg); color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Tables ─────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge .material-icons-round { font-size: 13px !important; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-muted   { background: var(--muted-bg);   color: var(--muted); }
.badge-blue    { background: #eff6ff; color: var(--brand); }

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  line-height: 1;
}
.btn .material-icons-round { font-size: 16px !important; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-danger  { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-ghost   { background: #f1f5f9; color: var(--text); }
.btn-ghost:hover { background: #e2e8f0; }
.btn-success { background: var(--success-bg); color: var(--success); }
.btn-success:hover { background: #bbf7d0; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-sm .material-icons-round { font-size: 14px !important; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ── Forms ──────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-help { font-size: 11.5px; color: var(--text-muted); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

/* ── Alerts ─────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 500;
}
.alert .material-icons-round { font-size: 18px !important; flex-shrink: 0; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error   { background: var(--danger-bg);  color: var(--danger); }
.alert-info    { background: #eff6ff;            color: var(--brand); }

/* ── Login ──────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.4);
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-brand .brand-icon { font-size: 36px !important; color: var(--brand); }
.login-brand h1 { font-size: 24px; font-weight: 700; margin-top: 6px; }
.login-brand p { font-size: 13px; color: var(--text-muted); }

/* ── Feed Detail Matrix ──────────────────────── */
.matrix-table thead th.site-col {
  min-width: 120px;
  text-align: center;
}
.matrix-table td.status-cell { text-align: center; }
.article-title { font-weight: 500; }
.article-date { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.article-link { font-size: 11.5px; color: var(--brand); text-decoration: none; }
.article-link:hover { text-decoration: underline; }

/* ── Site mapping checkboxes ─────────────────── */
.sites-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
}
.site-check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.site-check-label:hover { border-color: var(--brand); background: #eff6ff; }
.site-check-label input[type=checkbox]:checked + span { color: var(--brand); }
.site-check-label:has(input:checked) { border-color: var(--brand); background: #eff6ff; }

/* ── Progress bar ───────────────────────────── */
.progress-bar { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--brand); }
.progress-fill.green { background: var(--success); }
.progress-fill.red { background: var(--danger); }

/* ── Misc ───────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.inline-flex { display: inline-flex; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .material-icons-round { font-size: 48px !important; opacity: .3; display: block; margin: 0 auto 12px; }
.empty-state p { font-size: 15px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .brand-name, .sidebar .nav-item span:not(.material-icons-round),
  .sidebar .user-meta { display: none; }
  .sidebar-brand { justify-content: center; }
  .main-content { margin-left: 60px; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
