/* ============================================================
   WESAM SMART SERVICE ASSISTANT - Reference Enhanced Edition
   Floating robot + guided service chooser + mobile scroll fixes
   ============================================================ */
.wesam-ai-wrap,
.wesam-ai-wrap * { box-sizing: border-box; }

.wesam-ai-wrap {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 99999;
  direction: rtl;
  font-family: 'Cairo', 'Tajawal', Arial, sans-serif;
  color: #0f172a;
  --wesam-blue: #0f2a5f;
  --wesam-blue2: #12306b;
  --wesam-orange: #f97316;
  --wesam-cyan: #22d3ee;
  --wesam-green: #16a34a;
}

.wesam-ai-bubble {
  position: absolute;
  left: 82px;
  bottom: 74px;
  width: 302px;
  max-width: min(302px, calc(100vw - 118px));
  max-height: 124px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  background:
    radial-gradient(circle at 12% 12%, rgba(34,211,238,.16), transparent 35%),
    linear-gradient(180deg, #ffffff, #f8fbff);
  color: #102142;
  border: 1px solid rgba(34, 211, 238, .40);
  border-radius: 22px 22px 22px 7px;
  padding: 12px 15px 12px 17px;
  line-height: 1.65;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .20), inset 0 0 0 1px rgba(255,255,255,.85);
  opacity: 1;
  transform: translateY(0);
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}
.wesam-ai-bubble::-webkit-scrollbar { width: 5px; }
.wesam-ai-bubble::-webkit-scrollbar-thumb { background: rgba(15,42,95,.28); border-radius: 99px; }
.wesam-ai-bubble-title { color: var(--wesam-orange); font-weight: 950; font-size: 13.5px; margin-bottom: 2px; }
.wesam-ai-bubble-text { font-size: 12.5px; font-weight: 850; }
.wesam-ai-wrap.is-open .wesam-ai-bubble,
.wesam-ai-wrap.is-quiet .wesam-ai-bubble {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
}

.wesam-ai-robot {
  width: 74px;
  height: 74px;
  border: 0;
  cursor: pointer;
  border-radius: 25px;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  color: #fff;
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.50), transparent 24%),
    linear-gradient(145deg, #081936 0%, #112f74 48%, #f97316 100%);
  box-shadow:
    0 18px 44px rgba(2, 6, 23, .32),
    0 0 0 6px rgba(34, 211, 238, .12),
    0 0 34px rgba(249,115,22,.34);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  animation: wesamAiFloat 3s ease-in-out infinite;
}
.wesam-ai-robot::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 30px;
  background: conic-gradient(from 140deg, rgba(34,211,238,.70), transparent 30%, rgba(249,115,22,.78), transparent 70%, rgba(34,211,238,.70));
  filter: blur(10px);
  opacity: .38;
  z-index: -1;
  animation: wesamAiGlow 4.8s linear infinite;
}
.wesam-ai-robot:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 22px 54px rgba(2, 6, 23, .34), 0 0 0 7px rgba(34,211,238,.16), 0 0 46px rgba(249,115,22,.46);
  filter: saturate(1.08);
}
.wesam-ai-robot:focus-visible,
.wesam-ai-close:focus-visible,
.wesam-ai-chip:focus-visible,
.wesam-ai-pill:focus-visible,
.wesam-ai-action:focus-visible { outline: 3px solid rgba(34,211,238,.55); outline-offset: 3px; }

.wesam-ai-robot-face {
  width: 47px;
  height: 38px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 85%, rgba(255,255,255,.58), transparent 22%),
    linear-gradient(180deg, #e0faff, #8be8ff);
  border: 2px solid rgba(255,255,255,.82);
  position: relative;
  box-shadow: inset 0 -5px 9px rgba(8,145,178,.18), 0 5px 12px rgba(0,0,0,.12);
}
.wesam-ai-robot-face::before,
.wesam-ai-robot-face::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 8px;
  height: 11px;
  background: #0f2a5f;
  border-radius: 99px;
  box-shadow: 0 0 10px rgba(15,42,95,.45);
}
.wesam-ai-robot-face::before { right: 11px; }
.wesam-ai-robot-face::after { left: 11px; }
.wesam-ai-smile {
  position: absolute;
  right: 17px;
  bottom: 8px;
  width: 13px;
  height: 6px;
  border-bottom: 2px solid #0f2a5f;
  border-radius: 0 0 99px 99px;
}
.wesam-ai-antenna {
  position: absolute;
  top: 6px;
  width: 2px;
  height: 12px;
  background: rgba(255,255,255,.88);
  border-radius: 99px;
}
.wesam-ai-antenna::before {
  content: "";
  position: absolute;
  top: -6px;
  right: -5px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 13px rgba(34,197,94,.85);
}
.wesam-ai-notify {
  position: absolute;
  top: -7px;
  right: -8px;
  min-width: 28px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 10px;
  font-weight: 950;
  border: 2px solid #fff;
  box-shadow: 0 5px 12px rgba(220,38,38,.35);
}
@keyframes wesamAiFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wesamAiGlow { to { transform: rotate(360deg); } }

