.ctkb-chatbot {
  --ctkb-blue: #005eb8;
  --ctkb-blue-dark: #003f7d;
  --ctkb-gold: #f4b000;
  --ctkb-black: #1f252b;
  --ctkb-gray: #f4f6f8;
  --ctkb-border: #d7dde3;
  max-width: 760px;
  border: 1px solid var(--ctkb-border);
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0,0,0,.1);
  font-family: inherit;
}
.ctkb-chatbot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--ctkb-black), var(--ctkb-blue-dark));
  color: #fff;
  padding: 16px 18px;
}
.ctkb-chatbot-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ctkb-gold); box-shadow: 0 0 0 4px rgba(244,176,0,.25); }
.ctkb-parker-header-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ctkb-parker-header-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  color: #fff;
  overflow: hidden;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,.22);
}
.ctkb-parker-header-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ctkb-parker-header-avatar .dashicons { font-size: 22px; width: 22px; height: 22px; }
.ctkb-parker-header-text { min-width: 0; }
.ctkb-parker-header-text strong { display: block; line-height: 1.15; }
.ctkb-parker-header-text span { display: block; color: rgba(255,255,255,.78); font-size: 12px; margin-top: 2px; line-height: 1.2; }
.ctkb-chatbot-header .ctkb-parker-header-avatar { width: 38px; height: 38px; }

