/* Ekonbee AI assistant — on-brand floating chat widget styles
   Tokens come from tokens.css; falls back to safe defaults if missing.
*/

/* ============================================================
   Floating action button
   ============================================================ */
.ekb-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 14px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ee9002 0%, #aa3baa 55%, #7e3fbf 100%);
  color: #fff;
  font-family: var(--font-nav, "Roboto", system-ui, sans-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow:
    0 12px 32px -8px rgba(170, 59, 170, .55),
    0 6px 16px -4px rgba(238, 144, 2, .35),
    0 0 0 1px rgba(255,255,255,.06) inset;
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s, opacity .2s;
}
.ekb-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 18px 40px -10px rgba(170, 59, 170, .65),
    0 8px 20px -4px rgba(238, 144, 2, .45),
    0 0 0 1px rgba(255,255,255,.1) inset;
}
.ekb-chat-fab:active { transform: translateY(0); }
.ekb-chat-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(.85);
}
.ekb-chat-fab__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.ekb-chat-fab__logo-wrap {
  position: relative;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.ekb-chat-fab__logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
  animation: ekbFabLogoSpin 8s linear infinite,
             ekbFabLogoFloat 3.2s ease-in-out infinite;
  transform-origin: 50% 50%;
}
.ekb-chat-fab__logo-halo {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.35), rgba(255,255,255,0) 65%);
  animation: ekbFabHalo 2.4s ease-in-out infinite;
  pointer-events: none;
}
.ekb-chat-fab:hover .ekb-chat-fab__logo {
  animation-duration: 3s, 1.6s;
}
@keyframes ekbFabLogoSpin {
  to { transform: rotate(360deg); }
}
@keyframes ekbFabLogoFloat {
  0%, 100% { filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)) brightness(1); }
  50%      { filter: drop-shadow(0 4px 10px rgba(255,200,120,.45)) brightness(1.1); }
}
@keyframes ekbFabHalo {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%      { opacity: .9;  transform: scale(1.15); }
}
.ekb-chat-fab__label {
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.ekb-chat-fab__pulse {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ee9002, #7e3fbf);
  opacity: .55;
  animation: ekbChatPulse 2.4s ease-out infinite;
  z-index: 0;
}
@keyframes ekbChatPulse {
  0% { transform: scale(1); opacity: .45; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ============================================================
   Panel
   ============================================================ */
.ekb-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border: 1px solid rgba(26, 21, 19, .08);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 32px 80px -20px rgba(26, 21, 19, .35),
    0 12px 32px -10px rgba(26, 21, 19, .15),
    0 0 0 1px rgba(255,255,255,.6) inset;
  font-family: var(--font-body, "Inter", system-ui, sans-serif);
  color: var(--fg-body, #1a1513);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.7,.2,1);
}
.ekb-chat.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.ekb-chat[hidden] { display: none; }

/* ============================================================
   Header
   ============================================================ */
.ekb-chat__head {
  padding: 16px 18px;
  background: linear-gradient(168deg, #13100f 0%, #1f1a18 100%);
  color: #f3eee9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  flex-shrink: 0;
}
.ekb-chat__head::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(280px 180px at 100% 0%, rgba(193,38,140,.32), transparent 60%),
    radial-gradient(240px 180px at 0% 100%, rgba(238,144,2,.24), transparent 60%);
}
.ekb-chat__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.ekb-chat__avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.08);
}
.ekb-chat__head h3 {
  margin: 0;
  font-family: var(--font-heading, "Raleway", system-ui, sans-serif);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -.005em;
  color: #fff;
}
.ekb-chat__sub-name {
  font-weight: 400;
  font-size: 12.5px;
  color: rgba(243, 238, 233, .55);
  letter-spacing: 0;
  margin-left: 2px;
}
.ekb-chat__sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(243, 238, 233, .65);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ekb-chat__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: ekbChatDot 2s ease-in-out infinite;
}
@keyframes ekbChatDot {
  0%, 100% { opacity: .9; }
  50% { opacity: .4; }
}
.ekb-chat__close {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: #f3eee9;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: background .2s, transform .2s;
}
.ekb-chat__close:hover {
  background: rgba(255,255,255,.12);
  transform: rotate(90deg);
}

