/* ── IA GURU ASSISTANT POPUP ── */

.btn-iag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff !important;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  padding: 14px 28px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
  transition: all 0.2s ease;
}
.btn-iag:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99,102,241,0.5);
  color: #fff !important;
}
.btn-iag-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 9px 20px;
  border-radius: 4px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(99,102,241,0.3);
}
.btn-iag-nav:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99,102,241,0.45);
}

/* Trigger */
#iag-chat-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9800;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid rgba(99,102,241,0.55);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: iag-pulse 2.5s ease-in-out infinite;
}
#iag-chat-trigger .iag-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border: 2px solid #07070f;
  border-radius: 50%;
}
@keyframes iag-pulse {
  0%,100% { box-shadow: 0 4px 20px rgba(99,102,241,.35), 0 0 0 0 rgba(99,102,241,.25); }
  50%      { box-shadow: 0 4px 20px rgba(99,102,241,.5),  0 0 0 8px rgba(99,102,241,.0); }
}
#iag-chat-trigger:hover { transform: scale(1.1); box-shadow: 0 8px 32px rgba(99,102,241,.55); }

/* Popup window */
#iag-chat-popup {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9850;
  width: 360px;
  max-height: 580px;
  background: #07070f;
  border: 1px solid rgba(99,102,241,.35);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 40px rgba(99,102,241,.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0) translateY(10px);
  opacity: 0;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
  pointer-events: none;
}
#iag-chat-popup.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.iag-pop-header {
  background: linear-gradient(135deg,#0d0d1f,#111128);
  border-bottom: 1px solid rgba(99,102,241,.2);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.iag-pop-header-left { display:flex; align-items:center; gap:10px; }
.iag-pop-avatar {
  width:36px; height:36px;
  background: linear-gradient(135deg,#6366f1,#00d4ff);
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:18px; flex-shrink:0;
}
.iag-pop-title { font-family:'Syne',sans-serif; font-size:14px; font-weight:700; color:#f0f0f0; line-height:1.2; }
.iag-pop-subtitle { font-size:11px; color:#00d4ff; display:flex; align-items:center; gap:4px; }
.iag-pop-dot { width:6px; height:6px; background:#00d4ff; border-radius:50%; animation:iag-blink 1.5s ease-in-out infinite; }
@keyframes iag-blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.iag-pop-close { background:none; border:none; color:#666; font-size:18px; cursor:pointer; padding:4px; line-height:1; transition:color .2s; }
.iag-pop-close:hover { color:#f0f0f0; }

.iag-pop-body {
  flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px;
  min-height:160px; max-height:400px;
  scrollbar-width:thin; scrollbar-color:rgba(99,102,241,.3) transparent;
}
.iag-pop-body::-webkit-scrollbar { width:3px; }
.iag-pop-body::-webkit-scrollbar-thumb { background:rgba(99,102,241,.4); border-radius:2px; }

.iag-msg { display:flex; gap:8px; animation:iag-in .3s ease; }
@keyframes iag-in { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.iag-msg-bot .iag-bubble {
  background:linear-gradient(135deg,#111128,#0d0d20);
  border:1px solid rgba(99,102,241,.2);
  color:#e0e0e0; border-radius:4px 14px 14px 14px;
}
.iag-msg-user { flex-direction:row-reverse; }
.iag-msg-user .iag-bubble {
  background:linear-gradient(135deg,#3730a3,#4f46e5);
  color:#fff; border-radius:14px 4px 14px 14px; margin-left:auto;
}
.iag-bubble { padding:9px 13px; font-size:13.5px; line-height:1.6; max-width:88%; }
.iag-bubble a { color:#818cf8; text-decoration:underline; }

.iag-options { display:flex; flex-direction:column; gap:6px; animation:iag-in .3s ease; }
.iag-opt-btn {
  background:rgba(99,102,241,.08); border:1px solid rgba(99,102,241,.25);
  border-radius:10px; color:#c7d2fe; font-family:'DM Sans',sans-serif;
  font-size:13px; padding:9px 13px; text-align:left; cursor:pointer;
  transition:all .2s; display:flex; align-items:center; gap:8px;
}
.iag-opt-btn:hover { background:rgba(99,102,241,.18); border-color:rgba(99,102,241,.5); color:#fff; transform:translateX(3px); }

.iag-pop-input-area { border-top:1px solid rgba(99,102,241,.15); padding:10px 14px; flex-shrink:0; background:#07070f; }
.iag-input-row { display:flex; gap:8px; align-items:center; }
.iag-text-input {
  flex:1; background:rgba(255,255,255,.05); border:1px solid rgba(99,102,241,.25);
  border-radius:10px; color:#f0f0f0; font-family:'DM Sans',sans-serif;
  font-size:13px; padding:9px 13px; outline:none; transition:border-color .2s; resize:none;
}
.iag-text-input:focus { border-color:rgba(99,102,241,.6); }
.iag-text-input::placeholder { color:#555; }
.iag-send-btn {
  width:36px; height:36px; background:linear-gradient(135deg,#6366f1,#4f46e5);
  border:none; border-radius:10px; color:#fff; font-size:15px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all .2s;
}
.iag-send-btn:hover { background:linear-gradient(135deg,#818cf8,#6366f1); transform:scale(1.05); }
.iag-send-btn:disabled { opacity:.4; cursor:not-allowed; }

.iag-typing {
  display:flex; align-items:center; gap:4px; padding:10px 14px;
  background:linear-gradient(135deg,#111128,#0d0d20);
  border:1px solid rgba(99,102,241,.2); border-radius:4px 14px 14px 14px; width:fit-content;
}
.iag-typing span {
  width:6px; height:6px; background:rgba(99,102,241,.7); border-radius:50%;
  animation:iag-tdot 1.2s ease-in-out infinite;
}
.iag-typing span:nth-child(2){animation-delay:.2s} .iag-typing span:nth-child(3){animation-delay:.4s}
@keyframes iag-tdot { 0%,80%,100%{transform:scale(.8);opacity:.5} 40%{transform:scale(1.2);opacity:1} }

@media(max-width:480px){
  #iag-chat-popup { bottom:0; right:0; left:0; width:100%; max-height:85vh; border-radius:20px 20px 0 0; transform-origin:bottom center; }
  #iag-chat-trigger { bottom:20px; right:16px; }
}
