/* style.css - Tema Retrô Cyber-Office para Pixel Agents x Antigravity */
:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-panel: #1e293b;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-purple: #a855f7;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 2px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 8px var(--accent-cyan));
}

.brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-tag {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--accent-cyan);
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: var(--bg-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.header-controls {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--border-color);
  border-color: var(--accent-cyan);
}

/* Layout Principal */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  padding: 20px 24px;
  flex: 1;
}

/* Área do Canvas */
.canvas-container {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

canvas#office-canvas {
  width: 100%;
  height: 100%;
  max-height: 600px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Efeito CRT / Scanlines */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 6px 100%;
  opacity: 0.8;
  display: block;
}

.crt-overlay.disabled {
  display: none;
}

/* Barra inferior do Canvas com métricas rápidas */
.canvas-footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.metrics-group {
  display: flex;
  gap: 20px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-val {
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: monospace;
}

/* Barra Lateral / Painel de Controle */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

/* Detalhes do Agente Selecionado */
.agent-card {
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 12px;
  border-left: 4px solid var(--accent-cyan);
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.agent-name {
  font-weight: 700;
  font-size: 14px;
}

.agent-role {
  font-size: 11px;
  color: var(--text-muted);
}

.agent-action {
  font-size: 12px;
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  color: var(--accent-amber);
}

.agent-thought {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  border-radius: 4px;
}

/* Feed de Logs em Tempo Real */
.log-stream {
  background: #020617;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  height: 240px;
  overflow-y: auto;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.4);
  border-left: 3px solid var(--border-color);
  animation: fadeIn 0.25s ease;
}

.log-item.terminal { border-left-color: var(--accent-green); }
.log-item.code { border-left-color: var(--accent-cyan); }
.log-item.search { border-left-color: var(--accent-amber); }
.log-item.subagent { border-left-color: var(--accent-purple); }
.log-item.user { border-left-color: var(--accent-red); }

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

.log-time {
  color: var(--text-muted);
  font-size: 10px;
  margin-right: 6px;
}

.log-agent {
  font-weight: 700;
  color: var(--accent-cyan);
}

.log-desc {
  margin-top: 2px;
  color: #e2e8f0;
}

/* Botões do Simulador / Demonstração */
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-sim {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-sim:hover {
  background: #334155;
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.office-column { display:flex;flex-direction:column;gap:20px;min-width:0; }
.office-column .canvas-container { flex:none; }
.office-column .canvas-wrapper { aspect-ratio:580 / 300;flex:none; }
.codex-console { border-color:#145d4b; }
.console-heading { display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap; }
.console-heading h2 {font-size:19px;}
.console-heading p {font-size:13px;color:var(--text-muted);margin-top:5px;}
.console-status {font-size:11px;padding:6px 10px;border:1px solid #145d4b;border-radius:20px;color:#6ee7b7;}
.console-status[data-state="running"] {color:#67e8f9;}
.console-status[data-state="waiting"],.console-status[data-state="failed"] {color:#fbbf24;}
#codex-task-form {display:flex;flex-direction:column;gap:10px;}
#codex-task-form label {font-size:12px;font-weight:600;}
#codex-task-form input,#codex-task-form textarea {width:100%;background:#090d16;color:#f8fafc;border:1px solid var(--border-color);border-radius:8px;padding:12px;font:inherit;font-size:13px;}
#codex-task-form textarea {resize:vertical;min-height:90px;}
#codex-task-form input:focus,#codex-task-form textarea:focus {outline:2px solid #10a37f;outline-offset:1px;}
#codex-task-form small {font-size:11px;color:var(--text-muted);}
.codex-messages {min-height:110px;max-height:420px;overflow:auto;border:1px solid #263347;border-radius:9px;padding:12px;display:flex;flex-direction:column;gap:12px;}
.console-empty {margin:auto;color:var(--text-muted);font-size:13px;text-align:center;padding:24px;}
.chat-message {padding:12px;border-radius:8px;background:#162335;overflow-wrap:anywhere;}
.chat-message strong {font-size:11px;display:block;margin-bottom:7px;color:#6ee7b7;}
.chat-message div {white-space:pre-wrap;line-height:1.6;font-size:13px;}
.chat-message.from-user {background:#12382f;margin-left:8%;}
.chat-message.from-user strong {color:#d1fae5;}
.console-actions {display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;}
.console-actions span {margin-right:auto;font-size:11px;color:var(--text-muted);}
#codex-send {background:#10a37f;border:1px solid #34d399;border-radius:7px;color:white;padding:10px 16px;font-weight:600;cursor:pointer;}
button:disabled {opacity:.45;cursor:default;}
.console-error {font-size:12px;line-height:1.5;color:#fda4af;}
.approval-card {background:#332810;border:1px solid #a16207;border-radius:8px;padding:14px;display:flex;flex-direction:column;gap:10px;font-size:13px;}
.approval-card pre {white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;background:#17140d;padding:10px;border-radius:6px;max-height:180px;overflow:auto;}
.approval-actions {display:flex;flex-wrap:wrap;gap:8px;}
#task-provider,.gemini-settings input {background:#090d16;color:#f8fafc;border:1px solid var(--border-color);border-radius:8px;padding:12px;font:inherit;font-size:13px;width:100%;}
.gemini-settings summary{cursor:pointer;font-size:13px;color:#93c5fd;}
.gemini-settings form{display:flex;flex-direction:column;gap:10px;margin-top:12px;}
.gemini-settings small,.connection-help{font-size:12px;line-height:1.5;color:var(--text-muted);}
.connection-help a{color:var(--accent-cyan);}
[hidden]{display:none!important;}
/* Responsividade */
.bridge-sources p { font-size: 12px; margin: 8px 0; line-height: 1.5; }
.bridge-sources small { color: var(--text-muted); line-height: 1.5; display: block; }
header { flex-wrap: wrap; gap: 12px; }
.brand, .header-status { min-width: 0; }
.canvas-footer { flex-wrap: wrap; gap: 12px; }
.metrics-group { flex-wrap: wrap; }
@media (max-width: 480px) {
  header { padding: 16px; }
  .main-layout { padding: 16px; }
  .header-status { flex-wrap: wrap; }
  .canvas-container { min-width: 0; }
}
@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}
