/* مساعد داماي v1.0 — 2026-11-24 — يعتمد متغيرات :root في style.css */
.da-root{ font-family: var(--font-body, 'Tajawal', 'Segoe UI', Tahoma, sans-serif); }
.da-sr{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

.da-launch{
  position:fixed; z-index:81; bottom:92px; inset-inline-end:22px;
  display:flex; align-items:center; gap:8px; min-height:48px; padding:0 18px 0 14px;
  border:0; border-radius:999px; cursor:pointer;
  background: var(--c-primary, #1B365D); color:#fff;
  font-family: var(--font-head, 'Cairo', sans-serif); font-weight:700; font-size:15px;
  box-shadow: var(--shadow-md, 0 10px 30px rgba(15,25,50,.10));
  border:2px solid var(--c-gold, #C8A75B);
  transition: transform .2s, background .2s;
}
.da-launch:hover{ background: var(--c-primary-dark, #10233F); transform: translateY(-2px); }
.da-launch:focus-visible, .da-root button:focus-visible, .da-root a:focus-visible, .da-input:focus-visible, .da-log:focus-visible{
  outline:3px solid var(--c-gold, #C8A75B); outline-offset:2px;
}
.da-launch svg{ width:22px; height:22px; flex-shrink:0; }
.da-open .da-launch{ display:none; }
html.da-is-open .wa-float{ display:none; }

.da-panel{
  position:fixed; z-index:95; bottom:22px; inset-inline-end:22px;
  width:min(390px, calc(100vw - 44px)); height:min(600px, calc(100vh - 44px));
  display:flex; flex-direction:column; overflow:hidden; padding:0; margin:0;
  background: var(--c-bg, #FBF9F4); color: var(--c-text, #262421);
  border:1px solid var(--c-border, #E4DFCE); border-radius:20px;
  box-shadow: var(--shadow-lg, 0 20px 50px rgba(15,25,50,.14));
}
.da-panel[hidden]{ display:none; }
@media (prefers-reduced-motion: no-preference){
  .da-panel{ animation: da-in .22s ease-out; }
  @keyframes da-in{ from{ opacity:0; transform: translateY(12px); } to{ opacity:1; transform:none; } }
}

.da-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 16px; color:#fff;
  background: linear-gradient(150deg, var(--c-primary-dark, #10233F), var(--c-primary, #1B365D));
  border-bottom:3px solid var(--c-gold, #C8A75B);
}
.da-head-text{ display:flex; flex-direction:column; min-width:0; }
.da-title{ font-family: var(--font-head, 'Cairo', sans-serif); font-size:17px; line-height:1.3; }
.da-sub{ font-size:12.5px; color:#DCE4F0; line-height:1.5; }
.da-close{ width:44px; height:44px; flex-shrink:0; border:0; border-radius:12px; background:rgba(255,255,255,.12); color:#fff; display:grid; place-items:center; cursor:pointer; }
.da-close:hover{ background:rgba(255,255,255,.22); }
.da-close svg{ width:20px; height:20px; }

.da-log{ flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px; scroll-behavior:smooth; overscroll-behavior:contain; }
.da-msg{ display:flex; }
.da-user{ justify-content:flex-end; }
.da-bubble{
  max-width:88%; padding:10px 13px; border-radius:16px; font-size:15px; line-height:1.75;
  white-space:pre-line; overflow-wrap:anywhere; unicode-bidi:plaintext;
}
.da-bot .da-bubble{ background:#fff; border:1px solid var(--c-border, #E4DFCE); border-start-start-radius:4px; }
.da-user .da-bubble{ background: var(--c-primary, #1B365D); color:#fff; border-start-end-radius:4px; }
.da-wait .da-bubble{ color: var(--c-text-muted, #5A5A5A); font-style:italic; }

.da-actions{ display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.da-link{
  display:inline-flex; align-items:center; min-height:44px; padding:6px 12px; border-radius:12px;
  font-size:13.5px; font-weight:700; text-decoration:none; line-height:1.4;
  background: var(--c-primary-light, #E7ECF4); color: var(--c-primary-dark, #10233F);
}
.da-link:hover{ background: var(--c-primary, #1B365D); color:#fff; }
.da-link.da-wa{ background:#1E7E44; color:#fff; }
.da-link.da-wa:hover{ background:#16653A; }
.da-link.da-quiet{ background:transparent; color: var(--c-text-muted, #5A5A5A); text-decoration:underline; padding-inline:6px; font-weight:500; }
.da-link.da-quiet:hover{ background:transparent; color: var(--c-primary-dark, #10233F); }
.da-link.da-cta{ background: var(--c-accent, #A6402D); color:#fff; }
.da-link.da-cta:hover{ background: var(--c-accent-dark, #833224); }

.da-more{ margin:2px 0 -4px; font-size:13px; color: var(--c-text-muted, #5A5A5A); }
.da-chips{ display:flex; flex-wrap:wrap; gap:6px; }
.da-chip{
  min-height:44px; padding:6px 12px; border-radius:999px; cursor:pointer; text-align:start;
  border:1px solid var(--c-gold, #C8A75B); background:#fff; color: var(--c-primary-dark, #10233F);
  font-family:inherit; font-size:13.5px; font-weight:700; line-height:1.4;
}
.da-chip:hover{ background: var(--c-gold-light, #E9D6AA); }
.da-chip-human{ border-color: var(--c-border, #E4DFCE); color: var(--c-text-muted, #5A5A5A); }

.da-form{ display:flex; gap:8px; padding:10px 12px 6px; border-top:1px solid var(--c-border, #E4DFCE); background:#fff; }
.da-input{
  flex:1; min-width:0; min-height:46px; padding:0 14px; border-radius:14px;
  border:1px solid var(--c-border, #E4DFCE); background: var(--c-bg, #FBF9F4);
  font-family:inherit; font-size:16px; color: var(--c-text, #262421);
}
.da-send{ width:46px; height:46px; flex-shrink:0; border:0; border-radius:14px; cursor:pointer; background: var(--c-accent, #A6402D); color:#fff; display:grid; place-items:center; }
.da-send:hover{ background: var(--c-accent-dark, #833224); }
.da-send svg{ width:20px; height:20px; }
[dir="rtl"] .da-send svg{ transform: scaleX(-1); }
.da-privacy{ margin:0; padding:2px 14px 10px; background:#fff; font-size:11.5px; line-height:1.6; color: var(--c-text-muted, #5A5A5A); }

/* الجوال: فوق شريط الأزرار السفلي (mobile-cta) ولوحة كاملة العرض */
@media (max-width:760px){
  .da-launch{ bottom: calc(80px + env(safe-area-inset-bottom)); inset-inline-end:14px; min-height:46px; padding:0 14px 0 12px; font-size:14px; }
  .da-panel{ inset:auto 0 0 0; width:100%; height: min(88vh, 100dvh); border-radius:20px 20px 0 0; border-bottom:0; padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width:360px){ .da-launch-text{ display:none; } .da-launch{ padding:0; width:48px; justify-content:center; } }
@media print{ .da-root{ display:none !important; } }
