/* HX Electric — Chatbot Widget Styles */

/* ===== Container ===== */
#hx-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
@media (max-width: 600px) {
  #hx-chat {
    right: 14px;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

/* ===== Callout-Label ===== */
.hx-chat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FFD700;
  color: #000;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(255,215,0,0.4), 0 2px 8px rgba(0,0,0,0.35);
  margin-bottom: 10px;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateX(20px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  position: relative;
}
.hx-chat-label::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 24px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #FFD700;
}
.hx-chat-label.hx-label-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}
.hx-label-dismiss {
  background: rgba(0,0,0,0.15);
  border: none;
  color: #000;
  font-size: 15px;
  line-height: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s;
}
.hx-label-dismiss:hover { background: rgba(0,0,0,0.28); }

/* ===== Permanentes Hint-Label über FAB ===== */
.hx-fab-hint {
  background: #FFD700;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 8px;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(255,215,0,0.4);
  pointer-events: none;
  text-align: center;
  letter-spacing: 0.02em;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
/* Beim Öffnen ausblenden */
#hx-chat.hx-open .hx-fab-hint {
  opacity: 0;
  transform: scale(0.85);
}

/* ===== FAB Button ===== */
#hx-chat-fab {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #FFD700, #B8860B);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(255,215,0,0.35), 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  flex-shrink: 0;
  touch-action: manipulation;
}
#hx-chat-fab:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(255,215,0,0.55); }
#hx-chat-fab.open { transform: scale(0.92); }
#hx-chat-fab.busy { opacity: 0.7; }
.hx-chat-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #FFD700;
  opacity: 0;
  animation: hxFabPulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes hxFabPulse {
  0%   { transform: scale(0.95); opacity: 0.7; }
  100% { transform: scale(1.6);  opacity: 0; }
}

/* ===== Panel — Desktop ===== */
#hx-chat-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(390px, calc(100vw - 28px));
  max-height: min(640px, calc(100vh - 120px));
  background: #0c0c0c;
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,215,0,0.05);
  flex-direction: column;
  overflow: hidden;
  color: #e8e8e8;
}
#hx-chat.hx-open #hx-chat-panel {
  display: flex;
  animation: hxChatIn 0.22s ease-out;
}
@keyframes hxChatIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Panel — Mobile (Bottom Sheet) ===== */
@media (max-width: 600px) {
  #hx-chat-panel {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: 88dvh;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
    animation: hxChatInMobile 0.28s cubic-bezier(.32,1,.44,1) !important;
  }
  @keyframes hxChatInMobile {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  #hx-chat-panel::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,215,0,0.35);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }
  .hx-chat-body-open {
    overflow: hidden;
    touch-action: none;
  }
  .hx-chat-body-open #hx-chat-msgs {
    touch-action: pan-y;
  }
}

/* ===== Header ===== */
.hx-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, #131313, #0c0c0c);
  border-bottom: 1px solid rgba(255,215,0,0.15);
  flex-shrink: 0;
}
.hx-chat-title { display: flex; align-items: center; gap: 10px; }
.hx-chat-avatar {
  width: 40px; height: 40px;
  background: rgba(255,215,0,0.12);
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.hx-chat-name { font-weight: 700; font-size: 14px; }
.hx-chat-sub {
  font-size: 11px; color: #999;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
}
.hx-online-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #2ECC71; box-shadow: 0 0 6px #2ECC71;
  flex-shrink: 0;
}
.hx-chat-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  touch-action: manipulation;
}
.hx-chat-close:hover { color: #FFD700; background: rgba(255,215,0,0.1); }
@media (max-width: 600px) {
  .hx-chat-close { width: 44px; height: 44px; font-size: 28px; }
}

/* ===== Messages ===== */
.hx-chat-msgs {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(ellipse at top right, rgba(255,215,0,0.04), transparent 60%),
    #0a0a0a;
  overscroll-behavior: contain;
}
.hx-chat-msgs::-webkit-scrollbar { width: 6px; }
.hx-chat-msgs::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.2); border-radius: 3px; }

.hx-msg {
  max-width: 85%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  border-radius: 14px;
  word-wrap: break-word;
  word-break: break-word;
}
.hx-msg-assistant {
  background: #181818;
  border: 1px solid #222;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  color: #e8e8e8;
}
.hx-msg-assistant a { color: #FFD700; }
.hx-msg-assistant strong { color: #FFD700; font-weight: 600; }
.hx-msg-user {
  background: #FFD700;
  color: #000;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.hx-typing { padding: 12px 14px; }
.hx-typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 14px; }
.hx-typing-dots span {
  width: 6px; height: 6px;
  background: #FFD700;
  border-radius: 50%;
  opacity: 0.3;
  animation: hxTypingPulse 1.2s infinite ease-in-out;
}
.hx-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.hx-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes hxTypingPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* ===== Suggestions ===== */
.hx-chat-suggest {
  padding: 8px 14px 10px;
  display: block;
  background: #0a0a0a;
  flex-shrink: 0;
  line-height: 2.2;
}
.hx-chat-suggest button {
  display: inline-block;
  background: transparent;
  border: 1px solid #333;
  color: #ddd;
  padding: 6px 13px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 999px;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
  touch-action: manipulation;
  margin: 2px 3px 2px 0;
  white-space: nowrap;
}
.hx-chat-suggest button:hover,
.hx-chat-suggest button:active {
  border-color: #FFD700;
  color: #FFD700;
}

/* ===== Input Form ===== */
.hx-chat-form {
  display: block;
  padding: 10px 12px;
  background: #0a0a0a;
  border-top: 1px solid rgba(255,215,0,0.12);
  flex-shrink: 0;
}
#hx-chat-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #fff;
  padding: 11px 14px;
  font-size: 16px;
  border-radius: 999px;
  outline: none;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  margin-bottom: 8px;
}
#hx-chat-input:focus { border-color: #FFD700; }
#hx-chat-input:disabled { opacity: 0.5; }
#hx-chat-send {
  width: 44px;
  height: 44px;
  background: #FFD700;
  color: #000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  touch-action: manipulation;
  vertical-align: middle;
}
#hx-chat-send:hover:not(:disabled) { background: #FFE95C; }
#hx-chat-send:active:not(:disabled) { transform: scale(0.9); }
#hx-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Footer ===== */
.hx-chat-foot {
  padding: 8px 14px 12px;
  font-size: 10px;
  color: #666;
  text-align: center;
  background: #0a0a0a;
  letter-spacing: 0.02em;
  line-height: 1.5;
  flex-shrink: 0;
}
.hx-chat-foot a { color: #FFD700; }

/* ===== Icon-Switch FAB ===== */
.hx-fab-icon-close { display: none; }
#hx-chat-fab.open .hx-fab-icon-chat  { display: none; }
#hx-chat-fab.open .hx-fab-icon-close { display: block; }
