/* ==========================================================================
   Vertex AI Claude Studio — Multi-Chat Glassmorphism Stylesheet
   ========================================================================== */

:root {
  --bg-dark: #090D16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1F2937;
  --bg-glass: rgba(17, 24, 39, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(129, 140, 248, 0.4);

  --text-primary: #F9FAFB;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;

  --accent-purple: #818CF8;
  --accent-pink: #F472B6;
  --accent-emerald: #34D399;
  --accent-blue: #3B82F6;

  --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #D946EF 100%);
  --gradient-hover: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #C026D3 100%);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.15);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);

  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(217, 70, 239, 0.06) 0%, transparent 40%);
}

.app-container {
  width: 100%;
  max-width: 1320px;
  height: 96vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: rgba(17, 24, 39, 0.9);
  border-bottom: 1px solid var(--border-glass);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #FFFFFF 0%, #D1D5DB 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.user-selector-wrapper:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(129, 140, 248, 0.4);
}

.user-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-select {
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.user-select option {
  background: #1E293B;
  color: #FFFFFF;
}

.model-picker-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.picker-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.custom-select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.model-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.select-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(129, 140, 248, 0.2);
  color: var(--accent-purple);
  font-weight: 600;
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.2);
  font-size: 0.78rem;
  color: var(--accent-emerald);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulseDot 2s infinite;
}

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

.icon-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   Main Body Layout (Sidebar + Chat Area)
   ========================================================================== */

.main-body-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Multi-Chat Sidebar */
.chat-sidebar {
  width: 270px;
  background: rgba(17, 24, 39, 0.6);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.new-chat-button {
  width: 100%;
  background: var(--gradient-primary);
  border: none;
  color: #FFF;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.new-chat-button:hover {
  background: var(--gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.sidebar-section-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 4px;
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.session-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.session-item.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  flex: 1;
}

.session-title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.session-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}

.session-item:hover .session-delete-btn {
  opacity: 1;
}

.session-delete-btn:hover {
  color: #F87171;
  background: rgba(248, 113, 113, 0.1);
}

/* Chat Main Area */
.chat-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Viewport */
.chat-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

.welcome-card {
  max-width: 720px;
  margin: auto;
  text-align: center;
  padding: 36px 28px;
  background: rgba(31, 41, 55, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  animation: fadeIn 0.4s ease-out;
}

.welcome-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.welcome-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #FFFFFF 0%, #9CA3AF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 28px;
}

.model-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.model-card {
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
}

.model-card:hover, .model-card.active {
  background: rgba(31, 41, 55, 0.8);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

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

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.badge {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #C084FC;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-emerald {
  background: rgba(52, 211, 153, 0.15);
  color: #34D399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sample-prompts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.sample-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 100%;
  margin-bottom: 4px;
}

.prompt-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-chip:hover {
  background: rgba(129, 140, 248, 0.1);
  color: var(--accent-purple);
  border-color: rgba(129, 140, 248, 0.3);
}

/* Messages Feed */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.message-row {
  display: flex;
  gap: 14px;
  animation: slideUp 0.3s ease-out;
}

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

.message-row.user-row {
  flex-direction: row-reverse;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-row .avatar {
  background: var(--gradient-primary);
  color: #FFF;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.assistant-row .avatar {
  background: rgba(31, 41, 55, 0.8);
  border: 1px solid var(--border-glass);
  color: var(--accent-purple);
}

.message-bubble {
  max-width: 80%;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
}

.user-row .message-bubble {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.assistant-row .message-bubble {
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-card);
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.model-name-tag {
  color: var(--accent-purple);
  font-weight: 600;
  font-family: var(--font-mono);
}

.message-bubble p {
  margin-bottom: 10px;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #F472B6;
}

.message-bubble pre {
  background: #0D1117 !important;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 12px 0;
  overflow-x: auto;
}

.message-bubble pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.thinking-block {
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(129, 140, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.thinking-header {
  font-weight: 600;
  color: var(--accent-purple);
  font-size: 0.78rem;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Typing Indicator */
.typing-indicator-container {
  display: flex;
  justify-content: center;
  padding: 10px;
}

.typing-indicator-container.hidden {
  display: none;
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(31, 41, 55, 0.7);
  border: 1px solid var(--border-glass);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-purple);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Footer Area */
.chat-footer {
  padding: 16px 24px;
  background: rgba(17, 24, 39, 0.85);
  border-top: 1px solid var(--border-glass);
}

.input-box-wrapper {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease;
}

.input-box-wrapper:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px rgba(129, 140, 248, 0.15);
}

textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  resize: none;
  outline: none;
  max-height: 160px;
  line-height: 1.5;
}

textarea::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.attach-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s ease;
}

.attach-button:hover {
  background: rgba(129, 140, 248, 0.12);
  color: var(--accent-purple);
  border-color: rgba(129, 140, 248, 0.3);
}

.attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.attachments-preview.hidden {
  display: none;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border-glass);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-primary);
  max-width: 220px;
}

.attachment-thumb {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.attachment-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.attachment-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}

.attachment-remove-btn:hover {
  color: #F87171;
}

/* Attached Media in Message Bubbles */
.message-attachments-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.message-image-attachment {
  max-width: 280px;
  max-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  object-fit: cover;
}

.message-file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--accent-purple);
  font-family: var(--font-mono);
}

