/* ---------- Stellar IT Assistant — AI-flavored dark theme ---------- */
:root {
  --bg: #0b0d17;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8eaf6;
  --muted: #9aa0b8;
  --c1: #7c3aed; /* violet */
  --c2: #2563eb; /* blue */
  --c3: #06b6d4; /* cyan */
  --c4: #ec4899; /* pink */
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* Slow-moving ambient color glow behind everything */
.bg-glow {
  position: fixed; inset: -30%;
  background:
    radial-gradient(40% 35% at 20% 25%, rgba(124, 58, 237, 0.22), transparent 70%),
    radial-gradient(35% 35% at 80% 20%, rgba(6, 182, 212, 0.18), transparent 70%),
    radial-gradient(40% 40% at 65% 85%, rgba(236, 72, 153, 0.16), transparent 70%),
    radial-gradient(30% 30% at 30% 80%, rgba(37, 99, 235, 0.18), transparent 70%);
  animation: drift 24s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}
@keyframes drift {
  from { transform: rotate(0deg) scale(1); }
  to   { transform: rotate(8deg) scale(1.15); }
}

.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 290px 1fr;
  height: 100vh;
  gap: 16px;
  padding: 16px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  padding: 18px;
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 16px; margin: 0; }
.tagline { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.convo-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.convo-item {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border: 1px solid transparent;
}
.convo-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-del {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: #dc2626; border: none; cursor: pointer;
  font-size: 14px; line-height: 1; border-radius: 7px;
  opacity: 0; transition: opacity 0.15s, background 0.15s, transform 0.1s;
}
.convo-item:hover .convo-del { opacity: 1; }
.convo-del:hover { background: #ef4444; transform: scale(1.1); }

.convo-search {
  font-size: 13px;
  padding: 8px 12px;
}
.convo-empty { color: var(--muted); font-size: 12.5px; text-align: center; margin: 14px 0; }
.convo-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.convo-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(6,182,212,0.18));
  border-color: rgba(124,58,237,0.45);
  color: var(--text);
}

.identity { display: flex; flex-direction: column; gap: 8px; }
.identity label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.session-user { font-size: 13.5px; overflow-wrap: anywhere; }
.btn-outline-sm {
  background: transparent; border: 1px solid var(--panel-border); color: var(--muted);
  padding: 7px 12px; font-size: 12.5px;
}
.btn-outline-sm:hover { border-color: var(--c3); color: var(--text); }

.hidden { display: none !important; }

/* Sign-in gate */
.signin-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(11, 13, 23, 0.75);
  backdrop-filter: blur(12px);
}
.signin-card {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 44px 52px;
  text-align: center;
  max-width: 420px;
}
.signin-card .btn { width: 100%; }

/* ---------- Chat ---------- */
.chat {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  min-height: 0;
  padding: 0 0 14px;
}
.messages { flex: 1; overflow-y: auto; padding: 28px 8%; display: flex; flex-direction: column; gap: 18px; }

.hero { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 640px; }
.gradient-text {
  font-size: 30px; margin: 0;
  background: linear-gradient(90deg, var(--c1), var(--c3), var(--c4), var(--c2));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hue-slide 8s linear infinite;
}
@keyframes hue-slide { to { background-position: 300% 0; } }
.muted { color: var(--muted); }

.suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover {
  border-color: var(--c3);
  box-shadow: 0 0 18px rgba(6,182,212,0.35);
  transform: translateY(-1px);
}

