/* =========================================================
   VELAEA Global Live Chat
   Shared customer/guest chat launcher for all public/customer pages.
   The script injects markup only when a page does not already have
   a native Live Chat widget.
========================================================= */
.velaea-global-chat-widget,
.velaea-global-chat-widget *{
  box-sizing:border-box;
}

.velaea-global-chat-widget{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:2400;
  font-family:Inter,'Noto Sans Thai',Arial,sans-serif;
  color:#eef5ff;
}

.velaea-global-chat-launcher{
  min-width:154px;
  height:52px;
  border:0;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:0 18px;
  background:linear-gradient(135deg,#ffd978,#c8952e);
  color:#1d1205;
  font-weight:950;
  font-size:13px;
  letter-spacing:.01em;
  box-shadow:0 18px 44px rgba(200,149,46,.30),0 10px 30px rgba(0,0,0,.26);
  cursor:pointer;
  transition:transform .2s ease,box-shadow .2s ease,filter .2s ease;
}

.velaea-global-chat-launcher:hover{
  transform:translateY(-2px);
  box-shadow:0 22px 50px rgba(200,149,46,.36),0 12px 34px rgba(0,0,0,.30);
  filter:saturate(1.05);
}

.velaea-global-chat-launcher-icon{
  display:inline-grid;
  place-items:center;
  width:20px;
  height:20px;
  font-size:15px;
}

.velaea-global-chat-launcher-pulse{
  position:absolute;
  right:8px;
  top:6px;
  width:9px;
  height:9px;
  border-radius:999px;
  background:#29d66d;
  box-shadow:0 0 0 6px rgba(41,214,109,.16);
}

.velaea-global-chat-panel{
  position:absolute;
  right:0;
  bottom:66px;
  width:min(390px,calc(100vw - 28px));
  height:min(640px,calc(100dvh - 118px));
  display:grid;
  grid-template-rows:auto 1fr auto;
  overflow:hidden;
  border:1px solid rgba(242,199,106,.26);
  border-radius:24px;
  background:
    radial-gradient(circle at 18% 0,rgba(242,199,106,.16),transparent 38%),
    linear-gradient(180deg,rgba(8,18,34,.985),rgba(3,10,22,.985));
  box-shadow:0 34px 100px rgba(0,0,0,.52),inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(12px) scale(.985);
  transition:opacity .22s ease,visibility .22s ease,transform .22s ease;
}

.velaea-global-chat-widget.open .velaea-global-chat-panel{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0) scale(1);
}

.velaea-global-chat-head{
  padding:16px 16px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(242,199,106,.16);
}

.velaea-global-chat-title{
  display:flex;
  align-items:center;
  gap:11px;
  min-width:0;
}

.velaea-global-chat-avatar{
  width:42px;
  height:42px;
  border-radius:15px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#ffd978,#c8952e);
  color:#1d1205;
  font-weight:950;
  box-shadow:0 12px 28px rgba(200,149,46,.22);
}

.velaea-global-chat-title strong{
  display:block;
  color:#fff;
  font-size:14px;
  font-weight:950;
}

.velaea-global-chat-title span{
  display:flex;
  align-items:center;
  gap:6px;
  color:#9fb0c3;
  font-size:12px;
  font-weight:800;
  margin-top:2px;
}

.velaea-global-chat-status-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:#29d66d;
  box-shadow:0 0 0 5px rgba(41,214,109,.14);
}

