/* ════════════════════════════════════════════════════════════
   PROSPER SOUND — AI OFFICE · STYLES
   Dark premium · Gold accents · Pixel-art friendly
   ════════════════════════════════════════════════════════════ */

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

:root {
  --gold: #D4AF37;
  --gold-bright: #F0CB55;
  --gold-dim: #8a6f1e;
  --gold-glow: rgba(212, 175, 55, 0.15);
  --bg-0: #07070a;
  --bg-1: #0c0c11;
  --bg-2: #11111a;
  --bg-3: #181822;
  --surface: #1a1a24;
  --surface-2: #22222e;
  --border: #2a2a38;
  --border-strong: #383848;
  --border-gold: rgba(212, 175, 55, 0.28);
  --text: #f0f0f5;
  --text-soft: #a0a0b0;
  --text-dim: #6a6a78;
  --text-faint: #3a3a48;
  --green: #22C55E;
  --blue: #4A9EFF;
  --pink: #EC4899;
  --amber: #F59E0B;
  --red: #EF4444;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg-0);
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════════ */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 56px; z-index: 100;
  display: flex; align-items: center;
  padding: 0 22px; gap: 18px;
  background: rgba(7, 7, 10, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

.brand-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dim) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 14px;
  color: #1a1208;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.brand-text { line-height: 1.15; }
.brand-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 15px; color: var(--text);
}
.brand-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.topbar-spacer { flex: 1; }
.topbar-meta { display: flex; align-items: center; gap: 14px; }

.meta-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 20px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 12px; font-weight: 500; color: #4ade80;
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.dot.live { box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.meta-clock {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  padding: 6px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════════════
   APP LAYOUT
   ════════════════════════════════════════════════════════════ */
#app {
  display: flex;
  width: 100%; height: 100%;
  padding-top: 56px;
}

/* ════════════════════════════════════════════════════════════
   STAGE (área do escritório)
   ════════════════════════════════════════════════════════════ */
#stage {
  flex: 1; position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 35%, #15151c 0%, #08080c 75%);
}

#stage-inner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(82vh, calc(100vw - 360px - 60px));
  height: min(82vh, calc(100vw - 360px - 60px));
  max-width: 880px; max-height: 880px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px var(--border-gold),
    0 0 60px rgba(212, 175, 55, 0.05);
  background: #0a0a0a;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

#floor {
  width: 100%; height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

#agents-layer, #rooms-layer {
  position: absolute; inset: 0;
  pointer-events: none;
}

#agents-layer { pointer-events: none; }

/* AGENTE — bonequinho */
.agent {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.agent:hover {
  filter: drop-shadow(0 0 12px var(--agent-color, var(--gold))) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
  transform: translate(-50%, -103%);
  z-index: 20;
}

.agent-svg { display: block; }

.agent-label {
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: rgba(7, 7, 10, 0.92);
  border: 1px solid var(--agent-color);
  color: var(--text);
  font-size: 9.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.agent-label::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--agent-color);
}

.agent-status-dot {
  position: absolute;
  top: -2px; right: -4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  border: 1.5px solid var(--bg-0);
  box-shadow: 0 0 6px var(--green);
}
.agent-status-dot.warn { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

/* HOVER TIP */
#hover-tip {
  position: absolute;
  background: rgba(7, 7, 10, 0.96);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text);
  pointer-events: none;
  display: none;
  z-index: 50;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  max-width: 240px;
}

#hover-tip.show { display: block; }

#hover-tip .tip-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 12px;
  color: var(--gold);
}
#hover-tip .tip-role { font-size: 10px; color: var(--text-soft); margin-top: 2px; }
#hover-tip .tip-task { font-size: 10px; color: var(--text-dim); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }

/* STAGE HINT */
#stage-hint {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: rgba(7, 7, 10, 0.85);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px; color: var(--text-soft);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.hint-icon { color: var(--gold); font-weight: bold; }

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
#sidebar {
  width: 340px; min-width: 340px;
  height: 100%;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

.side-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: relative;
}
.side-header::after {
  content: '';
  position: absolute; bottom: -1px; left: 22px; right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-glow), transparent);
}

.side-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.side-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.btn-primary {
  margin: 14px 18px;
  padding: 13px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-gold);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.16) 0%, rgba(212, 175, 55, 0.06) 100%);
  color: var(--gold);
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.15), transparent);
  transition: left 0.6s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28) 0%, rgba(212, 175, 55, 0.12) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.2);
}
.btn-primary:hover::before { left: 100%; }
.btn-primary:active { transform: translateY(0); }
.btn-primary.running {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.32) 0%, rgba(212, 175, 55, 0.18) 100%);
  cursor: wait;
}
.btn-icon { font-size: 11px; }

