/* ─────────────────────────────────────────────────────────────────
   jarvis.css — Executive Interface Design System
   Deep navy base. Calm. Grounded. No chrome. Just conversation.
───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:      #0F172A;
  --bg-surface:   #111827;
  --bg-msg-ai:    #141E30;
  --bg-msg-jeff:  #1A2236;
  --bg-input:     #111827;
  --bg-hover:     #1E2D45;
  --border:       #1F2937;
  --border-mid:   #253045;
  --text-primary:   #E5E7EB;
  --text-secondary: #9CA3AF;
  --text-muted:     #4B5563;
  --text-ai:        #D1D5DB;
  --blue:       #3B82F6;
  --blue-light: #60A5FA;
  --blue-dim:   #1E3A5F;
  --context-bar: #2563EB;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --topbar-h: 52px;
  --max-width: 720px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

html, body {
  height: 100%; overflow: hidden;
  background: var(--bg-base); color: var(--text-primary);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Shell */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* Top Bar */
.topbar {
  flex-shrink: 0; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-base);
}
.topbar-name { font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.2px; }
.topbar-status { display: flex; align-items: center; gap: 7px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0; transition: background 0.3s;
}
.status-dot.cloud  { background: #6B7280; }
.status-dot.error  { background: #EF4444; }
.status-dot.thinking { animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.25} }
.status-label { font-size: 12px; color: var(--text-secondary); }

/* Thread */
.thread {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 28px 20px 16px; scroll-behavior: smooth;
}
.thread::-webkit-scrollbar { width: 3px; }
.thread::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* Empty state */
.empty-state { max-width: var(--max-width); margin: 0 auto; padding-top: 14vh; }
.empty-greeting { font-size: 22px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.empty-sub { font-size: 15px; color: var(--text-secondary); }

/* Message groups */
.msg-group { max-width: var(--max-width); margin: 0 auto 20px; }

.msg-group.jeff { display: flex; justify-content: flex-end; }
.msg-group.jeff .msg-bubble {
  background: var(--bg-msg-jeff); border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg) var(--radius-sm) var(--radius-lg) var(--radius-lg);
  color: var(--text-primary); max-width: 75%;
  padding: 11px 15px; font-size: 15px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}

.msg-group.jarvis { display: flex; flex-direction: column; align-items: flex-start; }
.msg-role-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--blue-light); margin-bottom: 6px; padding-left: 2px;
}
.msg-group.jarvis .msg-bubble {
  background: var(--bg-msg-ai); border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg);
  color: var(--text-ai); width: 100%;
  padding: 14px 16px; font-size: 15px; line-height: 1.75; word-break: break-word;
}
.msg-group.context .msg-bubble { border-left: 3px solid var(--context-bar); background: #0F1929; }

/* Message content */
.msg-content p { margin-bottom: 10px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content strong { font-weight: 600; color: var(--text-primary); }
.msg-content ul, .msg-content ol { margin: 8px 0 8px 20px; line-height: 1.8; }
.msg-content li { margin-bottom: 3px; }
.msg-content h2 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 14px 0 6px; }
.msg-content h3 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 12px 0 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.msg-content code { font-family: "SF Mono", Menlo, monospace; font-size: 13px; background: #0B1120; color: var(--blue-light); padding: 2px 6px; border-radius: 4px; }
.msg-content pre { background: #0B1120; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
.msg-content pre code { background: none; padding: 0; color: var(--text-secondary); }

/* Thinking */
.thinking-bubble {
  display: flex; align-items: center; gap: 5px; padding: 14px 16px;
  background: var(--bg-msg-ai); border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg);
}
.thinking-bubble span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted);
  animation: thinking 1.4s ease-in-out infinite;
}
.thinking-bubble span:nth-child(2) { animation-delay: 0.2s; }
.thinking-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking {
  0%,100%{opacity:0.2;transform:translateY(0)}
  50%{opacity:1;transform:translateY(-3px)}
}

/* Input bar */
.inputbar {
  flex-shrink: 0; display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 16px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--bg-base);
}
.input-wrap {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border-mid);
  border-radius: var(--radius-md); transition: border-color 0.15s;
}
.input-wrap:focus-within { border-color: var(--blue); }
.msg-input {
  width: 100%; background: transparent; border: none; outline: none; resize: none;
  font-family: var(--font); font-size: 15px; color: var(--text-primary);
  line-height: 1.5; padding: 10px 14px; max-height: 180px; overflow-y: auto;
}
.msg-input::placeholder { color: var(--text-muted); }

