/* ── MCP Odoo AI Chat Widget ─────────────────────────────────────────────── */

#mcp-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Launcher button ─────────────────────────────────────────────────────── */
#mcp-chat-launcher {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7 0%, #6366f1 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(79, 142, 247, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  color: #fff;
  font-size: 1.4rem;
}
#mcp-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(79, 142, 247, 0.55);
}
#mcp-chat-launcher .badge-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  display: none;
}

/* ── Chat window ─────────────────────────────────────────────────────────── */
#mcp-chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 380px;
  height: 580px;
  border-radius: 20px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: chatSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#mcp-chat-window.open {
  display: flex;
}

@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Mobile */
@media (max-width: 480px) {
  #mcp-chat-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  #mcp-chat-widget { bottom: 16px; right: 16px; }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#mcp-chat-header {
  background: linear-gradient(135deg, #1a1f2e 0%, #2c3a5e 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.mcp-hdr-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(79, 142, 247, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.mcp-hdr-info .mcp-hdr-title {
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.2;
}
.mcp-hdr-info .mcp-hdr-sub {
  color: #a8b3c8;
  font-size: .72rem;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.mcp-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
#mcp-chat-close {
  margin-left: auto;
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: background .2s;
  flex-shrink: 0;
}
#mcp-chat-close:hover { background: rgba(255,255,255,.2); }

/* ── Status bar ──────────────────────────────────────────────────────────── */
#mcp-status-bar {
  background: rgba(245,158,11,.15);
  border-bottom: 1px solid rgba(245,158,11,.25);
  padding: 7px 16px;
  font-size: .75rem;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 6px;
  display: none;
}

/* ── Welcome screen ──────────────────────────────────────────────────────── */
#mcp-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 18px;
  background: #0f172a;
}
.mcp-welcome-icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 10px;
}
.mcp-welcome-title {
  color: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}
.mcp-welcome-sub {
  color: #64748b;
  font-size: .8rem;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
}
.mcp-form-group {
  margin-bottom: 12px;
}
.mcp-form-label {
  color: #94a3b8;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.mcp-form-input {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: #f1f5f9;
  font-size: .88rem;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
}
.mcp-form-input:focus {
  border-color: #4f8ef7;
  background: rgba(79,142,247,.08);
}
.mcp-form-input::placeholder { color: #475569; }
.mcp-start-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  margin-top: 6px;
}
.mcp-start-btn:hover { opacity: .92; transform: translateY(-1px); }
.mcp-start-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Suggestions ─────────────────────────────────────────────────────────── */
.mcp-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}
.mcp-suggestion-btn {
  background: rgba(79,142,247,.15);
  border: 1px solid rgba(79,142,247,.3);
  border-radius: 20px;
  padding: 6px 13px;
  color: #93c5fd;
  font-size: .75rem;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.mcp-suggestion-btn:hover { background: rgba(79,142,247,.28); }

/* ── Messages ────────────────────────────────────────────────────────────── */
#mcp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #0f172a;
  scrollbar-width: thin;
  scrollbar-color: #1e293b transparent;
}
#mcp-messages::-webkit-scrollbar { width: 4px; }
#mcp-messages::-webkit-scrollbar-track { background: transparent; }
#mcp-messages::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

.mcp-msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 88%;
}
.mcp-msg-row.visitor { align-self: flex-end; flex-direction: row-reverse; }
.mcp-msg-row.ai, .mcp-msg-row.agent { align-self: flex-start; }
.mcp-msg-row.system { align-self: center; max-width: 100%; }

.mcp-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: .65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mcp-msg-avatar.ai-av    { background: rgba(37,99,235,.3); }
.mcp-msg-avatar.agent-av { background: rgba(22,163,74,.3); }

.mcp-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: .84rem;
  line-height: 1.55;
  word-break: break-word;
  max-width: 100%;
}
.mcp-bubble.visitor {
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mcp-bubble.ai {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.07);
  border-bottom-left-radius: 4px;
}
.mcp-bubble.agent {
  background: #14532d;
  color: #dcfce7;
  border-bottom-left-radius: 4px;
}
.mcp-bubble.system {
  background: rgba(255,255,255,.05);
  color: #64748b;
  font-size: .77rem;
  border-radius: 20px;
  padding: 5px 14px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.06);
}
.mcp-bubble img { max-width: 180px; border-radius: 8px; margin-top: 6px; display: block; }
.mcp-bubble a.mcp-file-link {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.1); border-radius: 8px;
  padding: 7px 10px; margin-top: 6px;
  color: inherit; text-decoration: none; font-size: .78rem;
}
.mcp-msg-time { font-size: .65rem; color: #475569; margin-top: 3px; }
.mcp-msg-row.visitor .mcp-msg-time { text-align: right; }

/* Typing animation */
.mcp-typing {
  padding: 10px 14px;
  min-height: 22px;
  color: #475569;
  font-size: .76rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mcp-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4f8ef7;
  animation: typingBounce 1s infinite;
}
.mcp-typing-dot:nth-child(2) { animation-delay: .15s; }
.mcp-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); opacity: .4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* ── Input area ──────────────────────────────────────────────────────────── */
#mcp-input-area {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,.07);
}
#mcp-file-preview {
  display: none;
  padding: 6px 4px;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.mcp-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.mcp-attach-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
.mcp-attach-btn:hover { background: rgba(255,255,255,.12); color: #94a3b8; }
#mcp-msg-input {
  flex: 1;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 9px 13px;
  color: #f1f5f9;
  font-size: .84rem;
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  font-family: inherit;
  transition: border-color .2s;
  line-height: 1.4;
}
#mcp-msg-input:focus { border-color: #4f8ef7; }
#mcp-msg-input::placeholder { color: #475569; }
#mcp-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .9rem;
  transition: opacity .2s, transform .1s;
}
#mcp-send-btn:hover { opacity: .88; transform: scale(1.05); }
#mcp-send-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

/* ── Review popup ────────────────────────────────────────────────────────── */
#mcp-review-popup {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 24px;
  display: none;
}
.mcp-review-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  width: 100%;
  border: 1px solid rgba(255,255,255,.08);
}
.mcp-review-title {
  color: #f1f5f9;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.mcp-review-sub { color: #64748b; font-size: .8rem; margin-bottom: 18px; }
.mcp-stars { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.mcp-star {
  font-size: 1.8rem;
  cursor: pointer;
  color: #334155;
  transition: color .15s, transform .1s;
}
.mcp-star.active, .mcp-star:hover { color: #f59e0b; transform: scale(1.15); }
.mcp-review-textarea {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 10px;
  color: #e2e8f0;
  font-size: .82rem;
  resize: none;
  outline: none;
  margin-bottom: 12px;
  font-family: inherit;
  box-sizing: border-box;
}
.mcp-review-submit {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}
.mcp-review-skip {
  background: none;
  border: none;
  color: #475569;
  font-size: .75rem;
  cursor: pointer;
  margin-top: 8px;
  width: 100%;
}

/* ── Closed conversation footer ───────────────────────────────────────────── */
#mcp-closed-footer {
  flex-shrink: 0;
  padding: 14px 16px;
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,.07);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.mcp-closed-msg {
  color: #475569;
  font-size: .75rem;
  text-align: center;
}
#mcp-new-chat-btn {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
#mcp-new-chat-btn:hover { opacity: .9; transform: translateY(-1px); }
