/* ==========================================================================
   CTELG SMART CHATBOT & AI ASSISTANT WIDGET
   UEH Brand Palette: Deep Teal (#004b41 / #005f69) & Vibrant Orange (#f27121)
   ========================================================================== */

/* Shift existing floating bar slightly up so Chatbot launcher sits cleanly below it */
body .floating-contact-bar {
  bottom: 96px !important;
}

.ctelg-cb-root {
  position: fixed;
  bottom: 30px;
  right: 25px;
  z-index: 99990;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Launcher Button (matches 50x50px floating-btn column) */
.ctelg-cb-launcher {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none !important;
  outline: none !important;
  background: linear-gradient(135deg, #f27121 0%, #e05e0e 100%);
  color: #ffffff;
  font-size: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  position: relative;
  padding: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease;
}

.ctelg-cb-launcher:focus,
.ctelg-cb-launcher:active {
  outline: none !important;
  border: none !important;
}

.ctelg-cb-launcher:hover {
  transform: scale(1.08);
}

.ctelg-cb-launcher-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(242, 113, 33, 0.5);
  z-index: -1;
  pointer-events: none;
  animation: ctelgCbPulse 2s infinite ease-out;
}

@keyframes ctelgCbPulse {
  0% { transform: scale(0.95); opacity: 0.85; }
  70% { opacity: 0.3; }
  100% { transform: scale(1.7); opacity: 0; }
}

.ctelg-cb-launcher-icon-close {
  display: none;
}

.ctelg-cb-root.is-open .ctelg-cb-launcher {
  background: #004b41;
  box-shadow: 0 6px 20px rgba(0, 75, 65, 0.35);
}

.ctelg-cb-root.is-open .ctelg-cb-launcher-icon-open {
  display: none;
}

.ctelg-cb-root.is-open .ctelg-cb-launcher-icon-close {
  display: inline-block;
}

.ctelg-cb-launcher-badge {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  background: #004b41;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid #ffffff;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 75, 65, 0.25);
  pointer-events: none;
}

.ctelg-cb-root.is-open .ctelg-cb-launcher-badge {
  display: none;
}

/* Teaser Bubble */
.ctelg-cb-teaser {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 270px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #f27121;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  animation: ctelgCbSlideUp 0.3s ease;
}

.ctelg-cb-teaser-content strong {
  display: block;
  font-size: 13px;
  color: #004b41;
  margin-bottom: 3px;
}

.ctelg-cb-teaser-content span {
  display: block;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.45;
}

.ctelg-cb-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

/* Main Chat Window */
.ctelg-cb-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 390px;
  max-width: calc(100vw - 28px);
  height: 575px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(0, 75, 65, 0.18);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
}

.ctelg-cb-root.is-open .ctelg-cb-window {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.ctelg-cb-header {
  background: linear-gradient(135deg, #004b41 0%, #006658 100%);
  color: #ffffff;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 3px solid #f27121;
  flex-shrink: 0;
}

.ctelg-cb-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ctelg-cb-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #ffffff;
  position: relative;
  flex-shrink: 0;
}

.ctelg-cb-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border: 2px solid #004b41;
  border-radius: 50%;
}

.ctelg-cb-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctelg-cb-subtitle {
  font-size: 11.5px;
  color: #d1fae5;
  margin-top: 2px;
}

.ctelg-cb-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ctelg-cb-top-reg-btn {
  background: #f27121;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s;
}

.ctelg-cb-top-reg-btn:hover {
  background: #d95d12;
}

.ctelg-cb-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ctelg-cb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Messages Stream */
.ctelg-cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px 14px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ctelg-cb-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: ctelgCbSlideUp 0.2s ease;
}

@keyframes ctelgCbSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ctelg-cb-msg-row.is-user {
  align-self: flex-end;
  align-items: flex-end;
}

