/* Alaa Beauty Assistant — floating launcher, ping bubble, chat panel.
   The chat panel uses the spec IDs (#askAlaaWidget / #askAlaaForm /
   #askAlaaInput / #askAlaaSend / #askMessages / #askQuickTopics) and is
   rebuilt to guarantee the input + quick topics + send button are clickable
   above any other layer. */

:root {
  --alaa-cream: #fff8f3;
  --alaa-blush: #fbe4df;
  --alaa-rose: #d65a72;
  --alaa-rose-dark: #9d3f52;
  --alaa-gold: #d8a05d;
  --alaa-brown: #5d3b35;
  --alaa-white: #ffffff;
}

/* When an auth/review modal is open, hide the floating assistant so its
   high-z launcher + chat bubble never overlap the modal CTAs (mobile). */
body.alaa-modal-open #alaaAssistantLauncher,
body.alaa-modal-open .ask-alaa-widget {
  display: none !important;
}

/* ---------- Floating launcher button ------------------------------------ */
#alaaAssistantLauncher {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #d65a72, #f3a7b5);
  color: #fff;
  box-shadow: 0 18px 45px rgba(214, 90, 114, 0.35);
  cursor: pointer;
  font-weight: 700;
  animation: alaaPulseGlow 3s infinite, alaaLauncherIn 600ms ease both;
}

#alaaAssistantLauncher .alaa-launcher-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff8f3, #ffe7e0);
  display: grid;
  place-items: center;
  font-size: 20px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
  position: relative;
}
#alaaAssistantLauncher .alaa-launcher-icon.is-fallback {
  background: linear-gradient(135deg, #fff8f3, #ffe7e0);
  color: #b9445b;
  font-weight: 900;
  font-family: Georgia, serif;
  font-style: italic;
}
#alaaAssistantLauncher .alaa-launcher-mascot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  animation: alaaFloatIdle 4.5s ease-in-out infinite;
}

#alaaAssistantPing {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 99998;
  max-width: 260px;
  padding: 14px 18px;
  border-radius: 24px 24px 8px 24px;
  background: rgba(255, 248, 243, 0.96);
  color: var(--alaa-brown);
  border: 1px solid rgba(214, 90, 114, 0.25);
  box-shadow: 0 18px 45px rgba(93, 59, 53, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  cursor: pointer;
}
#alaaAssistantPing.is-visible {
  pointer-events: auto;
  animation: alaaPopIn 600ms ease forwards;
}

@keyframes alaaPulseGlow {
  0%, 100% { transform: translateY(0); box-shadow: 0 18px 45px rgba(214, 90, 114, 0.32); }
  50%      { transform: translateY(-3px); box-shadow: 0 24px 60px rgba(214, 90, 114, 0.46); }
}
@keyframes alaaLauncherIn {
  from { opacity: 0; transform: translateY(20px) scale(.7); }
  60%  { opacity: 1; transform: translateY(-4px) scale(1.05); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes alaaPopIn {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes alaaFloatIdle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* ---------- Chat widget (spec) ------------------------------------------ */
.ask-alaa-widget,
.ask-alaa-widget * {
  box-sizing: border-box;
}

.ask-alaa-widget {
  position: fixed;
  right: 24px;
  bottom: 92px;          /* clear of the launcher button */
  z-index: 999999;
  pointer-events: auto !important;
}
.ask-alaa-widget[hidden] { display: none !important; }

.ask-alaa-panel {
  width: 390px;
  max-width: calc(100vw - 24px);
  max-height: min(720px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff6f7;
  border: 1px solid rgba(185, 28, 99, 0.14);
  border-radius: 32px;
  box-shadow: 0 24px 70px rgba(185, 28, 99, 0.22);
  pointer-events: auto !important;
}

.ask-alaa-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 8px;
  background: linear-gradient(135deg, rgba(255, 232, 234, 0.95), rgba(253, 240, 245, 0.95));
  flex-shrink: 0;
  pointer-events: auto !important;
}
.ask-alaa-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  color: #b91c63;
  letter-spacing: 0.2px;
}
.ask-alaa-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #76534f;
  font-weight: 600;
}

.ask-alaa-actions {
  display: inline-flex;
  gap: 6px;
}
.ask-alaa-actions button {
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(185, 28, 99, 0.22);
  background: rgba(255, 255, 255, 0.85);
  color: #b91c63;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto !important;
}
.ask-alaa-actions button:hover { background: #fff0f5; }

.ask-alaa-greeting {
  padding: 6px 18px 10px;
  font-size: 14px;
  color: #5a323a;
  flex-shrink: 0;
  pointer-events: auto !important;
}
.ask-alaa-greeting strong {
  color: #b91c63;
  font-style: italic;
  font-size: 18px;
  font-family: Georgia, serif;
}

.ask-alaa-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 6px 14px 10px;
  border-bottom: 1px dashed rgba(185, 28, 99, 0.18);
  flex-shrink: 0;
  pointer-events: auto !important;
}
.ask-alaa-controls label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: #9d3f52;
}
.ask-alaa-controls select {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: #5d3b35;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(185, 28, 99, 0.24);
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
  pointer-events: auto !important;
}

.ask-alaa-messages {
  flex: 1 1 auto;
  min-height: 160px;
  overflow-y: auto;
  padding: 14px;
  pointer-events: auto !important;
  display: flex;
  flex-direction: column;
}

/* Quick topic chips — horizontally scrollable, always above the input */
.ask-quick-topics {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px 12px;
  background: rgba(255, 245, 247, 0.98);
  border-top: 1px solid rgba(185, 28, 99, 0.12);
  scrollbar-width: thin;
  flex-shrink: 0;
  pointer-events: auto !important;
  position: relative;
  z-index: 5;
}
.ask-quick-topics button {
  flex: 0 0 auto;
  border: 1px solid rgba(185, 28, 99, 0.24);
  background: #fff;
  color: #b91c63;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto !important;
  position: relative;
  z-index: 6;
}
.ask-quick-topics button:hover { background: #fdf0f5; }

/* Input row */
.ask-alaa-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid rgba(185, 28, 99, 0.12);
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

#askAlaaInput {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1px solid rgba(185, 28, 99, 0.24);
  border-radius: 999px;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: #2b171c;
  outline: none;
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  position: relative;
  z-index: 11;
}
#askAlaaInput:focus {
  border-color: #b91c63;
  box-shadow: 0 0 0 3px rgba(185, 28, 99, 0.12);
}

#askAlaaSend {
  height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: #b91c63;
  color: #fff;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  pointer-events: auto !important;
  position: relative;
  z-index: 11;
}
#askAlaaSend:disabled { opacity: 0.7; cursor: progress; }

/* Message bubbles */
.ask-msg {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 18px;
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.ask-msg-user {
  margin-left: auto;
  background: #df6684;
  color: #fff;
}
.ask-msg-alaa {
  margin-right: auto;
  background: #fff;
  color: #5a323a;
  border: 1px solid rgba(185, 28, 99, 0.10);
}

/* Mobile */
@media (max-width: 640px) {
  #alaaAssistantLauncher {
    right: 14px;
    bottom: 86px;
    padding: 10px 12px;
  }
  #alaaAssistantPing {
    right: 14px;
    bottom: 150px;
  }

  .ask-alaa-widget {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
  .ask-alaa-panel {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 24px;
  }
  .ask-quick-topics { padding: 10px; }
  .ask-quick-topics button { padding: 10px 13px; font-size: 13px; }
}