/* ============================================================
   Body
   ============================================================ */
.ekb-chat__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px 8px;
  background: #faf7f4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.18) transparent;
}
.ekb-chat__body::-webkit-scrollbar { width: 6px; }
.ekb-chat__body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.18);
  border-radius: 3px;
}
.ekb-chat__welcome {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 0 4px;
}
.ekb-chat__welcome-msg {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-muted, #6b6562);
  font-family: var(--font-body, "Inter", sans-serif);
}
.ekb-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ekb-chat__chip {
  background: #fff;
  border: 1px solid rgba(26, 21, 19, .1);
  color: var(--fg-heading, #1a1513);
  font-family: var(--font-nav, "Roboto", sans-serif);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .15s, box-shadow .2s;
}
.ekb-chat__chip:hover {
  border-color: #aa3baa;
  color: #aa3baa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -4px rgba(170, 59, 170, .25);
}

/* ============================================================
   Messages
   ============================================================ */
.ekb-chat__msg {
  display: flex;
  animation: ekbChatIn .3s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes ekbChatIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ekb-chat__msg--user { justify-content: flex-end; }
.ekb-chat__msg--assistant { justify-content: flex-start; }
.ekb-chat__bubble {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ekb-chat__msg--user .ekb-chat__bubble {
  background: linear-gradient(135deg, #1a1513 0%, #2a211e 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ekb-chat__msg--assistant .ekb-chat__bubble {
  background: #fff;
  color: var(--fg-body, #1a1513);
  border: 1px solid rgba(26, 21, 19, .08);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.ekb-chat__dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.ekb-chat__dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-muted, #6b6562);
  animation: ekbChatDots 1.2s ease-in-out infinite;
}
.ekb-chat__dots i:nth-child(2) { animation-delay: .15s; }
.ekb-chat__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ekbChatDots {
  0%, 80%, 100% { opacity: .25; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   Input
   ============================================================ */
.ekb-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid rgba(26, 21, 19, .06);
  flex-shrink: 0;
}
.ekb-chat__input {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  padding: 9px 12px;
  border: 1px solid rgba(26, 21, 19, .12);
  border-radius: 10px;
  resize: none;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 14px;
  line-height: 1.45;
  color: var(--fg-body, #1a1513);
  background: #faf7f4;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.ekb-chat__input:focus {
  border-color: #aa3baa;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(170, 59, 170, .12);
}
.ekb-chat__input::placeholder { color: rgba(26, 21, 19, .4); }
.ekb-chat__send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ee9002 0%, #aa3baa 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.ekb-chat__send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(170, 59, 170, .45);
}
.ekb-chat__send:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============================================================
   Footer
   ============================================================ */
.ekb-chat__foot {
  padding: 8px 14px 12px;
  background: #fff;
  font-family: var(--font-nav, "Roboto", sans-serif);
  font-size: 11px;
  color: var(--fg-muted, #6b6562);
  text-align: center;
  letter-spacing: .03em;
  border-top: 1px solid rgba(26, 21, 19, .04);
}
.ekb-chat__foot a {
  color: #aa3baa;
  font-weight: 500;
  text-decoration: none;
}
.ekb-chat__foot a:hover { text-decoration: underline; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 480px) {
  .ekb-chat-fab {
    bottom: 16px;
    right: 16px;
    padding: 12px 16px 12px 14px;
    font-size: 13px;
  }
  .ekb-chat-fab__label { display: none; }
  .ekb-chat {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    max-width: 100vw;
    border-radius: 0;
    border: 0;
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .ekb-chat-fab__pulse,
  .ekb-chat__dot,
  .ekb-chat__dots i {
    animation: none;
  }
  .ekb-chat,
  .ekb-chat-fab,
  .ekb-chat__msg {
    transition: opacity .1s;
    animation: none;
  }
}
