/* ============================================================
   ELIJAH AI — Self Learning Chatbot
   UI faithful to the supplied design: dark sci-fi lab, electric
   blue accents, rounded panels, iOS-style bubbles.
   ============================================================ */

.elijah-app,
.elijah-app * { box-sizing: border-box; margin: 0; padding: 0; }

.elijah-app {
  --e-bg:        #05070b;
  --e-panel:     #0b0f16;
  --e-panel-2:   #10151f;
  --e-bubble:    #1b2029;
  --e-blue:      #2f7df6;
  --e-blue-2:    #4aa3ff;
  --e-cyan:      #37c8f5;
  --e-text:      #eef2f8;
  --e-text-dim:  #8a94a6;
  --e-border:    #1a2233;
  --e-green:     #2ee56b;
  --e-radius:    22px;

  display: flex;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  height: min(860px, 88vh);
  background: var(--e-bg);
  border: 1px solid var(--e-border);
  border-radius: 28px;
  overflow: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--e-text);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}

/* ================= HERO PANEL ================= */

.elijah-hero {
  position: relative;
  flex: 0 0 55%;
  background:
    radial-gradient(60% 50% at 70% 45%, rgba(47,125,246,.20), transparent 70%),
    radial-gradient(40% 40% at 20% 80%, rgba(55,200,245,.10), transparent 70%),
    linear-gradient(160deg, #070b12 0%, #04060a 60%, #060a12 100%);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.elijah-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(3,5,9,.35) 0%, transparent 35%, rgba(3,5,9,.55) 100%);
  pointer-events: none;
}

.elijah-hero-brand {
  position: absolute;
  top: 56px; left: 56px;
  z-index: 2;
}

.elijah-logo-ring {
  width: 118px; height: 118px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #10182a, #060a12 70%);
  border: 3px solid rgba(74,163,255,.85);
  box-shadow:
    0 0 24px rgba(47,125,246,.55),
    inset 0 0 22px rgba(47,125,246,.35);
  position: relative;
}
.elijah-logo-ring::after {
  content: "";
  position: absolute; inset: -9px;
  border-radius: 50%;
  border: 1px dashed rgba(74,163,255,.35);
  animation: elijah-spin 24s linear infinite;
}
@keyframes elijah-spin { to { transform: rotate(360deg); } }

.elijah-logo-e {
  font-size: 58px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #ffffff 30%, #b9d4ff 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 3px 12px rgba(47,125,246,.4);
}

.elijah-hero-title {
  margin-top: 26px;
  font-size: clamp(34px, 3.4vw, 48px);
  font-weight: 800;
  letter-spacing: 4px;
  color: #f4f8ff;
  text-shadow: 0 0 30px rgba(47,125,246,.35);
}
.elijah-hero-sub {
  margin-top: 8px;
  font-size: 14px;
  letter-spacing: 7px;
  color: var(--e-cyan);
  font-weight: 600;
}
.elijah-hero-divider {
  width: 300px; height: 1px;
  margin: 22px 0 16px;
  background: linear-gradient(90deg, rgba(138,148,166,.55), transparent);
}
.elijah-powered {
  font-size: 15px;
  color: #c3cbd9;
  letter-spacing: .5px;
}
.elijah-powered-mark { color: var(--e-blue-2); font-size: 17px; }
.elijah-powered strong { color: #fff; letter-spacing: 2px; font-weight: 700; }

/* Built-in animated HUD (shown when no hero image is set) */
.elijah-hero-hud {
  position: absolute;
  right: 48px; top: 140px;
  z-index: 2;
}
.elijah-hud-card {
  width: 250px;
  padding: 18px;
  border-radius: 14px;
  background: rgba(8, 14, 24, .78);
  border: 1px solid rgba(74,163,255,.35);
  box-shadow: 0 0 30px rgba(47,125,246,.18), inset 0 0 30px rgba(47,125,246,.06);
  backdrop-filter: blur(4px);
  color: var(--e-cyan);
}
.elijah-hud-title {
  font-size: 11px; letter-spacing: 3px; font-weight: 700;
  color: #bfe6ff; margin-bottom: 10px;
}
.elijah-brain-svg { width: 100%; height: 110px; color: var(--e-cyan); }
.elijah-hud-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 9.5px; letter-spacing: 2px; color: #9fd8f5;
  margin-top: 12px;
}
.elijah-hud-bars { display: inline-flex; gap: 3px; }
.elijah-hud-bars i {
  width: 4px; height: 12px; background: var(--e-cyan); border-radius: 1px;
  animation: elijah-eq 1.1s ease-in-out infinite;
}
.elijah-hud-bars i:nth-child(2) { animation-delay: .15s; }
.elijah-hud-bars i:nth-child(3) { animation-delay: .3s; }
.elijah-hud-bars i:nth-child(4) { animation-delay: .45s; }
@keyframes elijah-eq { 0%,100% { transform: scaleY(.4);} 50% { transform: scaleY(1);} }
.elijah-hud-pct { color: var(--e-green); font-weight: 700; font-size: 12px; letter-spacing: 1px; }
.elijah-hud-progress {
  margin-top: 6px; height: 4px; border-radius: 2px;
  background: rgba(74,163,255,.18); overflow: hidden;
}
.elijah-hud-progress-fill {
  height: 100%; width: 5%;
  background: linear-gradient(90deg, var(--e-blue), var(--e-cyan));
  border-radius: 2px;
  transition: width 1.2s ease;
  box-shadow: 0 0 8px rgba(55,200,245,.8);
}

/* ================= CHAT PANEL ================= */

.elijah-chat {
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #090d14 0%, #070a10 100%);
  min-width: 0;
}

/* --- Header --- */
.elijah-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--e-border);
}
.elijah-chat-id { display: flex; align-items: center; gap: 14px; }
.elijah-avatar-wrap { position: relative; }
.elijah-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid #223048;
  display: block;
}
.elijah-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #1a2740, #0b111d);
  color: var(--e-blue-2);
  font-weight: 900; font-style: italic; font-size: 24px;
}
.elijah-status-dot {
  position: absolute; left: -4px; top: 50%;
  transform: translate(-100%, -50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--e-green);
  box-shadow: 0 0 10px rgba(46,229,107,.8);
}
.elijah-chat-name { font-size: 21px; font-weight: 700; }
.elijah-chat-sub { font-size: 13px; color: var(--e-text-dim); margin-top: 2px; }

