/* =====================================================
   Insight Chat Widget — Paper & Highlighter system
   ===================================================== */
:root {
  --insight-paper: #FAF7F0;
  --insight-yellow: #F2BC2D;
  --insight-yellow-soft: #F8D87A;
  --insight-black: #0A0A0A;
  --insight-ink: #1A1A1A;
  --insight-muted: #6B6B6B;
  --insight-line: rgba(10, 10, 10, 0.12);
  --insight-shadow: 0 20px 60px -10px rgba(10, 10, 10, 0.35),
                   0 8px 20px -8px rgba(10, 10, 10, 0.2);
}

.insight-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--insight-yellow);
  border: 3px solid var(--insight-black);
  cursor: pointer;
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(10, 10, 10, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  padding: 0;
}
.insight-launcher:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 30px rgba(10, 10, 10, 0.4);
}
.insight-launcher svg {
  width: 28px;
  height: 28px;
  fill: var(--insight-black);
}
.insight-launcher.open svg.chat-icon { display: none; }
.insight-launcher .close-icon { display: none; }
.insight-launcher.open .close-icon { display: block; }

.insight-launcher::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--insight-yellow);
  opacity: 0.6;
  animation: insight-pulse 2.5s ease-out infinite;
}
@keyframes insight-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}
.insight-launcher.open::before { display: none; }

.insight-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 130px);
  background: var(--insight-paper);
  border: 2px solid var(--insight-black);
  border-radius: 18px;
  box-shadow: var(--insight-shadow);
  z-index: 999999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.insight-panel.open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.insight-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(10,10,10,0.025) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(10,10,10,0.02) 0%, transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(10,10,10,0.015) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.insight-header {
  position: relative;
  background: var(--insight-black);
  color: var(--insight-paper);
  padding: 18px 20px 16px;
  z-index: 1;
  border-bottom: 3px solid var(--insight-yellow);
}
.insight-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--insight-paper);
}
.insight-header p {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.7;
  letter-spacing: 0.3px;
  color: var(--insight-paper);
}
.insight-header .status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--insight-yellow);
  border-radius: 50%;
  margin-right: 6px;
  animation: insight-blink 2s ease-in-out infinite;
}
@keyframes insight-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.insight-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.insight-messages::-webkit-scrollbar { width: 6px; }
.insight-messages::-webkit-scrollbar-thumb {
  background: rgba(10,10,10,0.2);
  border-radius: 3px;
}

.insight-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  animation: insight-msg-in 0.3s ease-out;
}
@keyframes insight-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.insight-msg.bot {
  align-self: flex-start;
  background: #FFFFFF;
  color: var(--insight-ink);
  border: 1px solid var(--insight-line);
  border-bottom-left-radius: 4px;
}
.insight-msg.user {
  align-self: flex-end;
  background: var(--insight-black);
  color: var(--insight-paper);
  border-bottom-right-radius: 4px;
}
.insight-msg.highlight {
  align-self: flex-start;
  background: var(--insight-yellow);
  color: var(--insight-black);
  font-weight: 700;
  border: 1px solid var(--insight-black);
  border-bottom-left-radius: 4px;
}

.insight-typing {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid var(--insight-line);
  padding: 12px 16px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: none;
}
.insight-typing.show { display: flex; gap: 4px; }
.insight-typing span {
  width: 7px;
  height: 7px;
  background: var(--insight-muted);
  border-radius: 50%;
  animation: insight-bounce 1.4s ease-in-out infinite;
}
.insight-typing span:nth-child(2) { animation-delay: 0.2s; }
.insight-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes insight-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.insight-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  position: relative;
  z-index: 1;
}
.insight-chip {
  background: transparent;
  border: 1.5px solid var(--insight-black);
  color: var(--insight-black);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.insight-chip:hover {
  background: var(--insight-yellow);
  transform: translateY(-1px);
}

.insight-input-wrap {
  border-top: 1px solid var(--insight-line);
  padding: 12px;
  background: var(--insight-paper);
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.insight-input {
  flex: 1;
  border: 1.5px solid var(--insight-line);
  background: #FFFFFF;
  border-radius: 22px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--insight-ink);
  resize: none;
  max-height: 100px;
  outline: none;
  transition: border-color 0.15s ease;
}
.insight-input:focus { border-color: var(--insight-black); }
.insight-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--insight-yellow);
  border: 2px solid var(--insight-black);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease;
  padding: 0;
}
.insight-send:hover { transform: scale(1.08); }
.insight-send:disabled { opacity: 0.5; cursor: not-allowed; }
.insight-send svg { width: 18px; height: 18px; fill: var(--insight-black); }

.insight-cta {
  display: inline-block;
  margin-top: 8px;
  background: var(--insight-yellow);
  color: var(--insight-black) !important;
  padding: 9px 16px;
  border-radius: 22px;
  text-decoration: none !important;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 2px solid var(--insight-black);
  transition: transform 0.15s ease;
}
.insight-cta:hover { transform: translateY(-2px); }

.insight-lead-form {
  background: #FFFFFF;
  border: 1.5px solid var(--insight-black);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
  margin-right: 16px;
}
.insight-lead-form label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--insight-black);
}
.insight-lead-form input,
.insight-lead-form select {
  border: 1px solid var(--insight-line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #FFFFFF;
  color: var(--insight-ink);
}
.insight-lead-form input:focus,
.insight-lead-form select:focus {
  border-color: var(--insight-black);
}
.insight-lead-form button {
  background: var(--insight-black);
  color: var(--insight-paper);
  border: none;
  padding: 11px;
  border-radius: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: background 0.15s ease;
}
.insight-lead-form button:hover {
  background: var(--insight-yellow);
  color: var(--insight-black);
}

.insight-footer {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: var(--insight-muted);
  background: var(--insight-paper);
  border-top: 1px solid var(--insight-line);
  letter-spacing: 0.5px;
  z-index: 1;
  position: relative;
}
.insight-footer b { color: var(--insight-black); }

@media (max-width: 480px) {
  .insight-panel {
    bottom: 90px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: calc(100vh - 110px);
  }
  .insight-launcher { bottom: 16px; right: 16px; }
}
