
/* ==================================================
   AI BUILD AGENT INTERFACE
   FILE: css/agent.css
   VERSION: 1.0
================================================== */

:root {
  --agent-accent: #e63946;
  --agent-bg: rgba(15, 17, 22, 0.94);
  --agent-border: rgba(255, 255, 255, 0.12);
  --agent-text: #f4f4f5;
  --agent-muted: #858993;
  --agent-green: #58d6a0;
}

/* ==============================================
   1. FLOATING AGENT CONTAINER
============================================== */

.ai-agent {
  position: absolute;

  right: clamp(20px, 4vw, 70px);
  bottom: 85px;

  width: min(370px, calc(100vw - 40px));

  z-index: 30;

  display: flex;
  flex-direction: column;

  background: var(--agent-bg);
  border: 1px solid var(--agent-border);
  border-radius: 12px;

  box-shadow:
    0 20px 65px rgba(0, 0, 0, 0.55),
    0 0 35px rgba(230, 57, 70, 0.06);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  overflow: hidden;

  opacity: 0;
  visibility: hidden;
  transform: translateY(25px);

  will-change: transform, opacity;
}

/* ==============================================
   2. AGENT HEADER
============================================== */

.ai-agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 16px 18px;

  border-bottom: 1px solid var(--agent-border);
}

.ai-agent-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.ai-agent-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(230, 57, 70, 0.12);
  border: 1px solid rgba(230, 57, 70, 0.4);
  border-radius: 7px;

  color: var(--agent-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ai-agent-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ai-agent-heading strong {
  color: var(--agent-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.ai-agent-heading > span {
  color: var(--agent-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

/* ==============================================
   3. STATUS INDICATOR
============================================== */

.ai-agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  flex-shrink: 0;

  color: var(--agent-green);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.ai-agent-status-dot {
  width: 6px;
  height: 6px;

  border-radius: 50%;
  background: var(--agent-green);

  box-shadow: 0 0 10px rgba(88, 214, 160, 0.6);

  animation: agentPulse 2s ease-in-out infinite;
}

@keyframes agentPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 5px rgba(88, 214, 160, 0.5);
  }

  50% {
    opacity: 0.45;
    box-shadow: 0 0 15px rgba(88, 214, 160, 0.85);
  }
}

/* ==============================================
   4. CURRENT TASK
============================================== */

.ai-agent-task {
  padding: 18px;
  border-bottom: 1px solid var(--agent-border);
}

.ai-agent-task-label {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 12px;

  color: var(--agent-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

#agentStepNumber {
  color: var(--agent-accent);
}

.ai-agent-task-title {
  color: var(--agent-text);

  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;

  margin-bottom: 8px;
}

.ai-agent-task-description {
  color: #a7a9b0;

  font-size: 11px;
  line-height: 1.7;
}

/* ==============================================
   5. TERMINAL EXECUTION LOG
============================================== */

.ai-agent-terminal {
  margin: 12px 14px;

  background: #0b0d11;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;

  overflow: hidden;
}

.ai-agent-terminal-header {
  display: flex;
  align-items: center;
  gap: 7px;

  padding: 10px 12px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.07);

  color: #999da6;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.09em;
}

.ai-terminal-indicator {
  width: 6px;
  height: 6px;

  border-radius: 50%;
  background: var(--agent-accent);
}

.ai-terminal-file {
  margin-left: auto;
  color: #626773;
  font-family: monospace;
  font-size: 9px;
  letter-spacing: 0;
}

.ai-agent-log {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;

  height: 110px;
  overflow: hidden;

  padding: 12px;
}

.ai-agent-log-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;

  color: #a9adb5;
  font-family: Consolas, Monaco, monospace;
  font-size: 10px;
  line-height: 1.5;

  overflow-wrap: anywhere;
}

.log-prefix {
  color: var(--agent-green);
  font-weight: 700;
  flex-shrink: 0;
}

.ai-agent-log-line.is-current {
  color: #ffffff;
}

.ai-agent-log-line.is-current .log-prefix {
  color: var(--agent-accent);
}

/* ==============================================
   6. PROGRESS FOOTER
============================================== */

.ai-agent-footer {
  padding: 13px 18px 15px;
  border-top: 1px solid var(--agent-border);
}

.ai-agent-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 10px;

  color: var(--agent-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

#agentBuildPercentage {
  color: var(--agent-accent);
  font-family: Consolas, Monaco, monospace;
  font-size: 11px;
  font-weight: 700;
}

.ai-agent-progress {
  width: 100%;
  height: 3px;

  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;

  overflow: hidden;
}

.ai-agent-progress-fill {
  width: 100%;
  height: 100%;

  background: var(--agent-accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.ai-agent-footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-top: 11px;

  color: #6c717c;
  font-size: 9px;
  letter-spacing: 0.08em;
}

#agentBuildState {
  color: var(--agent-accent);
}

/* ==============================================
   7. TABLET RESPONSIVE
============================================== */

@media (max-width: 1024px) {
  .ai-agent {
    right: 20px;
    bottom: 75px;
    width: 310px;
  }

  .ai-agent-header {
    padding: 12px 14px;
  }

  .ai-agent-task {
    padding: 14px;
  }

  .ai-agent-footer {
    padding: 12px 14px;
  }
}

/* ==============================================
   8. MOBILE RESPONSIVE
============================================== */

@media (max-width: 768px) {
  .ai-agent {
    right: 12px;
    bottom: 58px;

    width: min(290px, calc(100vw - 24px));

    border-radius: 9px;
  }

  .ai-agent-header {
    padding: 10px 12px;
  }

  .ai-agent-icon {
    width: 28px;
    height: 28px;
  }

  .ai-agent-heading strong {
    font-size: 10px;
  }

  .ai-agent-heading > span {
    font-size: 7px;
  }

  .ai-agent-task {
    padding: 12px;
  }

  .ai-agent-task-title {
    font-size: 12px;
  }

  .ai-agent-task-description {
    font-size: 10px;
  }

  .ai-agent-terminal {
    margin: 8px 10px;
  }

  .ai-agent-log {
    height: 72px;
    padding: 9px;
    gap: 5px;
  }

  .ai-agent-log-line {
    font-size: 9px;
  }

  .ai-agent-footer {
    padding: 10px 12px;
  }
}

/* ==============================================
   9. SMALL MOBILE
============================================== */

@media (max-width: 480px) {
  .ai-agent {
    width: min(260px, calc(100vw - 24px));
    right: 12px;
    bottom: 55px;
  }

  .ai-agent-task-description {
    display: none;
  }

  .ai-agent-task {
    padding: 10px 12px;
  }

  .ai-agent-task-label {
    margin-bottom: 6px;
  }

  .ai-agent-task-title {
    margin-bottom: 0;
  }

  .ai-agent-terminal {
    margin: 7px 9px;
  }

  .ai-agent-log {
    height: 54px;
  }

  .ai-agent-footer-meta {
    display: none;
  }
}

/* ==============================================
   10. REDUCED MOTION
============================================== */

@media (prefers-reduced-motion: reduce) {
  .ai-agent-status-dot {
    animation: none;
  }

  .ai-agent {
    will-change: auto;
  }
}
/* Allow GSAP to control the agent visibility */

.ai-agent {
  display: flex;
  opacity: 0;
  visibility: hidden;
}

.ai-agent[style*="visibility: inherit"],
.ai-agent[style*="visibility: visible"] {
  visibility: visible;
}