.ctkb-chatbot-messages { height: 420px; overflow-y: auto; padding: 18px; background: var(--ctkb-gray); }
.ctkb-msg { display: flex; margin-bottom: 12px; }
.ctkb-msg-bubble { max-width: 82%; border-radius: 18px; padding: 12px 14px; line-height: 1.45; white-space: pre-wrap; }
.ctkb-msg.bot { justify-content: flex-start; }
.ctkb-msg.bot .ctkb-msg-bubble { background: #fff; border: 1px solid var(--ctkb-border); color: #1f252b; }
.ctkb-msg.user { justify-content: flex-end; }
.ctkb-msg.user .ctkb-msg-bubble { background: var(--ctkb-blue); color: #fff; }
.ctkb-chatbot-input-row { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--ctkb-border); background: #fff; }
.ctkb-chatbot-input { flex: 1; min-height: 44px; max-height: 130px; resize: vertical; border: 1px solid var(--ctkb-border); border-radius: 14px; padding: 12px; font: inherit; }
.ctkb-chatbot-send { background: var(--ctkb-blue); color: #fff; border: 0; border-radius: 14px; padding: 0 18px; font-weight: 800; cursor: pointer; }
.ctkb-chatbot-send:hover { background: var(--ctkb-blue-dark); }
.ctkb-choice-wrap {
  margin: -4px 18px 14px 18px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--ctkb-border);
  border-radius: 16px;
}
.ctkb-choice-helper {
  margin-bottom: 10px;
  font-size: 13px;
  color: #4b5563;
}
.ctkb-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ctkb-choice-btn,
.ctkb-choice-done,
.ctkb-chatbot-tools button {
  border: 1px solid var(--ctkb-blue);
  background: #fff;
  color: var(--ctkb-blue-dark);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}
.ctkb-choice-btn:hover,
.ctkb-choice-btn.is-selected,
.ctkb-choice-done:hover {
  background: var(--ctkb-blue);
  color: #fff;
}
.ctkb-choice-done {
  margin-top: 10px;
  background: var(--ctkb-gold);
  border-color: var(--ctkb-gold);
  color: #1f252b;
}
.ctkb-choice-done:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.ctkb-choice-wrap.is-disabled {
  opacity: .72;
  pointer-events: none;
}
.ctkb-chatbot-tools {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  align-items: center;
  padding: 6px 10px 10px 10px;
  background: #fff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ctkb-chatbot-tools button {
  border-color: var(--ctkb-border);
  color: #1f252b;
  font-size: 11px;
  line-height: 1.1;
  padding: 6px 9px;
  white-space: nowrap;
}


.ctkb-floating-panel .ctkb-chatbot-tools {
  flex: 0 0 auto;
  min-height: 36px;
  max-height: 44px;
}
.ctkb-floating-panel .ctkb-chatbot-tools button {
  font-size: 11px;
  padding: 6px 8px;
}

/* Floating sitewide chatbot */
.ctkb-floating-chatbot {
  --ctkb-blue: #005eb8;
  --ctkb-blue-dark: #003f7d;
  --ctkb-gold: #f4b000;
  --ctkb-black: #1f252b;
  --ctkb-gray: #f4f6f8;
  --ctkb-border: #d7dde3;
  position: fixed;
  z-index: 99999;
  bottom: 22px;
  font-family: inherit;
}
.ctkb-floating-bottom-right { right: 22px; }
.ctkb-floating-bottom-left { left: 22px; }
.ctkb-floating-teaser {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: max-content;
  max-width: 280px;
  background: #fff;
  color: var(--ctkb-black);
  border: 1px solid var(--ctkb-border);
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,.16);
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}
.ctkb-floating-bottom-left .ctkb-floating-teaser { left: 0; right: auto; border-radius: 18px 18px 18px 4px; }
.ctkb-floating-chatbot.is-open .ctkb-floating-teaser { display: none; }
.ctkb-floating-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ctkb-blue-dark), var(--ctkb-blue));
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 62, 126, .34);
  padding: 8px 18px 8px 8px;
  cursor: pointer;
  font-weight: 800;
}
.ctkb-floating-launcher:hover { transform: translateY(-1px); box-shadow: 0 20px 44px rgba(0, 62, 126, .42); }
.ctkb-floating-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--ctkb-gold);
  color: var(--ctkb-black);
  overflow: hidden;
  flex: 0 0 auto;
}
.ctkb-floating-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ctkb-floating-avatar .dashicons { font-size: 22px; width: 22px; height: 22px; }
.ctkb-floating-label { white-space: nowrap; }
.ctkb-floating-badge {
  position: absolute;
  right: 4px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ctkb-gold);
  border: 2px solid #fff;
}
.ctkb-floating-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(420px, calc(100vw - 28px));
  height: min(680px, calc(100vh - 120px));
  display: none;
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(215,221,227,.9);
  box-shadow: 0 26px 80px rgba(0,0,0,.28);
}
.ctkb-floating-bottom-left .ctkb-floating-panel { left: 0; right: auto; }
.ctkb-floating-chatbot.is-open .ctkb-floating-panel { display: flex; flex-direction: column; }
.ctkb-floating-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--ctkb-black), var(--ctkb-blue-dark));
  color: #fff;
  padding: 15px 16px;
}
.ctkb-floating-header strong { display: block; font-size: 16px; }
.ctkb-floating-header span { display: block; color: rgba(255,255,255,.78); font-size: 12px; margin-top: 1px; }
.ctkb-floating-close {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.ctkb-floating-panel .ctkb-chatbot {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.ctkb-floating-panel .ctkb-chatbot-messages {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}
.ctkb-chatbot-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px 0 14px;
  background: #fff;
  border-top: 1px solid var(--ctkb-border);
}
.ctkb-chatbot-quick-actions.is-used { display: none; }
.ctkb-quick-action {
  border: 1px solid var(--ctkb-border);
  background: #fff;
  color: var(--ctkb-blue-dark);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.ctkb-quick-action:hover { background: #edf6ff; border-color: var(--ctkb-blue); }
.ctkb-typing { display: inline-flex; gap: 4px; align-items: center; min-height: 18px; }
.ctkb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ctkb-blue);
  display: inline-block;
  animation: ctkbTyping 1s infinite ease-in-out;
}
.ctkb-typing span:nth-child(2) { animation-delay: .16s; }
.ctkb-typing span:nth-child(3) { animation-delay: .32s; }
@keyframes ctkbTyping { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ctkb-transcript-panel {
  padding: 12px 14px 14px;
  background: #fff;
  border-top: 1px solid var(--ctkb-border);
}
.ctkb-transcript-panel textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--ctkb-border);
  border-radius: 12px;
  padding: 10px;
  font: 12px/1.4 monospace;
}
.ctkb-transcript-panel button {
  margin-top: 8px;
  border: 1px solid var(--ctkb-border);
  background: #fff;
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
}
@media (max-width: 640px) {
  .ctkb-floating-chatbot.hide-mobile { display: none; }
  .ctkb-floating-chatbot { left: 12px; right: 12px; bottom: 12px; }
  .ctkb-floating-bottom-left, .ctkb-floating-bottom-right { left: 12px; right: 12px; }
  .ctkb-floating-launcher { margin-left: auto; }
  .ctkb-floating-label { display: none; }
  .ctkb-floating-teaser { right: 0; bottom: 68px; max-width: calc(100vw - 24px); }
  .ctkb-floating-panel { width: calc(100vw - 24px); height: calc(100vh - 24px); right: 0; bottom: 0; border-radius: 22px; }
}

