/* ============================================
   Agent Block Styles (CCCI Branded)
   ============================================ */

#agent-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f8f8f8;
}

#chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #ddd;
}

/* Intro + Helper header on Agent page */
.agent-intro,
.agent-helper {
  margin: 0 0 1rem 0;
  padding: 0.5rem 0.75rem;
  background: #f8f8f8;
  border-left: 4px solid #FFCF07; /* Cru Yellow */
  border-radius: 4px;
  color: #093C71; /* Cru Navy */
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.agent-intro.fade-in,
.agent-helper.fade-in {
  opacity: 1;
  transform: translateY(0);
}


/* =========================
   Message containers
   ========================= */
.agent-msg {
  margin-bottom: 0.75rem;
  display: flex;
}

.agent-msg-user {
  justify-content: flex-end;
}

.agent-msg-ai {
  justify-content: flex-start;
}

/* =========================
   Message bubbles
   ========================= */
.agent-bubble {
  max-width: 70%;
  padding: 0.6rem 0.9rem;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 0.95rem;
  background: #e5e5e5;
  word-wrap: break-word;
  overflow-wrap: break-word; /* modern equivalent */
}

.agent-msg-user .agent-bubble {
  background: #007BC6; /* Cru Blue */
  color: #fff;
}

.agent-bubble-error {
  background: #fdd;
  color: #900;
  border: 1px solid #e99;
}

/* =========================
   Loader Ellipsis (CCCI Branded)
   ========================= */
/* Pending AI bubble (yellow with navy dots) */
.agent-bubble-pending {
  background: #FFCF07; /* Cru Yellow bubble */
  color: #093C71;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;   /* fixed width */
  height: 32px;  /* fixed height */
  border-radius: 16px; /* pill shape */
  padding: 0;    /* remove default padding */
}

/* Smooth fade-out for loader */
.agent-bubble-pending.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Ellipsis loader inside pending bubble */
.agent-ellipsis {
  display: inline-flex;
  gap: 4px;
}

.agent-ellipsis span {
  width: 6px;
  height: 6px;
  background: #093C71; /* Cru Navy dots */
  border-radius: 50%;
  display: inline-block;
  animation: agent-ellipsis-bounce 1.4s infinite ease-in-out both;
}

.agent-ellipsis span:nth-child(1) {
  animation-delay: -0.32s;
}
.agent-ellipsis span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes agent-ellipsis-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Smooth fade-in for AI reply */
.agent-bubble.ai-reply {
  animation: fadeInScale 0.35s ease forwards;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* =========================
   Input form
   ========================= */
#agent-form {
  display: flex;
  border: 1px solid #ccc;
  border-radius: 999px;
  background: #fff;
  padding: 0.5rem 0.75rem;
}

#agent-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
}

#agent-form button {
  background: #093C71; /* Cru Navy */
  color: #fff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

#agent-form button:hover {
  background: #06294e; /* Darker Navy for hover */
}

/* Reset button */
.agent-reset-wrap {
  text-align: center;
  margin-top: 0.5rem;
}

.agent-reset-btn {
  background: transparent;
  border: none;
  color: #093C71; /* Cru Navy */
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s;
}

.agent-reset-btn:hover {
  color: #007BC6; /* Cru Blue */
}

/* =========================
   Modal (CCCI Branded)
   ========================= */
.agent-modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 60, 113, 0.8); /* Cru Navy overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.agent-modal.hidden {
  display: none;
}

.agent-modal-content {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  text-align: center;
}

.agent-modal-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 0.75rem;
  color: #093C71; /* Cru Navy */
}

.agent-modal-text {
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  color: #333;
}

.agent-modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* Buttons */
.agent-btn-confirm {
  background: #007BC6; /* Cru Blue */
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.agent-btn-confirm:hover {
  background: #005f94;
}

.agent-btn-cancel {
  background: #f1f1f1;
  color: #333;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.agent-btn-cancel:hover {
  background: #e0e0e0;
}
