@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ================= ROOT ================= */
:root{
  --bg:#f6f7fb;
  --surface:#ffffff;
  --line:#e9ecf3;

  --text:#0f172a;
  --muted:#64748b;

  --assistant:#eaf1ff;
  --assistantText:#1f2a44;

  --user:#0b1b34;
  --userText:#ffffff;

  --primary:#0b1b34;
  --shadow:0 10px 24px rgba(15,23,42,.08);

  --composerH:110px;
}

*{
  box-sizing:border-box;
}

html,body{
  height:100%;
}

body{
  margin:0;
  font-family:"Tajawal",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  overflow:auto;
}

/* ================= HEADER ================= */
.topbar{
  direction:rtl;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 16px;
  background:var(--surface);
  border-bottom:1px solid var(--line);
}

.topbar__right,
.topbar__left{
  display:flex;
  align-items:center;
}

.header-brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.header-brand__avatar{
  width:36px;
  height:36px;
  border-radius:10px;
  background:url('/ai/assets/balqees.jpg') center/cover no-repeat;
  border:1px solid rgba(15,23,42,.12);
}

.header-brand__text{
  text-align:right;
  line-height:1.15;
}

.header-brand__title{
  font-size:18px;
  font-weight:900;
  color:#0b1b34;
}

.header-brand__subtitle{
  font-size:12px;
  color:var(--muted);
}

/* ================= BUTTONS / INPUTS ================= */
button,
input,
textarea,
select{
  font-family:"Tajawal",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif !important;
}

.btn{
  border:0;
  border-radius:999px;
  padding:6px 14px;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
}

.btn--ghost{
  background:#eef2f7;
  border:1px solid rgba(15,23,42,.08);
  color:#0f172a;
}

.btn--primary{
  background:var(--primary);
  color:#fff;
}

/* ================= CHAT ================= */
/* الهيكل LTR ثابت – النص فقط RTL */
.chat{
  height:auto;
  max-height:calc(100vh - var(--composerH));
  overflow:auto;
  padding-bottom:calc(var(--composerH) + 20px);
}

.chat__inner{
  width:100%;
  max-width:900px;
  margin:0 auto;
  padding:16px;
}

/* ================= ROWS ================= */
.chat,
.chat__inner,
.row{
  direction:ltr;
}

.row{
  width:100%;
  display:flex;
  margin:12px 0;
}

/* بلقيس يسار */
.row--assistant{
  justify-content:flex-start;
  align-items:flex-start;
  flex-direction:column; /* ✅ فقاعه فوق + تبليغ تحت */
}

/* المستخدم يمين */
.row--user{
  justify-content:flex-end;
  align-items:flex-end;
}

/* ================= BUBBLES ================= */
.bubble{
  position:relative;
  max-width:75%;
  padding:14px 16px;
  border-radius:18px;
  box-shadow:var(--shadow);
  border:1px solid rgba(15,23,42,.06);
  overflow:visible;
}

.bubble__text{
  direction:rtl;
  text-align:right;
  font-size:15px;
  line-height:1.7;
  white-space:pre-wrap;
}

/* بلقيس */
.bubble--assistant{
  background:var(--assistant);
  color:var(--assistantText);
  border-top-left-radius:10px;
}

/* المستخدم */
.bubble--user{
  background:var(--user);
  color:var(--userText);
  border-top-right-radius:10px;
}

/* ================= AVATAR ================= */
.row--assistant .bubble--assistant{
  margin-left:48px;
}

.row--assistant .bubble--assistant::before{
  content:"";
  position:absolute;
  left:-48px;
  bottom:6px;
  width:34px;
  height:34px;
  border-radius:50%;
  background:url('/ai/assets/balqees.jpg') center/cover no-repeat;
  box-shadow:0 4px 10px rgba(0,0,0,.12);
  z-index:5;
}

/* ================= TYPING ================= */
.typing{
  padding:6px 12px;
  font-size:13px;
  color:var(--muted);
}

/* ✅ Typing (Plain + Blinking) */
.typing-plain{
  margin: 6px 12px;
  font-size: 13px;
  color: #9ca3af;
  animation: blinkText 1.2s infinite;
}
@keyframes blinkText{
  0%   { opacity: .2; }
  50%  { opacity: 1; }
  100% { opacity: .2; }
}

