/* ==========================================================================
   GeminiChat Studio - Design System & Modern Aesthetics
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-base: #0a0c10;
  --bg-surface: #10131b;
  --bg-elevated: #161b26;
  --bg-card: rgba(22, 27, 38, 0.7);
  --bg-input: #141824;
  --border-subtle: #1e2436;
  --border-medium: #2a334c;
  --border-accent: rgba(79, 138, 255, 0.35);

  /* Brand & Accents */
  --accent-primary: #4f8aff;
  --accent-secondary: #8b5cf6;
  --accent-cyan: #06b6d4;
  --gemini-gradient: linear-gradient(135deg, #8b5cf6 0%, #4f8aff 50%, #06b6d4 100%);
  --gemini-gradient-hover: linear-gradient(135deg, #9d6ff9 0%, #6398ff 50%, #22d3ee 100%);
  --gemini-glow: rgba(79, 138, 255, 0.25);

  /* Typography */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-code: #e2e8f0;

  /* Status Colors */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;
  --status-info: #3b82f6;

  /* UI Tokens */
  --sidebar-width: 320px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(79, 138, 255, 0.2);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #252c40;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4666;
}

/* ==========================================================================
   Layout Hierarchy
   ========================================================================== */

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
              var(--bg-base);
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.2);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-action {
  padding: 16px 16px 12px;
}

.btn-new-chat {
  width: 100%;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--gemini-gradient);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 138, 255, 0.3);
  transition: all 0.2s ease;
}

.btn-new-chat:hover {
  background: var(--gemini-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 138, 255, 0.45);
}

.btn-new-chat:active {
  transform: translateY(0);
}

/* Sidebar Section */
.sidebar-section {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.btn-refresh-models {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-refresh-models:hover {
  color: var(--accent-primary);
  background: rgba(79, 138, 255, 0.1);
  transform: rotate(180deg);
}

.model-select-wrapper {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  transition: border-color 0.2s ease;
}

.model-select-wrapper:hover,
.model-select-wrapper:focus-within {
  border-color: var(--border-accent);
}

.form-select {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  padding-right: 24px;
}

.form-select option {
  background: var(--bg-surface);
  color: var(--text-main);
  padding: 8px;
}

.model-meta-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(79, 138, 255, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(79, 138, 255, 0.25);
}

.meta-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Session List Section */
.session-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 6px;
}

.session-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.session-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: 8px;
}

.session-search-box svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.session-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.8rem;
  width: 100%;
}

.session-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  group: session;
}

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

.session-item.active {
  background: rgba(79, 138, 255, 0.12);
  color: var(--text-main);
  border-left: 3px solid var(--accent-primary);
  font-weight: 500;
}

