/* OpenMailBot chat UI — Claude.ai-style warm dark theme (terracotta accent) */

:root {
  --accent-rgb: 218, 119, 86; /* #da7756, matches the tailwind.config orange-500 remap in index.html */
}

* {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

body {
  background: radial-gradient(1200px 600px at 50% -10%, rgba(var(--accent-rgb), 0.06), transparent 60%), #1b1a18;
}

/* Scrollbars */
#chatWindow::-webkit-scrollbar,
#sidebarScroll::-webkit-scrollbar,
#emailPanelList::-webkit-scrollbar {
  width: 8px;
}
#chatWindow::-webkit-scrollbar-track,
#sidebarScroll::-webkit-scrollbar-track,
#emailPanelList::-webkit-scrollbar-track {
  background: transparent;
}
#chatWindow::-webkit-scrollbar-thumb,
#sidebarScroll::-webkit-scrollbar-thumb,
#emailPanelList::-webkit-scrollbar-thumb {
  background-color: rgba(var(--accent-rgb), 0.3);
  border-radius: 9999px;
}
#chatWindow::-webkit-scrollbar-thumb:hover,
#sidebarScroll::-webkit-scrollbar-thumb:hover,
#emailPanelList::-webkit-scrollbar-thumb:hover {
  background-color: rgba(var(--accent-rgb), 0.5);
}

textarea#chatInput {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.3) transparent;
}

/* ---------------------------------------------------------------------
   Layout: header's row below splits into chatPane + emailPanel --
   horizontal 50/50 (chat left, email panel right) on md+ screens when
   a panel is open, emailPanel takes over the full screen on small ones.
--------------------------------------------------------------------- */
#mainRow {
  display: flex;
  flex: 1;
  flex-direction: row;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#chatPane {
  flex: 1 1 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transition: flex-basis 180ms ease;
}

#emailPanel {
  display: none;
  flex-direction: column;
  background: #1f1e1c;
  border-left: 1px solid rgba(var(--accent-rgb), 0.15);
}

#mainRow.panel-open #emailPanel {
  display: flex;
  flex: 0 0 50%;
  width: 50%;
}

@media (max-width: 767px) {
  #mainRow.panel-open #chatPane {
    display: none;
  }
  #mainRow.panel-open #emailPanel {
    position: fixed;
    inset: 0;
    top: 60px; /* below the header */
    z-index: 25;
    flex: 1 1 100%;
    width: 100%;
  }
}

#emailPanelFrame {
  display: none;
  flex: 1;
}
#emailPanel.showing-frame #emailPanelFrame {
  display: flex;
}
#emailPanel.showing-frame #emailPanelList {
  display: none;
}

/* Email card (list inside the panel) */
.email-card {
  transition: border-color 150ms ease, background-color 150ms ease;
}
.email-card:hover {
  border-color: rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.04);
}

/* Message entrance */
.msg-enter {
  animation: msg-in 180ms ease-out;
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing indicator */
.typing-dot {
  animation: typing-bounce 1.1s infinite ease-in-out;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Message body: minimal markdown rendering */
.msg-body p {
  margin: 0 0 0.6em 0;
}
.msg-body p:last-child {
  margin-bottom: 0;
}
.msg-body strong {
  font-weight: 600;
}
.msg-body a {
  color: #e0976d;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.msg-body code {
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.msg-body pre {
  background: #141414;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 8px;
  padding: 0.7em 0.9em;
  overflow-x: auto;
  margin: 0.5em 0;
}
.msg-body pre code {
  background: none;
  border: none;
  padding: 0;
}
.msg-body ul {
  list-style: disc;
  padding-left: 1.3em;
  margin: 0.4em 0;
}
.msg-body li {
  margin: 0.2em 0;
}

/* Suggestion chip hover */
.suggestion-chip {
  transition: border-color 150ms ease, background-color 150ms ease;
}

/* Copy button fade-in */
.copy-btn {
  opacity: 0;
  transition: opacity 120ms ease;
}
.msg-row:hover .copy-btn {
  opacity: 1;
}

/* Mic button recording state */
#micBtn.recording {
  background: #e53935;
  border-color: #e53935;
  animation: mic-pulse 1s infinite;
}
#micBtn.recording svg {
  color: #fff;
}
@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(229, 57, 53, 0); }
}

#voiceStatus.rec { color: #ef5350; }
#voiceStatus.busy { color: #fbbf24; }
#voiceStatus.err { color: #ef5350; }
#voiceStatus.ok { color: #34d399; }

/* Approval (human-in-the-loop) cards */
.approval-card {
  border-radius: 0.875rem;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background: #211f1d;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.approval-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: #f0b690;
  background: rgba(var(--accent-rgb), 0.14);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 0.25rem 0.3rem 0.25rem 0.65rem;
  color: #d1cdc0;
}
