/* ==========================================================================
   KORA — on-site chat widget
   Loads after styles.css so it inherits the brand tokens (--aqua, --ink …).
   The widget builds its own markup from js/chatbot.js — there is no HTML
   to copy into your pages.
   ========================================================================== */

/* ---------------------------------------------------------------- launcher */
.kora-launcher {
  position: fixed;
  right: 1.9rem;
  bottom: 1.9rem;
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.95rem 1.5rem 0.95rem 1.2rem;
  border: 1.5px solid rgba(94, 220, 226, 0.45);
  border-radius: 100px;
  background: linear-gradient(160deg, #1b5a66, #0d323c);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.95),
              0 6px 26px -12px rgba(94, 220, 226, 0.45);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease),
              box-shadow 0.2s var(--ease);
}
.kora-launcher:hover {
  border-color: var(--aqua);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 22px 50px -16px rgba(0, 0, 0, 0.95),
              0 8px 30px -10px rgba(94, 220, 226, 0.6);
}
.kora-launcher:active { transform: translateY(0); }
.kora-launcher__icon { width: 20px; height: 20px; color: var(--aqua); flex: none; }
.kora-launcher__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 0 0 rgba(94, 220, 226, 0.55);
  animation: koraPulse 2.6s infinite;
  flex: none;
}
@keyframes koraPulse {
  0%   { box-shadow: 0 0 0 0 rgba(94, 220, 226, 0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(94, 220, 226, 0); }
  100% { box-shadow: 0 0 0 0 rgba(94, 220, 226, 0); }
}

/* One-time nudge so first-time visitors notice it */
.kora-teaser {
  position: fixed;
  right: 1.9rem;
  bottom: 6.3rem;
  z-index: 94;
  max-width: 260px;
  padding: 0.85rem 2rem 0.85rem 1rem;
  background: linear-gradient(160deg, #123c46, #0a2028);
  border: 1px solid rgba(94, 220, 226, 0.28);
  border-radius: 14px 14px 4px 14px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.kora-teaser.is-in { opacity: 1; transform: none; }
.kora-teaser b { color: var(--text); font-weight: 600; }
.kora-teaser__close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: 0;
  color: var(--faint, #6d8f96);
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}
.kora-teaser__close:hover { color: var(--aqua); }

.kora-launcher.is-hidden { display: none; }

/* The WhatsApp button moves up so the two stack rather than overlap,
   and steps out of the way entirely while the chat panel is open */
.wa-float { right: 1.9rem !important; bottom: 6.3rem !important; }
body.kora-teaser-on .wa-float { bottom: 11.5rem !important; }
body.kora-chat-open .wa-float { display: none; }

/* ---------------------------------------------------------------- panel */
.kora-panel {
  position: fixed;
  right: 1.9rem;
  bottom: 1.9rem;
  z-index: 96;
  width: min(392px, calc(100vw - 3.8rem));
  height: min(620px, calc(100vh - 3.8rem));
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, #0d2b34, #06171d 62%);
  border: 1px solid rgba(94, 220, 226, 0.22);
  border-radius: 18px;
  box-shadow: 0 30px 70px -26px rgba(0, 0, 0, 0.92);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.kora-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

.kora-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(94, 220, 226, 0.14);
  background: rgba(6, 22, 27, 0.5);
}
.kora-head img { width: 30px; height: 30px; object-fit: contain; }
.kora-head__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.2;
}
.kora-head__title span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--aqua);
  font-weight: 400;
}
.kora-head__actions { margin-left: auto; display: flex; gap: 0.35rem; }
.kora-icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(160, 200, 206, 0.14);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.kora-icon-btn:hover { border-color: var(--aqua); color: var(--aqua); }
.kora-icon-btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- messages */
.kora-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(94, 220, 226, 0.3) transparent;
}
.kora-log::-webkit-scrollbar { width: 6px; }
.kora-log::-webkit-scrollbar-thumb {
  background: rgba(94, 220, 226, 0.25);
  border-radius: 3px;
}

.kora-msg {
  max-width: 86%;
  padding: 0.62rem 0.85rem;
  font-size: 0.875rem;
  line-height: 1.55;
  border-radius: 14px;
  animation: koraIn 0.28s var(--ease) both;
}
.kora-msg--bot {
  background: #1f505b;
  color: var(--text);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.kora-msg--user {
  background: rgba(94, 220, 226, 0.13);
  border: 1px solid rgba(94, 220, 226, 0.35);
  color: var(--aqua-soft, #9deaee);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.kora-msg a { color: #bff2f5; text-decoration: underline; }
@keyframes koraIn { from { opacity: 0; transform: translateY(7px); } }

.kora-typing { display: inline-flex; gap: 4px; align-items: center; padding: 0.3rem 0.1rem; }
.kora-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--aqua);
  opacity: 0.45;
  animation: koraBlink 1.2s infinite;
}
.kora-typing i:nth-child(2) { animation-delay: 0.18s; }
.kora-typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes koraBlink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* ---------------------------------------------------------------- chips */
.kora-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.7rem;
}
.kora-chip {
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.45rem 0.8rem;
  border-radius: 100px;
  border: 1px solid rgba(94, 220, 226, 0.28);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease),
              background 0.18s var(--ease);
}
.kora-chip:hover {
  border-color: var(--aqua);
  color: var(--text);
  background: rgba(94, 220, 226, 0.08);
}
.kora-chip--wa {
  border-color: rgba(94, 220, 226, 0.5);
  color: var(--aqua);
}

/* ---------------------------------------------------------------- composer */
.kora-foot {
  border-top: 1px solid rgba(94, 220, 226, 0.14);
  padding: 0.7rem;
  background: rgba(4, 16, 21, 0.6);
}
.kora-form { display: flex; gap: 0.5rem; align-items: center; }
.kora-form input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  background: rgba(12, 34, 41, 0.9);
  border: 1px solid rgba(160, 200, 206, 0.14);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}
.kora-form input::placeholder { color: #5d7d84; }
.kora-form input:focus { outline: none; border-color: var(--aqua); }
.kora-send {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 10px;
  background: #3fb8c0;
  color: #03181c;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.kora-send:hover { background: var(--aqua); }
.kora-send svg { width: 17px; height: 17px; }

.kora-note {
  margin: 0.55rem 0 0;
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--faint, #6d8f96);
  text-align: center;
}
.kora-note a { color: var(--faint, #6d8f96); text-decoration: underline; }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 520px) {
  .kora-panel {
    right: 0; left: 0; bottom: 0;
    width: 100%;
    height: 88vh;
    border-radius: 18px 18px 0 0;
  }
  .kora-launcher { right: 1rem; bottom: 1rem; padding: 0.85rem 1.25rem 0.85rem 1rem; }
  .kora-teaser { right: 1rem; bottom: 5.6rem; max-width: calc(100vw - 2rem); }
  .wa-float { right: 1rem !important; bottom: 5.6rem !important; }
  body.kora-teaser-on .wa-float { bottom: 11rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  .kora-launcher__dot, .kora-typing i { animation: none; }
  .kora-teaser { transition: none; }
  .kora-panel, .kora-msg { transition: none; animation: none; }
}