.ctelg-cb-msg-row.is-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.ctelg-cb-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.ctelg-cb-msg-row.is-bot .ctelg-cb-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.ctelg-cb-msg-row.is-user .ctelg-cb-bubble {
  background: linear-gradient(135deg, #004b41 0%, #006658 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 75, 65, 0.18);
}

.ctelg-cb-bubble a {
  color: #f27121;
  font-weight: 700;
  text-decoration: underline;
}

.ctelg-cb-bubble ul {
  margin: 6px 0;
  padding-left: 18px;
}

.ctelg-cb-bubble li {
  margin-bottom: 4px;
}

/* Rich Course Cards inside Chat */
.ctelg-cb-courses-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.ctelg-cb-course-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 3.5px solid #004b41;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.ctelg-cb-course-title {
  font-size: 13px;
  font-weight: 700;
  color: #004b41;
  margin: 0 0 5px 0;
  line-height: 1.35;
}

.ctelg-cb-course-meta {
  font-size: 12px;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.ctelg-cb-course-price {
  color: #c2410c;
  font-weight: 700;
}

.ctelg-cb-course-actions {
  display: flex;
  gap: 6px;
}

.ctelg-cb-course-btn {
  flex: 1;
  text-align: center;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
}

.ctelg-cb-course-btn-reg {
  background: #f27121;
  color: #ffffff !important;
}

.ctelg-cb-course-btn-reg:hover {
  background: #d95d12;
}

.ctelg-cb-course-btn-view {
  background: #f1f5f9;
  color: #0f172a !important;
  border: 1px solid #cbd5e1;
}

.ctelg-cb-course-btn-view:hover {
  background: #e2e8f0;
}

/* Inline Lead Registration Drawer */
.ctelg-cb-lead-drawer {
  background: #fff7ed;
  border-top: 2px solid #f27121;
  padding: 12px 14px;
  flex-shrink: 0;
  animation: ctelgCbSlideUp 0.22s ease;
}

.ctelg-cb-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 800;
  color: #9a3412;
  margin-bottom: 8px;
}

.ctelg-cb-drawer-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #9a3412;
  cursor: pointer;
  line-height: 1;
}

.ctelg-cb-form-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.ctelg-cb-form-group {
  margin-bottom: 6px;
}

.ctelg-cb-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  color: #0f172a;
  background: #ffffff;
  box-sizing: border-box;
  font-family: inherit;
}

.ctelg-cb-select-sm {
  width: 78px;
  flex-shrink: 0;
}

.ctelg-cb-input:focus {
  outline: none;
  border-color: #004b41;
}

.ctelg-cb-lead-submit {
  width: 100%;
  background: linear-gradient(135deg, #004b41 0%, #006658 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.ctelg-cb-lead-submit:hover {
  background: #f27121;
}

/* Quick Replies Chips Bar */
.ctelg-cb-quick-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.ctelg-cb-quick-bar::-webkit-scrollbar {
  height: 4px;
}

.ctelg-cb-quick-bar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.ctelg-cb-chip {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #004b41;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.ctelg-cb-chip:hover {
  background: #004b41;
  border-color: #004b41;
  color: #ffffff;
}

/* Composer Input */
.ctelg-cb-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.ctelg-cb-composer-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  background: #f8fafc;
}

.ctelg-cb-composer-input:focus {
  border-color: #004b41;
  background: #ffffff;
}

.ctelg-cb-composer-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #004b41;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.ctelg-cb-composer-send:hover {
  background: #f27121;
}

/* Typing Dots */
.ctelg-cb-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}

.ctelg-cb-typing span {
  width: 6px;
  height: 6px;
  background: #004b41;
  border-radius: 50%;
  animation: ctelgCbDot 1.2s infinite ease-in-out;
}

.ctelg-cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.ctelg-cb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ctelgCbDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
  .ctelg-cb-root {
    bottom: 16px;
    right: 16px;
  }
  body .floating-contact-bar {
    bottom: 84px !important;
    right: 16px !important;
  }
  .ctelg-cb-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 105px);
    bottom: 64px;
  }
}
