﻿/* ICO SWISS Chatbot Widget (no-LLM) â€” Clara */

/*
  Theme integration:
  - Site uses documentElement[data-theme="light|dark"] via assets/js/theme.js
  - We adapt colors automatically.
*/

.ico-chatbot {
  /* match ICO site palette (see main.css :root --green) */
  --ico-chat-a: #1B8E2D;
  --ico-chat-b: #44C657;

  /* light defaults */
  --ico-chat-text: rgba(10, 16, 28, 0.92);
  --ico-chat-muted: rgba(10, 16, 28, 0.66);
  --ico-chat-border: rgba(10, 16, 28, 0.14);
  --ico-chat-panel: rgba(255, 255, 255, 0.97);
  --ico-chat-panel2: rgba(255, 255, 255, 0.97);
  --ico-chat-bubble: rgba(10, 16, 28, 0.06);
  --ico-chat-input: rgba(10, 16, 28, 0.06);
  --ico-chat-shadow: 0 22px 70px rgba(10, 16, 28, 0.22);

  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}

:root[data-theme="dark"] .ico-chatbot {
  --ico-chat-text: rgba(255, 255, 255, 0.92);
  --ico-chat-muted: rgba(255, 255, 255, 0.66);
  --ico-chat-border: rgba(255, 255, 255, 0.16);
  --ico-chat-panel: rgba(11, 18, 32, 0.97);
  --ico-chat-panel2: rgba(11, 18, 32, 0.97);
  --ico-chat-bubble: rgba(255, 255, 255, 0.07);
  --ico-chat-input: rgba(0, 0, 0, 0.22);
  --ico-chat-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

.ico-chatbot__fab {
  width: 120px;
  height: 120px;
  border-radius: 22px;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 220ms ease;
  position: relative;

  /* feel alive */
  animation: icoFabFloat 2800ms ease-in-out infinite;
}

@keyframes icoFabFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* no background layer: we want only the bot */
.ico-chatbot__fab:before { content: none; }

.ico-chatbot__fabAvatar {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.22));
}

.ico-chatbot__fab:hover {
  animation-play-state: paused;
  transform: translateY(-2px) scale(1.03);
}

.ico-chatbot__fab:active {
  transform: translateY(0) scale(0.98);
}

.ico-chatbot__fabTip {
  position: absolute;
  right: 78px;
  bottom: 22px;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--ico-chat-border);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(10, 16, 28, 0.92);
  box-shadow: 0 18px 60px rgba(10,16,28,0.18);
  backdrop-filter: blur(10px);
  max-width: min(300px, calc(100vw - 130px));
}

:root[data-theme="dark"] .ico-chatbot__fabTip {
  background: rgba(11, 18, 32, 0.84);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 60px rgba(0,0,0,0.36);
}

.ico-chatbot__fabTip:after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 14px;
  width: 12px;
  height: 12px;
  background: inherit;
  border-right: 1px solid var(--ico-chat-border);
  border-bottom: 1px solid var(--ico-chat-border);
  transform: rotate(-45deg);
}

.ico-chatbot__fabTip--show {
  display: inline-flex;
  animation: icoTipIn 160ms ease-out;
}

