/* Floating managerWEB Gemini chat widget — public site chrome */

.ins-chat {
  position: fixed;
  z-index: 57;
  right: max(1rem, env(safe-area-inset-right));
  left: auto;
  bottom: max(1.15rem, env(safe-area-inset-bottom));
  font-size: 16px;
  line-height: 1.45;
}

html.ins-cookie-open .ins-chat {
  bottom: calc(var(--ins-cookie-h, 6.5rem) + 1.15rem);
}

.ins-chat-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: linear-gradient(145deg, #f59e0b, #f97316);
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 12px 28px rgba(249, 115, 22, 0.38),
    0 0 0 4px rgba(245, 158, 11, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ins-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 32px rgba(249, 115, 22, 0.46),
    0 0 0 4px rgba(245, 158, 11, 0.2);
}

.ins-chat-toggle:focus-visible {
  outline: 2px solid #fb923c;
  outline-offset: 3px;
}

.ins-chat-toggle svg {
  width: 26px;
  height: 26px;
}

.ins-chat-toggle__close {
  display: none;
}

.ins-chat.is-open .ins-chat-toggle__open {
  display: none;
}

.ins-chat.is-open .ins-chat-toggle__close {
  display: block;
}

.ins-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  display: flex;
  flex-direction: column;
  width: min(23.5rem, calc(100vw - 1.5rem));
  height: min(34rem, calc(100dvh - 8.5rem));
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #fff;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.22);
  color: #0f172a;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.ins-chat.is-open .ins-chat-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.ins-chat-panel[hidden] {
  display: none !important;
}

.ins-chat.is-open .ins-chat-panel[hidden] {
  display: flex !important;
}

.ins-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem 0.9rem;
  background: linear-gradient(135deg, #0f172a, #164e63);
  color: #fff;
}

.ins-chat-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.ins-chat-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  border-radius: 0.8rem;
  background: linear-gradient(145deg, #0ea5e9, #06b6d4);
  color: #fff;
}

.ins-chat-avatar svg {
  width: 1.25rem;
  height: 1.25rem;
}

.ins-chat-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
}

.ins-chat-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #bae6fd;
}

.ins-chat-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.ins-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ins-chat-close:focus-visible,
.ins-chat-send:focus-visible,
.ins-chat-input:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.ins-chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.95rem 0.9rem;
  background:
    radial-gradient(ellipse at top right, rgba(14, 165, 233, 0.07), transparent 55%),
    #f8fafc;
}

.ins-chat-msg {
  max-width: 92%;
  margin-bottom: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.55;
}

.ins-chat-msg p {
  margin: 0;
}

.ins-chat-msg p + p {
  margin-top: 0.45rem;
}

.ins-chat-msg--bot {
  margin-inline-start: 0;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #1e293b;
  border-end-start-radius: 0.35rem;
}

.ins-chat-msg--user {
  margin-inline-start: auto;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  border-end-end-radius: 0.35rem;
}

.ins-chat-msg--error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.ins-chat-typing {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0 1.1rem 0.55rem;
  background: #f8fafc;
}

.ins-chat-typing[hidden] {
  display: none !important;
}

.ins-chat-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 9999px;
  background: #38bdf8;
  animation: ins-chat-bounce 1.1s ease-in-out infinite;
}

.ins-chat-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ins-chat-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ins-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.ins-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 0.75rem 0.8rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.ins-chat-input {
  flex: 1 1 auto;
  min-height: 2.65rem;
  max-height: 6.5rem;
  resize: none;
  padding: 0.65rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #f8fafc;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.ins-chat-input::placeholder {
  color: #94a3b8;
  font-weight: 600;
}

.ins-chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(14, 165, 233, 0.28);
}

.ins-chat-send svg {
  width: 1.15rem;
  height: 1.15rem;
  transform: scaleX(-1);
}

.ins-chat-send:hover {
  filter: brightness(1.05);
}

.ins-chat-send:disabled,
.ins-chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 639px) {
  .ins-chat-panel {
    width: min(23.5rem, calc(100vw - 1.25rem));
    height: min(32rem, calc(100dvh - 7.5rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ins-chat-toggle,
  .ins-chat-panel,
  .ins-chat-dot {
    transition: none;
    animation: none;
  }

  .ins-chat-toggle:hover {
    transform: none;
  }
}
