/* ═══════════════════════════════════════════════════════
   AIEA CHATBOT — AIKA Assistant  v3.0
   ═══════════════════════════════════════════════════════ */

/* ── Launcher button ── */
#aika-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1246e6 0%, #00c49a 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(18,70,230,.45), 0 8px 40px rgba(0,0,0,.15);
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  outline: none;
}
#aika-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(18,70,230,.55), 0 12px 48px rgba(0,0,0,.18);
}
#aika-launcher.open { transform: scale(0.9) rotate(10deg); }
#aika-launcher svg { transition: all .3s; }
#aika-launcher .icon-chat { display: block; }
#aika-launcher .icon-close { display: none; }
#aika-launcher.open .icon-chat { display: none; }
#aika-launcher.open .icon-close { display: block; }

/* Notification dot */
#aika-launcher .notif-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 13px; height: 13px;
  background: #ff4444;
  border-radius: 50%;
  border: 2px solid white;
  animation: notifPulse 2s infinite;
}
@keyframes notifPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: .8; }
}

/* ── Chat window ── */
#aika-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9998;
  width: 380px;
  max-height: 580px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,.14), 0 24px 80px rgba(0,0,0,.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e4e2dd;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all .3s cubic-bezier(.34,1.4,.64,1);
}
#aika-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.aika-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
}
.aika-header::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 100% at 100% 50%, rgba(18,70,230,.3) 0%, transparent 65%);
}
.aika-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1246e6, #00c49a);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative; z-index: 1;
  box-shadow: 0 0 0 3px rgba(255,255,255,.15);
}
.aika-avatar svg { width: 20px; height: 20px; fill: white; }
.aika-info { flex: 1; position: relative; z-index: 1; }
.aika-name {
  font-family: 'Sora', sans-serif;
  font-weight: 700; font-size: .9rem;
  color: white; letter-spacing: -.2px;
}
.aika-status {
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; color: rgba(255,255,255,.55);
  margin-top: 1px;
}
.aika-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #00c49a;
  animation: statusPulse 2.5s infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.aika-close {
  background: rgba(255,255,255,.1);
  border: none; cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.7);
  transition: all .2s;
  position: relative; z-index: 1;
}
.aika-close:hover { background: rgba(255,255,255,.2); color: white; }

/* ── Quick questions ── */
.aika-quick {
  padding: 12px 14px 6px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  background: #f7f6f3;
  border-bottom: 1px solid #e4e2dd;
  flex-shrink: 0;
}
.aika-quick-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid #e0ddd8;
  background: white;
  color: #3a3a3a;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.aika-quick-btn:hover {
  background: #1246e6;
  color: white;
  border-color: #1246e6;
}

/* ── Messages area ── */
.aika-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: #f7f6f3;
}
.aika-messages::-webkit-scrollbar { width: 4px; }
.aika-messages::-webkit-scrollbar-track { background: transparent; }
.aika-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* ── Message bubbles ── */
.aika-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn .3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.aika-msg.user { flex-direction: row-reverse; }

.aika-msg-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #1246e6, #00c49a);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(18,70,230,.25);
}
.aika-msg-icon svg { width: 14px; height: 14px; fill: white; }

.aika-bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: .86rem;
  line-height: 1.65;
  position: relative;
}
.aika-msg.bot .aika-bubble {
  background: white;
  color: #0a0a0a;
  border-radius: 4px 16px 16px 16px;
  border: 1px solid #e8e6e1;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.aika-msg.user .aika-bubble {
  background: linear-gradient(135deg, #1246e6, #1a5cff);
  color: white;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 2px 12px rgba(18,70,230,.3);
}

/* Markdown-like formatting in bot messages */
.aika-bubble strong { font-weight: 700; }
.aika-bubble a { color: #1246e6; text-decoration: underline; }
.aika-msg.user .aika-bubble a { color: rgba(255,255,255,.9); }
.aika-bubble ul { padding-left: 16px; margin: 6px 0; }
.aika-bubble ul li { margin-bottom: 3px; }
.aika-bubble p { margin: 0 0 6px; }
.aika-bubble p:last-child { margin-bottom: 0; }

/* Timestamp */
.aika-time {
  font-size: .66rem;
  color: #aaa;
  margin-top: 4px;
  padding: 0 4px;
}
.aika-msg.user .aika-time { text-align: right; }

/* ── Typing indicator ── */
.aika-typing .aika-bubble {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 56px;
}
.aika-typing .aika-bubble span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #bbb;
  display: inline-block;
  animation: typingDot 1.2s infinite ease-in-out;
}
.aika-typing .aika-bubble span:nth-child(2) { animation-delay: .2s; }
.aika-typing .aika-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); background: #bbb; }
  30% { transform: translateY(-5px); background: #1246e6; }
}

