/* ═══════════════════════════════════════════════════════
   supabase.css — Supabase Explorer tab
   ═══════════════════════════════════════════════════════ */

.supa-layout {
  display: flex; height: calc(100vh - 49px); overflow: hidden;
}
.supa-sidebar {
  width: 280px; min-width: 280px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.supa-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

/* Stats banner */
.supa-stats {
  padding: 16px; text-align: center; border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.supa-stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.supa-stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.supa-stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Sync buttons */
.supa-sync-btns { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.supa-btn {
  padding: 6px 14px; font-size: 12px; font-weight: 600; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; transition: background 0.15s, opacity 0.15s;
}
.supa-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.supa-btn-danger { background: rgba(239,68,68,0.15); color: #EF4444; border-color: rgba(239,68,68,0.3); }
.supa-btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.25); }
.supa-btn-primary { background: rgba(59,130,246,0.15); color: #3B82F6; border-color: rgba(59,130,246,0.3); }
.supa-btn-primary:hover:not(:disabled) { background: rgba(59,130,246,0.25); }

/* Search */
.supa-search-wrap { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.supa-search-wrap input {
  width: 100%; box-sizing: border-box; padding: 7px 10px; font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); outline: none;
}
.supa-search-wrap input:focus { border-color: var(--accent); }

/* Category list */
.supa-cat-list {
  overflow-y: auto; padding: 8px 0; border-bottom: 1px solid var(--border);
  max-height: 220px;
}
.supa-cat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer; font-size: 13px;
  color: var(--text-dim); transition: background 0.15s;
}
.supa-cat-item:hover { background: var(--bg-hover); }
.supa-cat-item.active { background: var(--accent-dim); color: #fff; }
.supa-cat-icon { font-size: 16px; flex-shrink: 0; }
.supa-cat-name { flex: 1; font-weight: 500; }
.supa-cat-count { font-size: 12px; font-weight: 600; color: var(--accent); min-width: 30px; text-align: right; }
.supa-cat-routes { font-size: 11px; color: var(--text-muted); min-width: 55px; text-align: right; }

/* Route list */
.supa-route-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.supa-route-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 12px;
  font-family: var(--mono); color: var(--text-dim); transition: background 0.15s;
}
.supa-route-item:hover { background: var(--bg-hover); }
.supa-route-item.active { background: var(--accent-dim); color: #fff; }
.supa-route-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supa-route-count {
  font-size: 11px; font-weight: 600; background: var(--bg-secondary);
  padding: 1px 6px; border-radius: 8px; color: var(--text-dim);
}

/* Header */
.supa-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.supa-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.supa-count {
  font-size: 12px; color: var(--text-dim);
  background: var(--bg-secondary); padding: 2px 8px; border-radius: 10px;
}
.supa-loading { font-size: 12px; color: var(--accent); animation: supaPulse 1s infinite; }
@keyframes supaPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Table */
.supa-table-wrap { flex: 1; overflow: auto; padding: 0 16px; min-width: 0; }
.supa-table {
  width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed;
}
.supa-table thead th {
  text-align: left; padding: 8px 10px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
  position: sticky; top: 0; background: var(--bg);
}
.supa-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.supa-table tbody tr:hover { background: var(--bg-hover); }
.supa-table td { padding: 8px 10px; vertical-align: top; }
.supa-td-route { font-family: var(--mono); font-size: 11px; color: var(--accent); width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supa-td-key { font-family: var(--mono); font-size: 12px; width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supa-td-payload { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.supa-td-payload strong { color: var(--text); font-weight: 500; }
.supa-td-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; width: 130px; }
.supa-meta { color: var(--text-muted); font-size: 11px; }

/* Pagination */
.supa-pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px; border-top: 1px solid var(--border);
}
.supa-pagination button {
  padding: 5px 14px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg-card); color: var(--text);
  cursor: pointer;
}
.supa-pagination button:hover:not(:disabled) { background: var(--bg-hover); }
.supa-pagination button:disabled { opacity: 0.4; cursor: default; }
.supa-pagination span { font-size: 12px; color: var(--text-dim); }

/* Detail overlay */
.supa-detail-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.supa-detail-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  width: 90%; max-width: 720px; max-height: 85vh; display: flex; flex-direction: column;
  overflow: hidden;
}
.supa-detail-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.supa-detail-header h3 { margin: 0; font-size: 14px; font-family: var(--mono); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supa-detail-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--text-dim); padding: 0 4px; line-height: 1;
}
.supa-detail-close:hover { color: var(--text); }
.supa-detail-meta {
  padding: 10px 18px; font-size: 12px; color: var(--text-dim);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  display: flex; gap: 16px; flex-wrap: wrap;
}
.supa-detail-meta span { display: inline-flex; align-items: center; gap: 4px; }
.supa-detail-body {
  flex: 1; overflow: auto; padding: 16px 18px;
}
.supa-detail-body pre {
  margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 13px;
  font-family: var(--mono); color: var(--text); line-height: 1.5;
}

/* Mobile */
@media (max-width: 768px) {
  .supa-layout { flex-direction: column; }
  .supa-sidebar { width: 100%; min-width: 0; max-height: 35vh; border-right: none; border-bottom: 1px solid var(--border); }
  .supa-cat-list { max-height: 120px; }
  .supa-detail-card { width: 95%; max-width: none; }
}