/* ═══════════════════════════════════════════════════════
   widget.css — Floating chatbot widget (homepage only)
   neuromexa / matnon
═══════════════════════════════════════════════════════ */

.chat-widget {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 300;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}

/* ── TOGGLE ── */
.widget-toggle {
  width: 52px; height: 52px;
  background: var(--gold); border: none; border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s, transform 0.18s, box-shadow 0.2s;
  box-shadow: 0 2px 16px rgba(240,165,0,0.22);
  position: relative; z-index: 1;
}
.widget-toggle:hover { background: var(--gold-lt); transform: translateY(-2px); box-shadow: 0 6px 24px var(--gold-glow); }
.widget-toggle svg { width: 22px; height: 22px; fill: var(--bg); position: absolute; transition: opacity 0.15s, transform 0.2s; }
.widget-toggle .icon-open  { opacity: 1; transform: scale(1) rotate(0deg); }
.widget-toggle .icon-close { opacity: 0; transform: scale(0.6) rotate(-90deg); }
.widget-toggle.is-open .icon-open  { opacity: 0; transform: scale(0.6) rotate(90deg); }
.widget-toggle.is-open .icon-close { opacity: 1; transform: scale(1) rotate(0deg); }

.widget-pip { position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); box-shadow: 0 0 8px var(--green); animation: pulse 2.5s infinite; }

/* ── TOOLTIP ── */
.widget-tooltip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 14px;
  font-size: 0.78rem; color: var(--text);
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  animation: fadeUp 0.3s 1.5s ease both;
  pointer-events: none; transition: opacity 0.3s;
}
.widget-tooltip.is-hidden { opacity: 0; pointer-events: none; }

/* ── PANEL ── */
.widget-panel {
  position: absolute; bottom: 64px; right: 0;
  width: 346px; height: 488px;
  background: var(--surface); border: 1px solid var(--border-md);
  border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 56px rgba(0,0,0,0.6), 0 0 0 1px rgba(240,165,0,0.05);
  transform-origin: bottom right;
  transform: scale(0.9) translateY(10px); opacity: 0; pointer-events: none;
  transition: transform 0.24s cubic-bezier(0.16,1,0.3,1), opacity 0.18s ease;
}
.widget-panel.is-open { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }
/* gold top border */
.widget-panel::before {
  content: '';
  position: absolute; top: 0; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  z-index: 1;
}

.wp-header {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface2); flex-shrink: 0;
}
.wp-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wp-avatar svg { width: 15px; height: 15px; stroke: var(--gold); fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.wp-header-info { flex: 1; }
.wp-name { font-family: var(--font-display); font-size: 0.82rem; font-weight: 700; color: var(--text); }
.wp-status { display: flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.56rem; color: var(--green); margin-top: 1px; }
.wp-status-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--green); box-shadow: 0 0 5px var(--green); animation: pulse 2s infinite; }

.wp-lang { display: flex; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.wp-lang-btn { padding: 5px 9px; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 500; color: var(--text-muted); background: transparent; border: none; cursor: pointer; transition: all 0.14s; letter-spacing: 0.05em; }
.wp-lang-btn.is-active { background: var(--gold); color: var(--bg); font-weight: 700; }

.wp-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; scrollbar-width: thin; scrollbar-color: var(--surface3) transparent; }

.wp-msg { max-width: 84%; padding: 9px 12px; border-radius: 11px; font-size: 0.79rem; line-height: 1.55; animation: msgIn 0.2s ease; }
.wp-msg.is-bot { background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 3px 11px 11px 11px; align-self: flex-start; }
.wp-msg.is-user { background: var(--gold-dim); border: 1px solid rgba(240,165,0,0.18); color: #ffc233; border-radius: 11px 11px 3px 11px; align-self: flex-end; }

.wp-typing { display: flex; gap: 4px; align-items: center; padding: 9px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 3px 11px 11px 11px; width: fit-content; align-self: flex-start; animation: msgIn 0.2s ease; }
.wp-typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--text-dim); animation: typingBounce 1.3s ease-in-out infinite; }
.wp-typing span:nth-child(2) { animation-delay: 0.18s; }
.wp-typing span:nth-child(3) { animation-delay: 0.36s; }

.wp-input-area { display: flex; gap: 8px; padding: 11px 13px; border-top: 1px solid var(--border); flex-shrink: 0; }
.wp-textarea { flex: 1; min-height: 36px; max-height: 78px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 8px 11px; font-family: var(--font-body); font-size: 0.78rem; color: var(--text); resize: none; outline: none; line-height: 1.5; transition: border-color 0.18s; }
.wp-textarea:focus { border-color: rgba(240,165,0,0.30); }
.wp-textarea::placeholder { color: var(--text-dim); }
.wp-send-btn { width: 36px; height: 36px; border-radius: var(--r-xs); background: var(--gold); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.16s; }
.wp-send-btn:hover { background: var(--gold-lt); }
.wp-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.wp-send-btn svg { width: 14px; height: 14px; fill: var(--bg); }

@media (max-width:480px) {
  .chat-widget { bottom: 16px; right: 16px; }
  .widget-panel { width: calc(100vw - 32px); }
  .widget-tooltip { display: none; }
}
