/* ═══════════════════════════════════════════════════════
   NET Tiger Assessment — obi-widget.css
   OBI Agent: floating AI assistant widget
   Inherits site custom properties from site.css
═══════════════════════════════════════════════════════ */

/* ── Widget-local custom properties ── */
:root {
  --purple-dark: #7c3aed;
}

/* ── Widget Host ── */
.obi-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* ── Toggle Button ── */
.obi-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--purple, #a855f7) 0%, var(--purple-dark, #7c3aed) 100%);
  box-shadow:
    0 0 0 3px rgba(168, 85, 247, 0.25),
    0 8px 32px rgba(168, 85, 247, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.22s ease;
  flex-shrink: 0;
}

.obi-toggle:hover,
.obi-toggle:focus-visible {
  transform: scale(1.10);
  box-shadow:
    0 0 0 4px rgba(168, 85, 247, 0.35),
    0 12px 40px rgba(168, 85, 247, 0.55),
    0 4px 16px rgba(0, 0, 0, 0.40);
  outline: none;
}

.obi-toggle:active {
  transform: scale(0.96);
}

.obi-toggle[aria-expanded="true"] {
  background: linear-gradient(135deg, var(--purple-dark, #7c3aed) 0%, var(--purple, #a855f7) 100%);
}

.obi-toggle svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: transform 0.22s ease, opacity 0.18s ease;
  flex-shrink: 0;
}

.obi-toggle .obi-icon-open  { display: block; }
.obi-toggle .obi-icon-close { display: none; }

.obi-toggle[aria-expanded="true"] .obi-icon-open  { display: none; }
.obi-toggle[aria-expanded="true"] .obi-icon-close { display: block; }

/* ── Panel ── */
.obi-panel {
  width: 340px;
  max-height: 520px;
  border-radius: var(--radius-lg, 24px);
  background: var(--panel-strong, rgba(14, 18, 28, 0.97));
  border: 1px solid var(--panel-border-strong, rgba(168, 85, 247, 0.30));
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(168, 85, 247, 0.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.20s ease;
}

.obi-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Panel Header ── */
.obi-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(
    135deg,
    rgba(168, 85, 247, 0.18) 0%,
    rgba(245, 158, 11, 0.08) 100%
  );
  border-bottom: 1px solid var(--panel-border, rgba(255, 255, 255, 0.10));
  flex-shrink: 0;
}

.obi-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple, #a855f7), var(--purple-dark, #7c3aed));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.30);
}

.obi-avatar svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.obi-header-text {
  flex: 1;
  min-width: 0;
}

.obi-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text, #f8f5ff);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.obi-status {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  color: var(--green, #22c55e);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.obi-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green, #22c55e);
  flex-shrink: 0;
  animation: obi-pulse 2.4s ease-in-out infinite;
}

@keyframes obi-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.55; transform: scale(0.80); }
}

/* ── Messages Area ── */
.obi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.25) transparent;
}

.obi-messages::-webkit-scrollbar {
  width: 4px;
}

.obi-messages::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.28);
  border-radius: 999px;
}

/* ── Message Bubbles ── */
.obi-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 88%;
}

.obi-msg.agent {
  align-self: flex-start;
}

.obi-msg.user {
  align-self: flex-end;
}

.obi-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.93rem;
  line-height: 1.5;
  color: var(--text, #f8f5ff);
}

.obi-msg.agent .obi-bubble {
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.20);
  border-bottom-left-radius: 4px;
}

.obi-msg.user .obi-bubble {
  background: linear-gradient(135deg, var(--purple, #a855f7), var(--purple-dark, #7c3aed));
  border: none;
  border-bottom-right-radius: 4px;
  color: #fff;
}

.obi-timestamp {
  font-size: 0.72rem;
  color: var(--muted, #c2cbdc);
  padding: 0 4px;
}

.obi-msg.user .obi-timestamp {
  text-align: right;
}

/* ── Typing Indicator ── */
.obi-typing .obi-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.obi-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple, #a855f7);
  animation: obi-bounce 1.3s ease-in-out infinite;
}

.obi-dot:nth-child(2) { animation-delay: 0.15s; }
.obi-dot:nth-child(3) { animation-delay: 0.30s; }

@keyframes obi-bounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.45; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick Replies ── */
.obi-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 12px;
  flex-shrink: 0;
}

.obi-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.08);
  color: var(--purple, #a855f7);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
  white-space: nowrap;
}

.obi-chip:hover,
.obi-chip:focus-visible {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.60);
  transform: translateY(-1px);
  outline: none;
}

/* ── Input Row ── */
.obi-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--panel-border, rgba(255, 255, 255, 0.10));
  background: rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.obi-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.92rem;
  color: var(--text, #f8f5ff);
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
  min-width: 0;
}

.obi-input::placeholder {
  color: var(--muted, #c2cbdc);
  opacity: 0.65;
}

.obi-input:focus {
  border-color: rgba(168, 85, 247, 0.50);
  background: rgba(168, 85, 247, 0.07);
}

.obi-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--purple, #a855f7), var(--purple-dark, #7c3aed));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.40);
}

.obi-send:hover,
.obi-send:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.55);
  outline: none;
}

.obi-send:active {
  transform: scale(0.95);
}

.obi-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ── Badge (unread count) ── */
.obi-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold, #f59e0b);
  color: #0f0f1a;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform 0.20s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}

.obi-badge[hidden] {
  transform: scale(0);
  opacity: 0;
}

/* ── Responsive ── */
@media (max-width: 420px) {
  .obi-widget {
    bottom: 16px;
    right: 16px;
  }

  .obi-panel {
    width: calc(100vw - 32px);
    max-height: 72vh;
  }

  .obi-toggle {
    width: 54px;
    height: 54px;
  }
}
