/* ═══════════════════════════════════════════════════════════════════════════
   AI-Factory Board — style.css
   Professionelles Light-Theme Cockpit mit Voice-FAB
   ═══════════════════════════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --header-bg: #1E1E2E;
  --header-height: 40px;
  --narrative-height: 28px;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --error: #EF4444;
  --success: #22C55E;
  --text-light: #ffffff;
  --text-muted: #94A3B8;
  --bg-narrative: #F1F5F9;
  --text-narrative: #64748B;
  --fab-size: 60px;
}

html, body {
  height: 100%;
  height: 100dvh; /* Dynamic Viewport Height — fix fuer iOS/iPadOS Adressleiste */
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffffff;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  background: var(--header-bg);
  padding: 0 16px;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  color: var(--text-light);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

.header-btn.active {
  color: var(--accent);
}

/* ── Heartbeat Dot ──────────────────────────────────────────────────────── */

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}

.health-dot.healthy {
  background: var(--success);
  animation: heartbeat 2s ease-in-out infinite;
}

.health-dot.unhealthy {
  background: var(--error);
  animation: heartbeat 1s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ── Narrative Banner ───────────────────────────────────────────────────── */

.narrative-banner {
  height: var(--narrative-height);
  background: var(--bg-narrative);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-narrative);
  border-bottom: 1px solid #E2E8F0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── Grafana Container ──────────────────────────────────────────────────── */

#grafana-container {
  height: calc(100vh - var(--header-height) - var(--narrative-height));
  height: calc(100dvh - var(--header-height) - var(--narrative-height));
  width: 100%;
  position: relative;
}

#grafana-iframe {
  width: 100%;
  height: 100%;
  border: none;
  overflow: auto;
}

/* ── Voice FAB ──────────────────────────────────────────────────────────── */

.voice-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background: var(--header-bg);
  color: var(--text-light);
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.3s, background 0.3s;
  z-index: 200;
}

.voice-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.voice-fab:active {
  transform: scale(0.95);
}

.voice-fab.hidden {
  display: none;
}

/* FAB icon management */
.fab-icon { display: none; width: 28px; height: 28px; min-width: 28px; min-height: 28px; }
.voice-fab.idle .fab-icon-mic { display: block; }
.voice-fab.listening .fab-icon-mic { display: block; }
.voice-fab.processing .fab-icon-spinner { display: block; }

/* FAB states */
.voice-fab.idle {
  border-color: rgba(255, 255, 255, 0.35);
}

.voice-fab.listening {
  border-color: var(--accent);
  animation: fab-pulse 1.5s ease-in-out infinite;
}

.voice-fab.processing {
  border-color: var(--accent);
  background: var(--accent);
}

.voice-fab.processing .fab-icon-spinner {
  animation: spin 0.8s linear infinite;
}

@keyframes fab-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(59, 130, 246, 0), 0 4px 12px rgba(0, 0, 0, 0.25);
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Error Toast ────────────────────────────────────────────────────────── */

.error-toast {
  display: none;
  position: fixed;
  bottom: 96px;
  right: 24px;
  background: var(--error);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 300;
  animation: toast-in 0.3s ease;
}

.error-toast.visible {
  display: block;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
