/* Autark Innovations - Lisa Chat Widget
 * Theme: Dark #0B0F19 + Amber Accent
 */
#autark-chat-widget, #autark-chat-widget * { box-sizing: border-box; }
#autark-chat-widget {
  position: fixed; bottom: 20px; right: 20px; z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Bubble */
#aci-bubble {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; transition: transform .2s ease;
  position: relative;
}
#aci-bubble:hover { transform: scale(1.08); }
#aci-bubble svg { width: 30px; height: 30px; fill: #0B0F19; }
#aci-bubble .aci-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #0B0F19;
}
#aci-bubble .aci-pulse {
  position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid #f59e0b; animation: aci-pulse 2s infinite;
}
@keyframes aci-pulse {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Chat Window */
#aci-window {
  display: none; flex-direction: column;
  width: 380px; max-width: calc(100vw - 40px);
  height: 580px; max-height: calc(100vh - 100px);
  background: #0B0F19; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  border: 1px solid rgba(245, 158, 11, 0.2);
  overflow: hidden; animation: aci-slide-up .3s ease;
}
#aci-window.aci-open { display: flex; }
@keyframes aci-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Header */
.aci-header {
  background: linear-gradient(135deg, #111827 0%, #0B0F19 100%);
  padding: 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
}
.aci-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #0B0F19; font-size: 18px;
  position: relative; flex-shrink: 0;
}
.aci-avatar::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: #10b981; border: 2px solid #0B0F19;
}
.aci-header-info { flex: 1; min-width: 0; }
.aci-header-info h3 { margin: 0; color: #fff; font-size: 16px; font-weight: 600; }
.aci-header-info p { margin: 2px 0 0; color: #10b981; font-size: 12px; }
.aci-close {
  background: transparent; border: none; color: #9ca3af;
  cursor: pointer; padding: 8px; border-radius: 8px;
  transition: background .2s;
}
.aci-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.aci-close svg { width: 20px; height: 20px; }

/* Messages Area */
.aci-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: #0B0F19;
  scrollbar-width: thin; scrollbar-color: #374151 transparent;
}
.aci-messages::-webkit-scrollbar { width: 6px; }
.aci-messages::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

.aci-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; word-wrap: break-word;
  animation: aci-msg-in .2s ease;
}
@keyframes aci-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.aci-msg.aci-bot {
  align-self: flex-start;
  background: #1f2937; color: #e5e7eb;
  border-bottom-left-radius: 4px;
}
.aci-msg.aci-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0B0F19; font-weight: 500;
  border-bottom-right-radius: 4px;
}
.aci-typing {
  align-self: flex-start; background: #1f2937;
  padding: 12px 16px; border-radius: 14px; border-bottom-left-radius: 4px;
  display: none;
}
.aci-typing.aci-active { display: flex; gap: 4px; }
.aci-typing span {
  width: 8px; height: 8px; background: #9ca3af; border-radius: 50%;
  animation: aci-typing-bounce 1.4s infinite;
}
.aci-typing span:nth-child(2) { animation-delay: .2s; }
.aci-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aci-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Intro Form */
.aci-intro {
  padding: 20px; background: #0B0F19; flex: 1;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.aci-intro h4 {
  margin: 0; color: #fff; font-size: 18px; font-weight: 600;
}
.aci-intro p { margin: 0; color: #9ca3af; font-size: 14px; line-height: 1.5; }
.aci-intro label {
  display: block; color: #e5e7eb; font-size: 13px;
  font-weight: 500; margin-bottom: 6px;
}
.aci-intro input {
  width: 100%; padding: 10px 12px; background: #1f2937;
  border: 1px solid #374151; border-radius: 8px;
  color: #fff; font-size: 14px; outline: none;
  transition: border-color .2s;
}
.aci-intro input:focus { border-color: #f59e0b; }
.aci-intro button {
  width: 100%; padding: 12px; margin-top: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0B0F19; font-weight: 600; font-size: 14px;
  border: none; border-radius: 8px; cursor: pointer;
  transition: transform .15s;
}
.aci-intro button:hover { transform: translateY(-1px); }
.aci-intro button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.aci-intro .aci-error { color: #ef4444; font-size: 12px; margin-top: 4px; }
.aci-privacy { font-size: 11px; color: #6b7280; line-height: 1.4; }
.aci-privacy a { color: #f59e0b; text-decoration: none; }

/* Input Bar */
.aci-input-bar {
  padding: 12px; border-top: 1px solid rgba(245, 158, 11, 0.15);
  background: #111827; display: flex; gap: 8px; align-items: flex-end;
}
.aci-input-bar textarea {
  flex: 1; background: #1f2937; border: 1px solid #374151;
  border-radius: 20px; padding: 10px 14px; color: #fff;
  font-size: 14px; font-family: inherit; resize: none;
  outline: none; max-height: 100px; line-height: 1.4;
  transition: border-color .2s;
}
.aci-input-bar textarea:focus { border-color: #f59e0b; }
.aci-input-bar button {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.aci-input-bar button:hover { transform: scale(1.05); }
.aci-input-bar button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.aci-input-bar button svg { width: 18px; height: 18px; fill: #0B0F19; }

/* Mobile */
@media (max-width: 480px) {
  #autark-chat-widget { bottom: 12px; right: 12px; }
  #aci-window {
    width: calc(100vw - 24px); height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    border-radius: 12px;
  }
  #aci-bubble { width: 56px; height: 56px; }
  #aci-bubble svg { width: 26px; height: 26px; }
}
