@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700&display=swap');

:root {
  --bg-color: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.5);
  --danger-color: #ef4444;
  --danger-hover: #f87171;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
body { 
  font-family: 'Inter', system-ui, sans-serif; 
  margin: 0; 
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 400px),
                    radial-gradient(circle at bottom left, rgba(239, 68, 68, 0.1), transparent 400px);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Outfit', sans-serif; }
h1 { margin-top: 0; font-size: 2.5rem; font-weight: 700; background: linear-gradient(to right, #60a5fa, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 1.5rem; }
h2 { font-size: 1.75rem; margin-top: 2rem; margin-bottom: 1rem; color: #e2e8f0; }

header {
  display: flex; justify-content: space-between; align-items: center; 
  padding: 1rem 2rem; 
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

header nav a { 
  color: var(--text-secondary); 
  margin-right: 1.5rem; 
  text-decoration: none; 
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.3s ease;
  padding: 0.5rem;
  border-radius: 8px;
}
header nav a:hover, header nav a.active { 
  color: var(--text-primary); 
  background: rgba(255,255,255,0.05);
}

button, .btn { 
  background: var(--accent-color); 
  color: #fff; 
  border: none; 
  padding: 0.6rem 1.2rem; 
  cursor: pointer; 
  border-radius: 8px; 
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px 0 var(--accent-glow);
  display: inline-block;
  text-decoration: none;
}
button:hover, .btn:hover { 
  background: var(--accent-hover); 
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
  color: #fff;
}

.trigger-form button {
  background: var(--danger-color);
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.4);
}
.trigger-form button:hover {
  background: var(--danger-hover);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

main { padding: 2rem 2rem; max-width: 1400px; margin: 0 auto; animation: fadeIn 0.5s ease-out; }

.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem; }
.card { 
  background: var(--bg-card); 
  padding: 1.5rem; 
  border-radius: 16px; 
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.3s ease, background 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  background: var(--bg-card-hover);
}
.card h3 { margin: 0 0 0.5rem; font-size: 1rem; color: var(--text-secondary); font-weight: 500; }
.card p { margin: 0; font-size: 2.5rem; font-weight: 700; color: var(--text-primary); }

.filters { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; background: rgba(30, 41, 59, 0.5); padding: 1rem; border-radius: 12px; border: 1px solid var(--glass-border); align-items: flex-end;}
.filters .filter-group { display: flex; flex-direction: column; gap: 0.25rem; }
.filters label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500;}
.filters input, .filters select { 
  padding: 0.6rem 1rem; 
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.3s ease;
}
.filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--accent-color);
}
.filters button { padding: 0.6rem 1.2rem; }

.table-container {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(8px);
  overflow: auto;
  margin-bottom: 2rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 1rem 1.2rem; border-bottom: 1px solid var(--glass-border); font-size: 0.95rem; }
th { background: rgba(0,0,0,0.2); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.05em; white-space: nowrap; }
tr { transition: background 0.2s ease; }
tr:hover { background: rgba(255,255,255,0.03); }
tr.status-failed { background: rgba(239, 68, 68, 0.1); }
tr.status-running { background: rgba(245, 158, 11, 0.1); }
tr.status-queued { background: rgba(148, 163, 184, 0.1); }
tr.status-cancelled { background: rgba(100, 116, 139, 0.2); opacity: 0.8; }

a { color: var(--accent-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.detail { background: var(--bg-card); border-radius: 16px; padding: 2rem; border: 1px solid var(--glass-border); margin-bottom: 2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.detail-item { display: flex; flex-direction: column; }
.detail dt { font-weight: 600; margin-top: 0.5rem; color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;}
.detail dd { margin: 0.25rem 0 0.5rem 0; font-size: 1.1rem; word-break: break-all; }

.pager { margin-top: 1.5rem; display: flex; gap: 1rem; align-items: center; justify-content: center; }
.pager a { padding: 0.5rem 1rem; background: rgba(255,255,255,0.05); border-radius: 8px; border: 1px solid var(--glass-border); }
.pager a:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

textarea { 
  width: 100%; 
  font-family: ui-monospace, Menlo, monospace; 
  padding: 1rem; 
  font-size: 0.9rem; 
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent-color); }

.query-form, .comment-form { display: flex; flex-direction: column; gap: 1.25rem; max-width: 900px; margin-top: 1.5rem; background: var(--bg-card); padding: 2rem; border-radius: 16px; border: 1px solid var(--glass-border); }
.query-form label, .comment-form label { display: flex; flex-direction: column; gap: 0.5rem; font-weight: 500; }
.query-form input[type="text"], .comment-form input[type="text"] { padding: 0.75rem 1rem; background: rgba(15, 23, 42, 0.8); border: 1px solid var(--border-color); color: var(--text-primary); border-radius: 8px; }

pre.esql { white-space: pre-wrap; word-break: break-word; max-width: 100%; max-height: 12em; overflow: auto; font-size: 0.85rem; background: rgba(0,0,0,0.3); padding: 1rem; margin: 0; border-radius: 8px; border: 1px solid var(--glass-border); }
code { background: rgba(255,255,255,0.1); padding: 0.2rem 0.4rem; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; font-size: 0.9em; color: #a78bfa; }

.btn-whitelist {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-hover);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  box-shadow: none;
}
.btn-whitelist:hover {
  background: rgba(59, 130, 246, 0.3);
  transform: none;
}
.badge-whitelisted {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  display: inline-block;
}
.badge-needs-enrichment {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.dropdown-card {
  position: relative;
  z-index: 10;
}
.dropdown-card.active {
  z-index: 50;
}
.dropdown-card .dropdown-arrow {
  transition: transform 0.2s ease;
}
.dropdown-card.active .dropdown-arrow {
  transform: rotate(180deg);
}
.card-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
}
.card-dropdown.show {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.85rem;
}
.score-high { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.score-med { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.score-low { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.header-logo { display: flex; align-items: center; gap: 0.75rem; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.5rem; color: #fff; text-decoration: none !important;}
.header-logo:hover { color: #fff; background: transparent; }
.header-logo svg { width: 28px; height: 28px; color: var(--accent-color); }


/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .2s;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
}
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #34d399;
}

/* ---- Demo environment banner (sticky top) ---- */
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 1000;
  padding: 0.5rem 1.25rem;
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem; color: var(--text-secondary);
}
.demo-banner-text strong {
  color: #f59e0b; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.78rem;
}
.demo-banner-links a {
  color: var(--accent-hover); text-decoration: none; font-weight: 500; margin-left: 1.1rem;
}
.demo-banner-links a:first-child { margin-left: 0; }
.demo-banner-links a:hover { color: #fff; text-decoration: underline; }
@media (max-width: 640px) {
  .demo-banner { flex-direction: column; gap: 0.25rem; text-align: center; }
}