.wesam-ai-panel {
  position: absolute;
  left: 0;
  bottom: 88px;
  width: 408px;
  max-width: calc(100vw - 28px);
  height: auto;
  max-height: min(690px, calc(100dvh - 112px));
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.99);
  border: 1px solid rgba(15, 42, 95, .14);
  border-radius: 27px;
  overflow: hidden;
  box-shadow: 0 28px 75px rgba(2, 6, 23, .32);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.98);
  transition: opacity .22s ease, transform .22s ease;
}
.wesam-ai-wrap.is-open .wesam-ai-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.wesam-ai-head {
  padding: 15px 15px 13px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 15%, rgba(34,211,238,.30), transparent 35%),
    linear-gradient(135deg, #07152e, #12306b 62%, #f97316);
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
}
.wesam-ai-mini-face {
  width: 47px;
  height: 47px;
  flex: 0 0 47px;
  border-radius: 17px;
  background: linear-gradient(180deg, #e0faff, #93e9ff);
  border: 2px solid rgba(255,255,255,.75);
  position: relative;
  box-shadow: 0 8px 18px rgba(0,0,0,.15);
}
.wesam-ai-mini-face::before,
.wesam-ai-mini-face::after {
  content: "";
  position: absolute;
  top: 16px;
  width: 7px;
  height: 10px;
  background: #0f2a5f;
  border-radius: 99px;
}
.wesam-ai-mini-face::before { right: 13px; }
.wesam-ai-mini-face::after { left: 13px; }
.wesam-ai-head-text { min-width: 0; }
.wesam-ai-title { font-weight: 950; font-size: 15.5px; margin-bottom: 2px; }
.wesam-ai-sub { font-size: 12px; color: #dbeafe; line-height: 1.55; }
.wesam-ai-close {
  margin-right: auto;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 13px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.wesam-ai-body {
  padding: 15px;
  background:
    radial-gradient(circle at 8% 8%, rgba(34,211,238,.10), transparent 30%),
    linear-gradient(180deg, #fff, #f8fbff);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
}
.wesam-ai-body::-webkit-scrollbar { width: 7px; }
.wesam-ai-body::-webkit-scrollbar-track { background: rgba(226,232,240,.45); border-radius: 99px; }
.wesam-ai-body::-webkit-scrollbar-thumb { background: rgba(15,42,95,.30); border-radius: 99px; }
.wesam-ai-message {
  background: linear-gradient(180deg, #f1f5f9, #ffffff);
  border: 1px solid #e2e8f0;
  color: #102142;
  border-radius: 18px;
  padding: 12px 13px;
  font-size: 13px;
  line-height: 1.75;
  margin-bottom: 12px;
  box-shadow: 0 8px 18px rgba(15,23,42,.05);
}
.wesam-ai-label {
  font-size: 12px;
  font-weight: 950;
  color: #334155;
  margin: 13px 2px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.wesam-ai-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wesam-orange);
  box-shadow: 0 0 0 4px rgba(249,115,22,.12);
}
.wesam-ai-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wesam-ai-grid.services { grid-template-columns: repeat(3, 1fr); }
.wesam-ai-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.wesam-ai-chip,
.wesam-ai-pill {
  border: 1px solid #dbe5f0;
  background: #fff;
  color: #102142;
  border-radius: 15px;
  padding: 10px 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 48px;
  font-weight: 850;
  font-size: 12.5px;
  text-align: right;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.wesam-ai-pill { justify-content: center; min-height: 42px; }
.wesam-ai-chip:hover,
.wesam-ai-chip.is-active,
.wesam-ai-pill:hover,
.wesam-ai-pill.is-active {
  border-color: #f97316;
  background: #fff7ed;
  box-shadow: 0 9px 22px rgba(249,115,22,.13);
  transform: translateY(-1px);
}
.wesam-ai-chip.is-active,
.wesam-ai-pill.is-active { box-shadow: 0 0 0 2px rgba(249,115,22,.18), 0 9px 22px rgba(249,115,22,.13); }
.wesam-ai-chip .emoji { font-size: 19px; width: 24px; text-align: center; flex: 0 0 auto; }
.wesam-ai-chip.issue { grid-column: auto; }
.wesam-ai-result {
  margin-top: 13px;
  display: none;
  border: 1px solid rgba(249,115,22,.30);
  background:
    radial-gradient(circle at 10% 0%, rgba(34,211,238,.12), transparent 32%),
    linear-gradient(180deg, #fff7ed, #ffffff);
  border-radius: 19px;
  padding: 13px;
  box-shadow: 0 10px 24px rgba(249,115,22,.08);
}
.wesam-ai-result.is-show { display: block; }
.wesam-ai-result-title {
  font-size: 14px;
  font-weight: 950;
  color: #0f2a5f;
  margin-bottom: 6px;
}
.wesam-ai-result-text {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.75;
  margin-bottom: 11px;
}
.wesam-ai-tip {
  display: inline-block;
  margin-top: 4px;
  color: #0f766e;
  font-weight: 800;
}
.wesam-ai-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wesam-ai-action {
  text-align: center;
  text-decoration: none;
  border: 0;
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 12.5px;
  font-weight: 950;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.wesam-ai-action:hover { transform: translateY(-1px); filter: saturate(1.08); }
.wesam-ai-action.primary { background: linear-gradient(180deg, #fb923c, #f97316); color: #fff; box-shadow: 0 10px 22px rgba(249,115,22,.24); }
.wesam-ai-action.secondary { background: #dcfce7; color: #14532d; }
.wesam-ai-action.light { background: #e0f2fe; color: #0f2a5f; }
.wesam-ai-foot {
  padding-top: 10px;
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.65;
}

@media (max-width: 700px) {
  .wesam-ai-wrap { left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .wesam-ai-robot { width: 63px; height: 63px; border-radius: 21px; }
  .wesam-ai-robot-face { width: 40px; height: 33px; }
  .wesam-ai-bubble {
    left: 70px;
    bottom: 66px;
    width: 248px;
    max-width: calc(100vw - 92px);
    max-height: 92px;
    padding: 9px 12px;
    line-height: 1.55;
  }
  .wesam-ai-bubble-title { font-size: 12.4px; }
  .wesam-ai-bubble-text { font-size: 11.8px; }
  .wesam-ai-panel {
    width: calc(100vw - 20px);
    bottom: 74px;
    border-radius: 22px;
    max-height: calc(100dvh - 94px);
  }
  .wesam-ai-head { padding: 12px; gap: 10px; }
  .wesam-ai-mini-face { width: 41px; height: 41px; flex-basis: 41px; border-radius: 15px; }
  .wesam-ai-sub { font-size: 11.2px; }
  .wesam-ai-body { padding: 12px; }
  .wesam-ai-grid,
  .wesam-ai-grid.services { grid-template-columns: 1fr 1fr; gap: 7px; }
  .wesam-ai-grid.issues { grid-template-columns: 1fr; }
  .wesam-ai-mini-grid { grid-template-columns: 1fr; gap: 7px; }
  .wesam-ai-chip { min-height: 44px; padding: 9px 10px; }
  .wesam-ai-pill { min-height: 40px; }
  .wesam-ai-actions {
    position: sticky;
    bottom: -12px;
    grid-template-columns: 1fr;
    background: linear-gradient(180deg, rgba(255,255,255,.72), #fff 35%);
    padding-top: 8px;
    margin-bottom: -2px;
  }
  .wesam-ai-action { width: 100%; }
}

@media (max-width: 380px) {
  .wesam-ai-grid,
  .wesam-ai-grid.services { grid-template-columns: 1fr; }
  .wesam-ai-bubble { width: 218px; max-width: calc(100vw - 88px); }
}

@media (max-height: 560px) {
  .wesam-ai-panel { max-height: calc(100dvh - 88px); bottom: 72px; }
  .wesam-ai-head { padding: 10px 12px; }
  .wesam-ai-mini-face { width: 38px; height: 38px; flex-basis: 38px; }
  .wesam-ai-message { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .wesam-ai-robot,
  .wesam-ai-robot::before { animation: none; }
  .wesam-ai-panel,
  .wesam-ai-bubble,
  .wesam-ai-chip,
  .wesam-ai-pill,
  .wesam-ai-action { transition: none; }
}

/* V27.12 - optional diagnostic yes/no questions inside the smart assistant */
.wesam-ai-triage-note {
  margin: -2px 2px 9px;
  padding: 9px 11px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ecfeff, #ffffff);
  border: 1px solid rgba(34, 211, 238, .30);
  color: #0f2a5f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.65;
}
.wesam-ai-triage {
  display: grid;
  gap: 8px;
}
.wesam-ai-q {
  border: 1px solid #dbe5f0;
  background: #fff;
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 8px 18px rgba(15,23,42,.045);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.wesam-ai-q.is-answered {
  border-color: rgba(34, 211, 238, .50);
  background: linear-gradient(180deg, #f8fdff, #ffffff);
  box-shadow: 0 8px 20px rgba(34,211,238,.08);
}
.wesam-ai-q-text {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: #102142;
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1.7;
  margin-bottom: 8px;
}
.wesam-ai-q-text span {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: #fff7ed;
  color: #f97316;
  border: 1px solid rgba(249,115,22,.24);
  font-size: 11px;
  font-weight: 950;
}
.wesam-ai-yn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.wesam-ai-yn button {
  border: 1px solid #dbe5f0;
  background: #f8fafc;
  color: #334155;
  border-radius: 12px;
  min-height: 36px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.wesam-ai-yn button:hover,
.wesam-ai-yn button.active {
  transform: translateY(-1px);
  border-color: #f97316;
  background: #fff7ed;
  color: #9a3412;
  box-shadow: 0 7px 16px rgba(249,115,22,.12);
}
.wesam-ai-result-checks {
  margin: 0 0 10px;
  padding: 10px 11px;
  border-radius: 14px;
  background: rgba(236, 254, 255, .78);
  border: 1px solid rgba(34,211,238,.28);
  color: #0f2a5f;
  line-height: 1.65;
  font-size: 12px;
}
.wesam-ai-result-checks b {
  display: block;
  margin-bottom: 5px;
  color: #0f2a5f;
}
.wesam-ai-result-checks span {
  display: block;
  margin-top: 3px;
}
.wesam-ai-result-checks em {
  display: inline-block;
  margin-right: 5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff;
  color: #f97316;
  border: 1px solid rgba(249,115,22,.22);
  font-style: normal;
  font-weight: 950;
}
.wesam-ai-result-checks.muted {
  color: #64748b;
  background: #f8fafc;
  border-color: #e2e8f0;
}

@media (max-width: 700px) {
  .wesam-ai-triage-note { font-size: 11.5px; }
  .wesam-ai-q { padding: 9px; }
  .wesam-ai-q-text { font-size: 12px; }
}

/* V27.14 - first-step destination chooser for home smart assistant */
.wesam-ai-message.compact {
  margin-top: 10px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #fff7ed, #ffffff);
  border-color: rgba(249,115,22,.25);
}
.wesam-ai-intents {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 10px;
}
.wesam-ai-intent {
  border: 1px solid #dbe5f0;
  background: #fff;
  color: #102142;
  border-radius: 18px;
  padding: 11px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  text-align: right;
  box-shadow: 0 8px 18px rgba(15,23,42,.045);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.wesam-ai-intent:hover,
.wesam-ai-intent.is-active {
  transform: translateY(-1px);
  border-color: #f97316;
  background: linear-gradient(180deg, #fff7ed, #ffffff);
  box-shadow: 0 10px 24px rgba(249,115,22,.13);
}
.wesam-ai-intent-emoji {
  width: 38px;
  height: 38px;
  border-radius: 15px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eff6ff, #ecfeff);
  border: 1px solid rgba(34,211,238,.24);
  font-size: 20px;
}
.wesam-ai-intent strong {
  display: block;
  font-size: 13px;
  color: #0f2a5f;
  margin-bottom: 2px;
}
.wesam-ai-intent small {
  display: block;
  font-size: 11.3px;
  line-height: 1.45;
  color: #64748b;
  font-weight: 800;
}
.wesam-ai-service-stage { margin-top: 8px; }
.wesam-ai-route-result { display: none; margin: 10px 0 4px; }
.wesam-ai-route-result.is-show { display: block; }
.wesam-ai-route-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(34,211,238,.32);
  background: radial-gradient(circle at 15% 0%, rgba(34,211,238,.14), transparent 36%), linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
}
.wesam-ai-route-icon {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(135deg, #0f2a5f, #22d3ee);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15,42,95,.18);
}
.wesam-ai-route-content { min-width: 0; flex: 1; }
.wesam-ai-route-content h3 {
  margin: 0 0 5px;
  color: #0f2a5f;
  font-size: 15px;
  font-weight: 950;
}
.wesam-ai-route-content p {
  margin: 0 0 11px;
  color: #475569;
  line-height: 1.75;
  font-size: 12.5px;
  font-weight: 800;
}
.wesam-ai-route-content .wesam-ai-action.light {
  border: 0;
}

@media (max-width: 700px) {
  .wesam-ai-intents { grid-template-columns: 1fr; }
  .wesam-ai-intent { min-height: 62px; }
  .wesam-ai-route-card { gap: 10px; padding: 12px; }
  .wesam-ai-route-icon { width: 44px; height: 44px; flex-basis: 44px; border-radius: 16px; }
}