.send-button {
  background: var(--gradient-primary);
  border: none;
  color: #FFF;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.send-button.stop-button {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35) !important;
}

.send-button.stop-button:hover {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45) !important;
}

.send-button:hover:not(:disabled) {
  background: var(--gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.send-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.footer-note {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 10px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  html, body {
    height: 100%;
    overflow: hidden;
  }

  .app-container {
    height: 100dvh;
    max-width: 100vw;
    border-radius: 0;
    border: none;
    margin: 0;
  }

  .mobile-only {
    display: flex;
  }

  .app-header {
    padding: 10px 14px;
    height: 56px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .brand h1 {
    font-size: 1.1rem;
  }

  .chat-sidebar {
    position: absolute;
    left: -280px;
    top: 56px;
    bottom: 0;
    width: 260px;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    transition: left 0.25s ease-in-out;
  }

  .chat-sidebar.open {
    left: 0;
  }

  .chat-viewport {
    padding: 12px 10px;
  }

  .welcome-card {
    padding: 16px 12px;
    margin: 10px auto;
  }

  .welcome-card h2 {
    font-size: 1.25rem;
  }

  .model-cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .chat-footer {
    padding: 8px 10px;
  }

  .input-box-wrapper {
    padding: 8px 10px;
  }

  .input-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .input-actions-left {
    flex: 1;
    min-width: 0;
    gap: 8px;
  }

  .model-picker-container {
    padding: 3px 8px;
    max-width: 150px;
  }

  .model-select {
    font-size: 0.78rem;
    max-width: 130px;
    text-overflow: ellipsis;
  }

  .message-bubble {
    max-width: 92%;
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  .code-block-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .code-block-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Code Block Header & Download Actions */
.code-block-wrapper {
  margin: 14px 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #0D1117;
}

.code-block-wrapper pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-block-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.code-block-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #E2E8F0;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.code-action-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

.code-action-btn.download-btn {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60A5FA;
}

.code-action-btn.download-btn:hover {
  background: rgba(59, 130, 246, 0.35);
  color: #93C5FD;
}

.code-action-btn.preview-btn {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.4);
  color: #C084FC;
}

.html-preview-frame {
  width: 100%;
  height: 320px;
  border: none;
  background: #ffffff;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
}

/* Right-Side Artifacts Column & Header Button */
.artifacts-header-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.artifacts-header-button:hover {
  background: rgba(129, 140, 248, 0.18);
  border-color: rgba(129, 140, 248, 0.4);
}

.artifacts-sidebar {
  width: 330px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-left: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  transition: margin-right 0.25s ease, opacity 0.25s ease;
  z-index: 40;
}

.artifacts-sidebar.closed {
  display: none !important;
}

.artifacts-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
}

.artifacts-sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-artifacts-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
}

.close-artifacts-button:hover {
  color: #FFFFFF;
}

.artifacts-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.artifacts-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.artifact-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.artifact-card:hover {
  border-color: rgba(129, 140, 248, 0.4);
}

.artifact-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.artifact-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.artifact-info {
  flex: 1;
  min-width: 0;
}

.artifact-filename {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.artifact-source-tag {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(147, 197, 253, 0.15);
  color: #93C5FD;
  margin-top: 4px;
}

.artifact-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .artifacts-sidebar {
    position: absolute;
    right: 0;
    top: 56px;
    bottom: 0;
    width: 300px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    z-index: 100;
  }

  .chat-header-bar {
    padding: 8px 12px;
    gap: 8px;
  }

  .chat-actions-right {
    gap: 6px;
  }

  .chat-top-action-btn {
    padding: 5px 9px;
    font-size: 0.78rem;
  }
}

@media (max-width: 520px) {
  .chat-title-display {
    max-width: 120px;
    font-size: 0.8rem;
  }

  .chat-top-action-btn span {
    display: none;
  }

  .chat-top-action-btn {
    padding: 6px 10px;
  }
}

/* Settings Gear & Dropdown */
.settings-wrapper {
  position: relative;
}

.settings-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(129, 140, 248, 0.4);
}

.settings-dropdown {
  position: absolute;
  top: 120%;
  right: 0;
  background: #1E293B;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  min-width: 190px;
  padding: 6px;
  z-index: 200;
}

.settings-dropdown.hidden {
  display: none !important;
}

.settings-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.settings-menu-item:hover {
  background: rgba(129, 140, 248, 0.18);
  color: #FFFFFF;
}

/* Token Dashboard Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: #0F172A;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #FFFFFF;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.token-user-banner {
  background: rgba(129, 140, 248, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.25);
  color: #C7D2FE;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 18px;
}

.token-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.token-stat-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.token-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.token-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #818CF8;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.token-section-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.token-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.token-breakdown-table th,
.token-breakdown-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.token-breakdown-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.token-breakdown-table td {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Chat Action Header Bar */
.chat-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--border-glass);
}

