/* HPC E3 AI Agent — widget.css */

#e3-root {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  pointer-events: all !important;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
}
@media (max-width: 768px) {
  #e3-root { bottom: 20px; right: 16px; }
}

/* ── Launcher ── */
#e3-launcher {
  position: relative;
  width: 90px;
  height: 90px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 10px rgba(204,0,0,0.9)) drop-shadow(0 0 26px rgba(204,0,0,0.5));
  -webkit-filter: drop-shadow(0 0 10px rgba(204,0,0,0.9)) drop-shadow(0 0 26px rgba(204,0,0,0.5));
  animation: e3-pulse 2.4s ease-in-out infinite;
  -webkit-animation: e3-pulse 2.4s ease-in-out infinite;
  transition: transform 0.2s;
  -webkit-transition: transform 0.2s;
  min-width: 90px;
  min-height: 90px;
}
#e3-launcher:hover { transform: scale(1.08); -webkit-transform: scale(1.08); }
#e3-launcher img {
  width: 90px;
  height: 90px;
  min-width: 90px;
  min-height: 90px;
  object-fit: contain;
}
@keyframes e3-pulse {
  0%,100% { filter: drop-shadow(0 0 10px rgba(204,0,0,0.95)) drop-shadow(0 0 22px rgba(204,0,0,0.45)); }
  50%      { filter: drop-shadow(0 0 20px rgba(232,16,16,1))  drop-shadow(0 0 44px rgba(204,0,0,0.8)) drop-shadow(0 0 66px rgba(204,0,0,0.3)); }
}
@-webkit-keyframes e3-pulse {
  0%,100% { -webkit-filter: drop-shadow(0 0 10px rgba(204,0,0,0.95)) drop-shadow(0 0 22px rgba(204,0,0,0.45)); }
  50%      { -webkit-filter: drop-shadow(0 0 20px rgba(232,16,16,1))  drop-shadow(0 0 44px rgba(204,0,0,0.8)); }
}

/* ── LIVE Badge ── */
#e3-live-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  background: #CC0000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(204,0,0,0.6);
}
#e3-live-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  animation: e3-blink 1.4s ease-in-out infinite;
  -webkit-animation: e3-blink 1.4s ease-in-out infinite;
}
@keyframes e3-blink { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(0.7)} }
@-webkit-keyframes e3-blink { 0%,100%{opacity:1;-webkit-transform:scale(1)} 50%{opacity:0.4;-webkit-transform:scale(0.7)} }

/* ── Notification Bubble ── */
#e3-notify {
  position: fixed;
  bottom: 108px;
  right: 110px;
  background: #161616;
  border-radius: 14px;
  padding: 12px 16px 12px 14px;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 99998;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: e3-notify-in 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
  -webkit-animation: e3-notify-in 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
  max-width: 210px;
}
#e3-notify::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 8px solid #161616;
}
@keyframes e3-notify-in {
  from { opacity: 0; transform: translateX(14px) scale(0.93); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes e3-notify-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(14px) scale(0.88); }
}
@-webkit-keyframes e3-notify-in {
  from { opacity: 0; -webkit-transform: translateX(14px) scale(0.93); }
  to   { opacity: 1; -webkit-transform: translateX(0) scale(1); }
}
.e3-notify-dot {
  width: 9px; height: 9px;
  background: #00e676;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(0,230,118,0.9);
  animation: e3-blink 1.6s ease-in-out infinite;
  -webkit-animation: e3-blink 1.6s ease-in-out infinite;
}
.e3-notify-text { font-size: 13px; line-height: 1.4; color: #d8eeff; }
.e3-notify-text strong { color: #CC0000; font-size: 13px; font-weight: 700; display: block; }
.e3-notify-x {
  position: absolute; top: 5px; right: 8px;
  font-size: 12px; color: rgba(255,255,255,0.3); cursor: pointer; line-height: 1;
}
.e3-notify-x:hover { color: #CC0000; }
@media (max-width: 768px) {
  #e3-notify { right: 90px; bottom: 100px; }
}

/* ── Chat Panel ── */
#e3-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 110px;
  right: 28px;
  width: 390px;
  height: 580px;
  min-width: 300px;
  min-height: 400px;
  background: #0d0d0d;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(204,0,0,0.4), 0 0 30px rgba(204,0,0,0.15);
}
#e3-panel.open { display: flex; }
@media (max-width: 768px) {
  #e3-panel { width: 92vw; right: 4vw; bottom: 100px; height: 72vh; min-height: 400px; }
}

/* ── Global theme override reset ── */
#e3-root * {
  box-sizing: border-box !important;
  -webkit-font-smoothing: antialiased !important;
}
#e3-root input,
#e3-root button,
#e3-root textarea {
  font-family: 'DM Sans', 'Segoe UI', sans-serif !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

/* ── Header ── */
#e3-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #222222 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.e3-avatar-sm {
  width: 58px; height: 58px;
  min-width: 58px; min-height: 58px;
  object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(204,0,0,0.7));
  -webkit-filter: drop-shadow(0 0 6px rgba(204,0,0,0.7));
}
.e3-header-info { flex: 1; }
.e3-header-name { font-size: 20px; font-weight: 700; color: #CC0000; line-height: 1.1; }
.e3-header-title { font-size: 12px; color: rgba(255,255,255,0.45); letter-spacing: 0.06em; margin-top: 2px; }
.e3-online-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,230,118,0.1); border: 1px solid rgba(0,230,118,0.3);
  border-radius: 20px; padding: 4px 10px;
  font-size: 11px; font-weight: 600; color: #00e676; letter-spacing: 0.06em;
}
.e3-online-dot {
  width: 6px; height: 6px; background: #00e676; border-radius: 50%;
  box-shadow: 0 0 4px rgba(0,230,118,0.9);
  animation: e3-blink 2s ease-in-out infinite;
  -webkit-animation: e3-blink 2s ease-in-out infinite;
}
#e3-close {
  background: rgba(255,255,255,0.06); border: none; color: rgba(255,255,255,0.5);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s; flex-shrink: 0;
}
#e3-close:hover { background: rgba(204,0,0,0.2); color: #CC0000; }