@keyframes icoTipIn {
  from { opacity: 0; transform: translateX(6px) scale(0.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.ico-chatbot__fabFlag {
  width: 20px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.06);
}

.ico-chatbot__fabTipText {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.ico-chatbot__panel {
  position: absolute;
  right: 0;
  bottom: 90px;
  width: min(390px, calc(100vw - 32px));
  max-height: min(580px, calc(100vh - 120px));
  border-radius: 20px;

  /* less transparent, more readable */
  background: linear-gradient(180deg, var(--ico-chat-panel), var(--ico-chat-panel2));

  border: 1px solid var(--ico-chat-border);
  box-shadow: var(--ico-chat-shadow);
  overflow: hidden;

  transform-origin: 100% 100%;
  transform: scale(0.985);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.ico-chatbot--open .ico-chatbot__panel {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.ico-chatbot__header {
  padding: 14px 14px 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--ico-chat-border);
  background: rgba(255, 255, 255, 0.92);
}

:root[data-theme="dark"] .ico-chatbot__header {
  background: rgba(11, 18, 32, 0.92);
}

.ico-chatbot__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ico-chatbot__avatar {
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  display: none;
}

.ico-chatbot__avatar img {
  display: none;
}

.ico-chatbot__title {
  display: grid;
  line-height: 1.05;
}

.ico-chatbot__name {
  font-size: 13px;
  font-weight: 900;
  color: var(--ico-chat-text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ico-chatbot__tag {
  font-size: 11px;
  color: var(--ico-chat-muted);
}

.ico-chatbot__headerRight {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ico-chatbot__close {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--ico-chat-border);
  background: rgba(10, 16, 28, 0.06);
  color: var(--ico-chat-text);
  cursor: pointer;
}

:root[data-theme="dark"] .ico-chatbot__close {
  background: rgba(0, 0, 0, 0.18);
}

/* sticky chips */
.ico-chatbot__topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ico-chat-border);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(10px);
}

:root[data-theme="dark"] .ico-chatbot__topbar {
  background: rgba(11, 18, 32, 0.62);
}

.ico-chatbot__chipsRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 2px;
}

.ico-chatbot__chipsRow::-webkit-scrollbar {
  display: none;
}

.ico-chatbot__chip {
  flex: 0 0 auto;
  border: 1px solid var(--ico-chat-border);
  background: rgba(10, 16, 28, 0.06);
  color: var(--ico-chat-text);
  border-radius: 999px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: filter 160ms ease, background 160ms ease;
}

:root[data-theme="dark"] .ico-chatbot__chip {
  background: rgba(0, 0, 0, 0.16);
}

.ico-chatbot__chip:hover {
  filter: brightness(1.03);
  background: rgba(255, 255, 255, 0.22);
}

:root[data-theme="dark"] .ico-chatbot__chip:hover {
  background: rgba(255, 255, 255, 0.10);
}

.ico-chatbot__body {
  padding: 12px 14px;
  overflow-y: auto;
  max-height: 280px;
}

.ico-chatbot__bubble {
  margin: 10px 0;
  display: flex;
}

.ico-chatbot__bubble--bot {
  justify-content: flex-start;
}

.ico-chatbot__bubble--user {
  justify-content: flex-end;
}

.ico-chatbot__bubbleInner {
  max-width: 86%;
  padding: 11px 12px;
  border-radius: 16px;
  border: 1px solid var(--ico-chat-border);
  background: var(--ico-chat-bubble);
  color: var(--ico-chat-text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ico-chatbot__bubble--user .ico-chatbot__bubbleInner {
  background: linear-gradient(135deg, rgba(27, 142, 45, 0.72), rgba(68, 198, 87, 0.45));
  border-color: rgba(255, 255, 255, 0.20);
  color: rgba(255, 255, 255, 0.96);
}

/* typing indicator */
.ico-chatbot__typingInner {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.ico-chatbot__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: icoChatPulse 1100ms ease-in-out infinite;
}

.ico-chatbot__dot:nth-child(2) { animation-delay: 120ms; }
.ico-chatbot__dot:nth-child(3) { animation-delay: 240ms; }

@keyframes icoChatPulse {
  0%, 100% { transform: translateY(0); opacity: 0.30; }
  50% { transform: translateY(-2px); opacity: 0.85; }
}

.ico-chatbot__mailLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 900;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, rgba(27, 142, 45, 0.86), rgba(68, 198, 87, 0.55));
}

.ico-chatbot__footer {
  padding: 12px 12px;
  border-top: 1px solid var(--ico-chat-border);
  background: rgba(255, 255, 255, 0.10);
}

:root[data-theme="dark"] .ico-chatbot__footer {
  background: rgba(255, 255, 255, 0.06);
}

.ico-chatbot__inputRow {
  display: flex;
  gap: 8px;
}

.ico-chatbot__input {
  flex: 1;
  border-radius: 14px;
  border: 1px solid var(--ico-chat-border);
  background: var(--ico-chat-input);
  color: var(--ico-chat-text);
  padding: 11px 12px;
  font-size: 13px;
  outline: none;
}

.ico-chatbot__send {
  width: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: linear-gradient(135deg, rgba(27, 142, 45, 0.86), rgba(68, 198, 87, 0.55));
  color: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  font-weight: 900;
}

.ico-chatbot__note {
  display: none;
}

.ico-chatbot__clearBtn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--ico-chat-border);
  background: rgba(10, 16, 28, 0.06);
  color: var(--ico-chat-text);
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
}

:root[data-theme="dark"] .ico-chatbot__clearBtn {
  background: rgba(0, 0, 0, 0.18);
}

@media (max-width: 520px) {
  .ico-chatbot {
    right: 14px;
    bottom: 14px;
  }
  .ico-chatbot__panel {
    width: calc(100vw - 28px);
  }
  .ico-chatbot__fab {
    width: 110px;
    height: 110px;
  }
  .ico-chatbot__fabAvatar {
    width: 110px;
    height: 110px;
  }
  .ico-chatbot__fabTip {
    right: 68px;
    bottom: 18px;
    max-width: calc(100vw - 100px);
  }
  .ico-chatbot__fabTipText {
    white-space: normal;
  }
}


@media (prefers-reduced-motion: reduce) {
  .ico-chatbot__panel,
  .ico-chatbot__fab {
    transition: none !important;
  }
  .ico-chatbot__dot {
    animation: none !important;
  }
}
