/* Amplified Insights - Janice assistant widget */

.janice-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 22px 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue-deep), var(--cyan));
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(29, 95, 214, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.janice-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(29, 95, 214, 0.4); }
.janice-launcher svg { width: 22px; height: 22px; flex: none; }
.janice-open .janice-launcher { opacity: 0; pointer-events: none; }

.janice-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 95;
  width: min(392px, calc(100vw - 24px));
  height: min(620px, calc(100dvh - 40px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.janice-open .janice-panel { display: flex; animation: janice-in 0.24s ease; }
@keyframes janice-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.janice-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ink);
  color: var(--white);
  flex: none;
}
.janice-avatar {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--white);
}
.janice-head-text { min-width: 0; }
.janice-head-text strong { display: block; font-family: var(--font-display); font-size: 1.02rem; letter-spacing: 0.01em; }
.janice-head-text span { display: block; font-size: 0.76rem; color: rgba(255, 255, 255, 0.72); }
.janice-close {
  margin-left: auto;
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.janice-close:hover { background: rgba(255, 255, 255, 0.12); }

.janice-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}
.janice-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.janice-msg.from-janice {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}
.janice-msg.from-user {
  align-self: flex-end;
  background: var(--blue-deep);
  color: var(--white);
  border-bottom-right-radius: 6px;
}
.janice-msg a { color: var(--blue-deep); font-weight: 600; }
.janice-msg.from-user a { color: var(--white); text-decoration: underline; }

.janice-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
}
.janice-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--soft-muted);
  animation: janice-dot 1.1s infinite ease-in-out;
}
.janice-typing i:nth-child(2) { animation-delay: 0.15s; }
.janice-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes janice-dot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.janice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 6px;
}
.janice-chip {
  min-height: 44px;
  padding: 8px 16px;
  border: 1.5px solid var(--blue);
  border-radius: 999px;
  background: var(--white);
  color: var(--blue-deep);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.janice-chip:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: var(--white); }
.janice-chip.janice-chip-quiet { border-color: var(--line); color: var(--muted); font-weight: 500; }
.janice-chip.janice-chip-quiet:hover { background: var(--paper); color: var(--text); }

.janice-form { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 6px; }
.janice-form input {
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-size: 0.92rem;
}
.janice-form input:focus { border-color: var(--blue); outline: none; }
.janice-form .janice-form-error { color: var(--error); font-size: 0.8rem; display: none; }
.janice-form.invalid .janice-form-error { display: block; }
.janice-form button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--blue-deep);
  color: var(--white);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.janice-form button:hover { background: var(--ink); }

.janice-input-row {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--white);
  border-top: 1px solid var(--line);
}
.janice-input-row textarea {
  flex: 1;
  resize: none;
  max-height: 110px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  background: var(--paper);
}
.janice-input-row textarea:focus { border-color: var(--blue); outline: none; background: var(--white); }
.janice-send {
  width: 44px;
  height: 44px;
  flex: none;
  align-self: flex-end;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--blue-deep);
  color: var(--white);
  cursor: pointer;
}
.janice-send:hover { background: var(--ink); }
.janice-send:disabled, .janice-input-row textarea:disabled { opacity: 0.45; cursor: default; }
.janice-send svg { width: 18px; height: 18px; }

.janice-foot {
  flex: none;
  padding: 6px 14px 9px;
  background: var(--white);
  font-size: 0.7rem;
  color: var(--soft-muted);
  text-align: center;
}
.janice-foot a { color: var(--muted); text-decoration: underline; }

@media (max-width: 480px) {
  .janice-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .janice-launcher span { display: none; }
  .janice-launcher { padding: 0; width: 56px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .janice-open .janice-panel { animation: none; }
  .janice-launcher, .janice-launcher:hover { transition: none; transform: none; }
  .janice-typing i { animation: none; opacity: 0.6; }
}
