/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --bg: #080808;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #222222;
  --text: #f0f0f0;
  --text2: #888888;
  --green: #22c55e;
  --green-dim: #166534;
  --orange: #f5a623;
  --red: #ef4444;
  --yellow: #eab308;
  --sidebar-width: 240px;
}

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

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo span {
  color: var(--green);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text2);
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  font-size: 14px;
}

.nav-link:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-link.active {
  background: var(--surface2);
  color: var(--green);
  border-left-color: var(--green);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* ── Main content ───────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 28px 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

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

.page-content {
  padding: 28px 32px;
  flex: 1;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
  margin-bottom: 16px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-value.green { color: var(--green); }
.stat-value.orange { color: var(--orange); }
.stat-value.red { color: var(--red); }

/* ── Grid layouts ──────────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

thead tr {
  background: var(--surface2);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--surface2);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-danger:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface2);
  color: var(--text);
}

.btn-warning {
  background: var(--orange);
  color: #000;
  border-color: var(--orange);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.badge-yellow {
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
}

.badge-orange {
  background: rgba(245, 166, 35, 0.15);
  color: var(--orange);
}

.badge-gray {
  background: rgba(136, 136, 136, 0.15);
  color: var(--text2);
}

/* Notification dot */
#alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  margin-left: 4px;
}

/* ── Alert Cards ─────────────────────────────────────────────────────────────── */
.alert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--border);
  position: relative;
}

.alert-card.critical {
  border-left-color: var(--red);
}

.alert-card.warning {
  border-left-color: var(--yellow);
}

.alert-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.alert-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.alert-meta {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 8px;
}

.alert-desc {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
}

.alert-action {
  font-size: 12px;
  color: var(--green);
  font-style: italic;
}

.alert-dismiss {
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}

.alert-dismiss:hover {
  color: var(--text);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-green { background: var(--green); }

/* ── Chart container ──────────────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 300px;
}

.chart-container canvas {
  max-height: 300px;
}

/* ── Container health ─────────────────────────────────────────────────────────── */
.container-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.container-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.container-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.running { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.stopped { background: var(--red); }

.container-detail {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
}

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--green);
}

.form-control option {
  background: var(--surface2);
}

/* ── Search + filter bar ──────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-control {
  width: auto;
  min-width: 160px;
}

.filter-bar input.form-control {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

/* ── Login page ──────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
  text-align: center;
}

.login-logo span { color: var(--green); }

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: var(--red);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ── Outreach stats ──────────────────────────────────────────────────────────── */
.outreach-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.outreach-stat {
  text-align: center;
}

.outreach-stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.outreach-stat-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Status message ──────────────────────────────────────────────────────────── */
.status-msg {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 12px;
  display: none;
}

.status-msg.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
  display: block;
}

.status-msg.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  display: block;
}

/* ── Outreach row action ─────────────────────────────────────────────────────── */
.pause-btn-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.pause-indicator {
  font-size: 12px;
  color: var(--orange);
  font-weight: 600;
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }

.text-muted  { color: var(--text2); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-orange { color: var(--orange); }
.text-sm     { font-size: 12px; }
.text-right  { text-align: right; }
.flex        { display: flex; }
.items-center { align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.justify-between { justify-content: space-between; }
.w-full      { width: 100%; }

.empty-state {
  text-align: center;
  color: var(--text2);
  padding: 40px 20px;
  font-size: 14px;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .page-content { padding: 16px; }
}
