/* Minara floating help: WhatsApp contacts + assistant. Uses the portal tokens when present. */
.mn-help {
  --mn-brown: var(--brown, #8C6A43); --mn-deep: var(--brown-deep, #3B2A17); --mn-cream: var(--cream, #F7F2EA);
  --mn-border: var(--border, #EADFCD); --mn-muted: var(--muted, #8A7A66); --mn-gold: var(--gold, #BC9250); --mn-wa: #25D366;
  --mn-ease: cubic-bezier(.16, 1, .3, 1); --mn-spring: cubic-bezier(.34, 1.56, .64, 1);
  position: fixed; inset-inline-end: 22px; bottom: 22px; z-index: 60; font-family: "Noto Sans Arabic", Tahoma, sans-serif; direction: rtl;
}
.mn-help [hidden] { display: none !important; }
.mn-help svg { width: 24px; height: 24px; flex: none; }

/* ---------- Floating buttons ---------- */
.mn-fabs { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.mn-fab {
  position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 28px rgba(59, 42, 23, .28); transition: transform .35s var(--mn-spring), box-shadow .3s ease;
  animation: mn-pop .7s var(--mn-spring) both;
}
.mn-fab:nth-child(2) { animation-delay: .15s; }
.mn-fab:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 18px 34px rgba(59, 42, 23, .32); }
.mn-fab:focus-visible { outline: 3px solid var(--mn-gold); outline-offset: 3px; }
.mn-fab-chat { background: linear-gradient(145deg, var(--mn-brown), var(--mn-deep)); }
.mn-fab-wa { background: var(--mn-wa); }
.mn-fab-wa::before, .mn-fab-chat::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid currentColor; opacity: 0; pointer-events: none;
  animation: mn-ring 2.8s ease-out 1.5s infinite;
}
.mn-fab-wa::before { color: var(--mn-wa); }
.mn-fab-chat::before { color: var(--mn-gold); animation-delay: 2.9s; }
.mn-fab[aria-expanded="true"]::before { animation: none; }
.mn-fab-label {
  position: absolute; inset-inline-end: 70px; white-space: nowrap; background: #fff; color: var(--mn-deep); font-weight: 700; font-size: .85rem;
  padding: 7px 14px; border-radius: 999px; box-shadow: 0 8px 22px rgba(59, 42, 23, .14); pointer-events: none;
  opacity: 0; transform: translateX(8px); transition: opacity .25s ease, transform .35s var(--mn-ease);
}
.mn-fab:hover .mn-fab-label, .mn-fab:focus-visible .mn-fab-label { opacity: 1; transform: none; }
.mn-fab .mn-ic-close { display: none; }
.mn-fab[aria-expanded="true"] .mn-ic-open { display: none; }
.mn-fab[aria-expanded="true"] .mn-ic-close { display: block; animation: mn-spin-in .35s var(--mn-ease); }
.mn-fab[aria-expanded="true"] .mn-fab-label { display: none; }
@keyframes mn-pop { from { opacity: 0; transform: scale(.3) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes mn-ring { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes mn-spin-in { from { transform: rotate(-90deg) scale(.5); } to { transform: none; } }

/* ---------- WhatsApp menu ---------- */
.mn-wa-menu {
  position: absolute; inset-inline-end: 0; bottom: calc(100% + 14px); width: 300px; background: #fff; border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(59, 42, 23, .22); transform-origin: bottom left; animation: mn-panel-in .4s var(--mn-ease);
}
.mn-wa-head { display: flex; gap: 12px; align-items: center; padding: 16px 18px; background: linear-gradient(135deg, #128C7E, var(--mn-wa)); color: #fff; }
.mn-wa-head svg { width: 32px; height: 32px; }
.mn-wa-head strong { display: block; font-size: 1rem; }
.mn-wa-head small { opacity: .9; font-size: .78rem; }
.mn-wa-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 18px; color: var(--mn-deep); text-decoration: none; border-top: 1px solid #f1ebe0;
  transition: background-color .2s ease; animation: mn-item-in .45s var(--mn-ease) both; animation-delay: calc(var(--i, 0) * 60ms + 80ms);
}
.mn-wa-item:hover, .mn-wa-item:focus-visible { background: #f2fbf5; outline: none; }
.mn-wa-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #e7f8ee; color: #128C7E; font-weight: 800; }
.mn-wa-text { flex: 1; display: flex; flex-direction: column; line-height: 1.4; }
.mn-wa-text small { color: var(--mn-muted); font-size: .76rem; }
.mn-wa-go { width: 18px !important; height: 18px !important; color: #128C7E; transition: transform .25s var(--mn-ease); }
.mn-wa-item:hover .mn-wa-go { transform: translateX(-4px); }
@keyframes mn-panel-in { from { opacity: 0; transform: translateY(16px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes mn-item-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

/* ---------- Chat panel ---------- */
.mn-chat {
  position: absolute; inset-inline-end: 0; bottom: calc(100% + 14px); width: 370px; height: min(560px, calc(100vh - 120px)); background: var(--mn-cream);
  border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 28px 70px rgba(59, 42, 23, .28);
  transform-origin: bottom left; animation: mn-panel-in .45s var(--mn-ease);
}
.mn-chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg, var(--mn-deep), var(--mn-brown)); color: #fff; }
.mn-bot-avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: var(--mn-gold); }
.mn-bot-avatar svg { animation: mn-twinkle 3.5s ease-in-out infinite; }
@keyframes mn-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.12) rotate(8deg); } }
.mn-chat-title { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.mn-chat-title small { opacity: .85; font-size: .75rem; }
.mn-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; margin-inline-end: 3px; box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: mn-live 2s infinite; }
@keyframes mn-live { 70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.mn-icon-btn { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; transition: background-color .2s ease; }
.mn-icon-btn:hover { background: rgba(255, 255, 255, .24); }
.mn-icon-btn svg { width: 18px; height: 18px; }

.mn-chat-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.mn-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; animation: mn-msg-in .35s var(--mn-ease) both; }
.mn-msg.bot { align-self: flex-start; background: #fff; color: var(--mn-deep); border: 1px solid var(--mn-border); border-start-start-radius: 4px; }
.mn-msg.user { align-self: flex-end; background: var(--mn-brown); color: #fff; border-start-end-radius: 4px; }
@keyframes mn-msg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.mn-typing { align-self: flex-start; background: #fff; border: 1px solid var(--mn-border); border-radius: 16px; border-start-start-radius: 4px; padding: 12px 16px; display: flex; gap: 5px; }
.mn-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--mn-gold); animation: mn-dot 1.2s infinite ease-in-out; }
.mn-typing i:nth-child(2) { animation-delay: .15s; }
.mn-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mn-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.mn-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 100%; }
.mn-chip {
  border: 1px solid var(--mn-border); background: #fff; color: var(--mn-brown); border-radius: 999px; padding: 6px 12px; font: 600 .82rem inherit;
  font-family: inherit; cursor: pointer; text-align: start; transition: background-color .2s ease, color .2s ease, transform .25s var(--mn-spring);
  animation: mn-msg-in .35s var(--mn-ease) both; animation-delay: calc(var(--i, 0) * 70ms);
}
.mn-chip:hover, .mn-chip:focus-visible { background: var(--mn-brown); color: #fff; transform: translateY(-2px); outline: none; }
.mn-chips-title { font-size: .75rem; color: var(--mn-muted); width: 100%; }
.mn-contacts { display: flex; flex-direction: column; gap: 6px; align-self: stretch; }
.mn-contact { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #cfeedd; border-radius: 12px; padding: 8px 12px; color: #0f6b5f; text-decoration: none; font-weight: 700; font-size: .88rem; }
.mn-contact:hover { background: #f2fbf5; }
.mn-contact svg { width: 20px; height: 20px; color: var(--mn-wa); }
.mn-rate { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--mn-muted); align-self: flex-start; animation: mn-msg-in .35s var(--mn-ease) .2s both; }
.mn-rate button { border: 1px solid var(--mn-border); background: #fff; border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: .9rem; transition: transform .25s var(--mn-spring), background-color .2s; }
.mn-rate button:hover { transform: scale(1.12); background: var(--mn-cream); }
.mn-rate.done { color: var(--emerald, #17695D); font-weight: 700; }

.mn-chat-form { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid var(--mn-border); }
.mn-chat-form input {
  flex: 1; border: 1px solid var(--mn-border); background: var(--mn-cream); border-radius: 14px; padding: 10px 14px; font: inherit; font-size: .92rem; color: var(--mn-deep);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.mn-chat-form input:focus { outline: none; border-color: var(--mn-gold); box-shadow: 0 0 0 4px rgba(188, 146, 80, .18); }
.mn-send { width: 44px; border: 0; border-radius: 14px; background: var(--mn-brown); color: #fff; display: grid; place-items: center; cursor: pointer; transition: transform .25s var(--mn-spring), background-color .2s; }
.mn-send:hover { transform: scale(1.06); background: var(--mn-deep); }
.mn-send:disabled { opacity: .5; cursor: default; transform: none; }
.mn-send svg { width: 20px; height: 20px; }

@media (max-width: 520px) {
  .mn-help { inset-inline-end: 14px; bottom: 14px; }
  .mn-chat { position: fixed; inset: auto 8px 82px 8px; width: auto; height: min(74vh, 600px); }
  .mn-wa-menu { position: fixed; inset: auto 8px 82px auto; width: min(300px, calc(100vw - 16px)); }
  .mn-help.mn-both .mn-chat, .mn-help.mn-both .mn-wa-menu { bottom: 148px; }
  .mn-help.mn-both .mn-chat { height: min(68vh, 560px); }
  .mn-fab { width: 54px; height: 54px; }
  .mn-fab-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mn-help *, .mn-help *::before { animation: none !important; transition: none !important; }
}
