/* KASHDI — DataForesight assistant widget */
.kashdi-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  border: 1px solid var(--border2);
  border-radius: 100px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: var(--btn-on-accent);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(79, 195, 247, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kashdi-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(79, 195, 247, 0.45);
}

.kashdi-fab[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.kashdi-fab-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.kashdi-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1001;
  width: min(400px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

.kashdi-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.kashdi-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.15), rgba(124, 58, 237, 0.12));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kashdi-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--btn-on-accent);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.kashdi-header-text h3 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.kashdi-header-text p {
  font-size: 0.72rem;
  color: var(--text3);
  margin: 2px 0 0;
  font-family: 'JetBrains Mono', monospace;
}

.kashdi-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text2);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.kashdi-close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.kashdi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.kashdi-msg {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.6;
  font-weight: 300;
}

.kashdi-msg p { margin: 0 0 0.5rem; }
.kashdi-msg p:last-child { margin-bottom: 0; }

.kashdi-msg ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.kashdi-msg li { margin-bottom: 0.25rem; }

.kashdi-msg a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.kashdi-msg.bot {
  align-self: flex-start;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-bottom-left-radius: 4px;
}

.kashdi-msg.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid var(--border2);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.kashdi-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.kashdi-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: kashdiBounce 1.2s ease-in-out infinite;
}

.kashdi-typing span:nth-child(2) { animation-delay: 0.15s; }
.kashdi-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes kashdiBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.kashdi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 1.1rem 0.75rem;
  flex-shrink: 0;
}

.kashdi-chip {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 6px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
}

.kashdi-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.kashdi-input-row {
  display: flex;
  gap: 8px;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

.kashdi-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.kashdi-input:focus {
  border-color: var(--accent);
}

.kashdi-input::placeholder { color: var(--text3); }

.kashdi-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--btn-on-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.kashdi-send:hover {
  background: #38bdf8;
  transform: scale(1.03);
}

.kashdi-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

@media (max-width: 480px) {
  .kashdi-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: min(85vh, 100%);
    border-radius: 18px 18px 0 0;
  }

  .kashdi-fab {
    bottom: 1rem;
    right: 1rem;
    padding: 12px 14px;
  }

  .kashdi-fab-label { display: none; }
}
