/* Visera AI chat widget — scoped to .vchat-* to avoid theme collisions. */

.vchat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, #7e57ff 0%, #2dd0e9 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s ease;
}
.vchat-launcher:hover { transform: scale(1.05); }
.vchat-launcher[aria-expanded="true"] .vchat-icon-open { display: none; }
.vchat-launcher[aria-expanded="false"] .vchat-icon-close { display: none; }

.vchat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 9998;
  width: min(380px, calc(100vw - 40px));
  height: min(560px, calc(100vh - 120px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: vchat-pop 0.18s ease-out;
}
@keyframes vchat-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.vchat-panel[hidden] { display: none !important; }

.vchat-header {
  background: linear-gradient(135deg, #7e57ff 0%, #2dd0e9 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.vchat-header strong { font-size: 15px; }
.vchat-header small { display: block; font-size: 11px; opacity: 0.8; }
.vchat-header .vchat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.vchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f7f8fb;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
}
.vchat-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.vchat-msg.user {
  align-self: flex-end;
  background: #7e57ff;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.vchat-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: #1d2330;
  border: 1px solid #eceef3;
  border-bottom-left-radius: 4px;
}
.vchat-msg.error {
  align-self: center;
  background: #fff4f4;
  color: #b3261e;
  font-size: 12px;
  border: 1px solid #f5d2d0;
}
.vchat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #eceef3;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.vchat-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #b9bfcf;
  animation: vchat-blink 1.2s infinite ease-in-out;
}
.vchat-typing span:nth-child(2) { animation-delay: 0.2s; }
.vchat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes vchat-blink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.9); }
  40% { opacity: 1; transform: scale(1); }
}

.vchat-input {
  border-top: 1px solid #eceef3;
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
}
.vchat-input textarea {
  flex: 1;
  border: 1px solid #d8dce6;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 120px;
}
.vchat-input textarea:focus { border-color: #7e57ff; }
.vchat-input button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 0;
  background: #7e57ff;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vchat-input button:disabled { background: #c9c7d6; cursor: not-allowed; }

.vchat-footer-note {
  text-align: center;
  font-size: 10px;
  color: #8a90a3;
  padding: 6px 12px 8px;
  background: #fff;
}

@media (max-width: 480px) {
  .vchat-panel {
    right: 10px;
    left: 10px;
    width: auto;
    height: 75vh;
    bottom: 78px;
  }
  .vchat-launcher { right: 14px; bottom: 14px; }
}