.msg { display: flex; gap: 12px; max-width: 100%; }
.msg .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 14px; font-weight: 600;
}
.msg.user .avatar { background: linear-gradient(135deg, var(--c2), var(--c3)); }
.msg.assistant .avatar { background: conic-gradient(from 0deg, var(--c1), var(--c3), var(--c4), var(--c1)); }
.msg .bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.msg.user .bubble { background: linear-gradient(135deg, rgba(37,99,235,0.32), rgba(6,182,212,0.22)); border: 1px solid rgba(37,99,235,0.4); }
.msg.assistant .bubble { background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); }
.bubble p:first-child { margin-top: 0; }
.bubble p:last-child { margin-bottom: 0; }
.bubble code { background: rgba(0,0,0,0.4); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.bubble pre { background: rgba(0,0,0,0.45); padding: 12px; border-radius: 10px; overflow-x: auto; }

.escalation-note {
  align-self: center;
  font-size: 13px;
  color: #fbbf24;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.35);
  border-radius: 999px;
  padding: 7px 16px;
}

/* ---------- The orb (AI presence) ---------- */
.orb {
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--c1), var(--c2), var(--c3), var(--c4), var(--c1));
  filter: blur(0.4px);
  position: relative;
  animation: spin 6s linear infinite;
}
.orb::after {
  content: '';
  position: absolute; inset: 18%;
  border-radius: 50%;
  background: rgba(11,13,23,0.85);
}
.orb-small { width: 38px; height: 38px; }
.brand-logo { object-fit: contain; }
.brand-logo-small { width: 38px; height: 38px; border-radius: 8px; }
.brand-logo-big { width: 110px; height: 110px; border-radius: 16px; }
.orb-big { width: 110px; height: 110px; box-shadow: 0 0 70px rgba(124,58,237,0.45), 0 0 120px rgba(6,182,212,0.25); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Thinking indicator: fast-moving colors + status text ---------- */
.thinking {
  display: flex; align-items: center; gap: 12px;
  margin: 0 8% 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  width: fit-content;
}
.thinking.hidden { display: none; }
.thinking-orb {
  animation: spin 1.1s linear infinite;
  box-shadow: 0 0 24px rgba(124,58,237,0.6), 0 0 40px rgba(236,72,153,0.4);
}
.thinking-text {
  font-size: 13.5px;
  background: linear-gradient(90deg, var(--c3), var(--c1), var(--c4), var(--c3));
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hue-slide 2.2s linear infinite;
}

/* ---------- Attachments ---------- */
.attach-preview {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin: 0 8% 8px;
}
.preview-thumb { position: relative; }
.preview-thumb img {
  height: 64px; border-radius: 10px;
  border: 1px solid var(--panel-border);
  display: block;
}
.preview-thumb button {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 10px; line-height: 1;
  background: #ef4444; color: white;
}
.attach-btn {
  width: 44px; height: 44px; border-radius: 12px; font-size: 17px;
  background: transparent; border: 1px solid var(--panel-border);
  color: var(--text); cursor: pointer; flex-shrink: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.attach-btn:hover { border-color: var(--c3); box-shadow: 0 0 14px rgba(6,182,212,0.3); }

.chat.dragging { outline: 2px dashed var(--c3); outline-offset: -8px; }
.drop-hint {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: rgba(11,13,23,0.65);
  backdrop-filter: blur(6px);
  font-size: 22px;
  pointer-events: none;
  color: var(--text);
}

.bubble img.chat-img {
  display: block; max-width: 280px; max-height: 220px;
  border-radius: 10px; margin-top: 8px; cursor: zoom-in;
  border: 1px solid var(--panel-border);
}
.bubble img.chat-img.expanded { max-width: 100%; max-height: none; cursor: zoom-out; }

/* ---------- Composer ---------- */
.composer {
  display: flex; gap: 10px; align-items: center;
  margin: 0 8%;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  transition: box-shadow 0.25s, border-color 0.25s;
}
.composer:focus-within {
  border-color: rgba(124,58,237,0.6);
  box-shadow: 0 0 0 1px rgba(124,58,237,0.4), 0 0 28px rgba(124,58,237,0.25);
}
.composer textarea {
  flex: 1; resize: none; border: none; outline: none; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; line-height: 1.5;
  max-height: 160px; padding: 0 8px; align-self: center;
}
.send-btn { width: 44px; height: 44px; border-radius: 12px; font-size: 16px; }
.footnote { text-align: center; font-size: 11.5px; color: var(--muted); margin: 10px 0 0; }

/* ---------- Shared controls ---------- */
.btn {
  border: none; cursor: pointer; color: white; font: inherit;
  border-radius: 12px; padding: 11px 16px; font-size: 14px;
}
.btn-gradient {
  background: linear-gradient(120deg, var(--c1), var(--c2), var(--c3));
  background-size: 200% 100%;
  transition: background-position 0.4s, box-shadow 0.25s;
}
.btn-gradient:hover { background-position: 100% 0; box-shadow: 0 6px 24px rgba(124,58,237,0.4); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input, textarea, select {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit; font-size: 13.5px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: rgba(124,58,237,0.6); }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .messages, .composer, .thinking { margin-left: 4%; margin-right: 4%; padding-left: 4%; padding-right: 4%; }
}
