/* ═══════════════════════════════════════════════════════════════════
   CIMA CONCRETE - AI CHATBOT STYLES
   ═══════════════════════════════════════════════════════════════════ */

.cima-chatbot {
  --cb-primary: #2925A9;
  --cb-accent: #3535FD;
  --cb-dark: #01244A;
  --cb-darker: #000000;
  --cb-surface: rgba(255, 255, 255, 0.08);
  --cb-border: rgba(255, 255, 255, 0.1);
  --cb-white: #FFFFFF;
  --cb-gray: #8b8b9e;
  --cb-text-muted: #c8c8ff;
  --cb-radius: 20px;
  --cb-shadow: 0 10px 40px rgba(41, 37, 169, 0.3);
  --cb-font: 'Montserrat', sans-serif;
  --cb-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── TOGGLE BUTTON ──────────────────────────────────────────────── */

.cima-chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-accent));
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(53, 53, 253, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: cbPulse 3s ease-in-out infinite;
  padding: 0;
  outline: none;
}

.cima-chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(53, 53, 253, 0.5);
}

.cima-chatbot-toggle.is-open {
  animation: none;
  background: var(--cb-accent);
  border-radius: 50%;
}

.cima-chatbot-toggle svg {
  width: 30px;
  height: 30px;
  transition: opacity 0.2s ease, transform 0.3s var(--cb-ease);
}

.cima-chatbot-toggle .cb-icon-close {
  display: none;
}

.cima-chatbot-toggle.is-open .cb-icon-main {
  display: none;
}

.cima-chatbot-toggle.is-open .cb-icon-close {
  display: block;
}

@keyframes cbPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 20px rgba(53, 53, 253, 0.35);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 6px 28px rgba(53, 53, 253, 0.5);
  }
}

/* ─── NOTIFICATION BADGE ─────────────────────────────────────────── */

.cima-chatbot-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--cb-accent);
  display: none;
  animation: cbBadgePulse 1.5s ease-in-out infinite;
}

.cima-chatbot-badge.is-visible {
  display: block;
}

@keyframes cbBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ─── CHAT WINDOW ────────────────────────────────────────────────── */

.cima-chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 520px;
  border-radius: var(--cb-radius);
  background: linear-gradient(180deg, var(--cb-dark) 0%, var(--cb-darker) 100%);
  border: 1px solid rgba(53, 53, 253, 0.2);
  box-shadow: var(--cb-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: var(--cb-font);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s var(--cb-ease);
}

.cima-chatbot-window.is-open {
  display: flex;
}

.cima-chatbot-window.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ─── HEADER ─────────────────────────────────────────────────────── */

.cima-chatbot-header {
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-accent));
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cima-chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.cima-chatbot-avatar img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.cima-chatbot-header-info {
  flex: 1;
  min-width: 0;
}

.cima-chatbot-header-name {
  color: var(--cb-white);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.cima-chatbot-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.cima-chatbot-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.cima-chatbot-header-status span {
  color: var(--cb-text-muted);
  font-size: 12px;
  font-weight: 400;
}

.cima-chatbot-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.cima-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.cima-chatbot-close svg {
  width: 16px;
  height: 16px;
}

/* ─── MESSAGES AREA ──────────────────────────────────────────────── */

.cima-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.cima-chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.cima-chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.cima-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(53, 53, 253, 0.3);
  border-radius: 4px;
}

/* ─── MESSAGE BUBBLES ────────────────────────────────────────────── */

.cima-chatbot-msg {
  max-width: 85%;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.55;
  animation: cbMsgIn 0.3s ease;
  word-wrap: break-word;
}

.cima-chatbot-msg a {
  color: var(--cb-accent);
  text-decoration: underline;
}

.cima-chatbot-msg ul {
  margin: 6px 0;
  padding-left: 18px;
}

.cima-chatbot-msg li {
  margin-bottom: 4px;
}

.cima-chatbot-msg-bot {
  align-self: flex-start;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 4px 16px 16px 16px;
  color: var(--cb-white);
}

.cima-chatbot-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-accent));
  border-radius: 16px 4px 16px 16px;
  color: var(--cb-white);
}

@keyframes cbMsgIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── TYPING INDICATOR ───────────────────────────────────────────── */

.cima-chatbot-typing {
  align-self: flex-start;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 4px 16px 16px 16px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  animation: cbMsgIn 0.3s ease;
}

.cima-chatbot-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cb-gray);
  animation: cbTypingBounce 1.4s ease-in-out infinite;
}

.cima-chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.cima-chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes cbTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── QUICK BUTTONS ──────────────────────────────────────────────── */

.cima-chatbot-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 12px;
  flex-shrink: 0;
}

.cima-chatbot-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--cb-accent);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: var(--cb-font);
  color: var(--cb-accent);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.cima-chatbot-quick-btn:hover {
  background: var(--cb-accent);
  color: var(--cb-white);
  transform: translateY(-1px);
}

/* ─── SERVICE OPTION BUTTONS (lead capture) ──────────────────────── */

.cima-chatbot-service-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.cima-chatbot-service-btn {
  display: block;
  width: 100%;
  border: 1px solid rgba(53, 53, 253, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--cb-font);
  color: var(--cb-white);
  background: rgba(53, 53, 253, 0.1);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cima-chatbot-service-btn:hover {
  background: rgba(53, 53, 253, 0.25);
  border-color: var(--cb-accent);
}

/* ─── INPUT AREA ─────────────────────────────────────────────────── */

.cima-chatbot-input-area {
  display: flex;
  align-items: flex-end;
  padding: 12px 16px;
  gap: 10px;
  border-top: 1px solid var(--cb-border);
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.cima-chatbot-input {
  flex: 1;
  background: var(--cb-surface);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--cb-white);
  font-size: 14px;
  font-family: var(--cb-font);
  resize: none;
  outline: none;
  max-height: 80px;
  min-height: 40px;
  line-height: 1.4;
  overflow-y: auto;
  transition: border-color 0.2s ease;
}

.cima-chatbot-input::placeholder {
  color: var(--cb-gray);
}

.cima-chatbot-input:focus {
  border-color: rgba(53, 53, 253, 0.5);
}

.cima-chatbot-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--cb-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.2s ease;
  padding: 0;
}

.cima-chatbot-send:hover {
  transform: scale(1.08);
  background: #4a4aff;
}

.cima-chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.cima-chatbot-send svg {
  width: 18px;
  height: 18px;
}

/* ─── POWERED BY ─────────────────────────────────────────────────── */

.cima-chatbot-powered {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: var(--cb-gray);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .cima-chatbot-window {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    border: none;
  }

  .cima-chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .cima-chatbot-toggle svg {
    width: 26px;
    height: 26px;
  }

  .cima-chatbot-toggle.is-open {
    display: none;
  }

  .cima-chatbot-header {
    border-radius: 0;
  }
}
