/* ═══════════════════════════════════════════════
   Wallickers Claude Chatbot Widget
   ═══════════════════════════════════════════════ */

:root {
  --wlk-primary:    #EE6005;
  --wlk-primary-dk: #1d4ed8;
  --wlk-bg:         #ffffff;
  --wlk-surface:    #f8fafc;
  --wlk-border:     #e2e8f0;
  --wlk-text:       #1e293b;
  --wlk-muted:      #64748b;
  --wlk-user-bg:    #2563eb;
  --wlk-user-text:  #ffffff;
  --wlk-bot-bg:     #f1f5f9;
  --wlk-bot-text:   #1e293b;
  --wlk-shadow:     0 20px 60px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.08);
  --wlk-radius:     16px;
  --wlk-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Widget Container ── */
#wlk-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: var(--wlk-font);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Toggle Button ── */
#wlk-chat-toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--wlk-primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37,99,235,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  outline: none;
}

#wlk-chat-toggle:hover {
  transform: scale(1.08);
  background: var(--wlk-primary-dk);
  box-shadow: 0 6px 24px rgba(37,99,235,0.55);
}

#wlk-chat-toggle:active {
  transform: scale(0.95);
}

.wlk-icon-close {
  display: none;
  font-style: normal;
  font-size: 18px;
  font-weight: 600;
}

div#wlk-chat-window.wlk-visible {
    display: flex;
}


#wlk-chat-toggle.wlk-open .wlk-icon-open { display: none; }
#wlk-chat-toggle.wlk-open .wlk-icon-close { display: block; }

/* ── Unread Badge ── */
#wlk-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ── Chat Window ── */
#wlk-chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 450px;
  max-height: 540px;
  background: var(--wlk-bg);
  border-radius: var(--wlk-radius);
  box-shadow: var(--wlk-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--wlk-border);
  animation: wlk-slide-up 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wlk-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
#wlk-chat-header {
  background: var(--wlk-primary);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.wlk-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wlk-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  color: white;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}

.wlk-bot-name {
  color: white;
  font-weight: 700;
  font-size: 15px;
}

.wlk-status {
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.wlk-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  animation: wlk-pulse 2s infinite;
}

@keyframes wlk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.wlk-clear-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.15s;
}

.wlk-clear-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Messages Area ── */
#wlk-messages {
  flex: 1;
  overflow-y: scroll;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--wlk-surface);
  scroll-behavior: smooth;
}

#wlk-messages::-webkit-scrollbar { width: 4px; }
#wlk-messages::-webkit-scrollbar-track { background: transparent; }
#wlk-messages::-webkit-scrollbar-thumb { background: var(--wlk-border); border-radius: 2px; }

/* ── Message Rows ── */
.wlk-msg {
  display: flex;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  flex-wrap: wrap;
}

.wlk-msg--visible {
  opacity: 1;
  transform: translateY(0);
}

.wlk-msg--user { justify-content: flex-end; }
.wlk-msg--bot  { justify-content: flex-start; }

/* ── Bubbles ── */
.wlk-bubble {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.wlk-msg--user .wlk-bubble {
  background: var(--wlk-user-bg);
  color: var(--wlk-user-text);
  border-bottom-right-radius: 4px;
}

.wlk-msg--bot .wlk-bubble {
  background: var(--wlk-bot-bg);
  color: var(--wlk-bot-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.wlk-bubble code {
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
  font-family: monospace;
}

/* ── Typing Indicator ── */
#wlk-typing-indicator {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 10px 16px 6px;
  background: var(--wlk-surface);
}

#wlk-typing-indicator:not([hidden]) {
  display: flex;
}

#wlk-typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--wlk-muted);
  border-radius: 50%;
  animation: wlk-bounce 1.2s infinite;
}

#wlk-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
#wlk-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wlk-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Input Area ── */
#wlk-chat-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--wlk-border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--wlk-bg);
  flex-shrink: 0;
}

#wlk-input {
  flex: 1;
  border: 1.5px solid var(--wlk-border);
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: var(--wlk-font);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  background: var(--wlk-surface);
  color: var(--wlk-text);
  min-height: 40px;
  max-height: 120px;
  line-height: 1.4;
}

#wlk-input:focus {
  border-color: var(--wlk-primary);
  background: white;
}

#wlk-input::placeholder { color: var(--wlk-muted); }

#wlk-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wlk-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  padding: 0;
}

#wlk-send-btn:hover { background: var(--wlk-primary-dk); }
#wlk-send-btn:active { transform: scale(0.92); }
#wlk-send-btn:disabled { opacity: 0.5; cursor: default; }

#wlk-send-btn svg {
  width: 16px;
  height: 16px;
  color: white;
  stroke: white;
  margin-left: 2px;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  #wlk-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  #wlk-chat-window {
    width: calc(100vw - 32px);
    max-height: 75vh;
    bottom: 66px;
    right: 0;
  }
}

/* ── Choice Buttons ── */
.wlk-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 0 4px;
}

.wlk-choice-btn {
    background: #ffffff;
    border: 1.5px solid var(--wlk-primary);
    color: var(--wlk-primary);
    border-radius: 20px;
    padding: 12px 18px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: var(--wlk-font);
}

.wlk-choice-btn:hover {
    background: var(--wlk-primary);
    color: #ffffff;
}

/* ── Markdown Rendering ── */
.wlk-bubble p {
    margin: 0 0 6px 0;
}

.wlk-bubble p:last-child {
    margin-bottom: 0;
}

.wlk-bubble h2,
.wlk-bubble h3,
.wlk-bubble h4 {
    margin: 8px 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--wlk-text);
}

.wlk-bubble ul,
.wlk-bubble ol {
    margin: 4px 0 6px 0;
    padding-left: 20px;
}

.wlk-bubble li {
    margin-bottom: 3px;
    line-height: 1.5;
}

.wlk-bubble hr {
    border: none;
    border-top: 1px solid var(--wlk-border);
    margin: 8px 0;
}

.wlk-bubble a {
    color: var(--wlk-primary);
    text-decoration: underline;
}

.wlk-bubble strong {
    font-weight: 700;
}

.wlk-bubble code {
    background: rgba(0,0,0,0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

.wlk-bubble br {
    display: none;
}
