/* TechNova portal assistant widget */
.tn-asst {
  position: fixed;
  right: 1.35rem;
  bottom: 1.35rem;
  z-index: 200;
  font-family: Inter, system-ui, sans-serif;
}

.tn-asst-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #0B6BCB 0%, #0D9488 100%);
  box-shadow: 0 10px 32px rgba(11, 107, 203, 0.35);
  border-radius: 999px;
  padding: 0.85rem 1.15rem 0.85rem 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tn-asst-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(11, 107, 203, 0.42);
}
.tn-asst-fab.is-open {
  border-radius: 50%;
  padding: 0.95rem;
}
.tn-asst-fab.is-open .tn-asst-fab-label { display: none; }
.tn-asst-fab-label {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tn-asst-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(400px, calc(100vw - 1.5rem));
  height: min(560px, calc(100vh - 6.5rem));
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* critical: custom display:flex must not override HTML [hidden] */
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tn-asst-panel[hidden],
.tn-asst-panel.is-closed {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.tn-asst-head {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #0B1220 0%, #0F2744 100%);
  color: #fff;
}
.tn-asst-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0B6BCB, #0D9488);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: -0.02em;
}
.tn-asst-head strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}
.tn-asst-head span {
  display: block;
  font-size: 0.75rem;
  color: #94A3B8;
  margin-top: 1px;
}
.tn-asst-close {
  border: 0;
  background: rgba(255,255,255,.08);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.tn-asst-close:hover { background: rgba(255,255,255,.16); }

.tn-asst-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #E2E8F0;
  background: #F8FAFC;
  max-height: 88px;
  overflow-y: auto;
}
.tn-asst-chip {
  border: 1px solid #E2E8F0;
  background: #fff;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.tn-asst-chip:hover {
  border-color: #0B6BCB;
  color: #0B6BCB;
}

.tn-asst-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #fff;
}
.tn-asst-msg {
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #0F172A;
}
.tn-asst-msg strong { font-weight: 650; }
.tn-asst-msg--assistant {
  align-self: flex-start;
  background: #F1F5F9;
  border-bottom-left-radius: 4px;
}
.tn-asst-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(11,107,203,.12), rgba(13,148,136,.1));
  border: 1px solid rgba(11,107,203,.15);
  border-bottom-right-radius: 4px;
}

.tn-asst-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.75rem;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
}
.tn-asst-form input {
  flex: 1;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: #0F172A;
}
.tn-asst-form input:focus {
  border-color: #0B6BCB;
  box-shadow: 0 0 0 3px rgba(11,107,203,.12);
}
.tn-asst-form button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #0B6BCB, #0D9488);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tn-asst-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.tn-asst-form button:hover:not(:disabled) {
  filter: brightness(1.05);
}

.tn-asst-typing {
  display: flex;
  gap: 5px;
  padding: 0 1rem 0.5rem;
  align-items: center;
}
.tn-asst-typing[hidden] { display: none !important; }
.tn-asst-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94A3B8;
  animation: tnAsstBounce 1.2s ease-in-out infinite;
}
.tn-asst-typing span:nth-child(2) { animation-delay: 0.15s; }
.tn-asst-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tnAsstBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.tn-asst-msg a {
  color: #0B6BCB;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

/* Hide legacy whatsapp if CSS loads first */
.whatsapp-float { display: none !important; }

@media (max-width: 480px) {
  .tn-asst {
    right: 0.85rem;
    bottom: 0.85rem;
  }
  .tn-asst-panel {
    width: calc(100vw - 1.2rem);
    height: min(70vh, 520px);
  }
  .tn-asst-fab-label { display: none; }
  .tn-asst-fab {
    border-radius: 50%;
    padding: 0.95rem;
  }
}