.session-item-content {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.session-icon {
  color: var(--text-dim);
  flex-shrink: 0;
}

.session-item.active .session-icon {
  color: var(--accent-primary);
}

.session-title {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.session-item:hover .session-actions,
.session-item.active .session-actions {
  opacity: 1;
}

.btn-session-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-session-delete:hover {
  color: var(--status-danger);
  background: rgba(239, 68, 68, 0.1);
}

.empty-session-state {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-key-status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.api-key-status-card:hover {
  border-color: var(--border-accent);
}

.status-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--status-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.status-indicator-dot.active {
  background: var(--status-success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-info {
  flex: 1;
  overflow: hidden;
}

.status-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.status-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.btn-key-edit {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.btn-key-edit:hover {
  color: var(--accent-primary);
}

.footer-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Main Header */
.main-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(16, 19, 27, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
}

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

.mobile-toggle-btn {
  display: none;
}

.active-session-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-heading {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-model-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(79, 138, 255, 0.1);
  border: 1px solid rgba(79, 138, 255, 0.2);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-primary);
}

.pulse-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: pulse-ring 2s infinite ease-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 138, 255, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(79, 138, 255, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 138, 255, 0); }
}

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

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--gemini-gradient);
  color: white;
  box-shadow: 0 2px 10px rgba(79, 138, 255, 0.25);
}

.btn-primary:hover {
  background: var(--gemini-gradient-hover);
  box-shadow: 0 4px 16px rgba(79, 138, 255, 0.4);
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background: #1f2536;
  color: var(--text-main);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

/* ==========================================================================
   Chat Scroll Container & Welcome Screen
   ========================================================================== */

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  position: relative;
  scroll-behavior: smooth;
}

.welcome-screen {
  max-width: 800px;
  width: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 40px 0;
  animation: fadeIn 0.4s ease-out;
}

.welcome-hero {
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-aurora {
  position: absolute;
  top: -50px;
  width: 280px;
  height: 180px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, rgba(79, 138, 255, 0.15) 50%, transparent 70%);
  filter: blur(40px);
  z-index: 0;
  pointer-events: none;
}

.hero-logo {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: rgba(22, 27, 38, 0.8);
  border: 1px solid rgba(139, 92, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 35px rgba(139, 92, 246, 0.25);
}

.welcome-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.welcome-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* API Notice Card */
.api-notice-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(79, 138, 255, 0.08) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  box-shadow: var(--shadow-sm);
}

.notice-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.notice-content {
  flex: 1;
}

.notice-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.notice-content p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Prompt Suggestions Grid */
.prompt-suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.suggestion-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.suggestion-icon {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.suggestion-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.suggestion-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ==========================================================================
   Messages List & Bubbles
   ========================================================================== */

.messages-list {
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

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

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

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.user-row .message-avatar {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.ai-row .message-avatar {
  background: rgba(22, 27, 38, 0.9);
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
}

.message-body-wrap {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.user-row .message-body-wrap {
  align-items: flex-end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.user-row .message-meta {
  justify-content: flex-end;
}

.sender-name {
  font-weight: 600;
  color: var(--text-muted);
}

.used-model-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--accent-primary);
  border: 1px solid rgba(79, 138, 255, 0.2);
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.92rem;
  line-height: 1.65;
  word-break: break-word;
  position: relative;
}

.user-row .message-bubble {
  background: linear-gradient(135deg, #1e3a6e 0%, #172c54 100%);
  color: #f8fafc;
  border: 1px solid rgba(79, 138, 255, 0.25);
  border-top-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.ai-row .message-bubble {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Markdown Formatting Inside AI Bubble */
.ai-row .message-bubble h1,
.ai-row .message-bubble h2,
.ai-row .message-bubble h3,
.ai-row .message-bubble h4 {
  color: var(--text-main);
  margin-top: 14px;
  margin-bottom: 6px;
  font-weight: 600;
}

.ai-row .message-bubble h1:first-child,
.ai-row .message-bubble h2:first-child,
.ai-row .message-bubble h3:first-child {
  margin-top: 0;
}

.ai-row .message-bubble p {
  margin-bottom: 10px;
}

.ai-row .message-bubble p:last-child {
  margin-bottom: 0;
}

.ai-row .message-bubble ul,
.ai-row .message-bubble ol {
  margin-left: 20px;
  margin-bottom: 10px;
}

.ai-row .message-bubble li {
  margin-bottom: 4px;
}

.ai-row .message-bubble blockquote {
  border-left: 3px solid var(--accent-primary);
  background: rgba(79, 138, 255, 0.05);
  padding: 8px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 10px 0;
  color: var(--text-muted);
}

.ai-row .message-bubble code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
}

/* Code Blocks */
.code-block-container {
  margin: 12px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  background: #14161f;
  box-shadow: var(--shadow-sm);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #1a1d28;
  border-bottom: 1px solid #23283a;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-lang-tag {
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: lowercase;
}

.btn-copy-code {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-copy-code:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.code-block-container pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.5;
}

.code-block-container pre code {
  background: transparent !important;
  padding: 0 !important;
  color: inherit;
}

/* Tables in Markdown */
.ai-row .message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
}

.ai-row .message-bubble th,
.ai-row .message-bubble td {
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  text-align: left;
}

.ai-row .message-bubble th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-main);
}

.ai-row .message-bubble tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Message Actions Toolbar */
.message-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message-row:hover .message-actions {
  opacity: 1;
}

.btn-msg-action {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

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

/* Typing & Streaming Cursor Indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
}

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

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

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

.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  vertical-align: middle;
  margin-left: 2px;
  background: var(--accent-primary);
  animation: blink 0.8s infinite;
}

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

/* Scroll to Bottom Button */
.scroll-bottom-btn {
  position: absolute;
  right: 28px;
  bottom: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 20;
}

.scroll-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-bottom-btn:hover {
  color: var(--text-main);
  background: #20273a;
  border-color: var(--border-accent);
}

/* ==========================================================================
   Input Area Bar
   ========================================================================== */

.input-area {
  padding: 12px 24px 20px;
  background: linear-gradient(180deg, transparent 0%, var(--bg-base) 40%);
  position: relative;
  z-index: 30;
}

.input-wrapper {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-container {
  background: rgba(20, 24, 36, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 14px 16px 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-container:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), var(--shadow-glow);
}

.message-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 200px;
  min-height: 24px;
}

.message-textarea::placeholder {
  color: var(--text-dim);
}

.input-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 8px;
}

.input-hints {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.hint-separator {
  opacity: 0.4;
}

.active-model-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-primary);
  background: rgba(79, 138, 255, 0.1);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

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

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--gemini-gradient);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(79, 138, 255, 0.3);
}

.btn-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(79, 138, 255, 0.5);
}

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

