:root {
  --bob-blue: #003366;
  --bob-blue-dark: #001f3f;
  --bob-orange: #f15a22;
  --bob-orange-light: #ff743d;
  --bg-deep: #050a14;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --accent: #00aaff;
  --sidebar-width: 320px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  background-image: radial-gradient(circle at 10% 20%, rgba(241, 90, 34, 0.05) 0%, transparent 40%),
                    radial-gradient(circle at 90% 80%, rgba(0, 51, 102, 0.2) 0%, transparent 40%);
}

.app-shell { display: flex; height: 100%; padding: 16px; gap: 16px; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--bob-blue-dark) 0%, #000a18 100%);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  display: flex; flex-direction: column; padding: 24px;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.sidebar-header { display: flex; align-items: center; gap: 16px; margin-bottom: 40px; }
.sidebar-logo { height: 48px; border-radius: 12px; }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.brand-name .accent { color: var(--bob-orange); }
.brand-sub { font-size: 10px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 2px; font-weight: 600; opacity: 0.7; }

.performance-monitor {
  display: flex; gap: 16px;
}

.stat-group {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 8px 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--bob-orange);
  font-variant-numeric: tabular-nums;
}

#sttMetric { color: #00ff88; }
#llmMetric { color: var(--accent); }
#ttsMetric { color: var(--bob-orange); }

.section-title { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; font-weight: 600; }
.dialer-card { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--card-border); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialer-card label { font-size: 10px; color: var(--text-secondary); opacity: 0.8; }
.input-wrapper { background: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border); border-radius: 10px; display: flex; align-items: center; padding: 0 12px; }
.input-wrapper:focus-within { border-color: var(--bob-orange); }
.prefix { color: var(--text-secondary); font-weight: 600; font-size: 14px; }
input[type="tel"] { background: transparent; border: none; color: white; padding: 12px; width: 100%; outline: none; font-size: 18px; font-family: inherit; font-weight: 500; }
.call-btn { background: linear-gradient(135deg, var(--bob-orange) 0%, #ff8c00 100%); color: white; border: none; padding: 16px; border-radius: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 15px rgba(241, 90, 34, 0.3); font-size: 15px; margin-top: 8px; }
.call-btn:hover { transform: scale(1.02); filter: brightness(1.1); }

/* Sidebar Navigation Fixed */
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 32px; }
.nav-links { display: flex; flex-direction: column; gap: 8px; }
.nav-link { 
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; 
  color: var(--text-secondary); border-radius: 12px; transition: 0.2s; font-size: 14px; font-weight: 500; 
}
.nav-link .icon { font-size: 18px; filter: grayscale(1); opacity: 0.6; }
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: white; }
.nav-link.active { background: rgba(241, 90, 34, 0.1); color: var(--bob-orange); border: 1px solid rgba(241, 90, 34, 0.2); }
.nav-link.active .icon { filter: grayscale(0); opacity: 1; }

/* Main Content */
.main-content {
  flex: 1; background: rgba(255, 255, 255, 0.02); border-radius: 20px;
  border: 1px solid var(--card-border); display: flex; flex-direction: column; overflow: hidden;
}

.view-container { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }

.top-bar { padding: 24px 32px; border-bottom: 1px solid var(--card-border); display: flex; justify-content: space-between; align-items: center; }
.page-info h1 { font-size: 20px; font-weight: 700; }
.page-info p { font-size: 12px; color: var(--text-secondary); }

.conversation-container { flex: 1; display: flex; flex-direction: column; padding: 32px; overflow: hidden; position: relative; }

.chat-viewport {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 24px;
  scrollbar-width: thin; padding-right: 12px; scroll-behavior: smooth;
}

.empty-state { margin: auto; text-align: center; color: var(--text-secondary); opacity: 0.4; animation: fadeIn 2s infinite alternate; }
.empty-icon { font-size: 64px; margin-bottom: 16px; }

/* Message Groups */
.message-wrapper {
  display: flex; flex-direction: column; gap: 4px; max-width: 80%;
  animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.message-wrapper.user { align-self: flex-start; }
.message-wrapper.ai { align-self: flex-end; align-items: flex-end; }
.message-wrapper.system { align-self: center; align-items: center; }

.label-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message-wrapper.ai .label-container {
  flex-direction: row-reverse;
}

.message-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--text-secondary); text-transform: uppercase; padding: 0 4px; }
.ai .message-label { color: var(--bob-orange); }

.latency-badge {
  font-size: 9px;
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.ai .latency-badge {
  background: rgba(241, 90, 34, 0.15);
  color: var(--bob-orange);
  border-color: rgba(241, 90, 34, 0.2);
}

.message {
  padding: 14px 20px; border-radius: 18px; font-size: 15px; border: 1px solid var(--card-border);
  position: relative; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.message.user {
  background: rgba(255, 255, 255, 0.05); border-bottom-left-radius: 4px;
}

.message.ai {
  background: linear-gradient(135deg, rgba(241, 90, 34, 0.15) 0%, rgba(241, 90, 34, 0.05) 100%);
  border-color: rgba(241, 90, 34, 0.3); border-bottom-right-radius: 4px;
}

.message.system {
  background: transparent; border: none; font-size: 11px; font-style: italic; color: var(--text-secondary); padding: 0; box-shadow: none;
}

.message-time {
  display: block; font-size: 10px; opacity: 0.5; margin-top: 6px; text-align: right;
}

.pause-marker {
  display: inline-block; width: 6px; height: 6px; background: var(--bob-orange); border-radius: 50%; margin: 0 4px; opacity: 0.6;
}

/* Audio Visualizer */
.audio-visualizer {
  height: 60px; background: rgba(0, 0, 0, 0.3); border-top: 1px solid var(--card-border);
  margin: 0 -32px -32px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between;
}
.bars { display: flex; gap: 4px; height: 32px; align-items: center; }
.audio-bar { width: 4px; background: var(--bob-orange); border-radius: 4px; height: 30%; transition: height 0.1s ease; }
.active .audio-bar { animation: bounce 0.8s infinite ease-in-out; }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounce { 0%, 100% { height: 30%; } 50% { height: 100%; } }
@keyframes fadeIn { from { opacity: 0.2; } to { opacity: 0.5; } }

.pulse-icon {
  display: inline-block; width: 8px; height: 8px; background: #00ff88; border-radius: 50%;
  margin-right: 6px; box-shadow: 0 0 10px #00ff88; animation: beacon 1.5s infinite;
}
@keyframes beacon { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }
