/* ═══════════════════════════════════════════════════════════════
   VACLIC — AI Chat Widget
   Matches the site's cinematic dark theme by default and switches
   with the light theme (html[data-theme="light"]). RTL-aware.
   ═══════════════════════════════════════════════════════════════ */

.vc-chat, .vc-chat *, .vc-chat *::before, .vc-chat *::after { box-sizing: border-box; }

.vc-launch, .vc-panel {
  --vc-bg:        #0a0f1c;
  --vc-bg2:       #0e1626;
  --vc-surface:   #131c30;
  --vc-surface2:  #1a2540;
  --vc-border:    rgba(255,255,255,0.08);
  --vc-text:      #eef2fa;
  --vc-text2:     #9aa4b8;
  --vc-gold:      #dfa011;
  --vc-gold-lt:   #ffd977;
  --vc-gold-bg:   rgba(223,160,17,0.10);
  --vc-user:      rgba(223,160,17,0.14);
  --vc-shadow:    0 12px 48px rgba(0,0,0,0.55), 0 0 0 1px var(--vc-border);
}
.vc-panel {
  font-family: 'Tajawal', 'Jost', system-ui, sans-serif;
}

/* ── launcher button ── */
.vc-launch {
  position: fixed;
  right: 22px;
  bottom: 48px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid var(--vc-border);
  background: linear-gradient(160deg, #141d33, #0a0f1c);
  color: var(--vc-gold-lt);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 8px 28px rgba(0,0,0,0.45),
    0 0 24px rgba(223,160,17,0.12);
  transition: transform .25s ease, box-shadow .25s ease;
  z-index: 260;
}
.vc-launch:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 36px rgba(0,0,0,0.55), 0 0 32px rgba(223,160,17,0.22); }
.vc-launch svg { width: 32px; height: 32px; }
.vc-launch .vc-pulse {
  position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid rgba(223,160,17,0.5);
  animation: vcPulse 2.4s ease-out infinite;
}
@keyframes vcPulse {
  0%   { transform: scale(1);   opacity: .8; }
  70%  { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}
.vc-launch.is-open { display: none; }

html[dir="rtl"] .vc-launch { right: auto; left: 22px; }

/* ── panel ── */
.vc-panel {
  position: fixed;
  z-index: 260;
  right: 22px;
  bottom: 92px;
  width: min(384px, calc(100vw - 32px));
  height: min(600px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  overflow: hidden;
  background: var(--vc-bg);                    /* fully solid — no transparency in dark mode */
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),     /* top light edge */
    0 2px 6px rgba(0,0,0,0.45),               /* contact shadow */
    0 18px 36px rgba(0,0,0,0.5),              /* mid drop */
    0 32px 72px rgba(0,0,0,0.6),              /* deep ambient */
    0 0 42px rgba(223,160,17,0.10);           /* subtle gold rim glow */
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
html[dir="rtl"] .vc-panel { right: auto; left: 22px; }
.vc-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* header */
.vc-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  background: linear-gradient(180deg, #111a2e, #0a0f1c);
  border-bottom: 1px solid var(--vc-border);
}
.vc-head-mark { width: 30px; height: 30px; flex: none; }
.vc-head-t { font-size: 14.5px; font-weight: 700; color: var(--vc-text); line-height: 1.15; }
.vc-head-s { font-size: 11.5px; color: var(--vc-text2); line-height: 1.2; }
.vc-head-s b { color: #22c55e; font-weight: 600; }
.vc-close {
  margin-inline-start: auto;
  background: none; border: none; color: var(--vc-text2);
  cursor: pointer; padding: 6px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.vc-close:hover { color: var(--vc-text); background: rgba(255,255,255,0.06); }

/* messages */
.vc-msgs {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
  overscroll-behavior: contain;   /* never chain-scroll to the page */
}
.vc-msgs::-webkit-scrollbar { width: 5px; }
.vc-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.vc-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--vc-text);
  word-break: break-word;
  animation: vcIn .28s ease;
  unicode-bidi: plaintext;   /* mixed AR/EN text flows correctly inside one bubble */
}
@keyframes vcIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.vc-msg.bot  {
  align-self: flex-start;
  background: var(--vc-surface);
  border: 1px solid var(--vc-border);
  border-start-start-radius: 6px;
}
.vc-msg.user {
  align-self: flex-end;
  background: var(--vc-user);
  border: 1px solid rgba(223,160,17,0.25);
  border-start-end-radius: 6px;
  color: var(--vc-text);
}
.vc-msg a { color: var(--vc-gold-lt); unicode-bidi: isolate; }
.vc-msg b, .vc-msg strong { font-weight: 700; }
.vc-msg code { background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* typing dots */
.vc-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.vc-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--vc-gold);
  animation: vcBlink 1.2s infinite ease-in-out;
}
.vc-dots i:nth-child(2) { animation-delay: .2s; }
.vc-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes vcBlink { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

.vc-think {
  display: block; margin-bottom: 6px;
  font-size: 11.5px; color: var(--vc-text2);
}

/* quick question chips */
.vc-chips {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 10px 14px 4px;
  border-top: 1px solid var(--vc-border);
  background: var(--vc-bg2);
}
.vc-chip {
  border: 1px solid var(--vc-border);
  background: var(--vc-surface2);
  color: var(--vc-text2);
  font-family: inherit; font-size: 12px;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.vc-chip:hover { color: var(--vc-gold-lt); border-color: rgba(223,160,17,0.5); }

/* input row */
.vc-in {
  display: flex; gap: 8px; padding: 11px 12px;
  border-top: 1px solid var(--vc-border);
  background: var(--vc-bg2);
}
.vc-in textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 110px;
  background: #0c1322;                       /* solid field, not transparent */
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  padding: 10px 12px;
  color: var(--vc-text);
  font-family: inherit; font-size: 13.5px; line-height: 1.4;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.35);
}
.vc-in textarea::placeholder { color: var(--vc-text2); }
.vc-in textarea:focus { border-color: rgba(223,160,17,0.65); box-shadow: 0 0 0 3px rgba(223,160,17,0.12); }
.vc-send {
  align-self: flex-end;
  width: 40px; height: 40px; flex: none;
  border: none; border-radius: 12px;
  background: #ffffff;
  color: #0a0f1c;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s ease, transform .2s ease;
}
.vc-send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 2px 10px rgba(255,255,255,0.25); }
.vc-send:disabled { opacity: .45; cursor: default; }

.vc-foot {
  padding: 4px 12px 8px;
  font-size: 10.5px; color: var(--vc-text2); text-align: center;
}

/* ── light theme ── */
html[data-theme="light"] .vc-launch,
html[data-theme="light"] .vc-panel {
  --vc-bg:        #fdfcf9;
  --vc-bg2:       #f4f2ec;
  --vc-surface:   #ffffff;
  --vc-surface2:  #f0eee8;
  --vc-border:    rgba(0,0,0,0.10);
  --vc-text:      #18181b;
  --vc-text2:     #6b7280;
  --vc-gold:      #c8870e;
  --vc-gold-lt:   #dfa011;
  --vc-gold-bg:   rgba(201,143,20,0.08);
  --vc-user:      rgba(240,180,41,0.18);
  --vc-shadow:    0 12px 40px rgba(20,30,60,0.18), 0 0 0 1px var(--vc-border);
}
html[data-theme="light"] .vc-launch { background: #fff; box-shadow: 0 6px 22px rgba(20,30,60,0.22); }
html[data-theme="light"] .vc-head { background: #fff; }
html[data-theme="light"] .vc-send {
  background: #ffffff;
  color: #c8870e;
  border: 1px solid rgba(0,0,0,0.12);
}
html[data-theme="light"] .vc-send:hover:not(:disabled) { box-shadow: 0 2px 10px rgba(20,30,60,0.18); }
html[data-theme="light"] .vc-panel {
  background: linear-gradient(175deg, #ffffff 0%, #fdfcf9 38%);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 2px 6px rgba(20,30,60,0.10),
    0 18px 36px rgba(20,30,60,0.22),
    0 32px 72px rgba(20,30,60,0.28);
}
html[data-theme="light"] .vc-in textarea {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.16);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

/* ── mobile ── */
@media (max-width: 520px) {
  .vc-panel {
    right: 0; left: 0; bottom: 0;
    width: 100%;
    height: min(72dvh, 560px);
    border-radius: 26px 26px 0 0;
  }
  html[dir="rtl"] .vc-panel { right: 0; left: 0; }
}

/* ── desktop: glassmorphism (tablet & mobile stay solid) ── */
@media (min-width: 1024px) {
  .vc-panel {
    background: rgba(10, 15, 28, 0.72);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(255,255,255,0.16);
  }
  .vc-head   { background: rgba(17, 26, 46, 0.55); }
  .vc-chips  { background: rgba(14, 22, 38, 0.55); }
  .vc-in     { background: rgba(14, 22, 38, 0.55); }
  .vc-msg.bot { background: rgba(19, 28, 48, 0.78); }

  html[data-theme="light"] .vc-panel {
    background: rgba(253, 252, 249, 0.75);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(0,0,0,0.10);
  }
  html[data-theme="light"] .vc-head  { background: rgba(255,255,255,0.60); }
  html[data-theme="light"] .vc-chips { background: rgba(244,242,236,0.60); }
  html[data-theme="light"] .vc-in    { background: rgba(244,242,236,0.60); }
  html[data-theme="light"] .vc-msg.bot { background: rgba(255,255,255,0.85); }
}

/* ═══════════════════ v2 additions ═══════════════════ */
.vc-chips[hidden] { display: none; }

/* footer: "talk to our team" + brand */
.vc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vc-talk {
  background: none; border: none; padding: 2px 0; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 600; color: var(--vc-gold-lt);
  text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(223,160,17,0.4);
}
.vc-talk:hover { text-decoration-color: currentColor; }
.vc-muted { color: var(--vc-text2); font-size: 11.5px; }

/* send button doubles as a stop button while streaming */
.vc-send.is-stop { background: var(--vc-surface2); color: var(--vc-text); border: 1px solid var(--vc-border); }
html[data-theme="light"] .vc-send.is-stop { background: #f0eee8; color: #18181b; }

/* teaser bubble next to the launcher (replaces auto-open) */
.vc-teaser {
  position: fixed; z-index: 259;
  right: 100px; bottom: 60px;
  display: flex; align-items: center; gap: 4px;
  max-width: min(260px, calc(100vw - 130px));
  padding: 4px 4px 4px 12px;
  border-radius: 16px;
  background: var(--vc-surface, #131c30);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 24px rgba(223,160,17,0.10);
  color: #eef2fa;
  font-family: 'Tajawal', 'Jost', system-ui, sans-serif;
  animation: vcIn .3s ease;
}
.vc-teaser[hidden] { display: none; }
.vc-teaser-txt {
  background: none; border: none; padding: 6px 4px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: inherit; text-align: start; line-height: 1.3;
}
.vc-teaser-x {
  background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px;
  color: #9aa4b8; display: flex; align-items: center;
}
.vc-teaser-x:hover { color: #eef2fa; background: rgba(255,255,255,0.06); }
.vc-teaser::after {
  content: ''; position: absolute; right: -6px; top: 50%; width: 10px; height: 10px;
  transform: translateY(-50%) rotate(45deg);
  background: inherit; border-right: 1px solid rgba(255,255,255,0.14); border-top: 1px solid rgba(255,255,255,0.14);
}
html[dir="rtl"] .vc-teaser { right: auto; left: 100px; }
html[dir="rtl"] .vc-teaser::after { right: auto; left: -6px; transform: translateY(-50%) rotate(-135deg); }
html[data-theme="light"] .vc-teaser { background: #fff; color: #18181b; border-color: rgba(0,0,0,0.12); box-shadow: 0 10px 30px rgba(20,30,60,0.18); }
html[data-theme="light"] .vc-teaser::after { border-color: rgba(0,0,0,0.12); }
html[data-theme="light"] .vc-teaser-x { color: #6b7280; }
.vc-launch.is-open ~ .vc-teaser { display: none; }

/* lead form inside a bot bubble */
.vc-lead { max-width: 92%; display: flex; flex-direction: column; gap: 7px; }
.vc-lead-t { font-size: 13px; line-height: 1.45; margin-bottom: 2px; }
.vc-lead input, .vc-lead textarea {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--vc-text);
  background: #0c1322; border: 1px solid rgba(255,255,255,0.18); border-radius: 10px;
  padding: 8px 10px; outline: none; resize: none;
}
.vc-lead input::placeholder, .vc-lead textarea::placeholder { color: var(--vc-text2); }
.vc-lead input:focus, .vc-lead textarea:focus { border-color: rgba(223,160,17,0.65); box-shadow: 0 0 0 3px rgba(223,160,17,0.12); }
.vc-lead .vc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.vc-lead-row { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.vc-lead-go {
  flex: 1; border: none; border-radius: 10px; padding: 9px 12px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700;
  background: linear-gradient(180deg, #ffd977, #dfa011); color: #1a1405;
}
.vc-lead-go:disabled { opacity: .6; cursor: default; }
.vc-lead-no {
  background: none; border: none; cursor: pointer; padding: 8px 6px;
  font-family: inherit; font-size: 12px; color: var(--vc-text2);
}
.vc-lead-no:hover { color: var(--vc-text); }
.vc-lead-err { font-size: 12px; color: #f87171; }
.vc-lead-err[hidden] { display: none; }
html[data-theme="light"] .vc-lead input, html[data-theme="light"] .vc-lead textarea {
  background: #fff; border-color: rgba(0,0,0,0.16);
}

@media (max-width: 520px) {
  .vc-teaser { right: 96px; bottom: 58px; }
  html[dir="rtl"] .vc-teaser { left: 96px; }
}