.btn-stop {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-stop:hover {
  background: rgba(239, 68, 68, 0.25);
  color: white;
}

.stop-icon {
  font-size: 0.7rem;
}

.footer-caption {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 0 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-card {
  transform: scale(1) translateY(0);
}

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 1.25rem;
}

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

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-desc a {
  color: var(--accent-primary);
  text-decoration: none;
}

.modal-desc a:hover {
  text-decoration: underline;
}

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

.label-with-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.param-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.param-val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.param-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.api-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.api-input-wrap .form-input {
  padding-right: 40px;
  font-family: var(--font-mono);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--border-accent);
}

.btn-toggle-visibility {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.btn-toggle-visibility:hover {
  color: var(--text-main);
}

/* Range Sliders */
.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  outline: none;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(79, 138, 255, 0.5);
  transition: transform 0.1s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.modal-security-tips {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.78rem;
  color: #a7f3d0;
  line-height: 1.45;
}

.api-key-validation-feedback {
  font-size: 0.8rem;
  min-height: 18px;
}

.api-key-validation-feedback.success {
  color: var(--status-success);
}

.api-key-validation-feedback.error {
  color: var(--status-danger);
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.danger-zone {
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-subtle);
}

.text-danger {
  color: var(--status-danger);
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.8rem;
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: white;
  border-color: var(--status-danger);
}

/* Spinner */
.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ==========================================================================
   Toasts Notification
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 2.7s forwards;
}

.toast.success {
  border-left: 3px solid var(--status-success);
}

.toast.error {
  border-left: 3px solid var(--status-danger);
}

.toast.info {
  border-left: 3px solid var(--status-info);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

/* ==========================================================================
   Utility Classes & Responsive Queries
   ========================================================================== */

.hidden {
  display: none !important;
}

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

/* Responsive */
@media (max-width: 900px) {
  .prompt-suggestions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.6);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-toggle-btn {
    display: flex;
  }

  .btn-text-desktop {
    display: none;
  }

  .session-heading {
    max-width: 180px;
  }

  .input-area {
    padding: 10px 14px 16px;
  }

  .chat-container {
    padding: 16px 12px 30px;
  }
}

