/* ============================================================
   statusbar.css — Status bar: metrics, lint chip, AI status.
   ============================================================ */

/* ---------- Status bar ---------- */

#statusbar {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-muted);
  user-select: none;
}

#save-state {
  color: var(--text-faint);
}

#save-state.saved {
  color: var(--success);
}

/* AI Chat status in status bar */
#ai-chat-status {
  margin-left: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

#ai-chat-status b {
  color: var(--text);
  font-weight: 600;
}

.ai-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: aiPulse 1s infinite ease-in-out;
}

.ai-live-dot.hidden {
  display: none;
}

@keyframes aiPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* AI Chat toggle button */
#ai-chat-toggle-btn {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 27px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
}

#ai-chat-toggle-btn:hover {
  background: var(--bg-raised);
  color: var(--text);
}

#ai-chat-toggle-btn.open {
  color: var(--accent);
  background: var(--accent-dim);
}

.ai-status-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.ai-status-dot.green {
  background: var(--success);
}

.ai-status-dot.orange {
  background: var(--warning);
}

.ai-status-dot.red {
  background: var(--error);
}

.metrics {
  margin-left: auto;
  display: flex;
  gap: 16px;
}

.metric b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Reading metrics chip ---------- */

.stats-chip {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.stats-chip:hover,
.stats-chip:hover b {
  color: var(--accent);
}

/* ---------- Font scope button ---------- */

.tb-scope {
  width: auto;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tb-scope:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Backup button states ---------- */

#backup-btn.linked {
  color: var(--success);
}

#backup-btn.warn {
  color: var(--warning);
}

/* ---------- Lint chip ---------- */

.lint-chip {
  margin-left: 14px;
  padding: 1px 9px;
  border: 1px solid rgba(229, 181, 103, 0.35);
  border-radius: 20px;
  background: rgba(229, 181, 103, 0.08);
  color: var(--warning);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s ease;
}

.lint-chip:hover {
  background: rgba(229, 181, 103, 0.18);
}

.lint-chip.hidden {
  display: none;
}

@media (max-width: 540px) {
  .editor-page #statusbar {
    min-width: 0;
    overflow: hidden;
    padding-inline: 8px;
    font-size: 0.75rem;
  }

  .editor-page #ai-chat-status,
  .editor-page .metrics .metric:not(:first-child) {
    display: none;
  }

  .editor-page .metrics {
    gap: 8px;
  }
}