/* ================= REPORT UNDER BUBBLE (NEW) ================= */
.row--assistant .report-under{
  margin-left:48px;       /* ✅ نفس إزاحة الأفاتار */
  margin-top:6px;
  align-self:flex-start;
  display:inline-block;
  font-size:12px;
  color:#d9534f;
  cursor:pointer;
  text-decoration:underline;
  user-select:none;
  opacity:.95;
  position: static !important;
  float: none !important;
}
.row--assistant .report-under:hover{ opacity:1; }

/* ================= COMPOSER ================= */
.composer{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:999;
  background:#fff;
  border-top:1px solid var(--line);
  padding:12px 16px;
}

.composer__form{
  max-width:900px;
  margin:0 auto;
  display:flex;
  gap:10px;
}

.composer__input{
  flex:1;
  height:48px;
  border-radius:14px;
  border:1px solid var(--line);
  padding:0 14px;
  font-size:15px;
}

.composer__send{
  min-width:96px;
  height:48px;
  border-radius:14px;
  background:var(--primary);
  color:#fff;
  font-weight:900;
  border:0;
}

/* ================= REPORT MODAL (OLD STYLE - SAFE) ================= */
.report-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.35);
  backdrop-filter:blur(2px);
  z-index:99999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}

.report-menu{
  width:min(520px,94vw);
  background:#fff;
  border-radius:18px;
  border:1px solid rgba(15,23,42,.1);
  box-shadow:0 20px 60px rgba(0,0,0,.18);
  padding:16px;
  direction:rtl;
}

.report-menu__title{
  font-size:16px;
  font-weight:900;
  margin-bottom:12px;
}

.report-menu__label{
  font-size:12px;
  font-weight:800;
  margin:10px 0 6px;
}

.report-menu__select,
.report-menu__textarea{
  width:100%;
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  font-size:14px;
}

.report-menu__textarea{
  min-height:88px;
}

.report-menu__actions{
  display:flex;
  gap:10px;
  margin-top:14px;
}

/* ================= Contact Admin Button ================= */
.contact-admin-btn{
  background:#7b39fb;
  color:#fff;
  border:0;
  padding:10px 16px;
  border-radius:10px;
  cursor:pointer;
  margin-top:8px;
  font-size:14px;
}
.contact-admin-btn:hover{opacity:.9}

/* ===== AI Notice (Warning Style) ===== */
.ai-note{
  width:100%;
  margin:0;
  background:#fff1f2;
  border-bottom:1px solid #fecdd3;
  padding:14px 48px 14px 16px;
  font-size:13px;
  color:#7f1d1d;
  position:relative;
}

.ai-note strong{
  color:#b91c1c;
}

.ai-note::before{
  content:'';
  position:absolute;
  right:0;
  top:0;
  height:100%;
  width:4px;
  background:#dc2626;
}

.ai-note-close{
  position:absolute;
  top:12px;
  left:12px;
  background:none;
  border:none;
  font-size:20px;
  cursor:pointer;
  color:#991b1b;
}

.ai-note-close:hover{
  opacity:.8;
}

.ai-note-list{
  margin:8px 0 0;
  padding-right:18px;
}

.ai-note-list li{
  list-style-type:disc;
  color:#7f1d1d;
  margin-bottom:6px;
}

.ai-note-list li::marker{
  color:#dc2626;
}

/* ================= REPORT MODAL (CURRENT: bq-modal) ================= */
.bq-modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.bq-modal__card{
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

.bq-modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.bq-modal__title{
  font-size: 14px;
  font-weight: 700;
  color:#111827;
}

.bq-modal__close{
  border:0;
  background: transparent;
  font-size: 20px;
  cursor:pointer;
  line-height: 1;
  color:#6b7280;
}

.bq-modal__body label{
  display:block;
  font-size: 12px;
  color:#374151;
  margin: 10px 0 6px;
}

.bq-modal__select,
.bq-modal__textarea{
  width:100%;
  border:1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  outline: none;
}

.bq-modal__textarea{
  min-height: 90px;
  resize: vertical;
}

.bq-modal__actions{
  display:flex;
  gap:10px;
  justify-content:flex-start;
  margin-top: 12px;
}

.bq-btn{
  border:0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  cursor:pointer;
}

.bq-btn--danger{
  background:#ef4444;
  color:#fff;
}

.bq-btn--ghost{
  background:#f3f4f6;
  color:#111827;
}

.bq-btn:disabled{
  opacity:.6;
  cursor:not-allowed;
}

.bq-modal__hint{
  margin-top: 10px;
  font-size: 12px;
  color:#6b7280;
  white-space: pre-wrap;
  word-break: break-word;
}
