/* ========================================
   AI bloop Admin — Styles
   ======================================== */

.admin-login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(10,12,20,0.85); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
}
.admin-login-card {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 36px; width: 380px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.admin-body { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sidebar-nav { flex: 1; padding: 8px 12px; }
.sidebar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: var(--font-body);
  border-left: 3px solid transparent;
}
.sidebar-item:hover { color: var(--text); background: var(--border-light); }
.sidebar-item.active { color: var(--accent); background: var(--accent-light); border-left-color: var(--accent); }
.sidebar-item span { width: 20px; text-align: center; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.sidebar-back {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 12px;
  transition: color 0.2s;
}
.sidebar-back:hover { color: var(--text); }

/* Main */
.admin-main {
  margin-left: 250px;
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* Page */
.page { display: none; }
.page.active { display: block; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.5px;
}
.page-title em { color: var(--accent); font-style: italic; }
.page-sub { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 12px; }

/* Admin Buttons */
.abtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.abtn-accent { background: var(--accent); color: #fff; }
.abtn-accent:hover { box-shadow: var(--shadow-accent); }
.abtn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.abtn-outline:hover { border-color: var(--text-muted); }
.admin-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 6px;
}
.stat-change {
  font-size: 12px;
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.stat-change.up { color: var(--accent); background: var(--accent-light); }

/* Cards */
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-head h3 { font-size: 16px; font-weight: 600; }
.badge-live {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.badge-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--border-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

/* Grids */
.grid-wide { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-half { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* Chart */
.chart-area { display: flex; align-items: flex-end; gap: 5px; height: 180px; padding-top: 16px; }
.chart-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
  min-height: 6px;
}
.chart-bar:hover::after {
  content: attr(data-val);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  color: var(--text);
}
.chart-labels { display: flex; gap: 5px; margin-top: 6px; }
.chart-labels span { flex: 1; text-align: center; font-size: 10px; font-family: var(--font-mono); color: var(--text-muted); }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.data-table td {
  padding: 12px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }
.accent { color: var(--accent); }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }

/* Status dots */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.green { background: var(--accent); }
.status-dot.yellow { background: #f5c542; }
.status-dot.blue { background: var(--blue); }
.status-dot.red { background: #ff5c5c; }

/* Activity */
.activity-feed { max-height: 350px; overflow-y: auto; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-text { color: var(--text-muted); line-height: 1.5; }
.activity-text strong { color: var(--text); }
.activity-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); opacity: 0.5; margin-top: 2px; }

/* SEO */
.seo-score-ring {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 6px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  position: relative;
}
.seo-score-ring::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 6px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-bottom-color: var(--accent);
  transform: rotate(30deg);
}
.seo-score-num { font-family: var(--font-mono); font-size: 28px; font-weight: 500; }
.seo-bars { }
.seo-bar-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.seo-bar-item span:first-child { width: 80px; color: var(--text-muted); }
.seo-bar-item span:last-child { width: 30px; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); text-align: right; }
.seo-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.seo-fill { height: 100%; border-radius: 2px; }

/* KV list */
.kv-list {}
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }

/* Agents Grid */
.agents-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.agent-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
}
.agent-card:hover { border-color: var(--text-muted); transform: translateY(-2px); }
.agent-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.agent-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.agent-av {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.agent-info { flex: 1; }
.agent-name { font-size: 14px; font-weight: 600; }
.agent-role { font-size: 12px; color: var(--text-muted); }
.agent-status {
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.agent-tasks { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.agent-task { font-size: 12px; color: var(--text-muted); padding: 3px 0; display: flex; align-items: center; gap: 6px; }
.agent-task .c { color: var(--accent); }

/* Agent Chat */
.agent-chat { }
.agent-chat-msgs {
  height: 320px;
  overflow-y: auto;
  padding: 16px 0;
}
.acm { margin-bottom: 14px; max-width: 88%; animation: fadeUp 0.3s ease; }
.acm.user { margin-left: auto; text-align: right; }
.acm-label { font-size: 11px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.acm.user .acm-label { justify-content: flex-end; }
.acm-bubble {
  display: inline-block;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
}
.acm.bot .acm-bubble { background: var(--border-light); border: 1px solid var(--border); }
.acm.user .acm-bubble { background: var(--accent); color: #fff; }
.agent-chat-bar { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.agent-chat-bar input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: var(--font-body);
}
.agent-chat-bar input:focus { border-color: var(--accent); }
.agent-chat-bar button {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.agent-chat-bar button:hover { box-shadow: var(--shadow-accent); }

/* Logs */
.log-feed {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 2;
  max-height: 600px;
  overflow-y: auto;
}
.log-line { color: var(--text-muted); }
.log-time { opacity: 0.5; }
.log-agent { color: var(--accent); }

/* Settings */
.settings-field { margin-bottom: 16px; }
.settings-field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.toggle-list {}
.toggle-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.toggle-item:last-child { border-bottom: none; }
.toggle-on { color: var(--accent); font-size: 13px; }
.toggle-off { color: #f5c542; font-size: 13px; }

/* Responsive */
@media (max-width: 1200px) {
  .agents-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .grid-wide, .grid-half { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 16px; }
  .stats-row { grid-template-columns: 1fr; }
}
