/* Levrus chat widget */
#lvchat, #lvchat * { box-sizing: border-box; }
#lvchat {
  position: fixed; right: 20px; bottom: 20px; z-index: 99999;
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #1c1c1c;
}

#lvchat-btn {
  position: relative; width: 58px; height: 58px; border-radius: 50%;
  border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #2f7d32, #1f5c22);
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
#lvchat-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.28); }
#lvchat-badge {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px;
  border-radius: 10px; background: #e53935; color: #fff; font-size: 12px;
  font-weight: 700; line-height: 20px; text-align: center; padding: 0 5px;
}

#lvchat-panel {
  position: absolute; right: 0; bottom: 72px; width: 360px; max-width: calc(100vw - 32px);
  height: 360px; max-height: calc(100vh - 140px);
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
}
#lvchat-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, #2f7d32, #1f5c22);
}
#lvchat-head strong { display: block; font-size: 15px; }
#lvchat-head small { display: block; font-size: 12px; opacity: .85; margin-top: 2px; }
#lvchat-close {
  border: 0; background: rgba(255,255,255,.16); color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px; font-size: 14px; line-height: 1;
}
#lvchat-close:hover { background: rgba(255,255,255,.28); }

#lvchat-log {
  flex: 1 1 auto; overflow-y: auto; padding: 14px;
  background: #f6f7f6; display: flex; flex-direction: column; gap: 8px;
}
.lv-msg {
  max-width: 82%; padding: 9px 12px; border-radius: 14px;
  font-size: 14px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  animation: lv-in .16s ease-out;
}
@keyframes lv-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.lv-client {
  align-self: flex-end; background: #2f7d32; color: #fff;
  border-bottom-right-radius: 4px;
}
.lv-operator {
  align-self: flex-start; background: #fff; color: #1c1c1c;
  border: 1px solid #e3e6e3; border-bottom-left-radius: 4px;
}
.lv-system {
  align-self: center; background: #eceeed; color: #5c6660;
  font-size: 12.5px; text-align: center; max-width: 92%; border-radius: 10px;
}
.lv-time { display: block; font-size: 11px; opacity: .6; margin-top: 3px; }

#lvchat-form {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px;
  border-top: 1px solid #e6e8e6; background: #fff;
}
#lvchat-input {
  flex: 1 1 auto; resize: none; border: 1px solid #d9dcd9; border-radius: 12px;
  padding: 9px 12px; font: inherit; font-size: 14px; max-height: 92px; outline: none;
  background: #fbfbfb;
}
#lvchat-input:focus { border-color: #2f7d32; background: #fff; }
#lvchat-send {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: #2f7d32; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#lvchat-send:disabled { opacity: .45; cursor: default; }
#lvchat-hint {
  display: block; padding: 0 12px 10px; font-size: 11.5px; color: #7b837e; background: #fff;
}

.lv-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.lv-on  { background: #4caf50; }
.lv-off { background: #b0b6b1; }

@media (max-width: 420px) {
  #lvchat { right: 12px; bottom: 12px; }
  #lvchat-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); bottom: 70px; }
}

/* hidden должен реально скрывать: display:flex перебивает атрибут hidden */
#lvchat-panel[hidden], #lvchat-btn[hidden] { display: none !important; }

/* свёрнутое состояние: панель закрыта, остаётся только круглая кнопка */
#lvchat[data-state="min"] #lvchat-panel { display: none !important; }

/* кнопки в шапке */
#lvchat-head { position: relative; }
#lvchat-min {
  border: 0; background: rgba(255,255,255,.16); color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px; font-size: 15px; line-height: 1;
  margin-left: auto; margin-right: 6px;
}
#lvchat-min:hover, #lvchat-close:hover { background: rgba(255,255,255,.3); }