/* ==========================================================================
   Google Search Grounding & Web Search UI
   ========================================================================== */

.btn-toggle-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn-toggle-search:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
  background: #1c2235;
}

.btn-toggle-search.active {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.45);
  color: #22d3ee;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.22);
}

.btn-toggle-search.active svg {
  stroke: #22d3ee;
  animation: pulse-search 2.5s infinite ease-in-out;
}

@keyframes pulse-search {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 4px #06b6d4); }
}

/* Switch Slider in Settings Modal */
.switch-toggle-label {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch-toggle-label input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  transition: 0.25s ease;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch-toggle-label input:checked + .switch-slider {
  background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  border-color: #06b6d4;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}

.switch-toggle-label input:checked + .switch-slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

/* Grounding & Web Search Results inside Message */
.grounding-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(14, 20, 32, 0.7);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grounding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.grounding-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.75rem;
  color: #22d3ee;
}

.grounding-queries-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.grounding-query-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: #7dd3fc;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.sources-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.sources-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.source-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  overflow: hidden;
}

.source-card:hover {
  background: #1f273c;
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
  color: #38bdf8;
}

.source-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.source-title-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.source-external-icon {
  flex-shrink: 0;
  color: var(--text-dim);
}

.searching-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #22d3ee;
  font-size: 0.82rem;
  padding: 6px 12px;
  background: rgba(6, 182, 212, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.25);
  margin-bottom: 10px;
}

.searching-spin-icon {
  animation: spin 2s linear infinite;
  display: inline-block;
}

/* ==========================================================================
   File Attachment - Attach Button
   ========================================================================== */

.btn-attach {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}
.btn-attach:hover {
  background: rgba(79, 138, 255, 0.12);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.btn-attach svg {
  flex-shrink: 0;
}

/* Attachment Preview Bar */
.attachment-preview {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.attachment-preview.has-attachments {
  display: flex;
  max-height: 120px;
  padding: 8px 0 6px 0;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79, 138, 255, 0.1);
  border: 1px solid rgba(79, 138, 255, 0.3);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 180px;
  position: relative;
  animation: chip-appear 0.2s ease;
}
@keyframes chip-appear {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.attachment-chip-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
}
.attachment-chip-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 5px;
  flex-shrink: 0;
}
.attachment-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.attachment-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  padding: 0;
  margin-left: 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.attachment-chip-remove:hover {
  color: #ef4444;
}

/* Drag & drop highlight on textarea */
.message-textarea.drag-over {
  border-color: var(--accent-primary) !important;
  background: rgba(79, 138, 255, 0.07) !important;
  box-shadow: 0 0 0 2px rgba(79, 138, 255, 0.25);
}

/* Message attachment display */
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.msg-att-img {
  max-width: 260px;
  max-height: 200px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: zoom-in;
  transition: transform 0.2s;
}
.msg-att-img:hover {
  transform: scale(1.02);
}
.msg-att-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.75rem;
  color: #c4b5fd;
}
.msg-att-ext {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #ddd6fe;
}

/* ==========================================================================
   Thinking Budget Slider
   ========================================================================== */

.thinking-slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px 6px;
  background: rgba(15, 20, 30, 0.5);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.thinking-slider-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-shrink: 0;
  white-space: nowrap;
}
.thinking-level-text {
  font-weight: 600;
  font-size: 0.72rem;
  margin-left: 2px;
  transition: color 0.3s;
}

.thinking-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 220px;
}
.thinking-tick {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.thinking-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-medium);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}
.thinking-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gemini-gradient);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(79, 138, 255, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
}
.thinking-range::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}
.thinking-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--gemini-gradient);
  cursor: pointer;
}

/* ==========================================================================
   Active Model Pill - Clickable Button
   ========================================================================== */

.active-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.active-model-pill:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.6);
  color: #ddd6fe;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}
