/**
 * @file        asan-frontend.css
 * @path        assets/css/asan-frontend.css
 * @role        Frontend — Chatbot Widget & Public-Facing Styles
 * @description Styles for the Asan AI chatbot widget rendered on the public
 *              frontend. Includes the floating launcher button, chat window
 *              (popup and embedded modes), message bubbles, typing indicator,
 *              input area with attachments, header/footer, quick replies,
 *              feedback buttons, and all responsive/accessibility states.
 *              Fully self-contained — does not leak into theme styles.
 *
 * @author      Sirvan Alirezaei
 * @copyright   © Sirvan Alirezaei. All rights reserved.
 * @version     4.0.0
 * @since       2025-01
 * @status      Production-critical
 */


/* ==========================================================================
   1. SCOPE ISOLATION — Prevent theme bleed
   ========================================================================== */

.asan-ai-chatbot,
.asan-ai-chatbot *,
.asan-ai-chatbot *::before,
.asan-ai-chatbot *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--asan-font-persian);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.asan-ai-chatbot:lang(en),
.asan-ai-chatbot[dir="ltr"],
.asan-ai-chatbot[dir="ltr"] * {
  font-family: var(--asan-font-system);
}

.asan-ai-chatbot {
  /* Local token overrides — chatbot can be themed independently */
  --asan-chat-bg:               var(--asan-bg-primary, #1c1c1e);
  --asan-chat-surface:          var(--asan-bg-secondary, #2c2c2e);
  --asan-chat-border:           var(--asan-border, rgba(255, 255, 255, 0.1));
  --asan-chat-text:             var(--asan-text-primary, #ffffff);
  --asan-chat-text-dim:         var(--asan-text-tertiary, #98989d);
  --asan-chat-accent:           var(--asan-accent, #007aff);
  --asan-chat-user-bubble:      var(--asan-accent, #007aff);
  --asan-chat-user-text:        #ffffff;
  --asan-chat-ai-bubble:        var(--asan-bg-secondary, #2c2c2e);
  --asan-chat-ai-text:          var(--asan-text-primary, #ffffff);
  --asan-chat-input-bg:         var(--asan-bg-secondary, #2c2c2e);
  --asan-chat-radius:           var(--asan-radius-xl, 20px);
  --asan-chat-bubble-radius:    var(--asan-radius-lg, 14px);
  --asan-chat-width:            380px;
  --asan-chat-height:           600px;
  --asan-chat-max-height:       80vh;
  --asan-chat-launcher-size:    56px;

  font-size: 15px;
  line-height: 1.5;
  color: var(--asan-chat-text);
  direction: rtl;
}

.asan-ai-chatbot[dir="ltr"] {
  direction: ltr;
}


/* ==========================================================================
   2. LAUNCHER BUTTON (Floating)
   ========================================================================== */

.asan-ai-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  width: var(--asan-chat-launcher-size);
  height: var(--asan-chat-launcher-size);
  background: var(--asan-chat-accent);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3),
              0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

.asan-ai-chatbot-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35),
              0 3px 8px rgba(0, 0, 0, 0.2);
}

.asan-ai-chatbot-launcher:active {
  transform: scale(0.95);
}

.asan-ai-chatbot-launcher__icon {
  width: 26px;
  height: 26px;
  transition: transform 200ms ease, opacity 150ms ease;
}

.asan-ai-chatbot-launcher__close-icon {
  position: absolute;
  width: 22px;
  height: 22px;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
  transition: transform 200ms ease, opacity 150ms ease;
}

.asan-ai-chatbot-launcher--open .asan-ai-chatbot-launcher__icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.asan-ai-chatbot-launcher--open .asan-ai-chatbot-launcher__close-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Unread badge */
.asan-ai-chatbot-launcher__badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  width: 20px;
  height: 20px;
  background: #ff453a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--asan-chat-bg);
  animation: asan-ai-scale-in 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ==========================================================================
   3. CHAT WINDOW — Popup Mode
   ========================================================================== */

.asan-ai-chatbot-window {
  position: fixed;
  bottom: calc(24px + var(--asan-chat-launcher-size) + 16px);
  inset-inline-end: 24px;
  width: var(--asan-chat-width);
  max-height: var(--asan-chat-max-height);
  height: var(--asan-chat-height);
  background: var(--asan-chat-bg);
  border: 1px solid var(--asan-chat-border);
  border-radius: var(--asan-chat-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
              0 8px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 250ms ease,
              visibility 250ms ease,
              transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

[dir="rtl"] .asan-ai-chatbot-window {
  transform-origin: bottom left;
}

.asan-ai-chatbot-window--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.asan-ai-chatbot-window--closing {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition-duration: 150ms;
  transition-timing-function: ease-in;
}


/* ==========================================================================
   4. CHAT WINDOW — Embedded Mode
   ========================================================================== */

.asan-ai-chatbot--embedded .asan-ai-chatbot-window {
  position: relative;
  bottom: auto;
  inset-inline-end: auto;
  width: 100%;
  max-height: none;
  height: 500px;
  opacity: 1;
  visibility: visible;
  transform: none;
  box-shadow: none;
  border-radius: var(--asan-chat-radius);
}


/* ==========================================================================
   5. CHAT WINDOW — Fullscreen Mode
   ========================================================================== */

.asan-ai-chatbot-window--fullscreen {
  bottom: 0;
  inset-inline-end: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  border: none;
}


/* ==========================================================================
   6. HEADER
   ========================================================================== */

.asan-ai-chatbot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--asan-chat-surface);
  border-bottom: 1px solid var(--asan-chat-border);
  flex-shrink: 0;
  min-height: 56px;
}

.asan-ai-chatbot-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.asan-ai-chatbot-header__avatar img,
.asan-ai-chatbot-header__avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asan-ai-chatbot-header__info {
  flex: 1;
  min-width: 0;
}

.asan-ai-chatbot-header__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--asan-chat-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asan-ai-chatbot-header__status {
  font-size: 12px;
  color: var(--asan-chat-text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.asan-ai-chatbot-header__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #30d158;
  flex-shrink: 0;
}

.asan-ai-chatbot-header__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.asan-ai-chatbot-header__btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--asan-chat-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}

.asan-ai-chatbot-header__btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--asan-chat-text);
}

.asan-ai-chatbot-header__btn svg {
  width: 18px;
  height: 18px;
}


/* ==========================================================================
   7. MESSAGES AREA
   ========================================================================== */

.asan-ai-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* Thin scrollbar */
.asan-ai-chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.asan-ai-chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.asan-ai-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.asan-ai-chatbot-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}


/* ==========================================================================
   8. MESSAGE BUBBLES
   ========================================================================== */

.asan-ai-chatbot-message {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: asan-ai-slide-up 250ms ease-out;
}

/* --- User message --- */
.asan-ai-chatbot-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

[dir="ltr"] .asan-ai-chatbot-message--user {
  flex-direction: row-reverse;
}

.asan-ai-chatbot-message--user .asan-ai-chatbot-message__bubble {
  background: var(--asan-chat-user-bubble);
  color: var(--asan-chat-user-text);
  border-radius: var(--asan-chat-bubble-radius)
                 var(--asan-chat-bubble-radius)
                 4px
                 var(--asan-chat-bubble-radius);
}

[dir="rtl"] .asan-ai-chatbot-message--user .asan-ai-chatbot-message__bubble {
  border-radius: var(--asan-chat-bubble-radius)
                 var(--asan-chat-bubble-radius)
                 var(--asan-chat-bubble-radius)
                 4px;
}

/* --- AI message --- */
.asan-ai-chatbot-message--ai {
  align-self: flex-start;
}

.asan-ai-chatbot-message--ai .asan-ai-chatbot-message__bubble {
  background: var(--asan-chat-ai-bubble);
  color: var(--asan-chat-ai-text);
  border: 1px solid var(--asan-chat-border);
  border-radius: var(--asan-chat-bubble-radius)
                 var(--asan-chat-bubble-radius)
                 var(--asan-chat-bubble-radius)
                 4px;
}

[dir="rtl"] .asan-ai-chatbot-message--ai .asan-ai-chatbot-message__bubble {
  border-radius: var(--asan-chat-bubble-radius)
                 var(--asan-chat-bubble-radius)
                 4px
                 var(--asan-chat-bubble-radius);
}

/* --- Bubble base --- */
.asan-ai-chatbot-message__bubble {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- Avatar in message --- */
.asan-ai-chatbot-message__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.06);
}

.asan-ai-chatbot-message__avatar img,
.asan-ai-chatbot-message__avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Timestamp --- */
.asan-ai-chatbot-message__time {
  font-size: 11px;
  color: var(--asan-chat-text-dim);
  margin-top: 4px;
  padding-inline: 4px;
  opacity: 0;
  transition: opacity 150ms ease;
}

.asan-ai-chatbot-message:hover .asan-ai-chatbot-message__time {
  opacity: 1;
}

/* --- Grouped messages (same sender) --- */
.asan-ai-chatbot-message--grouped {
  margin-top: -2px;
}

.asan-ai-chatbot-message--grouped .asan-ai-chatbot-message__avatar {
  visibility: hidden;
}


/* ==========================================================================
   9. MESSAGE CONTENT — Rich text, code, images
   ========================================================================== */

.asan-ai-chatbot-message__bubble p {
  margin-bottom: 8px;
}

.asan-ai-chatbot-message__bubble p:last-child {
  margin-bottom: 0;
}

.asan-ai-chatbot-message__bubble a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.asan-ai-chatbot-message__bubble a:hover {
  opacity: 0.8;
}

/* Inline code */
.asan-ai-chatbot-message__bubble code {
  font-family: var(--asan-font-mono, monospace);
  font-size: 0.88em;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  direction: ltr;
  unicode-bidi: embed;
}

.asan-ai-chatbot-message--user .asan-ai-chatbot-message__bubble code {
  background: rgba(255, 255, 255, 0.15);
}

/* Code block */
.asan-ai-chatbot-message__bubble pre {
  margin: 8px 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
}

.asan-ai-chatbot-message__bubble pre code {
  padding: 0;
  background: transparent;
  font-size: 13px;
  line-height: 1.5;
}

/* Code block header (language label + copy) */
.asan-ai-chatbot-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px 8px 0 0;
  font-size: 11px;
  color: var(--asan-chat-text-dim);
  margin-bottom: -1px;
}

.asan-ai-chatbot-code-header + pre {
  margin-top: 0;
  border-radius: 0 0 8px 8px;
}

.asan-ai-chatbot-code-copy {
  background: transparent;
  border: none;
  color: var(--asan-chat-text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 120ms ease;
}

.asan-ai-chatbot-code-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--asan-chat-text);
}