/* Section */
.side-section {
  padding: 8px 18px 4px;
  display: flex; flex-direction: column;
}
.side-section.flex-grow { flex: 1; min-height: 0; }

.section-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 8px 4px;
}

.link-btn {
  background: none; border: none; cursor: pointer;
  font-size: 10px; color: var(--text-dim);
  font-family: inherit;
  text-transform: lowercase; letter-spacing: 0;
  padding: 2px 6px; border-radius: 4px;
  transition: color 0.15s;
}
.link-btn:hover { color: var(--gold); }

/* Lista de agentes */
#agents-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 4px; }

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.18s ease;
}

.agent-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--agent-color);
  border-radius: 3px 0 0 3px;
}

.agent-card:hover {
  background: var(--surface-2);
  border-color: var(--agent-color);
  transform: translateX(2px);
}

.agent-card.selected {
  background: var(--surface-2);
  border-color: var(--agent-color);
  box-shadow: 0 0 0 3px var(--agent-glow, transparent);
}

.agent-card-row {
  display: flex; align-items: center; gap: 10px;
}

.agent-avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: var(--agent-bg);
  border: 1px solid var(--agent-color);
  flex-shrink: 0;
}

.agent-card-info { flex: 1; min-width: 0; }
.agent-card-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 13px;
  color: var(--text);
}
.agent-card-role { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.agent-card-status {
  display: flex; align-items: center; gap: 5px;
  flex-shrink: 0;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.status-dot.warn { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

.agent-card-task {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Standup feed */
#standup-feed {
  flex: 1;
  overflow-y: auto;
  padding: 4px 4px 16px;
  display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}

#standup-feed::-webkit-scrollbar { width: 5px; }
#standup-feed::-webkit-scrollbar-track { background: transparent; }
#standup-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
#standup-feed::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.feed-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  animation: feedIn 0.4s ease both;
}

.feed-msg::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--feed-color, var(--gold));
}

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

.feed-msg-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.feed-author {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 12px;
  color: var(--feed-color, var(--gold));
}
.feed-time { font-size: 10px; color: var(--text-faint); }
.feed-text { font-size: 11.5px; color: var(--text-soft); line-height: 1.55; }
.feed-text strong { color: var(--text); font-weight: 600; }

.feed-msg.system::before { background: var(--gold); }
.feed-msg.system .feed-author { color: var(--gold); }

/* ════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 24px;
  animation: overlayIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: var(--bg-3);
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  width: 520px; max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.8),
    0 0 60px rgba(212, 175, 55, 0.1);
  animation: modalIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.modal-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.modal-avatar {
  width: 60px; height: 60px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: var(--agent-bg);
  border: 1.5px solid var(--agent-color);
  flex-shrink: 0;
  box-shadow: 0 0 24px var(--agent-glow);
}

.modal-head-info { flex: 1; min-width: 0; }
.modal-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px; font-weight: 700; color: var(--text);
}
.modal-role { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.modal-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.modal-tag {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px; font-weight: 500;
  background: var(--agent-bg);
  border: 1px solid var(--agent-color);
  color: var(--agent-color);
}

.modal-section {
  margin-bottom: 16px;
}
.modal-section-label {
  font-size: 10px; font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.modal-section-label .label-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--agent-color);
}
.modal-section-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}
.modal-section-body.danger {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.modal-section-body.success {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.modal-actions {
  display: flex; gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.modal-btn {
  flex: 1;
  padding: 12px 18px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
}

.modal-btn:hover { background: var(--surface-2); color: var(--text); }

.modal-btn.primary {
  border-color: var(--border-gold);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.06));
  color: var(--gold);
}
.modal-btn.primary:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(212, 175, 55, 0.14));
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2);
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 980px) {
  #sidebar { width: 300px; min-width: 300px; }
  #stage-inner { width: min(75vh, calc(100vw - 320px - 40px)); height: min(75vh, calc(100vw - 320px - 40px)); }
}

@media (max-width: 720px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%; min-width: 0;
    height: 50%;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  #stage-inner { width: min(90vw, 90vh); height: min(90vw, 90vh); }
  #stage-hint { font-size: 10px; padding: 6px 12px; }
  .brand-sub { display: none; }
}
