/* Morgan — Octaria Sales Agent Widget */

#morgan-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fa7f44;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(250, 127, 68, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
}

#morgan-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(250, 127, 68, 0.55);
}

#morgan-launcher svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

#morgan-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 360px;
  max-height: 520px;
  background: #0d0d0d;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: opacity 0.2s, transform 0.2s;
}

#morgan-window.morgan-hidden {
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
}

#morgan-header {
  padding: 16px 20px;
  background: #111;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
}

#morgan-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fa7f44, #e05c1a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

#morgan-header-info {
  flex: 1;
}

#morgan-header-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

#morgan-header-status {
  color: #9a9aaa;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

#morgan-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

#morgan-close {
  background: none;
  border: none;
  color: #9a9aaa;
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s;
}

#morgan-close:hover {
  color: #fff;
}

#morgan-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#morgan-messages::-webkit-scrollbar {
  width: 4px;
}

#morgan-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.morgan-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

.morgan-msg-agent {
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.07);
  color: #e0e0e0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.morgan-msg-user {
  background: #fa7f44;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.morgan-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.morgan-typing span {
  width: 7px;
  height: 7px;
  background: #9a9aaa;
  border-radius: 50%;
  animation: morgan-bounce 1.2s infinite;
}

.morgan-typing span:nth-child(2) { animation-delay: 0.15s; }
.morgan-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes morgan-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

#morgan-input-row {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#morgan-input {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 13.5px;
  font-family: inherit;
  padding: 9px 12px;
  resize: none;
  outline: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color 0.15s;
}

#morgan-input:focus {
  border-color: rgba(250,127,68,0.4);
}

#morgan-input::placeholder {
  color: #555;
}

#morgan-send {
  background: #fa7f44;
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

#morgan-send:hover {
  background: #e06a2d;
}

#morgan-send:active {
  transform: scale(0.95);
}

#morgan-send svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

#morgan-send:disabled {
  background: #333;
  cursor: not-allowed;
}

@media (max-width: 420px) {
  #morgan-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 88px;
  }

  #morgan-launcher {
    right: 16px;
    bottom: 20px;
  }
}