.elijah-chat-actions { display: flex; gap: 6px; }
.elijah-icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer;
  color: #aeb7c6; border-radius: 10px;
  transition: background .15s, color .15s;
}
.elijah-icon-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.elijah-icon-btn:focus-visible { outline: 2px solid var(--e-blue); outline-offset: 2px; }
.elijah-ico { width: 22px; height: 22px; }

/* --- Messages --- */
.elijah-messages {
  flex: 1;
  overflow-y: auto;
  padding: 26px 26px 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: #2a3550 transparent;
}
.elijah-messages::-webkit-scrollbar { width: 6px; }
.elijah-messages::-webkit-scrollbar-thumb { background: #2a3550; border-radius: 3px; }

.elijah-row { display: flex; gap: 12px; max-width: 92%; animation: elijah-in .25s ease; }
@keyframes elijah-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.elijah-row.is-bot { align-self: flex-start; }
.elijah-row.is-user { align-self: flex-end; justify-content: flex-end; }

.elijah-msg-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; flex: 0 0 40px;
  border: 1px solid #223048;
  align-self: flex-start;
}
.elijah-msg-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #1a2740, #0b111d);
  color: var(--e-blue-2); font-weight: 900; font-style: italic; font-size: 18px;
}

.elijah-bubble {
  padding: 16px 20px 10px;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.is-bot .elijah-bubble {
  background: var(--e-bubble);
  border-top-left-radius: 6px;
  color: var(--e-text);
}
.is-user .elijah-bubble {
  background: linear-gradient(180deg, #3b8bff 0%, #2670ec 100%);
  border-bottom-right-radius: 6px;
  color: #fff;
  box-shadow: 0 6px 18px rgba(47,125,246,.35);
}
.elijah-bubble strong.elijah-name { color: var(--e-blue-2); font-weight: 700; }

.elijah-meta {
  display: flex; align-items: center; gap: 5px;
  justify-content: flex-end;
  margin-top: 8px;
  font-size: 11.5px;
  opacity: .65;
}
.is-bot .elijah-meta { justify-content: flex-start; }
.elijah-ticks { display: inline-flex; }
.elijah-ticks svg { width: 16px; height: 12px; }

/* Typing indicator */
.elijah-typing {
  display: inline-flex; gap: 5px; padding: 6px 2px;
}
.elijah-typing i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6d7c95;
  animation: elijah-bounce 1.2s infinite;
}
.elijah-typing i:nth-child(2) { animation-delay: .15s; }
.elijah-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes elijah-bounce { 0%,60%,100% { transform: translateY(0); opacity:.5;} 30% { transform: translateY(-5px); opacity:1;} }

/* --- Quick chips --- */
.elijah-quick {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 14px 26px 4px;
}
.elijah-chip {
  padding: 11px 20px;
  border-radius: 12px;
  background: rgba(47,125,246,.06);
  border: 1px solid rgba(74,163,255,.55);
  color: var(--e-blue-2);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .1s;
  font-family: inherit;
}
.elijah-chip:hover { background: rgba(47,125,246,.16); }
.elijah-chip:active { transform: scale(.97); }
.elijah-chip:focus-visible { outline: 2px solid var(--e-blue); outline-offset: 2px; }

/* --- Input bar --- */
.elijah-input-bar { padding: 14px 26px 18px; }
.elijah-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--e-panel-2);
  border: 1px solid var(--e-border);
  border-radius: 20px;
  padding: 8px 8px 8px 22px;
  transition: border-color .15s, box-shadow .15s;
}
.elijah-input-wrap:focus-within {
  border-color: rgba(74,163,255,.6);
  box-shadow: 0 0 0 3px rgba(47,125,246,.12);
}
.elijah-input {
  flex: 1;
  background: transparent;
  border: 0;
  resize: none;
  color: var(--e-text);
  font-size: 16px;
  line-height: 1.5;
  font-family: inherit;
  padding: 10px 0;
  max-height: 130px;
  outline: none;
}
.elijah-input::placeholder { color: #59637a; }
.elijah-send {
  width: 46px; height: 46px;
  flex: 0 0 46px;
  border: 0; border-radius: 14px;
  background: transparent;
  color: var(--e-blue-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
}
.elijah-send svg { width: 24px; height: 24px; transform: rotate(0deg); }
.elijah-send:hover { background: rgba(47,125,246,.14); }
.elijah-send:active { transform: scale(.94); }
.elijah-send:disabled { opacity: .4; cursor: default; }
.elijah-send:focus-visible { outline: 2px solid var(--e-blue); outline-offset: 2px; }

.elijah-footer-note {
  text-align: center;
  font-size: 12.5px;
  color: #6d778c;
  margin-top: 12px;
}

/* Error bubble */
.elijah-bubble.is-error {
  background: rgba(220, 60, 60, .12);
  border: 1px solid rgba(220, 60, 60, .4);
  color: #ffb4b4;
}

/* Hidden state (close button) */
.elijah-app.is-closed .elijah-chat { display: none; }
.elijah-app.is-closed { height: auto; }
.elijah-reopen {
  display: none;
}
.elijah-app.is-closed + .elijah-reopen,
.elijah-reopen.is-visible {
  display: flex;
  align-items: center; gap: 10px;
  margin: 14px auto 0;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1px solid rgba(74,163,255,.5);
  background: rgba(47,125,246,.1);
  color: #cfe3ff; font-size: 15px; cursor: pointer;
  font-family: inherit;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 960px) {
  .elijah-app { flex-direction: column; height: auto; border-radius: 20px; }
  .elijah-hero { flex: none; min-height: 300px; }
  .elijah-hero-brand { top: 32px; left: 28px; }
  .elijah-logo-ring { width: 84px; height: 84px; }
  .elijah-logo-e { font-size: 42px; }
  .elijah-hero-hud { display: none; }
  .elijah-chat { min-height: 560px; }
}

@media (max-width: 520px) {
  .elijah-chat-header { padding: 16px 16px 14px; }
  .elijah-messages { padding: 18px 14px 8px; }
  .elijah-quick { padding: 10px 14px 2px; }
  .elijah-input-bar { padding: 10px 14px 14px; }
  .elijah-chip { font-size: 13px; padding: 9px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .elijah-app *, .elijah-app *::before, .elijah-app *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ================= V2 FEATURES ================= */

/* Mood-aware status dot */
.elijah-status-dot[data-mood="energised"] { background:#2ee56b; animation: elijah-pulse .8s ease-in-out infinite; }
.elijah-status-dot[data-mood="inspired"]  { background:#37c8f5; box-shadow:0 0 10px rgba(55,200,245,.9); animation: elijah-pulse 1.4s ease-in-out infinite; }
.elijah-status-dot[data-mood="engaged"]   { background:#2ee56b; animation: elijah-pulse 1.6s ease-in-out infinite; }
.elijah-status-dot[data-mood="attentive"] { background:#2ee56b; }
.elijah-status-dot[data-mood="reflective"]{ background:#8a94a6; box-shadow:0 0 8px rgba(138,148,166,.6); }
@keyframes elijah-pulse { 0%,100%{ transform:translate(-100%,-50%) scale(1);} 50%{ transform:translate(-100%,-50%) scale(1.25);} }

/* Mic button */
.elijah-btn-mic.is-listening {
  color:#fff; background: var(--e-blue);
  animation: elijah-mic 1s ease-in-out infinite;
}
@keyframes elijah-mic { 0%,100%{ box-shadow:0 0 0 0 rgba(47,125,246,.5);} 50%{ box-shadow:0 0 0 8px rgba(47,125,246,0);} }

/* Image attach */
.elijah-attach-preview {
  display:flex; align-items:center; gap:10px;
  margin-bottom:10px;
}
.elijah-attach-thumb {
  height:64px; border-radius:10px; border:1px solid var(--e-border);
}
.elijah-attach-remove {
  width:26px; height:26px; border-radius:50%;
  border:1px solid var(--e-border); background:var(--e-panel-2);
  color:#aeb7c6; cursor:pointer; font-size:12px;
}
.elijah-bubble-img {
  display:block; max-width:240px; border-radius:12px; margin-bottom:8px;
}

/* Level-up toast */
.elijah-toast {
  position:absolute; left:50%; top:86px;
  transform: translateX(-50%) translateY(-12px);
  background: linear-gradient(180deg, #16233c, #0e1729);
  border:1px solid rgba(74,163,255,.6);
  color:#cfe3ff; font-size:13.5px;
  padding:10px 18px; border-radius:999px;
  box-shadow:0 8px 30px rgba(47,125,246,.35);
  opacity:0; transition: opacity .35s, transform .35s;
  pointer-events:none; z-index:5; white-space:nowrap;
}
.elijah-toast.is-in { opacity:1; transform: translateX(-50%) translateY(0); }
.elijah-chat { position:relative; }

/* ---------- Floating site-wide widget ---------- */
.elijah-widget {
  position: fixed; right: 22px; bottom: 22px;
  z-index: 99999;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.elijah-widget-bubble {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid rgba(74,163,255,.8);
  background: radial-gradient(circle at 35% 30%, #10182a, #060a12 70%);
  cursor: pointer; position: relative;
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 20px rgba(47,125,246,.4);
  transition: transform .15s;
  padding:0; overflow:visible;
}
.elijah-widget-bubble:hover { transform: scale(1.06); }
.elijah-widget-bubble img { width:100%; height:100%; border-radius:50%; object-fit:cover; }
.elijah-widget-e {
  font-size:30px; font-weight:900; font-style:italic;
  background: linear-gradient(180deg,#fff 30%,#b9d4ff 70%);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.elijah-widget-dot {
  position:absolute; top:2px; right:2px;
  width:14px; height:14px; border-radius:50%;
  background:#2ee56b; border:2px solid #060a12;
  box-shadow:0 0 8px rgba(46,229,107,.8);
}
.elijah-widget-panel {
  display:none;
  position:absolute; right:0; bottom:80px;
  width: 400px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 130px);
  border-radius: 22px; overflow:hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.65);
  animation: elijah-in .25s ease;
}
.elijah-widget.is-open .elijah-widget-panel { display:block; }
.elijah-widget-panel .elijah-app { height:100%; max-width:none; border-radius:22px; }
.elijah-widget-panel .elijah-chat { min-height:0; }
.elijah-in-widget .elijah-chat-header { padding:16px 18px 14px; }
.elijah-in-widget .elijah-messages { padding:18px 16px 8px; }
.elijah-in-widget .elijah-quick { padding:10px 16px 2px; }
.elijah-in-widget .elijah-input-bar { padding:10px 16px 14px; }

@media (max-width: 480px) {
  .elijah-widget { right: 12px; bottom: 12px; }
  .elijah-widget-panel { bottom: 74px; height: 74vh; }
}

/* ================= V3 ================= */
.elijah-link { color: var(--e-blue-2); text-decoration: underline; }
.is-user .elijah-bubble .elijah-link { color:#fff; }
