/* ═══════════════════════════════════════════════
   ZIA WIDGET — Styles standalone
   Inclure ce CSS sur toute page où ZIA doit apparaître
   ═══════════════════════════════════════════════ */

/* Variables utilisées (fallback si non définies par la page hôte) */
.zia-widget-root {
  --zia-gold: #B6FF1F;
  --zia-gold-l: #C8FF3F;
  --zia-violet: #7C5CFF;
  --zia-green: #22c55e;
  --zia-bg: #0A0D14;
  --zia-bg2: #131824;
  --zia-bg3: #1C2230;
  --zia-ink: #F5F7FA;
  --zia-ink-m: #9098AE;
  --zia-ink-l: #6B7388;
  --zia-white: #ffffff;
}

#zia-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,8,15,.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center; justify-content: center;
  padding: 16px;
  animation: ziaFadeIn .25s ease;
  font-family: 'Inter', -apple-system, sans-serif;
}
#zia-overlay.open { display: flex; }
@keyframes ziaFadeIn { from { opacity: 0; } to { opacity: 1; } }

.zia-panel {
  background: linear-gradient(180deg, #131824 0%, #0F131C 100%);
  border: 1px solid rgba(182,255,31,.18);
  border-radius: 20px;
  width: 100%; max-width: 520px; height: min(88vh, 720px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 25px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.03) inset, 0 -1px 0 rgba(182,255,31,.1) inset;
  animation: ziaPanelIn .4s cubic-bezier(.2,.8,.3,1);
}
@keyframes ziaPanelIn { from { transform: translateY(20px) scale(.97); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.zia-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, rgba(182,255,31,.04), rgba(124,92,255,.03));
}
.zia-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #B6FF1F 0%, #7C5CFF 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(182,255,31,.3);
  position: relative; overflow: visible;
}
.zia-avatar svg {
  width: 22px; height: 22px; color: #0A0D14;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
}
.zia-avatar::after {
  content: ''; position: absolute; bottom: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 50%; background: #22c55e;
  border: 2.5px solid #131824;
  box-shadow: 0 0 10px rgba(34,197,94,.6);
}
.zia-title-wrap { flex: 1; min-width: 0; }
.zia-title { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -.2px; line-height: 1.2; }
.zia-subtitle { font-size: 11px; color: #9098AE; margin-top: 2px; font-weight: 500; }

.zia-close-btn {
  background: rgba(255,255,255,.05); border: none; border-radius: 10px;
  width: 32px; height: 32px; cursor: pointer; color: #9098AE;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  transition: all .18s;
  font-family: inherit;
}
.zia-close-btn:hover { background: rgba(239,68,68,.15); color: #ef4444; }

.zia-msgs {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
  background: radial-gradient(circle at 50% 0%, rgba(182,255,31,.03), transparent 70%);
}
.zia-msgs::-webkit-scrollbar { width: 6px; }
.zia-msgs::-webkit-scrollbar-track { background: transparent; }
.zia-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
.zia-msgs::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

.zia-bubble {
  max-width: 85%; padding: 12px 16px;
  font-size: 14px; line-height: 1.55; white-space: pre-wrap;
  animation: ziaBubbleIn .35s cubic-bezier(.2,.8,.3,1);
  word-wrap: break-word;
}
@keyframes ziaBubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.zia-bubble.bot {
  background: linear-gradient(180deg, #1C2230, #171C28);
  color: #F5F7FA;
  align-self: flex-start;
  border-radius: 18px 18px 18px 4px;
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  position: relative;
  margin-left: 40px;
}
.zia-bubble.bot::before {
  content: ''; position: absolute; left: -40px; top: 0;
  width: 30px; height: 30px; border-radius: 9px;
  box-shadow: 0 2px 8px rgba(182,255,31,.25);
  background:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230A0D14'%3E%3Cpath d='M12 0 L14.09 9.91 L24 12 L14.09 14.09 L12 24 L9.91 14.09 L0 12 L9.91 9.91 Z'/%3E%3C/svg%3E") center/55% no-repeat,
    linear-gradient(135deg, #B6FF1F 0%, #7C5CFF 100%);
}
.zia-bubble.user {
  background: linear-gradient(135deg, #C8FF3F 0%, #B6FF1F 100%);
  color: #0A0D14;
  align-self: flex-end;
  border-radius: 18px 18px 4px 18px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(182,255,31,.25);
}
.zia-bubble.result {
  background: linear-gradient(180deg, rgba(182,255,31,.08), rgba(182,255,31,.02));
  border: 1px solid rgba(182,255,31,.35);
  align-self: flex-start; max-width: 95%;
  border-radius: 16px; margin-left: 40px;
  color: #F5F7FA;
}

.zia-typing {
  display: flex; gap: 5px; align-items: center;
  padding: 14px 18px;
  background: linear-gradient(180deg, #1C2230, #171C28);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px 18px 18px 4px;
  align-self: flex-start; margin-left: 40px;
  animation: ziaBubbleIn .3s ease;
}
.zia-tdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, #B6FF1F, #7C5CFF);
  animation: ziaTdot 1.1s infinite;
}
.zia-tdot:nth-child(2) { animation-delay: .15s; }
.zia-tdot:nth-child(3) { animation-delay: .3s; }
@keyframes ziaTdot { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }

.zia-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; gap: 10px; align-items: center;
  background: rgba(10,13,20,.4);
}
.zia-input {
  flex: 1; height: 44px; padding: 0 16px;
  border: 1.5px solid rgba(255,255,255,.08); border-radius: 22px;
  background: rgba(255,255,255,.03); color: #fff;
  font-family: inherit; font-size: 14px; outline: none;
  transition: all .18s;
}
.zia-input::placeholder { color: #6B7388; }
.zia-input:focus {
  border-color: #B6FF1F;
  background: rgba(182,255,31,.04);
  box-shadow: 0 0 0 4px rgba(182,255,31,.1);
}
.zia-send {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #C8FF3F 0%, #B6FF1F 100%);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(182,255,31,.35);
  transition: all .18s; color: #0A0D14;
}
.zia-send:hover:not(:disabled) { transform: translateY(-2px) scale(1.05); box-shadow: 0 10px 24px rgba(182,255,31,.5); }
.zia-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.zia-send svg { width: 18px; height: 18px; }

/* ═══ FAB (Floating Action Button) — ouvre ZIA ═══ */
.zia-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 300;
  width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #B6FF1F 0%, #7C5CFF 100%);
  box-shadow: 0 10px 30px rgba(182,255,31,.4), 0 0 0 6px rgba(182,255,31,.08);
  display: flex; align-items: center; justify-content: center;
  color: #0A0D14;
  animation: ziaPulse 2.5s ease-in-out infinite;
  transition: transform .2s;
  font-family: inherit;
}
.zia-fab svg {
  width: 32px; height: 32px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
  transition: transform .3s;
}
.zia-fab:hover svg {
  transform: rotate(90deg) scale(1.1);
}
.zia-fab:hover { transform: scale(1.08) rotate(-5deg); animation: none; }
@keyframes ziaPulse {
  0%,100% { box-shadow: 0 10px 30px rgba(182,255,31,.4), 0 0 0 6px rgba(182,255,31,.08); }
  50% { box-shadow: 0 10px 30px rgba(182,255,31,.5), 0 0 0 14px rgba(182,255,31,.03); }
}
.zia-fab-label {
  position: absolute; bottom: 72px; right: 0;
  background: #131824; color: #fff;
  padding: 8px 14px; border-radius: 12px; font-size: 12px; font-weight: 600;
  border: 1px solid rgba(182,255,31,.2); white-space: nowrap;
  opacity: 0; pointer-events: none; transform: translateY(4px);
  transition: all .2s;
}
.zia-fab:hover .zia-fab-label { opacity: 1; transform: translateY(0); }

@media (max-width: 560px) {
  .zia-fab { bottom: 24px; right: 16px; width: 56px; height: 56px; font-size: 24px; }
  .zia-bubble.bot, .zia-bubble.result, .zia-typing { margin-left: 36px; }
  .zia-bubble.bot::before { left: -36px; width: 26px; height: 26px; font-size: 12px; }
}