.ctkb-email-transcript-panel {
  padding: 12px 14px 14px;
  background: #fff;
  border-top: 1px solid var(--ctkb-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.ctkb-email-transcript-panel label {
  flex: 1 1 220px;
  font-size: 12px;
  font-weight: 700;
  color: #344054;
}
.ctkb-email-transcript-panel input[type="email"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--ctkb-border);
  border-radius: 999px;
  padding: 9px 12px;
  font: inherit;
}
.ctkb-email-transcript-panel button {
  border: 0;
  background: var(--ctkb-blue);
  color: #fff;
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}
.ctkb-transcript-status {
  flex: 1 1 100%;
  font-size: 12px;
  color: #344054;
}

/* 2.3.9 mobile floating chat refinements */
@media (max-width: 640px) {
  .ctkb-floating-teaser {
    display: none !important;
  }

  .ctkb-floating-chatbot {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .ctkb-floating-panel {
    width: calc(100vw - 20px);
    height: min(calc(var(--ctkb-visual-height, 100vh) - 20px), calc(100dvh - 20px));
    max-height: calc(var(--ctkb-visual-height, 100vh) - 20px);
    right: 0;
    bottom: calc(var(--ctkb-keyboard-offset, 0px) + env(safe-area-inset-bottom, 0px));
    border-radius: 22px;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-floating-panel {
    height: calc(var(--ctkb-visual-height, 100vh) - 12px);
    max-height: calc(var(--ctkb-visual-height, 100vh) - 12px);
    border-radius: 18px 18px 10px 10px;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-floating-header {
    padding: 10px 14px;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-messages {
    padding: 12px;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-input-row {
    padding: 10px;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-tools {
    display: none;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-quick-actions {
    display: none;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-input {
    max-height: 86px;
  }
}

/* 2.4.0 stronger mobile floating chat refinements */
.ctkb-chatbot-tools .ctkb-tools-toggle {
  display: none;
}

@media (max-width: 782px) {
  .ctkb-floating-chatbot .ctkb-floating-teaser,
  .ctkb-floating-teaser {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .ctkb-floating-chatbot {
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    pointer-events: none;
  }

  .ctkb-floating-chatbot .ctkb-floating-launcher {
    pointer-events: auto;
    position: fixed;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    margin-left: 0;
  }

  .ctkb-floating-bottom-left .ctkb-floating-launcher {
    left: 12px;
    right: auto;
  }

  .ctkb-floating-chatbot.is-open .ctkb-floating-launcher {
    display: none;
  }

  .ctkb-floating-panel {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 18px !important;
    pointer-events: auto;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-floating-panel {
    top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    bottom: calc(var(--ctkb-keyboard-offset, 0px) + 8px + env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 16px !important;
  }

  .ctkb-floating-header {
    padding: 12px 14px !important;
    min-height: 50px;
    flex: 0 0 auto;
  }

  .ctkb-floating-close {
    width: 40px;
    height: 40px;
    font-size: 26px;
    flex: 0 0 auto;
  }

  .ctkb-floating-panel .ctkb-chatbot {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .ctkb-floating-panel .ctkb-chatbot-messages {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px !important;
  }

  .ctkb-chatbot-tools {
    flex: 0 0 auto;
    padding: 6px 10px 10px;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    overflow: visible;
  }

  .ctkb-chatbot-tools .ctkb-tools-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 10px;
  }

  .ctkb-chatbot-tools > button:not(.ctkb-tools-toggle) {
    display: none;
  }

  .ctkb-chatbot-tools.is-expanded > button:not(.ctkb-tools-toggle) {
    display: inline-flex;
    font-size: 11px;
    padding: 7px 9px;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-tools {
    display: none !important;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-quick-actions {
    display: none !important;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-input-row {
    padding: 8px !important;
    flex: 0 0 auto;
  }

  .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-chatbot-input {
    max-height: 72px;
  }
}



/* ============================================================
   2.6.3 – Frontend UX & Accessibility Enhancements
   ============================================================ */

/* --- Focus-visible styles ----------------------------------- */
.ctkb-chatbot *:focus-visible,
.ctkb-floating-chatbot *:focus-visible {
    outline: 3px solid var(--ctkb-blue);
    outline-offset: 2px;
}
.ctkb-chatbot-send:focus-visible {
    outline-color: var(--ctkb-gold);
}
.ctkb-choice-btn:focus-visible,
.ctkb-quick-action:focus-visible {
    outline: 3px solid var(--ctkb-blue);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 94, 184, .15);
}
.ctkb-floating-launcher:focus-visible {
    outline: 3px solid var(--ctkb-gold);
    outline-offset: 3px;
}

/* --- Send button disabled state ----------------------------- */
.ctkb-chatbot-send[disabled],
.ctkb-chatbot-send.is-sending {
    opacity: .55;
    pointer-events: none;
    cursor: not-allowed;
}

/* --- Error message styling ---------------------------------- */
.ctkb-msg.bot .ctkb-msg-bubble.ctkb-error-bubble {
    background: #fff8e6;
    border-color: var(--ctkb-gold);
    color: #6b4e00;
}
.ctkb-msg-retry {
    display: inline-block;
    margin-top: 6px;
    color: var(--ctkb-blue);
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    background: none;
    border: none;
    font-size: 13px;
    padding: 0;
}

/* --- Improved touch targets for mobile ---------------------- */
@media (max-width: 782px) {
    .ctkb-choice-btn,
    .ctkb-quick-action {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .ctkb-chatbot-send {
        min-width: 54px;
        min-height: 44px;
    }
    .ctkb-floating-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* --- Reduced motion ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .ctkb-typing span,
    .ctkb-floating-launcher {
        animation: none !important;
        transition: none !important;
    }
    .ctkb-floating-launcher:hover {
        transform: none;
    }
}



/* ============================================================
   2.7.1 – Frontend UX Enhancements
   ============================================================ */

/* --- Message timestamps --- */
.ctkb-msg-timestamp {
    display: block;
    font-size: 10px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}
.ctkb-msg.user .ctkb-msg-timestamp {
    text-align: right;
}

/* --- Scroll-to-bottom button --- */
.ctkb-scroll-bottom {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ctkb-blue, #005eb8);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity .2s ease, transform .2s ease;
}
.ctkb-scroll-bottom:hover {
    background: var(--ctkb-blue-dark, #003f7d);
    transform: scale(1.08);
}

/* --- Character counter --- */
.ctkb-char-counter {
    position: absolute;
    bottom: 4px;
    right: 70px;
    font-size: 10px;
    color: #9ca3af;
    pointer-events: none;
    user-select: none;
}
.ctkb-char-counter.is-near-limit {
    color: #b8860b;
}
.ctkb-char-counter.is-over-limit {
    color: #c52222;
    font-weight: 700;
}

/* --- Collapsible quick actions --- */
.ctkb-qa-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    border-top: 1px solid var(--ctkb-border, #d7dde3);
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ctkb-blue-dark, #003f7d);
    cursor: pointer;
    text-align: left;
}
.ctkb-qa-toggle:hover {
    background: #f8fbff;
}
.ctkb-chatbot-quick-actions.is-collapsed {
    display: none;
}

/* --- Reduced motion for new elements --- */
@media (prefers-reduced-motion: reduce) {
    .ctkb-scroll-bottom {
        transition: none;
    }
}

/* --- Mobile adjustments for new elements --- */
@media (max-width: 782px) {
    .ctkb-char-counter {
        right: 60px;
    }
    .ctkb-scroll-bottom {
        width: 32px;
        height: 32px;
        font-size: 16px;
        bottom: 8px;
        right: 8px;
    }
    .ctkb-floating-chatbot.ctkb-keyboard-open .ctkb-qa-toggle {
        display: none;
    }
}

@media (max-width: 480px) { .ctkb-parker-header-avatar { width: 38px; height: 38px; } .ctkb-parker-header-identity { gap: 10px; } }