/* Lists */
.asan-ai-chatbot-message__bubble ul,
.asan-ai-chatbot-message__bubble ol {
  padding-inline-start: 20px;
  margin: 6px 0;
}

.asan-ai-chatbot-message__bubble li {
  margin-bottom: 4px;
}

/* Images in messages */
.asan-ai-chatbot-message__image {
  max-width: 100%;
  border-radius: 10px;
  margin: 6px 0;
  cursor: pointer;
  transition: opacity 120ms ease;
}

.asan-ai-chatbot-message__image:hover {
  opacity: 0.9;
}

/* Tables */
.asan-ai-chatbot-message__bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
}

.asan-ai-chatbot-message__bubble th,
.asan-ai-chatbot-message__bubble td {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: start;
}

.asan-ai-chatbot-message__bubble th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}


/* ==========================================================================
   10. TYPING INDICATOR
   ========================================================================== */

.asan-ai-chatbot-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  align-self: flex-start;
}

.asan-ai-chatbot-typing__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.asan-ai-chatbot-typing__dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--asan-chat-ai-bubble);
  border: 1px solid var(--asan-chat-border);
  border-radius: var(--asan-chat-bubble-radius);
}

.asan-ai-chatbot-typing__dot {
  width: 7px;
  height: 7px;
  background: var(--asan-chat-text-dim);
  border-radius: 50%;
  animation: asan-ai-typing-bounce 1.4s ease-in-out infinite;
}

