/* ============================================================
   CLaudio Chatbot Widget CSS
   All classes prefixed with .claudio- to avoid conflicts
   ============================================================ */

/* ---- Variables ---- */
:root {
  --claudio-bg:          #1a1a2e;
  --claudio-surface:     #16213e;
  --claudio-accent:      #F5C518;
  --claudio-user-bubble: #3a86ff;
  --claudio-bot-bubble:  #F5C518;
  --claudio-text:        #ffffff;
  --claudio-text-muted:  #a0a0b8;
  --claudio-border:      rgba(255,255,255,0.08);
  --claudio-shadow:      0 8px 32px rgba(0,0,0,0.5);
  --claudio-radius:      16px;
  --claudio-font:        system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Reset for widget elements ---- */
.claudio-btn,
.claudio-panel,
.claudio-panel *,
.claudio-btn * {
  box-sizing: border-box;
  font-family: var(--claudio-font);
}

/* ============================================================
   BUBBLE BUTTON
   ============================================================ */
.claudio-btn {
  position:        fixed;
  bottom:          24px;
  right:           24px;
  z-index:         9998;
  width:           60px;
  height:          60px;
  border-radius:   50%;
  background:      var(--claudio-accent);
  border:          none;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  box-shadow:      0 4px 20px rgba(245,197,24,0.4);
  transition:      transform 0.2s ease, box-shadow 0.2s ease;
  color:           #1a1a2e;
}

.claudio-btn:hover {
  transform:  scale(1.08);
  box-shadow: 0 6px 28px rgba(245,197,24,0.55);
}

.claudio-btn--open {
  transform: scale(0.92) rotate(10deg);
}

.claudio-btn svg {
  width:  26px;
  height: 26px;
  color:  #1a1a2e;
}

.claudio-btn-badge {
  position:        absolute;
  top:             4px;
  right:           4px;
  width:           18px;
  height:          18px;
  background:      #e63946;
  color:           #fff;
  border-radius:   50%;
  font-size:       11px;
  font-weight:     700;
  display:         flex;
  align-items:     center;
  justify-content: center;
  border:          2px solid #fff;
  animation:       claudio-pulse 1.5s ease infinite;
}

@keyframes claudio-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}

/* ============================================================
   CHAT PANEL
   ============================================================ */
.claudio-panel {
  position:       fixed;
  bottom:         96px;
  right:          24px;
  z-index:        9999;
  width:          380px;
  height:         550px;
  background:     var(--claudio-bg);
  border-radius:  var(--claudio-radius);
  box-shadow:     var(--claudio-shadow);
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
  border:         1px solid var(--claudio-border);
  /* hidden state */
  opacity:        0;
  transform:      translateY(20px) scale(0.97);
  pointer-events: none;
  transition:     opacity 0.25s ease, transform 0.25s ease;
}

.claudio-panel--open {
  opacity:        1;
  transform:      translateY(0) scale(1);
  pointer-events: all;
}

/* ---- Header ---- */
.claudio-header {
  display:         flex;
  align-items:     center;
  gap:             12px;
  padding:         14px 16px;
  background:      rgba(0,0,0,0.3);
  border-bottom:   1px solid var(--claudio-border);
  flex-shrink:     0;
}

.claudio-header-avatar {
  position: relative;
  flex-shrink: 0;
}

.claudio-avatar-gif {
  width:         44px;
  height:        44px;
  border-radius: 50%;
  object-fit:    cover;
  border:        2px solid var(--claudio-accent);
}

.claudio-status-dot {
  position:      absolute;
  bottom:        2px;
  right:         2px;
  width:         10px;
  height:        10px;
  border-radius: 50%;
  border:        2px solid var(--claudio-bg);
  background:    #6c757d;
}

.claudio-status-dot--online {
  background: #2ecc71;
  animation: claudio-pulse 2s ease infinite;
}

.claudio-status-dot--away {
  background: #f39c12;
}

.claudio-header-info {
  flex: 1;
  min-width: 0;
}

.claudio-header-name {
  font-size:   16px;
  font-weight: 700;
  color:       var(--claudio-text);
  line-height: 1.2;
}

.claudio-header-sub {
  font-size:  12px;
  color:      var(--claudio-text-muted);
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
}

.claudio-close-btn {
  background:   none;
  border:       none;
  cursor:       pointer;
  color:        var(--claudio-text-muted);
  padding:      6px;
  border-radius:8px;
  display:      flex;
  align-items:  center;
  transition:   color 0.15s, background 0.15s;
  flex-shrink:  0;
}

.claudio-close-btn:hover {
  color:      var(--claudio-text);
  background: rgba(255,255,255,0.08);
}

.claudio-close-btn svg {
  width:  18px;
  height: 18px;
}

/* ---- Preview banner ---- */
.claudio-preview-banner {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  background:      rgba(255, 140, 0, 0.15);
  border-bottom:   1px solid rgba(255,140,0,0.3);
  color:           #ffa500;
  font-size:       12px;
  font-weight:     600;
  padding:         8px 16px;
  flex-shrink:     0;
}

/* ---- Messages area ---- */
.claudio-messages {
  flex:       1;
  overflow-y: auto;
  padding:    16px 12px;
  display:    flex;
  flex-direction: column;
  gap:        12px;
  scroll-behavior: smooth;
}

