/* ============================================
   HELM — Fourth Watch Ship AI Chat Widget
   ============================================ */

/* --- Toggle Button --- */
#helm-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #d4a853 0%, #b8923e 100%);
  color: #0d1b2a;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.4), 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#helm-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(212, 168, 83, 0.5), 0 4px 12px rgba(0,0,0,0.25);
}

#helm-toggle.open {
  transform: scale(0.9) rotate(45deg);
  opacity: 0.6;
}

/* --- Chat Panel --- */
#helm-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9001;
  width: 380px;
  max-height: 540px;
  background: #0d1b2a;
  border: 1px solid rgba(212, 168, 83, 0.25);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* --- Header --- */
.helm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #142236 0%, #1b2d45 100%);
  border-bottom: 1px solid rgba(212, 168, 83, 0.15);
}

.helm-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.helm-header-info strong {
  color: #d4a853;
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  font-family: 'Inter', sans-serif;
}

.helm-header-info span {
  color: #667788;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

.helm-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
  animation: helm-pulse 2s infinite;
}

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

.helm-close {
  background: none;
  border: none;
  color: #667788;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1;
}

.helm-close:hover {
  color: #d4a853;
  background: rgba(212, 168, 83, 0.1);
}

/* --- Messages Area --- */
.helm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
  max-height: 360px;
}

.helm-messages::-webkit-scrollbar {
  width: 4px;
}

.helm-messages::-webkit-scrollbar-track {
  background: transparent;
}

.helm-messages::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 83, 0.2);
  border-radius: 2px;
}

/* --- Message Bubbles --- */
.helm-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.55;
  font-family: 'Inter', sans-serif;
  animation: helm-fadeIn 0.3s ease;
}

@keyframes helm-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.helm-msg-ai {
  background: #1b2d45;
  color: #d0ccc4;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(212, 168, 83, 0.08);
}

.helm-msg-ai strong {
  color: #d4a853;
}

.helm-msg-ai a {
  color: #e8c97a;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.helm-msg-ai a:hover {
  color: #d4a853;
}

.helm-msg-user {
  background: #d4a853;
  color: #0d1b2a;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* --- Typing Indicator --- */
.helm-typing {
  display: flex;
  gap: 4px;
  padding: 12px 18px;
  min-width: 60px;
}

.helm-typing span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d4a853;
  opacity: 0.4;
  animation: helm-dot 1.2s infinite;
}

.helm-typing span:nth-child(2) { animation-delay: 0.2s; }
.helm-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes helm-dot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* --- Quick Reply Chips --- */
.helm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  animation: helm-fadeIn 0.3s ease;
}

.helm-chip {
  padding: 6px 14px;
  border: 1px solid rgba(212, 168, 83, 0.4);
  border-radius: 20px;
  background: transparent;
  color: #d4a853;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.helm-chip:hover {
  background: rgba(212, 168, 83, 0.15);
  border-color: #d4a853;
}

/* --- Input Area --- */
.helm-input-row {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: 1px solid rgba(212, 168, 83, 0.1);
  background: #0a1628;
}

#helm-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(212, 168, 83, 0.15);
  border-radius: 8px;
  background: #142236;
  color: #e0ddd6;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

#helm-input::placeholder {
  color: #556677;
}

#helm-input:focus {
  border-color: rgba(212, 168, 83, 0.4);
}

#helm-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: #d4a853;
  color: #0d1b2a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

#helm-send:hover {
  background: #e8c97a;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  #helm-panel {
    right: 12px;
    left: 12px;
    bottom: 88px;
    width: auto;
    max-height: 70vh;
  }

  #helm-toggle {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}
