/* ═══════════════════════════════════════════
   LUMA — Design System
   Paleta: Violeta / Dark
═══════════════════════════════════════════ */

:root {
  --bg:            #0F0A1E;
  --surface:       #16102B;
  --surface2:      #1F1640;
  --border:        #2A1F4A;
  --primary:       #7C3AED;
  --primary-light: #A78BFA;
  --primary-glow:  rgba(124,58,237,0.25);
  --text:          #F0EEFF;
  --text-muted:    #7C6FAA;
  --online:        #34D399;
  --warning:       #FBBF24;
  --error:         #F87171;
  --cyan:          #A78BFA;
  --radius:        12px;
  --radius-sm:     8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  height: 100dvh;
  overflow: hidden;
}

/* ═══ LAYOUT ═══ */
.luma-layout {
  display: flex;
  height: 100dvh;
}

.luma-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ═══ SIDEBAR ═══ */
.luma-sidebar {
  position: fixed;
  left: 0; top: 0;
  width: 272px;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.luma-sidebar.open { transform: translateX(0); }

.luma-sidebar::-webkit-scrollbar { width: 3px; }
.luma-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary-light);
}

.sidebar-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.sidebar-close-btn:hover { background: var(--surface2); color: var(--text); }

.sidebar-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Status */
.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text);
}

.status-dot-sm {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.3s;
}
.status-dot-sm.online  { background: var(--online);  box-shadow: 0 0 5px var(--online); }
.status-dot-sm.offline { background: var(--error); }
.status-dot-sm.checking { background: var(--warning); }

/* Agents list */
.agents-list { display: flex; flex-direction: column; gap: 2px; }

.aiox-agent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s;
  user-select: none;
}
.aiox-agent:hover  { background: var(--surface2); border-color: var(--border); }
.aiox-agent.active { background: var(--primary-glow); border-color: var(--primary); }
.aiox-agent.active .aiox-name { color: var(--primary-light); }
.aiox-agent.active .aiox-dot  { background: var(--primary-light); box-shadow: 0 0 5px var(--primary-light); }
.aiox-agent::before { display: none; }

.aiox-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.aiox-dot.online { background: var(--online); box-shadow: 0 0 4px var(--online); }

.aiox-name  { font-size: 13px; font-weight: 500; flex: 1; color: var(--text); }
.aiox-role  { font-size: 11px; color: var(--text-muted); }
.aiox-icon  { display: none; }

/* Language */
.lang-btns { display: flex; gap: 6px; }
.lang-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-btn.active,
.lang-btn:hover {
  border-color: var(--primary);
  color: var(--primary-light);
  background: var(--primary-glow);
}

/* ═══ OVERLAY ═══ */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  backdrop-filter: blur(3px);
}
.drawer-overlay.open { display: block; }

/* ═══ HEADER ═══ */
.luma-header {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  flex-shrink: 0;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.menu-btn:hover { background: var(--surface2); color: var(--text); }

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.header-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 7px var(--online);
  animation: pulse-glow 2.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 7px var(--online); }
  50%       { opacity: 0.55; box-shadow: 0 0 3px var(--online); }
}

.header-logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--primary-light);
}

.header-agent-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.2s;
}

/* ═══ MAIN CHAT ═══ */
.luma-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  scroll-behavior: smooth;
}

.luma-main::-webkit-scrollbar { width: 4px; }
.luma-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

#chat-mini-output {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
}

/* Welcome state */
.luma-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  gap: 10px;
}

.welcome-glyph {
  font-size: 40px;
  color: var(--primary-light);
  text-shadow: 0 0 24px var(--primary-glow);
  line-height: 1;
  margin-bottom: 6px;
}

.luma-welcome p { font-size: 16px; line-height: 1.6; }
.luma-welcome strong { color: var(--primary-light); }
.welcome-sub { font-size: 14px; color: var(--text-muted); }

/* Message lines from script.js */
#chat-mini-output > div,
#chat-mini-output > p {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  max-width: 88%;
  animation: msg-in 0.18s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* User messages */
#chat-mini-output .mini-line-user,
#chat-mini-output [class*="user"] {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Bot messages */
#chat-mini-output .mini-line-bot,
#chat-mini-output .mini-line-assistant,
#chat-mini-output [class*="bot"],
#chat-mini-output [class*="assistant"] {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* System / status messages */
#chat-mini-output .mini-line-system,
#chat-mini-output .mini-line-status,
#chat-mini-output [class*="system"] {
  align-self: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  max-width: 100%;
  text-align: center;
  border-radius: 20px;
  padding: 5px 14px;
}

/* Fallback: unclassed divs inside output */
#chat-mini-output > div:not([class]) {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

/* ═══ FOOTER / INPUT ═══ */
.luma-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.mic-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.mic-btn:hover { background: var(--primary-glow); border-color: var(--primary); color: var(--primary-light); }
.mic-btn.recording {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
  50%       { box-shadow: 0 0 0 8px transparent; }
}

.msg-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 11px 18px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}
.msg-input::placeholder { color: var(--text-muted); }
.msg-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.send-btn-luma {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.send-btn-luma:hover { background: var(--primary-light); box-shadow: 0 0 14px var(--primary-glow); }

/* ═══ AGENT PILL COMPAT ═══ */
.agent-pill { display: none; }
.agent-chip { display: none; }

/* ═══ DESKTOP ═══ */
@media (min-width: 768px) {
  .luma-sidebar {
    position: relative;
    transform: translateX(0) !important;
    transition: none;
    z-index: auto;
    flex-shrink: 0;
    height: 100dvh;
  }

  .drawer-overlay    { display: none !important; }
  .menu-btn          { display: none !important; }
  .sidebar-close-btn { display: none !important; }

  .luma-main { padding: 24px 28px; }
}

/* ═══ SCROLLBAR GLOBAL ═══ */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* === SPECIALIST PICKER — 7j-B === */
.specialist-picker {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 6px;
  min-width: 200px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: sp-in 0.12s ease;
}
@keyframes sp-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.sp-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  text-align: left;
  transition: background 0.12s;
  width: 100%;
}
.sp-option:hover { background: rgba(255,255,255,0.08); }
.sp-option.sp-active { background: rgba(255,255,255,0.06); color: #fff; }
.sp-option.sp-clear { color: rgba(255,255,255,0.4); border-bottom: 1px solid rgba(255,255,255,0.07); margin-bottom: 4px; padding-bottom: 10px; }
.sp-option.sp-clear:hover { color: rgba(255,255,255,0.7); background: transparent; }
.sp-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.sp-info { display: flex; flex-direction: column; }
.sp-name { font-size: 13px; font-weight: 500; line-height: 1.2; }
.sp-role { font-size: 11px; opacity: 0.5; }