/* ── Contact chips ── */
.aika-contact-chips {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 10px;
}
.aika-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: .76rem; font-weight: 600;
  padding: 6px 13px;
  border-radius: 100px;
  text-decoration: none;
  transition: all .2s;
  cursor: pointer; border: none;
}
.aika-chip--phone {
  background: #e8eeff;
  color: #1246e6;
}
.aika-chip--phone:hover { background: #1246e6; color: white; }
.aika-chip--wa {
  background: #e0faf4;
  color: #00875a;
}
.aika-chip--wa:hover { background: #00c49a; color: white; }

/* ── Input area ── */
.aika-footer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: white;
  border-top: 1px solid #e4e2dd;
  flex-shrink: 0;
}
.aika-input-wrap { flex: 1; position: relative; }
#aika-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e4e2dd;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem;
  color: #0a0a0a;
  background: #f7f6f3;
  outline: none;
  resize: none;
  line-height: 1.5;
  max-height: 100px;
  transition: border-color .2s;
}
#aika-input:focus {
  border-color: #1246e6;
  background: white;
  box-shadow: 0 0 0 3px rgba(18,70,230,.07);
}
#aika-input::placeholder { color: #aaa; }
#aika-send {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1246e6, #00c49a);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(18,70,230,.3);
}
#aika-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(18,70,230,.4); }
#aika-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#aika-send svg { width: 17px; height: 17px; fill: white; }

/* ── Powered by ── */
.aika-powered {
  text-align: center;
  font-size: .66rem;
  color: #bbb;
  padding: 4px 0 8px;
  background: white;
  letter-spacing: .03em;
}
.aika-powered span { color: #1246e6; font-weight: 600; }

/* ── Mobile ── */
@media (max-width: 480px) {
  #aika-window {
    right: 12px; left: 12px;
    width: auto;
    bottom: 88px;
    max-height: 72vh;
  }
  #aika-launcher { right: 18px; bottom: 20px; }
}

/* ── Language selector ── */
.aika-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.aika-lang-selector {
  position: relative;
}

.aika-lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 5px 9px;
  cursor: pointer;
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: .76rem;
  font-weight: 600;
  transition: all .2s;
  white-space: nowrap;
}
.aika-lang-btn:hover {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.35);
}
.aika-lang-btn svg {
  opacity: .7;
  transition: transform .2s;
}

.aika-lang-dropdown {
  position: fixed;
  top: auto;
  right: 40px;
  background: white;
  border: 1px solid #e4e2dd;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  overflow: hidden;
  min-width: 148px;
  z-index: 99999;
  opacity: 0;
  transform: translateY(-6px) scale(.96);
  pointer-events: none;
  transition: all .2s cubic-bezier(.34,1.4,.64,1);
}
.aika-lang-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.aika-lang-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: .84rem;
  font-weight: 500;
  color: #3a3a3a;
  text-align: left;
  transition: background .15s;
  border-bottom: 1px solid #f0ede8;
}
.aika-lang-opt:last-child { border-bottom: none; }
.aika-lang-opt:hover { background: #f7f6f3; }
.aika-lang-opt.active {
  background: #e8eeff;
  color: #1246e6;
  font-weight: 700;
}
.aika-lang-opt.active::after {
  content: '✓';
  margin-left: auto;
  font-size: .8rem;
  color: #1246e6;
}
