:root {
  --bg-app: #0D0D0E;
  --bg-sidebar: #141416;
  --bg-card: #1A1A1D;
  --bg-input: #17171A;
  --bg-hover: #222226;
  --bg-active: #28282E;
  
  --border-subtle: #242429;
  --border-focus: #3E3E48;
  
  --text-main: #EDEDEF;
  --text-muted: #8E8E98;
  --text-dim: #60606A;
  
  --accent-blue: #3B82F6;
  --accent-blue-hover: #2563EB;
  --accent-green: #10B981;
  --accent-amber: #F59E0B;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  min-width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  user-select: none;
}

.sidebar-header {
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-title-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.app-brand {
  font-weight: 600;
  color: var(--text-main);
  font-size: 12px;
}

.menu-item {
  cursor: pointer;
  transition: color 0.15s;
}

.menu-item:hover {
  color: var(--text-main);
}

.btn-new-conv {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-new-conv:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
}

.sidebar-nav {
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-link:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-scrollable::-webkit-scrollbar {
  width: 4px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  padding: 0 4px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 6px;
}

.section-icon {
  color: var(--text-dim);
  cursor: pointer;
}

.project-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 5px;
  margin-bottom: 4px;
}

.conv-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  text-decoration: none;
}

.conv-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.conv-item.active {
  background-color: var(--bg-active);
  color: var(--text-main);
  font-weight: 500;
}

.conv-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.conv-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.conv-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.pin-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-blue);
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
}

.footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.footer-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background-color: var(--bg-app);
}

/* Top Bar */
.top-bar {
  height: 48px;
  min-height: 48px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: var(--bg-app);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.bc-project {
  color: var(--text-muted);
}

.bc-sep {
  color: var(--text-dim);
}

.bc-title {
  color: var(--text-main);
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 12px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-ide {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ide:hover {
  background-color: var(--bg-hover);
}

/* Chat Feed */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20% 120px;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}
.chat-container::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Message Styles */
.message {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-user {
  align-self: flex-end;
  max-width: 85%;
}

.message-user .message-bubble {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: 12px 12px 2px 12px;
  color: var(--text-main);
  font-size: 14px;
}

.message-assistant {
  align-self: flex-start;
  width: 100%;
}

.message-assistant .message-bubble {
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
}

/* Markdown Rendering */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 600;
}
.message-bubble h1 { font-size: 18px; }
.message-bubble h2 { font-size: 16px; }
.message-bubble h3 { font-size: 14px; }
.message-bubble p { margin-bottom: 12px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin-left: 20px; margin-bottom: 12px; }
.message-bubble li { margin-bottom: 4px; }

.message-bubble code:not(pre code) {
  font-family: var(--font-mono);
  background-color: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  border: 1px solid var(--border-subtle);
}

.code-block-wrapper {
  margin: 14px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: #121214;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background-color: #18181B;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-muted);
}

.btn-copy-code {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-copy-code:hover {
  color: var(--text-main);
}

pre[class*="language-"] {
  margin: 0 !important;
  padding: 12px !important;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  background: #121214 !important;
}

/* Tool Execution Cards */
.tool-card {
  margin: 10px 0;
  background-color: #151518;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}

.tool-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
}

.tool-badge {
  background-color: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
}

.tool-output {
  padding: 10px 12px;
  background-color: #0E0E10;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  max-height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #B4B4BC;
}

/* Message Actions */
.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.action-btn-mini {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}

.action-btn-mini:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
}

/* Floating Input Bar */
.input-wrapper {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  max-width: 820px;
  z-index: 10;
}

.input-container {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px 16px 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
}

#chat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  resize: none;
  max-height: 180px;
  line-height: 1.5;
}

#chat-input::placeholder {
  color: var(--text-dim);
}

.input-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 4px;
}

.model-picker-container {
  position: relative;
}

.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s;
}

.model-selector-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
}

.plus-icon {
  color: var(--text-dim);
  font-size: 14px;
}

.model-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 280px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 50;
}

.model-dropdown.show {
  display: flex;
}

.model-option {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.model-option:hover {
  background-color: var(--bg-hover);
}

.model-option.active {
  background-color: var(--bg-active);
}

.model-opt-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
}

.model-opt-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-voice {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.btn-voice:hover {
  background: var(--bg-active);
  color: var(--accent-blue);
}

.btn-send {
  background-color: var(--accent-blue);
  color: #FFF;
}

.btn-send:hover {
  background-color: var(--accent-blue-hover);
}

/* Gemini Live Voice Overlay */
.live-voice-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.live-voice-overlay.active {
  display: flex;
}

.live-voice-card {
  width: 440px;
  background: #141417;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.live-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.live-title-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.05em;
}

.live-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

.btn-close-live {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* Live Audio Orb */
.live-orb-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

.live-orb {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orb-core {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, #3B82F6 0%, #1D4ED8 100%);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
  z-index: 4;
}

.orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.ring-1 { width: 75px; height: 75px; animation: orb-pulse 2s infinite ease-in-out; }
.ring-2 { width: 100px; height: 100px; animation: orb-pulse 2s infinite ease-in-out 0.5s; }
.ring-3 { width: 125px; height: 125px; animation: orb-pulse 2s infinite ease-in-out 1s; }

@keyframes orb-pulse {
  0% { transform: scale(0.9); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(0.9); opacity: 0.3; }
}

.live-transcript {
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: center;
  min-height: 40px;
  max-width: 360px;
  line-height: 1.4;
}

.live-tools-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--accent-amber);
  margin-bottom: 20px;
}

.tool-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid var(--accent-amber);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.live-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-live-ctrl {
  padding: 10px 16px;
  border-radius: 24px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.btn-mute {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-end-call {
  background: #EF4444;
  color: #FFF;
}

.btn-end-call:hover {
  background: #DC2626;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-dialog {
  width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.settings-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.form-control {
  background: #111113;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
}
