/* ==========================================================================
   ERKEXIN® AI CONCIERGE WIDGET ("ALI") — LUXURY OBSIDIAN, WHITE & ROYAL GOLD
   ========================================================================== */

.ali-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9500;
  font-family: var(--font-sans, "Plus Jakarta Sans", "Inter", sans-serif);
  color: #111116;
}

.ali-widget[hidden] {
  display: none !important;
}

.ali-widget[dir="rtl"],
:root[lang="ar"] .ali-widget {
  font-family: "Cairo", "Tajawal", sans-serif;
}

.ali-widget *,
.ali-widget *::before,
.ali-widget *::after {
  box-sizing: border-box;
}

/* Launcher Pill Button */
.ali-launcher {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  height: 54px;
  padding: 0 18px 0 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0B0B0E 0%, #1C170C 100%);
  border: 1px solid #D4AF37;
  color: #FFFFFF;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.ali-launcher:hover {
  border-color: #F3D266;
  transform: translateY(-2px);
}

.ali-launcher__icon-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #14141A;
  border: 2px solid #D4AF37;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ali-avatar__img {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.ali-online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #10B981;
  border: 2px solid #0B0B0E;
}

.ali-launcher__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.24;
}

.ali-widget[dir="rtl"] .ali-launcher__text,
:root[dir="rtl"] .ali-launcher__text {
  align-items: flex-end;
}

.ali-launcher__title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #F3D266;
}

.ali-launcher__sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: #D4D4DE;
}

/* Enlarged Desktop Chat Window */
.ali-window {
  position: fixed;
  bottom: 86px;
  left: 20px;
  width: 435px;
  max-width: calc(100vw - 32px);
  height: min(640px, 82vh);
  background: #FFFFFF;
  border: 1px solid rgba(212, 175, 55, 0.58);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(5, 5, 10, 0.32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9501;
}

.ali-window[hidden] {
  display: none !important;
}

.ali-header {
  background: linear-gradient(135deg, #0B0B0E 0%, #1E180B 100%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.38);
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.ali-header__profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ali-avatar {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #14141A;
  border: 2px solid #D4AF37;
  color: #F3D266;
  font-weight: 800;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ali-header__meta {
  min-width: 0;
}

.ali-header__name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ali-header__name {
  font-size: 1.02rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0;
}

.ali-header__online-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #34D399;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
}

.ali-header__role {
  font-size: 0.76rem;
  line-height: 1.32;
  color: #CFCFDA;
  margin: 3px 0 0;
  white-space: normal;
}

.ali-header__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ali-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.18rem;
  line-height: 1;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.ali-icon-btn:hover {
  border-color: #D4AF37;
  background: rgba(212, 175, 55, 0.16);
  color: #F3D266;
}

/* Message Feed */
.ali-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background: #F7F7F9;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ali-msg {
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: aliBubbleIn 120ms ease-out;
}

@keyframes aliBubbleIn {
  from { transform: translateY(4px); }
  to { transform: translateY(0); }
}

.ali-msg--assistant {
  align-self: flex-start;
}

.ali-msg--user {
  align-self: flex-end;
}

.ali-msg__row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.ali-msg__avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1.5px solid #D4AF37;
  object-fit: cover;
  object-position: center 20%;
  flex-shrink: 0;
  background: #0B0B0E;
}

.ali-bubble {
  padding: 12px 15px;
  border-radius: 15px;
  font-size: 14.5px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}

.ali-msg--assistant .ali-bubble {
  background: #FFFFFF;
  color: #111116;
  border: 1px solid #E4E4EC;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(17, 17, 22, 0.04);
}

.ali-widget[dir="rtl"] .ali-msg--assistant .ali-bubble,
:root[dir="rtl"] .ali-msg--assistant .ali-bubble {
  border-top-left-radius: 15px;
  border-top-right-radius: 4px;
}

.ali-msg--user .ali-bubble {
  background: #0B0B0E;
  color: #FFFFFF;
  border: 1px solid #D4AF37;
  border-top-right-radius: 4px;
}

.ali-widget[dir="rtl"] .ali-msg--user .ali-bubble,
:root[dir="rtl"] .ali-msg--user .ali-bubble {
  border-top-right-radius: 15px;
  border-top-left-radius: 4px;
}

/* Action Link Buttons inside Ali Bubbles */
.ali-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-inline-start: 36px;
}

.ali-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 10px;
  background: #0B0B0E;
  border: 1px solid #D4AF37;
  color: #F3D266 !important;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}

.ali-link-btn:hover {
  background: #D4AF37;
  color: #0B0B0E !important;
}

/* Direct WhatsApp Support CTA inside Welcome Block */
.ali-wa-row {
  padding-inline-start: 36px;
  margin-top: 2px;
}

.ali-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 11px;
  background: linear-gradient(135deg, #16A34A 0%, #15803D 100%);
  border: 1px solid #22C55E;
  color: #FFFFFF !important;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(21, 128, 61, 0.24);
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.ali-whatsapp-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(21, 128, 61, 0.32);
}

.ali-whatsapp-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Quick Starter Chips */
.ali-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 16px 6px;
  background: #F7F7F9;
  border-top: 1px solid #ECEEF2;
}

.ali-quick-chips[hidden] {
  display: none !important;
}

.ali-quick-chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid #D8DCE5;
  background: #FFFFFF;
  color: #111116;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.ali-quick-chip:hover {
  border-color: #D4AF37;
  background: #FFFDF5;
}

/* Typing Indicator */
.ali-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid #E4E4EC;
  color: #52525E;
  font-size: 0.82rem;
  font-weight: 700;
}

.ali-typing__dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.ali-typing__dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #D4AF37;
  animation: aliDotPulse 1.1s infinite ease-in-out;
}

.ali-typing__dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.ali-typing__dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes aliDotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.82); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Input Composer */
.ali-composer {
  padding: 12px 14px;
  background: #FFFFFF;
  border-top: 1px solid #E4E4EC;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex-shrink: 0;
}

.ali-input {
  flex: 1 1 auto;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid #D4D4DE;
  background: #F7F7F9;
  color: #111116;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.ali-input::placeholder {
  color: #6B7280;
}

.ali-input:focus {
  border-color: #D4AF37;
  background: #FFFFFF;
}

.ali-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #D4AF37;
  background: linear-gradient(135deg, #0B0B0E 0%, #231C0D 100%);
  color: #F3D266;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms ease, color 150ms ease;
}

.ali-send-btn:hover:not(:disabled) {
  background: #D4AF37;
  color: #0B0B0E;
}

.ali-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Mobile Full Responsive Sheet (< 520px) */
@media (max-width: 519px) {
  .ali-widget {
    bottom: 14px;
    left: 12px;
  }

  .ali-launcher {
    height: 48px;
    padding: 0 14px 0 8px;
  }

  .ali-launcher__icon-wrap {
    width: 34px;
    height: 34px;
  }

  .ali-window {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 92vh;
    height: 92dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    border-inline: none;
  }
}
