/* Elite Corporate Setup — floating AI agent */

#ecs-ai-root {
  --ecs-ai-green: #65c246;
  --ecs-ai-green-dark: #4fa332;
  --ecs-ai-navy: #0d1b2a;
  --ecs-ai-line: #e6ebf0;
  --ecs-ai-bg: #f7faf8;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ecs-ai-navy);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#ecs-ai-root * {
  box-sizing: border-box;
}

.ecs-ai-fab {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ecs-ai-green), var(--ecs-ai-green-dark));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(13, 27, 42, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ecs-ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(13, 27, 42, 0.28);
}

.ecs-ai-fab[aria-expanded="true"] {
  background: var(--ecs-ai-navy);
}

.ecs-ai-panel {
  display: none;
  flex-direction: column;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 100px));
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--ecs-ai-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(13, 27, 42, 0.2);
}

.ecs-ai-panel.is-open {
  display: flex;
}

.ecs-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--ecs-ai-navy), #1b3a4b);
  color: #fff;
}

.ecs-ai-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.ecs-ai-header p {
  margin: 2px 0 0;
  font-size: 11px;
  opacity: 0.8;
  font-weight: 400;
}

.ecs-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ecs-ai-icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ecs-ai-icon-btn.is-on {
  background: var(--ecs-ai-green);
}

.ecs-ai-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ecs-ai-call-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #14324a;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.ecs-ai-call-banner[hidden] {
  display: none !important;
}

.ecs-ai-end-call {
  border: none;
  border-radius: 999px;
  padding: 7px 12px;
  background: #d64545;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ecs-ai-end-call:hover {
  background: #b93636;
}

.ecs-ai-call-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 22px;
  background: linear-gradient(180deg, #f4faf6 0%, #fff 70%);
  text-align: center;
}

.ecs-ai-call-stage[hidden] {
  display: none !important;
}

.ecs-ai-call-pulse {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9be07f, var(--ecs-ai-green) 55%, var(--ecs-ai-green-dark));
  box-shadow: 0 0 0 0 rgba(101, 194, 70, 0.45);
  animation: ecs-ai-call-pulse 1.8s ease-out infinite;
}

#ecs-ai-root.is-in-call .ecs-ai-call-pulse {
  animation-duration: 1.4s;
}

.ecs-ai-call-stage-label {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ecs-ai-navy);
}

.ecs-ai-call-stage-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #5a6b75;
  max-width: 260px;
}

.ecs-ai-interrupt {
  margin-top: 6px;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--ecs-ai-navy);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(13, 27, 42, 0.18);
}

.ecs-ai-interrupt:hover {
  background: #163247;
}

.ecs-ai-interrupt[hidden] {
  display: none !important;
}

@keyframes ecs-ai-call-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(101, 194, 70, 0.45);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(101, 194, 70, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(101, 194, 70, 0);
  }
}

#ecs-ai-root.is-in-call .ecs-ai-fab {
  background: #d64545;
}

#ecs-ai-root.is-in-call .ecs-ai-panel {
  height: min(420px, calc(100vh - 100px));
}

#ecs-ai-root.is-in-call .ecs-ai-input-row {
  display: none;
}

.ecs-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(180deg, var(--ecs-ai-bg), #fff 40%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ecs-ai-messages[hidden] {
  display: none !important;
}

.ecs-ai-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ecs-ai-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--ecs-ai-line);
  border-bottom-left-radius: 4px;
}

.ecs-ai-bubble.user {
  align-self: flex-end;
  background: var(--ecs-ai-green);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ecs-ai-bubble.error {
  align-self: flex-start;
  background: #fff5f5;
  border: 1px solid #f5c2c2;
  color: #8a1f1f;
}

.ecs-ai-typing {
  align-self: flex-start;
  font-size: 12px;
  color: #667;
  padding: 0 4px;
}

.ecs-ai-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--ecs-ai-line);
  background: #fff;
  align-items: flex-end;
}

.ecs-ai-input {
  flex: 1;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  border: 1.5px solid var(--ecs-ai-line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: var(--ecs-ai-bg);
}

.ecs-ai-input:focus {
  outline: none;
  border-color: var(--ecs-ai-green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(101, 194, 70, 0.15);
}

.ecs-ai-send,
.ecs-ai-mic {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ecs-ai-send {
  background: var(--ecs-ai-green);
  color: #fff;
}

.ecs-ai-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ecs-ai-mic {
  background: #eef3f0;
  color: var(--ecs-ai-navy);
}

.ecs-ai-mic.is-listening {
  background: #ffe8e8;
  color: #c0392b;
  animation: ecs-ai-pulse 1s infinite;
}

.ecs-ai-mic:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@keyframes ecs-ai-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@media (max-width: 480px) {
  #ecs-ai-root {
    right: 12px;
    bottom: 12px;
  }

  .ecs-ai-panel {
    height: min(70vh, 520px);
  }
}

/* Keep clear of WhatsApp floating button if present */
body:has(.what-btn) #ecs-ai-root {
  bottom: 88px;
}