.chat-title-display {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-top-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-top-action-btn:hover {
  background: rgba(129, 140, 248, 0.18);
  border-color: rgba(129, 140, 248, 0.4);
}

.export-dropdown-wrapper {
  position: relative;
}

.export-dropdown {
  position: absolute;
  top: 120%;
  right: 0;
  background: #1E293B;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  min-width: 210px;
  padding: 6px;
  z-index: 200;
}

.export-dropdown.hidden {
  display: none !important;
}

.export-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.83rem;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.export-menu-item:hover {
  background: rgba(129, 140, 248, 0.18);
  color: #FFFFFF;
}

/* Modal Small Variant & Share Modal */
.modal-card.modal-sm {
  max-width: 480px;
}

.share-input-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.share-url-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: #93C5FD;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  outline: none;
}

.copy-share-btn {
  background: #3B82F6;
  border: none;
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.copy-share-btn:hover {
  background: #2563EB;
}

.share-status-msg {
  font-size: 0.78rem;
  color: #10B981;
  font-weight: 600;
  margin-top: 8px;
}

.shared-read-only-banner {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  color: #E0E7FF;
  padding: 14px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  margin: 12px;
  width: 100%;
}

/* Context Usage Meter Pill */
.context-meter-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: help;
  transition: border-color 0.2s ease;
}

.context-meter-container:hover {
  border-color: rgba(129, 140, 248, 0.4);
}

.context-meter-bar-track {
  width: 48px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.context-meter-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #6366F1);
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}

.context-meter-bar-fill.warning {
  background: linear-gradient(90deg, #F59E0B, #EF4444);
}

.context-meter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}







