/* ═══════════════════════════════════════════
   إيوان كلاود — Chat Widget Styles
   يستخدم نفس متغيرات الألوان الموجودة في shared.css
═══════════════════════════════════════════ */

#ewan-chat-root {
  --ec-gold: var(--gold, #C9A84C);
  --ec-gold-l: var(--gold-l, #F0D878);
  --ec-gold-d: var(--gold-d, #8B6914);
  --ec-bg: var(--bg, #05080F);
  --ec-card: var(--card, #0D1422);
  --ec-card2: var(--card2, #111928);
  --ec-text: var(--text, #EDE8D8);
  --ec-muted: var(--muted, #5A6E90);
  --ec-border: var(--border, rgba(255,255,255,.08));
  direction: rtl;
  font-family: 'Tajawal', Arial, sans-serif;
}

/* ── الزرار العائم ── */
#ewan-chat-fab {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 999998;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--ec-gold-l), var(--ec-gold-d));
  color: #05080F;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 28px rgba(201,168,76,.35), 0 2px 8px rgba(0,0,0,.3);
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s;
}
#ewan-chat-fab:hover {
  transform: scale(1.07);
  box-shadow: 0 10px 34px rgba(201,168,76,.45), 0 2px 8px rgba(0,0,0,.35);
}
#ewan-chat-fab:active { transform: scale(0.96); }

/* ── نافذة الشات ── */
#ewan-chat-panel {
  position: fixed;
  bottom: 92px;
  left: 22px;
  z-index: 999999;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: var(--ec-card);
  border: 1px solid var(--ec-border);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.16,1,.3,1);
}
#ewan-chat-panel.ewan-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── الهيدر ── */
#ewan-chat-header {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, #0D1525 0%, #162035 100%);
  border-bottom: 1px solid rgba(201,168,76,.15);
}
.ewan-chat-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(201,168,76,.1);
  border: 1px solid rgba(201,168,76,.25);
  display: grid; place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ewan-chat-title { font-weight: 800; font-size: .92rem; color: var(--ec-gold-l); }
.ewan-chat-status { font-size: .72rem; color: var(--ec-muted); display: flex; align-items: center; gap: .35rem; margin-top: 2px; }
.ewan-dot { width: 6px; height: 6px; border-radius: 50%; background: #2ECC71; display: inline-block; box-shadow: 0 0 6px #2ECC71; }

/* ── الرسائل ── */
#ewan-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
#ewan-chat-messages::-webkit-scrollbar { width: 5px; }
#ewan-chat-messages::-webkit-scrollbar-thumb { background: var(--ec-border); border-radius: 4px; }

.ewan-msg { display: flex; max-width: 88%; }
.ewan-msg-ai { align-self: flex-start; }
.ewan-msg-user { align-self: flex-end; }

.ewan-bubble {
  padding: .6rem .85rem;
  border-radius: 14px;
  font-size: .84rem;
  line-height: 1.65;
}
.ewan-msg-ai .ewan-bubble {
  background: var(--ec-card2);
  border: 1px solid var(--ec-border);
  color: var(--ec-text);
  border-bottom-right-radius: 4px;
}
.ewan-msg-user .ewan-bubble {
  background: linear-gradient(135deg, var(--ec-gold-l), var(--ec-gold));
  color: #05080F;
  font-weight: 600;
  border-bottom-left-radius: 4px;
}

/* ── مؤشر الكتابة ── */
.ewan-typing { display: flex; gap: 4px; padding: .75rem .9rem !important; }
.ewan-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ec-muted);
  animation: ewanBounce 1.2s infinite ease-in-out;
}
.ewan-typing span:nth-child(2) { animation-delay: .15s; }
.ewan-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ewanBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── بانر فتح تذكرة ── */
#ewan-chat-ticket-banner {
  margin: 0 1rem .6rem;
  padding: .6rem .8rem;
  background: rgba(201,168,76,.08);
  border: 1px solid rgba(201,168,76,.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .78rem;
  color: var(--ec-text);
  animation: ewanSlideIn .3s ease;
}
.ewan-ticket-icon { font-size: 1.2rem; }
.ewan-ticket-sub { color: var(--ec-muted); font-size: .72rem; margin-top: 2px; }
@keyframes ewanSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ── حقل الإدخال ── */
#ewan-chat-form {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem;
  border-top: 1px solid var(--ec-border);
  background: var(--ec-card);
}
#ewan-chat-input {
  flex: 1;
  background: var(--ec-card2);
  border: 1px solid var(--ec-border);
  border-radius: 22px;
  padding: .6rem 1rem;
  color: var(--ec-text);
  font-size: .84rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
#ewan-chat-input:focus { border-color: rgba(201,168,76,.4); }
#ewan-chat-input::placeholder { color: var(--ec-muted); }

#ewan-chat-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--ec-gold-l), var(--ec-gold-d));
  color: #05080F;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform .15s;
}
#ewan-chat-send:hover:not(:disabled) { transform: scale(1.08); }
#ewan-chat-send:disabled { opacity: .5; cursor: default; }
#ewan-chat-send svg { transform: scaleX(-1); } /* عشان اتجاه RTL */

/* ── موبايل: تكبير الشات ليشغل الشاشة تقريباً ── */
@media (max-width: 480px) {
  #ewan-chat-panel {
    left: 12px;
    right: 12px;
    bottom: 82px;
    width: auto;
    height: calc(100vh - 120px);
  }
  #ewan-chat-fab { left: 16px; bottom: 16px; }
}


/* ── تنسيق ردود المساعد المنظّمة (خطوات/نقاط/كود) ── */
.ewan-msg-ai .ewan-bubble { max-width: 100%; overflow-wrap: anywhere; }
.ewan-bubble .ewan-p { margin: 0 0 .35rem; }
.ewan-bubble .ewan-p:last-child { margin-bottom: 0; }
.ewan-bubble .ewan-h { font-weight: 800; margin: .5rem 0 .3rem; color: var(--ec-gold-l); }
.ewan-bubble ol, .ewan-bubble ul { margin: .3rem 0 .5rem; padding-inline-start: 1.3rem; }
.ewan-bubble li { margin: 0 0 .3rem; padding-inline-start: .15rem; }
.ewan-bubble strong { font-weight: 800; color: var(--ec-gold-l); }
.ewan-msg-user .ewan-bubble strong { color: inherit; }
.ewan-bubble a { color: var(--ec-gold-l); text-decoration: underline; word-break: break-all; }
.ewan-inline-code, .ewan-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  direction: ltr; unicode-bidi: plaintext; text-align: left;
  background: rgba(255,255,255,.07); border: 1px solid var(--ec-border);
}
.ewan-inline-code { padding: .05rem .35rem; border-radius: 6px; font-size: .78rem; }
.ewan-code {
  margin: .4rem 0; padding: .6rem .75rem; border-radius: 10px;
  font-size: .76rem; line-height: 1.6; overflow-x: auto; white-space: pre;
}
.ewan-code code { background: none; border: 0; padding: 0; }

/* wafix-20261201: stack WhatsApp float above chat button so they never overlap */
.float-wa{left:25px!important;right:auto!important;bottom:94px!important;z-index:999997!important}
@media(max-width:480px){.float-wa{left:19px!important;bottom:86px!important}}
/* end wafix-20261201 */