/* ── Messages ── */
#e3-messages {
  flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 14px;
}
#e3-messages::-webkit-scrollbar { width: 4px; }
#e3-messages::-webkit-scrollbar-track { background: transparent; }
#e3-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.e3-msg-row { display: flex; align-items: flex-end; gap: 8px; }
.e3-msg-row.user { flex-direction: row-reverse; }
.e3-msg-avatar {
  width: 30px; height: 30px; min-width: 30px; min-height: 30px;
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.e3-bubble {
  max-width: 78%; padding: 12px 16px; border-radius: 18px;
  font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.e3-msg-row.agent .e3-bubble {
  background: #1e1e1e; color: #e8e8e8;
  border-bottom-left-radius: 4px;
}
.e3-msg-row.user .e3-bubble {
  background: #CC0000; color: #ffffff;
  border-bottom-right-radius: 4px;
}
.e3-ts { font-size: 10px; color: rgba(255,255,255,0.2); margin-top: 4px; padding: 0 4px; }
.e3-msg-row.user .e3-ts { text-align: right; }

/* ── Typing ── */
.e3-typing-bubble {
  background: #1e1e1e; border-radius: 18px; border-bottom-left-radius: 4px;
  padding: 14px 18px; display: flex; align-items: center; gap: 5px;
}
.e3-typing-bubble span {
  width: 7px; height: 7px; background: rgba(255,255,255,0.4); border-radius: 50%;
  animation: e3-dot 1.2s infinite; -webkit-animation: e3-dot 1.2s infinite;
}
.e3-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.e3-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes e3-dot { 0%,60%,100%{transform:translateY(0);opacity:0.4} 30%{transform:translateY(-5px);opacity:1} }
@-webkit-keyframes e3-dot { 0%,60%,100%{-webkit-transform:translateY(0);opacity:0.4} 30%{-webkit-transform:translateY(-5px);opacity:1} }

/* ── Chips ── */
#e3-chips { padding: 0 16px 12px; display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.e3-chip {
  font-size: 12px; font-weight: 600; padding: 7px 14px;
  background: transparent; border: 1.5px solid rgba(204,0,0,0.5);
  color: rgba(255,255,255,0.75); border-radius: 20px; cursor: pointer;
  transition: all 0.2s; letter-spacing: 0.03em;
}
.e3-chip:hover { background: rgba(204,0,0,0.2); border-color: #CC0000; color: #ffffff; }

/* ── Input ── */
#e3-inputbar {
  border-top: 1px solid rgba(255,255,255,0.06); background: #0a0a0a;
  padding: 14px; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
#e3-root #e3-panel #e3-inputbar #e3-input,
#e3-input {
  flex: 1 !important; background: #1a1a1a !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: 12px !important; color: #ffffff !important;
  font-size: 15px !important; font-weight: 400 !important;
  padding: 12px 16px !important; outline: none !important;
  box-shadow: none !important; margin: 0 !important;
  font-family: 'DM Sans', 'Segoe UI', sans-serif !important;
  line-height: 1.4 !important; height: auto !important;
  min-height: 0 !important; max-height: none !important;
  width: auto !important; display: block !important;
  -webkit-appearance: none !important; appearance: none !important;
  text-indent: 0 !important; letter-spacing: normal !important;
  word-spacing: normal !important; text-transform: none !important;
}
#e3-input::placeholder { color: rgba(255,255,255,0.25); }
#e3-input:focus { border-color: rgba(204,0,0,0.5); }
#e3-send {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  background: #CC0000; border: none; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.1s; flex-shrink: 0;
}
#e3-send:hover { background: #e81010; transform: scale(1.05); }
#e3-send svg { width: 18px; height: 18px; fill: white; }

/* ── Footer ── */
#e3-footer {
  text-align: center; padding: 8px; font-size: 11px;
  color: rgba(255,255,255,0.2); flex-shrink: 0;
  background: #1a1a1a;
  border-top: 1px solid rgba(204,0,0,0.2);
}

/* ── Status messages ── */
.e3-status-msg {
  font-size: 11px; color: rgba(255,255,255,0.25);
  text-align: center; padding: 4px 0; font-style: italic;
}