.claudio-messages::-webkit-scrollbar {
  width: 4px;
}
.claudio-messages::-webkit-scrollbar-track {
  background: transparent;
}
.claudio-messages::-webkit-scrollbar-thumb {
  background:    rgba(255,255,255,0.15);
  border-radius: 4px;
}

/* ---- Message bubbles ---- */
.claudio-msg {
  display:    flex;
  gap:        8px;
  opacity:    0;
  transform:  translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

/* Bot / human messages: avatar on left */
.claudio-msg--bot,
.claudio-msg--human {
  align-items: flex-end;
}

/* User messages: push to right */
.claudio-msg--user {
  flex-direction: row-reverse;
}

.claudio-msg-avatar-wrap {
  flex-shrink: 0;
}

.claudio-msg-avatar {
  width:         32px;
  height:        32px;
  border-radius: 50%;
  object-fit:    cover;
}

.claudio-msg-body {
  display:        flex;
  flex-direction: column;
  gap:            2px;
  max-width:      80%;
}

.claudio-msg-label {
  font-size:   10px;
  font-weight: 600;
  color:       var(--claudio-text-muted);
  margin-left: 4px;
  letter-spacing: 0.03em;
}

.claudio-msg-bubble {
  padding:       10px 14px;
  border-radius: 14px;
  max-width:     100%;
  word-wrap:     break-word;
}

/* Bot bubble */
.claudio-msg--bot .claudio-msg-bubble {
  background:           var(--claudio-bot-bubble);
  color:                #1a1a2e;
  border-bottom-left-radius: 4px;
}

/* Human bubble (Christophe) */
.claudio-msg--human .claudio-msg-bubble {
  background:                #2ecc71;
  color:                     #fff;
  border-bottom-left-radius: 4px;
}

/* User bubble */
.claudio-msg--user .claudio-msg-bubble {
  background:                var(--claudio-user-bubble);
  color:                     #fff;
  border-bottom-right-radius:4px;
}

.claudio-msg-content {
  font-size:   14px;
  line-height: 1.5;
}

.claudio-msg-time {
  font-size:  10px;
  opacity:    0.6;
  text-align: right;
  margin-top: 4px;
}

/* ---- Typing indicator ---- */
.claudio-typing-bubble {
  display:     flex;
  align-items: center;
  gap:         5px;
  padding:     14px 18px;
}

.claudio-typing-bubble span {
  display:       inline-block;
  width:         8px;
  height:        8px;
  border-radius: 50%;
  background:    #1a1a2e;
  animation:     claudio-bounce 1.2s ease infinite;
}

.claudio-dot-1 { animation-delay: 0s; }
.claudio-dot-2 { animation-delay: 0.2s; }
.claudio-dot-3 { animation-delay: 0.4s; }

@keyframes claudio-bounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1;   }
}

/* ---- Transfer notice ---- */
.claudio-transfer-notice {
  display:         flex;
  align-items:     center;
  gap:             8px;
  padding:         10px 16px;
  background:      rgba(46,204,113,0.1);
  border-top:      1px solid rgba(46,204,113,0.2);
  color:           #2ecc71;
  font-size:       13px;
  font-weight:     500;
  flex-shrink:     0;
}

/* ---- Input area ---- */
.claudio-input-area {
  display:       flex;
  align-items:   flex-end;
  gap:           8px;
  padding:       12px 14px;
  border-top:    1px solid var(--claudio-border);
  background:    rgba(0,0,0,0.2);
  flex-shrink:   0;
}

.claudio-input {
  flex:          1;
  background:    rgba(255,255,255,0.07);
  border:        1px solid var(--claudio-border);
  border-radius: 12px;
  color:         var(--claudio-text);
  font-size:     14px;
  font-family:   var(--claudio-font);
  padding:       10px 14px;
  resize:        none;
  outline:       none;
  line-height:   1.5;
  min-height:    40px;
  max-height:    100px;
  transition:    border-color 0.15s;
}

.claudio-input::placeholder {
  color: var(--claudio-text-muted);
}

.claudio-input:focus {
  border-color: rgba(245,197,24,0.5);
}

.claudio-input:disabled {
  opacity: 0.5;
  cursor:  not-allowed;
}

.claudio-send-btn {
  background:    var(--claudio-accent);
  border:        none;
  border-radius: 12px;
  width:         40px;
  height:        40px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  cursor:        pointer;
  color:         #1a1a2e;
  flex-shrink:   0;
  transition:    transform 0.15s, background 0.15s;
}

.claudio-send-btn:hover:not(:disabled) {
  transform:  scale(1.08);
  background: #ffd700;
}

.claudio-send-btn:disabled {
  opacity: 0.5;
  cursor:  not-allowed;
}

.claudio-send-btn svg {
  width:  18px;
  height: 18px;
}

/* ---- Footer ---- */
.claudio-footer {
  text-align:  center;
  font-size:   10px;
  color:       var(--claudio-text-muted);
  padding:     6px 0 8px;
  flex-shrink: 0;
  background:  rgba(0,0,0,0.2);
}

/* ============================================================
   MOBILE RESPONSIVE (< 480px)
   ============================================================ */
@media (max-width: 480px) {
  .claudio-btn {
    bottom: 16px;
    right:  16px;
    width:  54px;
    height: 54px;
  }

  .claudio-panel {
    bottom:        0;
    right:         0;
    left:          0;
    top:           0;
    width:         100%;
    height:        100%;
    border-radius: 0;
  }

  .claudio-panel--open {
    transform: translateY(0) scale(1);
  }
}
