/* ==========================================================================
   AKASHOP AI Live Support Specialist Widget (Emily · AKASHOP UK)
   ========================================================================== */

#akashop-chat-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0F172A;
  box-sizing: border-box;
}
#akashop-chat-root * {
  box-sizing: border-box;
}

/* Floating Launcher Button */
.aka-chat-launcher {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D6201F 0%, #0A2540 100%);
  border: 3px solid #FFFFFF;
  box-shadow: 0 10px 28px -4px rgba(214, 32, 31, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}
.aka-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 34px -4px rgba(214, 32, 31, 0.6);
}
.aka-chat-launcher-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.aka-chat-online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10B981;
  border: 2.5px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}
.aka-chat-unread-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #EF4444;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: akaBadgePulse 2s infinite;
}
@keyframes akaBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Greeting Toast Speech Bubble */
.aka-chat-toast {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 290px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  box-shadow: 0 12px 35px -8px rgba(15, 23, 42, 0.18);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: akaToastSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.aka-chat-toast:hover {
  transform: translateY(-2px);
}
@keyframes akaToastSlide {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.aka-chat-toast-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.aka-chat-toast-content {
  flex: 1;
}
.aka-chat-toast-title {
  font-size: 12px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 2px;
}
.aka-chat-toast-text {
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
}
.aka-chat-toast-close {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 16px;
  line-height: 1;
  padding: 2px;
  cursor: pointer;
}
.aka-chat-toast-close:hover {
  color: #0F172A;
}

/* Main Chat Modal Panel */
.aka-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 22px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999999;
}
.aka-chat-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.aka-chat-header {
  background: linear-gradient(135deg, #D6201F 0%, #0A2540 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.aka-chat-header-agent {
  display: flex;
  align-items: center;
  gap: 12px;
}
.aka-chat-header-avatar-wrap {
  position: relative;
}
.aka-chat-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #FFFFFF;
  display: block;
}
.aka-chat-header-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #10B981;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
}
.aka-chat-header-name {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.aka-chat-header-status {
  font-size: 11.5px;
  color: #BFDBFE;
  display: flex;
  align-items: center;
  gap: 5px;
}
.aka-chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #10B981;
  border-radius: 50%;
  display: inline-block;
}
.aka-chat-header-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.aka-chat-header-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Chat Messages Container */
.aka-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #F8FAFC;
}

/* Individual Message Bubbles */
.aka-msg {
  display: flex;
  gap: 10px;
  max-width: 86%;
  animation: akaMsgFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes akaMsgFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.aka-msg.agent {
  align-self: flex-start;
}
.aka-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.aka-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  align-self: flex-end;
  border: 1px solid #E2E8F0;
}
.aka-msg-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
}
.aka-msg.agent .aka-msg-bubble {
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}
.aka-msg.user .aka-msg-bubble {
  background: #D6201F;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(214, 32, 31, 0.25);
}
.aka-msg-time {
  font-size: 10.5px;
  color: #94A3B8;
  margin-top: 4px;
  text-align: right;
}
.aka-msg.agent .aka-msg-time {
  text-align: left;
}

/* Typing Indicator */
.aka-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.aka-typing-dot {
  width: 6px;
  height: 6px;
  background: #94A3B8;
  border-radius: 50%;
  animation: akaTyping 1.4s infinite ease-in-out;
}
.aka-typing-dot:nth-child(1) { animation-delay: 0s; }
.aka-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.aka-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes akaTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Quick Suggestion Chips */
.aka-chat-suggestions {
  padding: 10px 16px 8px;
  background: #FFFFFF;
  border-top: 1px solid #F1F5F9;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.aka-chat-suggestions::-webkit-scrollbar {
  display: none;
}
.aka-chip-btn {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.aka-chip-btn:hover {
  background: #FDECEC;
  border-color: #93C5FD;
  color: #D6201F;
}

/* Chat Input Footer */
.aka-chat-footer {
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.aka-chat-input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #CBD5E1;
  border-radius: 21px;
  font-family: inherit;
  font-size: 13.5px;
  color: #0F172A;
  background: #F8FAFC;
  transition: all 0.2s ease;
}
.aka-chat-input:focus {
  outline: none;
  border-color: #D6201F;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(214, 32, 31, 0.12);
}
.aka-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #D6201F;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.aka-chat-send-btn:hover {
  background: #B3191A;
  transform: scale(1.05);
}
.aka-chat-send-btn svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.aka-chat-powered {
  text-align: center;
  font-size: 10px;
  color: #94A3B8;
  padding: 6px 0 10px;
  background: #FFFFFF;
}

/* Mobile Responsiveness */
@media screen and (max-width: 749px) {
  #akashop-chat-root {
    bottom: 14px;
    right: 14px;
  }
  /* a sheet that leaves the shop visible above it, not a full-screen takeover */
  .aka-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 78vh;
    max-height: 78vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .aka-chat-panel.open {
    transform: translateY(0);
  }
}
