/* Hinda Bot Widget - تصميم أنثوي روحاني */
:root {
  --hb-primary: #b8729a;
  --hb-primary-dark: #8e547a;
  --hb-bg: #fdf8f5;
  --hb-bubble-user: #b8729a;
  --hb-bubble-bot: #ffffff;
  --hb-text: #3a2d35;
  --hb-text-light: #7a6770;
  --hb-border: #ead3df;
  --hb-shadow: 0 12px 40px rgba(184, 114, 154, 0.18);
  --hb-radius: 18px;
}

#hinda-bot-root *,
#hinda-bot-root *::before,
#hinda-bot-root *::after {
  box-sizing: border-box;
}

#hinda-bot-root {
  font-family: 'Tajawal', 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  direction: rtl;
}

/* الجرس العائم */
.hb-launcher {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d49ab9 0%, #b8729a 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(184, 114, 154, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999998;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: hb-pulse 2.4s ease-in-out infinite;
}
.hb-launcher:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 30px rgba(184, 114, 154, 0.55);
}
.hb-launcher svg {
  width: 30px;
  height: 30px;
  fill: white;
}
.hb-launcher .hb-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff6b9d;
  border: 2px solid white;
}

@keyframes hb-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(184, 114, 154, 0.4), 0 0 0 0 rgba(184, 114, 154, 0.4); }
  50% { box-shadow: 0 8px 24px rgba(184, 114, 154, 0.4), 0 0 0 14px rgba(184, 114, 154, 0); }
}

/* نافذة الدردشة */
.hb-window {
  position: fixed;
  bottom: 100px;
  left: 24px;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--hb-bg);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.hb-window.hb-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* الهيدر */
.hb-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, #d49ab9 0%, #b8729a 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hb-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.hb-header-text { flex: 1; min-width: 0; }
.hb-header-title { font-weight: 700; font-size: 16px; line-height: 1.2; }
.hb-header-sub { font-size: 12px; opacity: 0.9; margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.hb-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6ee7a8;
  box-shadow: 0 0 0 0 rgba(110, 231, 168, 0.7);
  animation: hb-status-pulse 2s ease-in-out infinite;
}
@keyframes hb-status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(110, 231, 168, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(110, 231, 168, 0); }
}
.hb-close {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.hb-close:hover { background: rgba(255, 255, 255, 0.3); }

/* المحادثة */
.hb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hb-messages::-webkit-scrollbar { width: 6px; }
.hb-messages::-webkit-scrollbar-thumb { background: var(--hb-border); border-radius: 3px; }

.hb-msg {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: hb-fadein 0.25s ease;
}
@keyframes hb-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.hb-msg-bot {
  background: var(--hb-bubble-bot);
  color: var(--hb-text);
  border: 1px solid var(--hb-border);
  align-self: flex-start;
  border-bottom-right-radius: 4px;
}
.hb-msg-user {
  background: var(--hb-bubble-user);
  color: white;
  align-self: flex-end;
  border-bottom-left-radius: 4px;
}
.hb-msg a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}
.hb-msg-bot a { color: var(--hb-primary-dark); }
.hb-msg ul { padding-inline-start: 18px; margin: 6px 0; }
.hb-msg li { margin: 3px 0; }

/* مؤشر الكتابة */
.hb-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--hb-bubble-bot);
  border: 1px solid var(--hb-border);
  border-radius: 14px;
  border-bottom-right-radius: 4px;
  align-self: flex-start;
}
.hb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hb-primary);
  animation: hb-typing 1.2s ease-in-out infinite;
}
.hb-typing span:nth-child(2) { animation-delay: 0.2s; }
.hb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hb-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* الاقتراحات السريعة */
.hb-quick-replies {
  padding: 0 14px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hb-quick-replies button {
  background: white;
  border: 1px solid var(--hb-border);
  color: var(--hb-primary-dark);
  padding: 7px 12px;
  border-radius: 16px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.hb-quick-replies button:hover {
  background: var(--hb-primary);
  color: white;
  border-color: var(--hb-primary);
}

/* مدخل الكتابة */
.hb-input-row {
  padding: 12px;
  background: white;
  border-top: 1px solid var(--hb-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.hb-input {
  flex: 1;
  border: 1px solid var(--hb-border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 100px;
  background: var(--hb-bg);
  color: var(--hb-text);
}
.hb-input:focus {
  border-color: var(--hb-primary);
  background: white;
}
.hb-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d49ab9 0%, #b8729a 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.hb-send:hover { transform: scale(1.06); }
.hb-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.hb-send svg { width: 18px; height: 18px; fill: white; transform: rotate(180deg); }

.hb-footer {
  text-align: center;
  font-size: 11px;
  color: var(--hb-text-light);
  padding: 6px 0 8px;
  background: white;
}
.hb-footer span { opacity: 0.6; }

/* موبايل */
@media (max-width: 480px) {
  .hb-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 100px);
    left: 8px;
    bottom: 88px;
  }
  .hb-launcher {
    width: 58px;
    height: 58px;
    bottom: 18px;
    left: 18px;
  }
}

/* ════════════════════════════════════════════════════════
   فقاعة الترحيب الاستباقية "اسأل تايا"
   ════════════════════════════════════════════════════════ */
.hb-invite {
  position: fixed;
  bottom: 100px;
  left: 28px;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #fff 0%, #fdf6f8 100%);
  border: 1px solid #f5d6dd;
  border-radius: 18px;
  padding: 14px 18px 14px 14px;
  box-shadow: 0 8px 28px rgba(214, 122, 145, 0.22);
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 340px;
  animation: hb-invite-bounce 2.2s ease-in-out infinite;
}
@keyframes hb-invite-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}
.hb-invite.hb-invite-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.hb-invite-avatar {
  font-size: 38px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #fde8ee, #f7d4dc);
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.hb-invite-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hb-invite-title {
  font-size: 18px;
  font-weight: 700;
  color: #b54766;
}
.hb-invite-text {
  font-size: 15px;
  color: #4a4550;
  line-height: 1.5;
  margin-bottom: 6px;
  font-weight: 500;
}
.hb-invite-cta {
  background: linear-gradient(135deg, #d67a91 0%, #b54766 100%);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  box-shadow: 0 4px 14px rgba(181, 71, 102, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.hb-invite-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(181, 71, 102, 0.45);
}
.hb-invite-arrow {
  font-size: 22px;
  font-weight: 900;
  animation: hb-arrow-pulse 1.1s ease-in-out infinite;
  display: inline-block;
}
@keyframes hb-arrow-pulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-8px); }
}
.hb-invite-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  color: #b08a92;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  border-radius: 50%;
  transition: background 0.2s;
}
.hb-invite-close:hover {
  background: #f5d6dd;
}

@media (max-width: 480px) {
  .hb-invite {
    bottom: 90px;
    left: 12px;
    right: 12px;
    max-width: none;
  }
}