.asan-ai-chatbot-typing__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.asan-ai-chatbot-typing__dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes asan-ai-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}


/* ==========================================================================
   11. INPUT AREA
   ========================================================================== */

.asan-ai-chatbot-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: var(--asan-chat-surface);
  border-top: 1px solid var(--asan-chat-border);
  flex-shrink: 0;
}

.asan-ai-chatbot-input__field {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--asan-chat-text);
  background: var(--asan-chat-input-bg);
  border: 1px solid var(--asan-chat-border);
  border-radius: 12px;
  resize: none;
  overflow-y: auto;
  outline: none;
  transition: border-color 120ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.asan-ai-chatbot-input__field::placeholder {
  color: var(--asan-chat-text-dim);
}

.asan-ai-chatbot-input__field:focus {
  border-color: var(--asan-chat-accent);
}

/* Send button */
.asan-ai-chatbot-input__send {
  width: 40px;
  height: 40px;
  background: var(--asan-chat-accent);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 120ms ease, opacity 120ms ease;
}

.asan-ai-chatbot-input__send:hover {
  transform: scale(1.06);
}

.asan-ai-chatbot-input__send:active {
  transform: scale(0.94);
}

.asan-ai-chatbot-input__send:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.asan-ai-chatbot-input__send svg {
  width: 18px;
  height: 18px;
}

