.ai-chat-trigger-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
}

:root {
  --ai-chat-bubble: #2563eb;
  --ai-chat-bubble-text: #ffffff;
  --ai-chat-bubble-shadow-strong: rgba(37, 99, 235, 0.7);
  --ai-chat-bubble-shadow-weak: rgba(37, 99, 235, 0);
  --ai-chat-tooltip-bg: #0f172a;
  --ai-chat-tooltip-text: #ffffff;
  --ai-chat-tooltip-border: #0f172a;
}

.ai-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  background: var(--ai-chat-bubble);
  color: var(--ai-chat-bubble-text);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: radiate 1.8s ease-out infinite;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.ai-chat-fab-tooltip {
  /* Tail dimensions */
  --b: 14px;  /* base width of tail */
  --h: 10px;  /* height of tail */

  position: absolute;
  right: 76px;
  bottom: 45px;

  max-width: 28ch;
  padding: 10px 12px;

  /* Speech bubble shape */
  border-radius: 16px;
  border-bottom-right-radius: 0;

  background:
    0 0 / calc(100% + var(--h)) calc(100% + var(--h))
    linear-gradient(-30deg,
      var(--ai-chat-tooltip-bg),
      var(--ai-chat-tooltip-bg)
    );

  color: var(--ai-chat-tooltip-text);

  font-size: 13px;
  line-height: 1.3;
  text-align: center;

  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  white-space: nowrap;

  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1;
}

.ai-chat-fab-tooltip::before {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--h)) calc(-1 * var(--h)) 0;
  background: inherit; /* παίρνει το ίδιο background */
  clip-path: polygon(
    100% 100%,
    calc(100% - var(--h)) calc(100% - var(--b) - var(--h)),
    calc(100% - var(--h) - var(--b)) calc(100% - var(--h))
  );
}

.ai-chat-fab-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ai-chat-fab:hover,
.ai-chat-fab:focus {
  transform: scale(1.04);
}

.ai-chat-fab svg {
  width: 32px;
  height: 32px;
}

@keyframes radiate {
  0% { box-shadow: 0 0 0 0 var(--ai-chat-bubble-shadow-strong); }
  70% { box-shadow: 0 0 0 16px var(--ai-chat-bubble-shadow-weak); }
  100% { box-shadow: 0 0 0 0 var(--ai-chat-bubble-shadow-weak); }
}

.ai-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 99998;
  display: none;
  pointer-events: auto;
  width: 340px;
  height: 440px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-panel.is-open {
  display: flex;
  z-index: 3147483644;
}

.ai-chat-header {
  padding: 12px;
  background: var(--ai-chat-bubble);
  color: var(--ai-chat-bubble-text);
  border-top-left-radius: 0px;
  border-top-right-radius: 0px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.ai-chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.ai-chat-log {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.4;
  background: #f8f9fb;
}

.ai-chat-input-area {
  padding: 10px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.ai-chat-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.ai-chat-send {
  padding: 8px 12px;
  background: #fff;
  color: var(--ai-chat-bubble);
  border: 1px solid var(--ai-chat-bubble);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s ease, color 0.2s ease;
}

.ai-chat-send:hover,
.ai-chat-send:focus {
  background: var(--ai-chat-bubble);
  color: var(--ai-chat-bubble-text);
}

.ai-chat-message {
  margin-bottom: 10px;
  display: flex;
  width: 100%;
}

.ai-chat-message.is-user {
  justify-content: flex-end;
}

.ai-chat-message.is-bot {
  justify-content: flex-start;
}

.ai-chat-bubble {
  padding: 8px 10px;
  border-radius: 10px;
  display: inline-block;
  max-width: 90%;
}

.ai-chat-message.is-user .ai-chat-bubble {
  background: #f1f1f1;
  color: #000;
}

.ai-chat-message.is-bot .ai-chat-bubble {
  background: var(--ai-chat-bubble);
  color: var(--ai-chat-bubble-text);
}

.ai-chat-clear-row {
  text-align: center;
  margin-top: 6px;
}

.ai-chat-log .ai-chat-clear-link {
  color: var(--ai-chat-bubble);
  font-weight: 600;
  text-decoration: underline;
}

.ai-chat-log a {
  color: var(--ai-chat-bubble-text);
  text-decoration: underline;
}

.ai-chat-log a:hover,
.ai-chat-log a:focus {
  color: var(--ai-chat-bubble-text);
}

@media (max-width: 640px) {
 .ai-chat-panel {
    left: 0 !important;
    right: 0 !important;
    top: var(--ai-chat-vv-top, 0px) !important;
    height: var(--ai-chat-vh, 100vh) !important;
    width: 100vw !important;
    max-width: 100vw !important;
    bottom: auto !important;
    border-radius: 0 !important;
  }

  /* zoom fix και από CSS (αν το προτιμάς αντί για inline) */
  .ai-chat-input { font-size: 16px !important; }
  .ai-chat-trigger-container {
    bottom: 1rem;
    right: 1rem;
  }

  .ai-chat-fab-tooltip {
    right: 80px;
    bottom: 60px;
    max-width: 180px;
    white-space: normal;
  }
}