.velaea-global-chat-close{
  width:38px;
  height:38px;
  border-radius:13px;
  border:1px solid rgba(242,199,106,.20);
  background:rgba(255,255,255,.045);
  color:#f2c76a;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}

.velaea-global-chat-body{
  padding:14px;
  overflow:auto;
  display:grid;
  align-content:start;
  gap:10px;
  scrollbar-width:thin;
  scrollbar-color:rgba(242,199,106,.65) transparent;
}

.velaea-global-chat-body::-webkit-scrollbar{width:7px}
.velaea-global-chat-body::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#ffd978,#c8952e);border-radius:999px}

.velaea-global-chat-msg{
  width:fit-content;
  max-width:86%;
  padding:10px 12px;
  border-radius:16px;
  font-size:13px;
  line-height:1.5;
  word-break:break-word;
  border:1px solid rgba(255,255,255,.07);
  white-space:pre-wrap;
}

.velaea-global-chat-msg.agent{
  justify-self:start;
  color:#eaf2fc;
  background:rgba(255,255,255,.055);
  border-top-left-radius:6px;
}

.velaea-global-chat-msg.user{
  justify-self:end;
  color:#1d1205;
  background:linear-gradient(135deg,#ffd978,#c8952e);
  border-color:transparent;
  border-top-right-radius:6px;
}

.velaea-global-chat-time{
  display:block;
  margin-top:4px;
  font-size:10px;
  opacity:.64;
  font-weight:800;
  white-space:normal;
}

.velaea-global-chat-form{
  display:grid;
  gap:10px;
  padding:12px;
  border-top:1px solid rgba(242,199,106,.16);
  background:rgba(255,255,255,.025);
}

.velaea-global-chat-identity{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.velaea-global-chat-identity[hidden]{display:none!important}

.velaea-global-chat-input,
.velaea-global-chat-field{
  width:100%;
  border:1px solid rgba(242,199,106,.18);
  border-radius:15px;
  background:#06111f;
  color:#fff;
  padding:12px 13px;
  font-weight:800;
  outline:0;
}

.velaea-global-chat-field{
  min-height:42px;
  font-size:12px;
}

.velaea-global-chat-field.full{
  grid-column:1/-1;
}

.velaea-global-chat-input-row{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
}

.velaea-global-chat-input{
  min-height:44px;
  max-height:120px;
  resize:none;
}

.velaea-global-chat-send{
  width:46px;
  height:44px;
  border:0;
  border-radius:15px;
  background:linear-gradient(135deg,#ffd978,#c8952e);
  color:#1d1205;
  font-weight:950;
  cursor:pointer;
}

.velaea-global-chat-note{
  color:#9fb0c3;
  font-size:11px;
  line-height:1.4;
  padding:0 2px;
}

.velaea-global-chat-note a{
  color:#f2c76a;
  text-decoration:none;
  font-weight:900;
}

.velaea-global-chat-note a:hover{text-decoration:underline}

body.light-mode .velaea-global-chat-panel,
html[data-theme="light"] body .velaea-global-chat-panel{
  background:
    radial-gradient(circle at 18% 0,rgba(200,149,46,.14),transparent 38%),
    linear-gradient(180deg,rgba(255,255,255,.98),rgba(247,250,254,.98));
  border-color:rgba(200,149,46,.26);
  box-shadow:0 34px 100px rgba(8,24,42,.18);
}

body.light-mode .velaea-global-chat-title strong,
html[data-theme="light"] body .velaea-global-chat-title strong,
body.light-mode .velaea-global-chat-msg.agent,
html[data-theme="light"] body .velaea-global-chat-msg.agent{
  color:#061a2f;
}

body.light-mode .velaea-global-chat-title span,
html[data-theme="light"] body .velaea-global-chat-title span,
body.light-mode .velaea-global-chat-note,
html[data-theme="light"] body .velaea-global-chat-note{
  color:#5e6f84;
}

body.light-mode .velaea-global-chat-msg.agent,
html[data-theme="light"] body .velaea-global-chat-msg.agent{
  background:rgba(6,26,47,.045);
  border-color:rgba(6,26,47,.08);
}

body.light-mode .velaea-global-chat-close,
html[data-theme="light"] body .velaea-global-chat-close,
body.light-mode .velaea-global-chat-input,
html[data-theme="light"] body .velaea-global-chat-input,
body.light-mode .velaea-global-chat-field,
html[data-theme="light"] body .velaea-global-chat-field{
  background:#fff;
  color:#061a2f;
  border-color:rgba(200,149,46,.26);
}

body.light-mode .velaea-global-chat-form,
html[data-theme="light"] body .velaea-global-chat-form{
  background:rgba(255,255,255,.60);
}

@media(max-width:600px){
  .velaea-global-chat-widget{
    right:12px;
    bottom:12px;
  }

  .velaea-global-chat-launcher{
    min-width:52px;
    width:52px;
    height:52px;
    padding:0;
    border-radius:18px;
  }

  .velaea-global-chat-launcher-text{
    display:none;
  }

  .velaea-global-chat-panel{
    position:fixed;
    left:10px;
    right:10px;
    bottom:76px;
    width:auto;
    height:min(640px,calc(100dvh - 94px));
    border-radius:22px;
  }

  .velaea-global-chat-identity{
    grid-template-columns:1fr;
  }

  .velaea-global-chat-field.full{
    grid-column:auto;
  }
}

/* EA Community / EA Lab keep the statistics guide at the lower-right corner.
   Lift Live Chat slightly on these pages so both actions stay clickable
   and never cover each other. */
body.ea-community-page .velaea-global-chat-widget,
body.ea-lab-page .velaea-global-chat-widget,
body.backtest-detail-page .velaea-global-chat-widget{
  bottom:86px;
}

@media(max-width:600px){
  body.ea-community-page .velaea-global-chat-widget,
  body.ea-lab-page .velaea-global-chat-widget,
  body.backtest-detail-page .velaea-global-chat-widget{
    bottom:74px;
  }
  body.ea-community-page .velaea-global-chat-panel,
  body.ea-lab-page .velaea-global-chat-panel,
  body.backtest-detail-page .velaea-global-chat-panel{
    bottom:136px;
    height:min(620px,calc(100dvh - 154px));
  }
}