/* Flip send arrow for RTL */
[dir="rtl"] .asan-ai-chatbot-input__send svg {
  transform: scaleX(-1);
}

/* Attachment button */
.asan-ai-chatbot-input__attach {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--asan-chat-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}

.asan-ai-chatbot-input__attach:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--asan-chat-text);
}

.asan-ai-chatbot-input__attach svg {
  width: 20px;
  height: 20px;
}


/* ==========================================================================
   12. FILE ATTACHMENT PREVIEW (in input area)
   ========================================================================== */

.asan-ai-chatbot-attachments {
  display: flex;
  gap: 8px;
  padding: 8px 14px 0;
  background: var(--asan-chat-surface);
  overflow-x: auto;
  flex-shrink: 0;
}

.asan-ai-chatbot-attachment {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--asan-chat-border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--asan-chat-text-dim);
  white-space: nowrap;
  max-width: 180px;
}

.asan-ai-chatbot-attachment__name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.asan-ai-chatbot-attachment__remove {
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--asan-chat-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
}

.asan-ai-chatbot-attachment__remove:hover {
  background: rgba(255, 69, 58, 0.2);
  color: #ff453a;
}

/* Image thumbnail */
.asan-ai-chatbot-attachment--image {
  padding: 4px;
}

.asan-ai-chatbot-attachment__thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}


/* ==========================================================================
   13. QUICK REPLIES / SUGGESTIONS
   ========================================================================== */

.asan-ai-chatbot-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 16px 12px;
}

.asan-ai-chatbot-suggestion {
  padding: 7px 14px;
  font-family: inherit;
  font-size: 13px;
  color: var(--asan-chat-accent);
  background: transparent;
  border: 1px solid rgba(0, 122, 255, 0.3);
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.asan-ai-chatbot-suggestion:hover {
  background: rgba(0, 122, 255, 0.12);
  border-color: var(--asan-chat-accent);
}

.asan-ai-chatbot-suggestion:active {
  transform: scale(0.96);
}


/* ==========================================================================
   14. FEEDBACK BUTTONS (Thumbs up/down on AI messages)
   ========================================================================== */

.asan-ai-chatbot-feedback {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 150ms ease;
}

.asan-ai-chatbot-message:hover .asan-ai-chatbot-feedback {
  opacity: 1;
}

.asan-ai-chatbot-feedback__btn {
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--asan-chat-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}

.asan-ai-chatbot-feedback__btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--asan-chat-text);
}

.asan-ai-chatbot-feedback__btn--active {
  color: var(--asan-chat-accent);
}

.asan-ai-chatbot-feedback__btn svg {
  width: 14px;
  height: 14px;
}


/* ==========================================================================
   15. WELCOME / INTRO SCREEN
   ========================================================================== */

.asan-ai-chatbot-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 16px;
}

.asan-ai-chatbot-welcome__icon {
  width: 56px;
  height: 56px;
  opacity: 0.6;
}

.asan-ai-chatbot-welcome__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--asan-chat-text);
}

.asan-ai-chatbot-welcome__subtitle {
  font-size: 14px;
  color: var(--asan-chat-text-dim);
  max-width: 260px;
  line-height: 1.6;
}


/* ==========================================================================
   16. FOOTER / BRANDING
   ========================================================================== */

.asan-ai-chatbot-footer {
  padding: 6px 14px;
  background: var(--asan-chat-surface);
  border-top: 1px solid var(--asan-chat-border);
  text-align: center;
  flex-shrink: 0;
}

.asan-ai-chatbot-footer__brand {
  font-size: 10px;
  color: var(--asan-chat-text-dim);
  opacity: 0.5;
  text-decoration: none;
}

.asan-ai-chatbot-footer__brand:hover {
  opacity: 0.8;
}


/* ==========================================================================
   17. ERROR STATE
   ========================================================================== */

.asan-ai-chatbot-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  margin: 8px 16px;
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid rgba(255, 69, 58, 0.2);
  border-radius: 10px;
  font-size: 13px;
  color: #ff453a;
  animation: asan-ai-slide-up 200ms ease-out;
}

.asan-ai-chatbot-error__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.asan-ai-chatbot-error__retry {
  background: transparent;
  border: 1px solid rgba(255, 69, 58, 0.3);
  color: #ff453a;
  font-family: inherit;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 120ms ease;
}

.asan-ai-chatbot-error__retry:hover {
  background: rgba(255, 69, 58, 0.1);
}


/* ==========================================================================
   18. LOADING STATE (initial connection)
   ========================================================================== */

