/* Google-inspired theme */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Google+Sans:wght@400;500;700&display=swap');

:root {
  --font-sans: 'Roboto', 'Segoe UI', Arial, sans-serif;
  --g-blue: #1a73e8;
  --g-blue-light: #e8f0fe;
  --g-blue-hover: #1765cc;
  --g-red: #ea4335;
  --g-yellow: #fbbc04;
  --g-green: #34a853;
  --g-bg: #f8f9fa;
  --g-surface: #ffffff;
  --g-text: #202124;
  --g-text-secondary: #5f6368;
  --g-border: #dadce0;
  --g-shadow: 0 1px 2px rgba(60, 64, 67, 0.15), 0 1px 3px 1px rgba(60, 64, 67, 0.1);
  --g-shadow-lg: 0 4px 12px rgba(60, 64, 67, 0.12);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background-color: var(--g-bg);
  color: var(--g-text);
  margin: 0;
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 500;
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* Google color bar accent */
.google-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--g-blue) 0%, var(--g-red) 33%, var(--g-yellow) 66%, var(--g-green) 100%);
  flex-shrink: 0;
}

/* Cards & surfaces */
.g-surface {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-shadow);
}

.g-input {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  color: var(--g-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.g-input:focus {
  outline: none;
  border-color: var(--g-blue);
  box-shadow: 0 0 0 1px var(--g-blue);
}

/* Chat bubbles */
.msg-user {
  background: var(--g-blue-light);
  color: var(--g-text);
  border: 1px solid #d2e3fc;
  border-radius: 20px 20px 4px 20px;
}

.msg-assistant {
  background: var(--g-surface);
  color: var(--g-text);
  border: 1px solid var(--g-border);
  border-radius: 20px 20px 20px 4px;
  box-shadow: var(--g-shadow);
}

/* Google-style status timeline in chat */
.status-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
  animation: fadeUp 0.3s ease;
}

.status-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--g-blue);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  font-family: var(--font-sans);
}

.status-expand-btn:hover { text-decoration: underline; }

.status-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--g-text-secondary);
  border: 1px solid var(--g-border);
  background: var(--g-surface);
  transition: all 0.25s ease;
}

.status-chip.active {
  background: var(--g-blue-light);
  border-color: #aecbfa;
  color: var(--g-blue);
  font-weight: 500;
}

.status-chip.done {
  color: var(--g-text-secondary);
  opacity: 0.85;
}

.status-chip.hidden-step {
  display: none;
}

.status-chip.revealed {
  display: flex;
  animation: fadeUp 0.25s ease;
}

.status-icon-wrap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--g-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--g-text-secondary);
  background: var(--g-surface);
}

.status-chip.active .status-icon-wrap {
  border-color: var(--g-blue);
  color: var(--g-blue);
  background: #fff;
}

.status-ellipsis {
  display: inline-block;
  width: 1.2em;
  animation: ellipsis 1.2s steps(4, end) infinite;
  overflow: hidden;
  vertical-align: bottom;
}

@keyframes ellipsis {
  0%   { width: 0; }
  100% { width: 1.2em; }
}

.status-chip.pending {
  display: none;
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin-slow {
  display: inline-block;
  animation: spin 1.2s linear infinite;
}

/* Markdown in assistant messages */
.prose { line-height: 1.6; font-size: 14px; }
.prose p { margin: 0.4em 0; }
.prose h3, .prose h4 {
  color: var(--g-text);
  font-weight: 500;
  margin: 0.75rem 0 0.35rem;
}
.prose ul { list-style: disc; padding-left: 1.25rem; margin: 0.4em 0; }
.prose li { margin-bottom: 0.2rem; }
.prose strong { color: var(--g-text); font-weight: 600; }
.prose a { color: var(--g-blue); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose table { border-collapse: collapse; width: 100%; margin: 0.5em 0; font-size: 13px; }
.prose th, .prose td { border: 1px solid var(--g-border); padding: 6px 10px; text-align: left; }
.prose th { background: var(--g-bg); font-weight: 500; }

/* Session list */
.session-item.active {
  background: var(--g-blue-light);
  color: var(--g-blue);
  border-color: #aecbfa !important;
}

/* Toast */
.g-toast {
  background: #323232;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--g-shadow-lg);
}

/* Send button */
.g-send-btn {
  background: var(--g-blue);
  color: #fff;
  transition: background 0.2s, box-shadow 0.2s;
}
.g-send-btn:hover:not(:disabled) {
  background: var(--g-blue-hover);
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.4);
}
.g-send-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Welcome hero */
.welcome-hero {
  text-align: center;
  padding: 48px 24px;
  max-width: 520px;
  margin: 0 auto;
}
.welcome-hero h2 {
  font-size: 28px;
  font-weight: 400;
  color: var(--g-text);
  margin-bottom: 8px;
}
.welcome-hero p {
  font-size: 15px;
  color: var(--g-text-secondary);
  line-height: 1.5;
}
.welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}
.suggest-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--g-border);
  background: var(--g-surface);
  color: var(--g-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.suggest-chip:hover {
  background: var(--g-blue-light);
  border-color: #aecbfa;
  color: var(--g-blue);
}

/* Confidence-scored answer sections */
.confidence-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--g-border);
}

.confidence-card {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--g-border);
  background: #fafafa;
}

.confidence-card.confidence-high {
  border-left: 3px solid var(--g-green);
  background: #f6faf7;
}

.confidence-card.confidence-medium {
  border-left: 3px solid var(--g-yellow);
  background: #fffdf5;
}

.confidence-card.confidence-low {
  border-left: 3px solid #9aa0a6;
  background: #f8f9fa;
}

.confidence-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.confidence-type {
  font-size: 11px;
  font-weight: 500;
  color: var(--g-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.confidence-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.confidence-badge-high {
  background: #e6f4ea;
  color: #137333;
}

.confidence-badge-medium {
  background: #fef7e0;
  color: #b06000;
}

.confidence-badge-low {
  background: #f1f3f4;
  color: #5f6368;
}

.confidence-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--g-text);
  line-height: 1.4;
}

.confidence-card-summary {
  font-size: 12px;
  color: var(--g-text-secondary);
  margin: 4px 0 0;
  line-height: 1.45;
}

/* Voice input & output */
.voice-mic-btn {
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f1f3f4;
  color: var(--g-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.voice-mic-btn:hover {
  background: var(--g-blue-light);
  color: var(--g-blue);
}

.voice-mic-btn.listening {
  background: #fce8e6;
  color: var(--g-red);
  animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(234, 67, 53, 0); }
}

.voice-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--g-border);
  background: white;
  color: var(--g-text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.voice-toggle-btn:hover {
  background: var(--g-blue-light);
  border-color: #aecbfa;
  color: var(--g-blue);
}

.voice-toggle-btn.active {
  background: var(--g-blue-light);
  border-color: #aecbfa;
  color: var(--g-blue);
}

.msg-speak-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.msg-speak-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--g-border);
  background: white;
  color: var(--g-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.msg-speak-btn:hover,
.msg-speak-btn.speaking {
  background: var(--g-blue-light);
  border-color: #aecbfa;
  color: var(--g-blue);
}

.tts-live-text {
  margin: 0;
  line-height: 1.6;
  color: var(--g-text-primary);
  min-height: 1.25em;
}

.tts-cursor {
  display: inline-block;
  color: var(--g-blue);
  animation: ttsBlink 0.9s step-end infinite;
  margin-left: 1px;
}

@keyframes ttsBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
