/* ── City Eye Center · AI Chat Widget ───────────────────────────────────────── */
#cec-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 9998;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,172,193,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
#cec-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 30px rgba(0,172,193,.65);
}
#cec-chat-btn:active {
  transform: scale(.94);
}
.cec-btn-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* unread badge */
#cec-chat-btn .cec-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 14px; height: 14px;
  background: #e53935;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
#cec-chat-btn.cec-has-badge .cec-badge { display: block; }

/* ── window ──────────────────────────────────────────────────────────────────── */
#cec-chat-win {
  position: fixed;
  bottom: 104px;
  right: 24px;
  z-index: 9999;
  will-change: transform, opacity;
  width: 360px;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(11,29,58,.22);
  overflow: hidden;
  transform: scale(.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s;
}
#cec-chat-win.cec-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* header */
#cec-chat-win .cec-hdr {
  background: linear-gradient(135deg, #0B1D3A 60%, #1565C0);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cec-hdr-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cec-hdr-avatar svg { width: 22px; height: 22px; fill: #00ACC1; }
.cec-hdr-info { flex: 1; min-width: 0; }
.cec-hdr-name { font-weight: 700; font-size: .93rem; }
.cec-hdr-sub  { font-size: .72rem; color: rgba(255,255,255,.65); margin-top: 1px; }
.cec-hdr-close {
  background: none; border: none; color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 4px;
  transition: color .15s;
}
.cec-hdr-close:hover { color: #fff; }

/* messages */
#cec-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.cec-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: .88rem;
  line-height: 1.5;
  word-break: break-word;
}
.cec-msg-bot {
  background: #f0f4f8;
  color: #1a2740;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.cec-msg-user {
  background: linear-gradient(135deg, #1565C0, #00ACC1);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
[dir=rtl] .cec-msg-bot  { align-self: flex-end; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
[dir=rtl] .cec-msg-user { align-self: flex-start; border-bottom-right-radius: 14px; border-bottom-left-radius: 4px; }

/* typing indicator */
.cec-typing {
  display: flex; gap: 4px; align-items: center;
  padding: 10px 13px;
  background: #f0f4f8;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}
.cec-typing span {
  width: 7px; height: 7px;
  background: #90a4ae;
  border-radius: 50%;
  animation: cec-bounce .9s infinite;
}
.cec-typing span:nth-child(2) { animation-delay: .15s; }
.cec-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes cec-bounce {
  0%,80%,100% { transform: translateY(0); }
  40%          { transform: translateY(-6px); }
}

/* input bar */
#cec-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e8edf3;
  flex-shrink: 0;
}
#cec-chat-input {
  flex: 1;
  border: 1.5px solid #d1dbe8;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: .87rem;
  outline: none;
  resize: none;
  line-height: 1.4;
  max-height: 88px;
  overflow-y: auto;
  font-family: inherit;
  transition: border-color .15s;
}
#cec-chat-input:focus { border-color: #1565C0; }
#cec-chat-send {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #1565C0, #00ACC1);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
#cec-chat-send:hover { transform: scale(1.1); }
#cec-chat-send svg { width: 17px; height: 17px; fill: #fff; }

/* powered-by */
.cec-powered {
  text-align: center;
  font-size: .68rem;
  color: #b0bec5;
  padding: 4px 0 8px;
  flex-shrink: 0;
}

/* ── mobile full-screen ──────────────────────────────────────────────────────── */
@media (max-width: 440px) {
  #cec-chat-win {
    bottom: 0; right: 0; left: 0;
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }
  #cec-chat-btn { bottom: 18px; right: 18px; }
}