.asan-ai-chatbot-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.asan-ai-chatbot-loading__spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--asan-chat-accent);
  border-radius: 50%;
  animation: asan-ai-spin 0.7s linear infinite;
}


/* ==========================================================================
   19. GDPR CONSENT BANNER
   ========================================================================== */

.asan-ai-chatbot-consent {
  padding: 16px;
  background: var(--asan-chat-surface);
  border-top: 1px solid var(--asan-chat-border);
  text-align: center;
}

.asan-ai-chatbot-consent__text {
  font-size: 12px;
  color: var(--asan-chat-text-dim);
  line-height: 1.6;
  margin-bottom: 10px;
}

.asan-ai-chatbot-consent__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.asan-ai-chatbot-consent__accept {
  padding: 7px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--asan-chat-accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}

.asan-ai-chatbot-consent__accept:hover {
  background: #0051d5;
}

.asan-ai-chatbot-consent__decline {
  padding: 7px 18px;
  font-family: inherit;
  font-size: 13px;
  background: transparent;
  color: var(--asan-chat-text-dim);
  border: 1px solid var(--asan-chat-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}

.asan-ai-chatbot-consent__decline:hover {
  background: rgba(255, 255, 255, 0.05);
}


/* ==========================================================================
   20. STREAMING CURSOR
   ========================================================================== */

.asan-ai-chatbot-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--asan-chat-text);
  margin-inline-start: 1px;
  vertical-align: text-bottom;
  animation: asan-ai-cursor-blink 1s step-end infinite;
}

@keyframes asan-ai-cursor-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}


/* ==========================================================================
   21. RESPONSIVE — MOBILE
   ========================================================================== */

@media (max-width: 480px) {
  .asan-ai-chatbot-window {
    bottom: 0;
    inset-inline-end: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }

  .asan-ai-chatbot-launcher {
    bottom: 16px;
    inset-inline-end: 16px;
  }

  .asan-ai-chatbot-window--open {
    transform: none;
  }

  .asan-ai-chatbot-messages {
    padding: 12px;
  }

  .asan-ai-chatbot-message {
    max-width: 90%;
  }
}

@media (max-width: 380px) {
  .asan-ai-chatbot-header__name {
    font-size: 14px;
  }

  .asan-ai-chatbot-message__bubble {
    font-size: 13px;
    padding: 8px 12px;
  }
}


/* ==========================================================================
   22. ACCESSIBILITY
   ========================================================================== */

.asan-ai-chatbot :focus-visible {
  outline: 2px solid var(--asan-chat-accent);
  outline-offset: 2px;
}

.asan-ai-chatbot :focus:not(:focus-visible) {
  outline: none;
}

/* Skip to input link (screen reader) */
.asan-ai-chatbot-skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.asan-ai-chatbot-skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 8px 16px;
  margin: 0;
  overflow: visible;
  clip: auto;
  background: var(--asan-chat-accent);
  color: #ffffff;
  border-radius: 6px;
  font-size: 13px;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .asan-ai-chatbot,
  .asan-ai-chatbot * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .asan-ai-chatbot-message__bubble {
    border: 1px solid CanvasText;
  }

  .asan-ai-chatbot-input__field {
    border: 1px solid ButtonText;
  }

  .asan-ai-chatbot-input__send {
    border: 1px solid ButtonText;
  }
}


/* ==========================================================================
   23. LIGHT THEME VARIANT
   ========================================================================== */

.asan-ai-chatbot[data-asan-theme="light"] {
  --asan-chat-bg:            #f5f5f7;
  --asan-chat-surface:       #ffffff;
  --asan-chat-border:        rgba(0, 0, 0, 0.08);
  --asan-chat-text:          #1d1d1f;
  --asan-chat-text-dim:      #86868b;
  --asan-chat-ai-bubble:     #ffffff;
  --asan-chat-ai-text:       #1d1d1f;
  --asan-chat-input-bg:      #f2f2f7;
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-message__bubble code {
  background: rgba(0, 0, 0, 0.05);
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-message--user .asan-ai-chatbot-message__bubble code {
  background: rgba(255, 255, 255, 0.2);
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-message__bubble pre {
  background: #f2f2f7;
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-code-header {
  background: #e8e8ed;
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-launcher {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15),
              0 2px 6px rgba(0, 0, 0, 0.08);
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-window {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18),
              0 8px 20px rgba(0, 0, 0, 0.08);
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

.asan-ai-chatbot[data-asan-theme="light"] .asan-ai-chatbot-messages {
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}