.mic-btn, .send-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border-mid); background: transparent;
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.mic-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.mic-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.send-btn { background: var(--blue); border-color: var(--blue); color: #fff; }
.send-btn:hover { background: var(--blue-light); border-color: var(--blue-light); }
.send-btn:disabled { background: var(--border-mid); border-color: var(--border-mid); color: var(--text-muted); cursor: not-allowed; }

/* Mobile */
@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .thread { padding: 16px 12px 12px; }
  .inputbar { padding: 10px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .msg-group.jeff .msg-bubble { max-width: 88%; }
}

/* ── Voice / Mic states ──────────────────────────────────────── */
.mic-btn.mic-active {
  background: #EF4444;
  border-color: #EF4444;
  color: #fff;
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.status-dot.listening {
  background: #EF4444;
  animation: pulse-dot 0.8s ease-in-out infinite;
}

/* ── Topbar right group ──────────────────────────────────────── */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.meetings-btn {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border-mid);
  color: var(--text-secondary); font-family: var(--font);
  font-size: 12px; padding: 5px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.meetings-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Meetings panel ──────────────────────────────────────────── */
.meetings-panel {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0;
  width: 340px; background: var(--bg-surface);
  border-left: 1px solid var(--border); z-index: 100;
  display: flex; flex-direction: column; overflow: hidden;
}
.mp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-primary); flex-shrink: 0;
}
.mp-header button {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; cursor: pointer; padding: 2px 6px;
}
.mp-header button:hover { color: var(--text-primary); }
.mp-body { flex: 1; overflow-y: auto; padding: 12px; }
.mp-loading, .mp-empty { color: var(--text-muted); font-size: 13px; padding: 16px; text-align: center; }
.mp-item {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px; margin-bottom: 10px;
}
.mp-item-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 8px; }
.mp-title { font-size: 13px; font-weight: 500; color: var(--text-primary); line-height: 1.4; }
.mp-date { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.mp-summary { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 10px; }
.mp-actions { display: flex; gap: 8px; }
.mp-btn {
  font-size: 12px; font-family: var(--font); padding: 4px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-mid);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mp-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.mp-btn-thought { border-color: var(--blue-dim); color: var(--blue-light); }
.mp-btn-thought:hover { background: var(--blue-dim); color: var(--blue-light); }

/* ── Meeting thoughts panel ──────────────────────────────────── */
.thoughts-panel {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max-width);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-bottom: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 200; display: flex; flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
}
.thoughts-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.thoughts-title { display: flex; flex-direction: column; gap: 2px; }
.thoughts-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--blue-light); }
.thoughts-meeting { font-size: 13px; color: var(--text-secondary); }
.thoughts-close { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 2px 6px; }
.thoughts-close:hover { color: var(--text-primary); }
.thoughts-textarea {
  margin: 12px 16px; height: 120px; background: var(--bg-base);
  border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: var(--font); font-size: 14px;
  color: var(--text-primary); line-height: 1.6; resize: none; outline: none;
  transition: border-color 0.15s;
}
.thoughts-textarea:focus { border-color: var(--blue); }
.thoughts-textarea::placeholder { color: var(--text-muted); }
.thoughts-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 16px; flex-shrink: 0;
}
.thoughts-save {
  background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 8px 16px;
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: background 0.15s;
}
.thoughts-save:hover:not(:disabled) { background: var(--blue-light); }
.thoughts-save:disabled { background: var(--border-mid); color: var(--text-muted); cursor: not-allowed; }
.thoughts-hint { font-size: 11px; color: var(--text-muted); }

@media (max-width: 600px) {
  .meetings-panel { width: 100%; }
  .thoughts-panel { max-width: 100%; }
}

.mp-import-btn {
  font-size: 12px; font-family: var(--font); padding: 4px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--blue-dim);
  background: transparent; color: var(--blue-light);
  text-decoration: none; cursor: pointer;
  transition: background 0.15s;
}
.mp-import-btn:hover { background: var(--blue-dim); }

.signout-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid); color: var(--text-muted);
  text-decoration: none; transition: background 0.15s, color 0.15s;
}
.signout-btn:hover { background: var(--bg-hover); color: #F87171; border-color: #F87171; }


/* ─── Meeting Detail Panel ───────────────────────────────────── */
.meeting-detail-panel {
  position: fixed;
  top: 0; right: 0;
  width: 420px; max-width: 100vw;
  height: 100vh;
  background: #0f172a;
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 300;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
  animation: slideInRight 0.2s ease;
}
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.mdp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.mdp-back {
  background: none; border: none;
  color: rgba(255,255,255,0.5);
  font-size: 13px; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.mdp-back:hover { color: #fff; background: rgba(255,255,255,0.06); }
.mdp-close {
  background: none; border: none;
  color: rgba(255,255,255,0.4);
  font-size: 16px; cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.mdp-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.mdp-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 40px;
}
.mdp-loading {
  color: rgba(255,255,255,0.3);
  font-size: 14px;
  text-align: center;
  padding: 40px 0;
}
.mdp-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 8px;
}
.mdp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.mdp-meta-item {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
.mdp-section {
  margin-bottom: 22px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 16px;
}
.mdp-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  margin-bottom: 10px;
}
.mdp-takeaways {
  background: rgba(250,204,21,0.05);
  border: 1px solid rgba(250,204,21,0.12);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.mdp-takeaways .mdp-section-label { color: #facc15; }
.mdp-summary-text {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
}
.mdp-list {
  list-style: none;
  margin: 0; padding: 0;
}
.mdp-list li {
  font-size: 13px;
  color: rgba(255,255,255,0.72);
  line-height: 1.5;
  padding: 5px 0 5px 16px;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.mdp-list li:last-child { border-bottom: none; }
.mdp-list li::before {
  content: '';
  position: absolute;
  left: 4px; top: 12px;
  width: 5px; height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
}
.mdp-takeaways .mdp-list li::before { background: #facc15; }
.mdp-empty-section {
  font-size: 13px;
  color: rgba(255,255,255,0.25);
  font-style: italic;
}
.mdp-thoughts { background: rgba(139,92,246,0.05); border: 1px solid rgba(139,92,246,0.15); border-radius: 8px; padding: 14px 16px; }
.mdp-thoughts .mdp-section-label { color: #a78bfa; }
.mdp-thoughts-text { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.6; white-space: pre-wrap; }
.mdp-no-summary { font-size: 12px; color: rgba(255,255,255,0.22); font-style: italic; margin: 2px 0 6px; }
.mdp-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.mdp-btn-ask {
  flex: 1;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  color: #a5b4fc;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.mdp-btn-ask:hover { background: rgba(99,102,241,0.25); }
.mdp-btn-thoughts {
  flex: 1;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.25);
  color: #c4b5fd;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.mdp-btn-thoughts:hover { background: rgba(139,92,246,0.2); }

/* mp-item clickable hover state */
.mp-item:hover { background: rgba(255,255,255,0.04); }