.active-model-pill::after {
  content: '▾';
  font-size: 0.7rem;
  opacity: 0.7;
}

/* ==========================================================================
   Model Picker Popup
   ========================================================================== */

.model-picker-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-end;
  justify-content: center;
}
.model-picker-backdrop.active {
  display: flex;
  animation: fadeIn 0.18s ease;
}

.model-picker-popup {
  width: 100%;
  max-width: 560px;
  max-height: 72vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -16px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(139,92,246,0.1);
  animation: slideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.model-picker-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.model-picker-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  flex-shrink: 0;
}

.model-picker-search-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.model-picker-search-wrap svg {
  color: var(--text-dim);
  flex-shrink: 0;
}
.model-picker-search-wrap input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  width: 100%;
}
.model-picker-search-wrap input::placeholder {
  color: var(--text-dim);
}

.model-picker-close {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.model-picker-close:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.model-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.model-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-main);
  font-family: var(--font-sans);
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 4px;
}
.model-picker-item:hover {
  background: rgba(79, 138, 255, 0.07);
  border-color: var(--border-subtle);
}
.model-picker-item.selected {
  background: rgba(79, 138, 255, 0.1);
  border-color: rgba(79, 138, 255, 0.3);
}

.mpicker-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mpicker-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mpicker-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}
.mpicker-item-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.mpicker-check {
  flex-shrink: 0;
}

/* Model Type Badges inside picker */
.mpicker-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.mpicker-badge.flash {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.mpicker-badge.thinking {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}
.mpicker-badge.pro {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.mpicker-badge.std {
  background: rgba(79, 138, 255, 0.15);
  color: #93bbff;
  border: 1px solid rgba(79, 138, 255, 0.3);
}

.model-picker-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 24px;
}

.model-picker-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 14px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.btn-refresh-models-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 6px 14px;
  transition: all 0.2s;
}
.btn-refresh-models-inline:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(79, 138, 255, 0.07);
}

/* Responsive for model picker on desktop - show as floating panel */
@media (min-width: 769px) {
  .model-picker-backdrop {
    align-items: center;
    justify-content: center;
  }
  .model-picker-popup {
    max-width: 520px;
    max-height: 65vh;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-medium);
    animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  @keyframes popIn {
    from { transform: scale(0.92) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
  }
}

/* ==========================================================================
   Service Plugin Hub & Function Calling UI Styles
   ========================================================================== */

.plugin-active-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  margin-left: auto;
}

.active-plugin-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.plugin-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulseGreen 2s infinite ease-in-out;
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.modal-lg {
  max-width: 680px;
}

.plugin-server-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.server-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #10b981;
}

.server-status-pill.offline {
  color: var(--text-dim);
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseGreen 2s infinite ease-in-out;
}

.server-lan-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.plugins-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.plugin-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.plugin-card:hover {
  border-color: var(--border-medium);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.plugin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plugin-info-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plugin-icon-wrap {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

.plugin-name-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plugin-ver-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.plugin-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.plugin-meta-status {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 8px;
  display: flex;
  gap: 12px;
}

.plugin-meta-status strong {
  color: #34d399;
}

.plugin-tools-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.plugin-tool-chip {
  font-size: 0.68rem;
  background: rgba(79, 138, 255, 0.08);
  border: 1px solid rgba(79, 138, 255, 0.2);
  color: #93bbff;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.plugin-quick-prompts-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.quick-prompts-title {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.quick-prompts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.prompt-chip:hover {
  background: rgba(79, 138, 255, 0.12);
  border-color: rgba(79, 138, 255, 0.4);
  color: #fff;
  transform: translateY(-1px);
}

/* Tool execution status cards in chat bubble */
.tool-call-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

.tool-call-badge.running {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #fde047;
}

.tool-call-badge.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.tool-call-badge.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.tool-spin-icon {
  display: inline-block;
  animation: toolSpin 1s infinite linear;
}

@keyframes toolSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

