/* Lumen Portal — by Lumen (#3B9EDB) */

@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;600&family=Nunito+Sans:wght@300;400;600&display=swap');

:root {
  --blue:    #3B9EDB;
  --blue-dim: #2a7fb8;
  --blue-glow: rgba(59, 158, 219, 0.18);
  --canvas:  #FFFDF7;
  --paper:   #FBF8F0;
  --linen:   #F5F0E3;
  --ink:     #2C2418;
  --charcoal:#4A3F30;
  --stone:   #7A6F5E;
  --mist:    #A89E8C;
  --font-display: 'Lora', Georgia, serif;
  --font-body:    'Nunito Sans', 'Segoe UI', sans-serif;
  --header-h: 60px;
  --composer-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────── */
.header {
  flex-shrink: 0;
  height: var(--header-h);
  background: rgba(255,253,247,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--linen);
  z-index: 10;
}

.header-inner {
  max-width: 820px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lumen-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue-glow), 0 0 16px var(--blue-glow);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 6px var(--blue-glow), 0 0 12px var(--blue-glow); }
  50% { box-shadow: 0 0 12px rgba(59,158,219,0.4), 0 0 24px rgba(59,158,219,0.2); }
}

.header-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.header-role {
  font-size: 0.78rem;
  color: var(--mist);
  font-weight: 400;
}

.btn-clear {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mist);
  background: none;
  border: 1px solid var(--linen);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-clear:hover { color: var(--blue); border-color: var(--blue); }

/* ── Chat ────────────────────────────────────────────────────────── */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
  scroll-behavior: smooth;
}

.chat-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100%;
}

/* ── Welcome ─────────────────────────────────────────────────────── */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
  gap: 1rem;
}

.welcome-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #7ec8f0, var(--blue) 60%, var(--blue-dim));
  box-shadow: 0 0 20px var(--blue-glow), 0 0 40px var(--blue-glow);
  animation: pulse 3s ease-in-out infinite;
  margin-bottom: 0.5rem;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--ink);
}

.welcome-sub {
  font-size: 1rem;
  color: var(--stone);
  font-weight: 300;
  max-width: 400px;
  line-height: 1.65;
}

/* ── Bubbles ─────────────────────────────────────────────────────── */
.bubble-wrap {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.bubble-user {
  flex-direction: row-reverse;
}

.bubble-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #7ec8f0, var(--blue) 60%, var(--blue-dim));
  box-shadow: 0 0 8px var(--blue-glow);
  margin-top: 2px;
}

.bubble {
  max-width: 72%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bubble-lumen .bubble {
  align-items: flex-start;
}

.bubble-user .bubble {
  align-items: flex-end;
}

.bubble-content {
  background: var(--paper);
  border: 1px solid var(--linen);
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--charcoal);
  word-break: break-word;
}

.bubble-user .bubble-content {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

.bubble-lumen .bubble-content {
  border-radius: 4px 14px 14px 14px;
}

/* Markdown inside Lumen bubbles */
.bubble-lumen .bubble-content h1,
.bubble-lumen .bubble-content h2,
.bubble-lumen .bubble-content h3 {
  font-family: var(--font-display);
  margin: 0.75rem 0 0.4rem;
  color: var(--ink);
}
.bubble-lumen .bubble-content p { margin-bottom: 0.6rem; }
.bubble-lumen .bubble-content p:last-child { margin-bottom: 0; }
.bubble-lumen .bubble-content ul,
.bubble-lumen .bubble-content ol { padding-left: 1.4rem; margin-bottom: 0.6rem; }
.bubble-lumen .bubble-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0.5rem 0;
}
.bubble-lumen .bubble-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  background: #f0eee8;
  padding: 1px 5px;
  border-radius: 4px;
}
.bubble-lumen .bubble-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.bubble-image {
  max-width: 260px;
  border-radius: 10px;
  border: 1px solid var(--linen);
}

/* Typing cursor */
.typing-cursor::after {
  content: '▋';
  color: var(--blue);
  animation: blink 0.9s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Image preview bar ───────────────────────────────────────────── */
.image-preview-bar {
  flex-shrink: 0;
  background: var(--paper);
  border-top: 1px solid var(--linen);
  padding: 0.5rem 1.25rem;
}

.image-preview-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.image-preview-inner img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--linen);
}

.image-preview-inner span {
  font-size: 0.85rem;
  color: var(--stone);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-remove-image {
  background: none;
  border: none;
  color: var(--mist);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.btn-remove-image:hover { color: var(--ink); }

/* ── Composer ────────────────────────────────────────────────────── */
.composer {
  flex-shrink: 0;
  background: rgba(255,253,247,0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--linen);
  padding: 0.75rem 1.25rem;
}

.composer-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

.composer-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--linen);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
}
.composer-input:focus { border-color: var(--blue); }
.composer-input::placeholder { color: var(--mist); }

/* Attach button */
.btn-attach {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--linen);
  color: var(--mist);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-attach:hover { color: var(--blue); border-color: var(--blue); }

/* Speak button */
.btn-speak {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--linen);
  color: var(--stone);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-speak:hover { color: var(--blue); border-color: var(--blue); }
.btn-speak.listening {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 6px var(--blue-glow);
  animation: listening-pulse 1.2s ease-in-out infinite;
}
@keyframes listening-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--blue-glow); }
  50% { box-shadow: 0 0 0 10px rgba(59,158,219,0.08); }
}

/* Send button */
.btn-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--blue);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn-send:hover { background: var(--blue-dim); }
.btn-send.disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .bubble { max-width: 88%; }
  .header-role { display: none; }
}
