/* =====================================================================
   InvoiceGate — стили виджета онлайн-чата (в стилистике сайта)
   Использует те же CSS-переменные, что и css/site.css
   ===================================================================== */

.ig-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  width: 60px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--c-blue-light), var(--c-blue-deep));
  box-shadow: 0 8px 28px rgba(43, 141, 232, 0.45);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.ig-chat-launcher:hover { transform: translateY(-2px); filter: brightness(1.05); }
.ig-chat-launcher svg { height: 28px; width: 28px; }
.ig-chat-launcher .ig-icon-close { display: none; }
.ig-chat-launcher.is-open .ig-icon-chat { display: none; }
.ig-chat-launcher.is-open .ig-icon-close { display: block; }

.ig-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--c-gold);
  color: #3a2c00;
  font: 700 11px/20px Tektur, system-ui, sans-serif;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: none;
}
.ig-chat-badge.is-visible { display: block; }

.ig-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  overflow: hidden;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(43, 141, 232, 0.15);
  box-shadow: 0 20px 60px -12px rgba(14, 74, 140, 0.35);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.ig-chat-panel.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.ig-chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--c-blue), var(--c-blue-deep));
}
.ig-chat-header img { height: 38px; width: 38px; border-radius: 9px; object-fit: contain; background: #fff; padding: 3px; }
.ig-chat-header .ig-title { font: 700 15px/1.2 Unbounded, Tektur, sans-serif; letter-spacing: 0.02em; }
.ig-chat-header .ig-status { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 11px; opacity: 0.85; }
.ig-chat-header .ig-dot { height: 7px; width: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.ig-chat-header .ig-close { margin-left: auto; background: none; border: none; color: #fff; cursor: pointer; opacity: 0.8; padding: 4px; }
.ig-chat-header .ig-close:hover { opacity: 1; }
.ig-chat-header .ig-close svg { height: 20px; width: 20px; }

.ig-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(94, 179, 255, 0.08), transparent 55%),
    linear-gradient(180deg, #ffffff, var(--c-bg-alt));
}

.ig-msg {
  max-width: 82%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.45;
  border-radius: 1rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ig-msg .ig-time { display: block; margin-top: 4px; font-size: 10px; opacity: 0.6; }
.ig-msg-user {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, var(--c-blue-light), var(--c-blue));
  border-bottom-right-radius: 0.25rem;
}
.ig-msg-op {
  align-self: flex-start;
  color: var(--c-text);
  background: #fff;
  border: 1px solid rgba(43, 141, 232, 0.15);
  border-bottom-left-radius: 0.25rem;
}
.ig-msg-sys {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 12px;
  color: var(--c-text-muted);
  background: rgba(43, 141, 232, 0.08);
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
}

.ig-chat-footer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(43, 141, 232, 0.12);
  background: #fff;
}
.ig-chat-input {
  flex: 1;
  resize: none;
  max-height: 110px;
  border-radius: 0.875rem;
  border: 1px solid rgba(43, 141, 232, 0.25);
  background: #fff;
  padding: 0.625rem 0.875rem;
  font: 400 0.875rem/1.4 Tektur, system-ui, sans-serif;
  color: var(--c-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ig-chat-input:focus { outline: none; border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(43, 141, 232, 0.18); }
.ig-chat-send {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  width: 42px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--c-blue-light), var(--c-blue-deep));
  box-shadow: 0 4px 14px rgba(43, 141, 232, 0.4);
  transition: transform 0.15s, filter 0.15s;
}
.ig-chat-send:hover { filter: brightness(1.05); transform: translateY(-1px); }
.ig-chat-send:disabled { opacity: 0.5; cursor: default; transform: none; }
.ig-chat-send svg { height: 19px; width: 19px; }

.ig-chat-lead {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.25rem 0 0.5rem;
}
.ig-chat-lead input {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgba(43, 141, 232, 0.25);
  background: #fff;
  padding: 0.625rem 0.875rem;
  font: 400 0.875rem Tektur, system-ui, sans-serif;
  color: var(--c-text);
}
.ig-chat-lead input:focus { outline: none; border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(43, 141, 232, 0.18); }
.ig-chat-lead button {
  border: none;
  border-radius: 0.75rem;
  padding: 0.625rem;
  cursor: pointer;
  font: 700 0.875rem Tektur, sans-serif;
  color: #fff;
  background: linear-gradient(135deg, var(--c-blue-light), var(--c-blue-deep));
}

.ig-typing { display: inline-flex; gap: 3px; }
.ig-typing span {
  height: 6px; width: 6px; border-radius: 50%;
  background: var(--c-text-muted);
  animation: ig-bounce 1.2s infinite ease-in-out;
}
.ig-typing span:nth-child(2) { animation-delay: 0.15s; }
.ig-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ig-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 480px) {
  .ig-chat-panel { right: 12px; left: 12px; width: auto; bottom: 84px; height: min(70vh, calc(100vh - 100px)); }
  .ig-chat-launcher { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .ig-chat-panel, .ig-chat-launcher, .ig-chat-send { transition: none; }
  .ig-typing span { animation: none; }
}
