/* ═══════════════════════════════════════════════════════════════
   AYBUGE — AI Asistan Chat Widget
   ═══════════════════════════════════════════════════════════════ */

/* ── Widget Shell ─────────────────────────────────────────────── */
.ai-chat {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 380px;
  max-height: calc(100dvh - 120px);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(16, 152, 162, .15),
    0 24px 64px -12px rgba(10, 37, 64, .28),
    0 8px 24px rgba(10, 37, 64, .12);
  background: #fff;
  visibility: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.2,1), visibility .25s ease;
  pointer-events: none;
}

.ai-chat.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ───────────────────────────────────────────────────── */
.ai-chat__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0a2540 0%, #0e6470 100%);
  position: relative;
  overflow: hidden;
}

.ai-chat__head::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}

.ai-chat__avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1098a2, #0e6470);
  border: 2px solid rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.ai-chat__avatar-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0a2540;
}

.ai-chat__head-info {
  flex: 1;
  min-width: 0;
}

.ai-chat__head-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

.ai-chat__head-status {
  font-size: 11px;
  color: rgba(255,255,255,.65);
  margin-top: 1px;
}

.ai-chat__head-close {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}

.ai-chat__head-close:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}

/* ── Messages Area ────────────────────────────────────────────── */
.ai-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  min-height: 260px;
  max-height: 380px;
  scroll-behavior: smooth;
}

.ai-chat__messages::-webkit-scrollbar { width: 4px; }
.ai-chat__messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat__messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ── Message Bubbles ──────────────────────────────────────────── */
.ai-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: aiMsgIn .2s ease;
}

@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-msg--bot {
  align-self: flex-start;
}

.ai-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg__icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1098a2, #0e6470);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.ai-msg__bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.ai-msg--bot .ai-msg__bubble {
  background: #fff;
  color: #1e293b;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(10,37,64,.08);
  border: 1px solid #e2e8f0;
}

.ai-msg--user .ai-msg__bubble {
  background: linear-gradient(135deg, #1098a2, #0e6470);
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}

/* ── Typing indicator ─────────────────────────────────────────── */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(10,37,64,.08);
  border: 1px solid #e2e8f0;
  width: fit-content;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: aiTypingDot 1.2s ease-in-out infinite;
}

.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes aiTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

/* ── Quick Suggestions ────────────────────────────────────────── */
.ai-chat__suggestions {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px 0;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

.ai-chat__suggestions:empty {
  display: none;
  padding: 0;
}

.ai-sugg {
  padding: 6px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #1098a2;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}

.ai-sugg:hover {
  border-color: #1098a2;
  background: #f0fbfc;
}

/* ── Input Area ───────────────────────────────────────────────── */
.ai-chat__foot {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

.ai-chat__input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13.5px;
  color: #0a2540;
  background: #f8fafc;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
  overflow-y: auto;
}

.ai-chat__input:focus {
  border-color: #1098a2;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16,152,162,.1);
}

.ai-chat__input::placeholder { color: #94a3b8; }

.ai-chat__send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: #1098a2;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
}

.ai-chat__send:hover {
  background: #087f8a;
  transform: scale(1.05);
}

.ai-chat__send:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
}

/* ── Disclaimer ───────────────────────────────────────────────── */
.ai-chat__disclaimer {
  flex-shrink: 0;
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  padding: 4px 16px 10px;
  background: #fff;
}

/* ── Mobile ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .ai-chat {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .ai-chat.is-open {
    transform: translateY(0);
  }
}
