/* ==================== FRONTEND/CSS/CHAT.CSS ==================== */

/* ==================== MAIN CHAT AREA ==================== */

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-dark);
  position: relative;
  min-width: 0;
  overflow: hidden;
}

/* TOP NAV (ANTIGRAVITY MINIMALIST) */
.top-nav {
  height: 50px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background-color: var(--bg-nav);
  z-index: 5;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* CLEAN CHAT TITLE DISPLAY (GOOGLE AI STUDIO STYLE) */
.session-title-wrap, .session-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: transparent;
  border: none;
  padding: 4px 6px;
  max-width: 260px;
  min-width: 0;
  user-select: text;
}

.session-title-icon, .session-icon {
  font-size: 13px;
  color: var(--primary);
  opacity: 0.85;
  flex-shrink: 0;
}

.session-title-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}


/* GOOGLE AI STUDIO TOP NAV TOKEN COUNTER & LIVE COST WIDGET */
.nav-token-widget-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-nav-token-usage {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-nav-token-usage:hover, .btn-nav-token-usage.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.4);
  color: #fff;
  transform: translateY(-0.5px);
}

.nav-cache-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  animation: pulseGlow 2.5s infinite ease-in-out;
}

.nav-cache-status-badge.hidden {
  display: none !important;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.85; box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
  50% { opacity: 1; box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
}

.nav-token-icon {
  font-size: 11px;
  opacity: 0.65;
  transition: transform 0.2s ease;
}

.btn-nav-token-usage:hover .nav-token-icon {
  opacity: 1;
  color: var(--primary, #8b5cf6);
}

.nav-token-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 330px;
  background: rgba(18, 20, 29, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(139, 92, 246, 0.15);
  padding: 15px 16px;
  z-index: 1000;
  font-size: 12.5px;
  color: #e2e8f0;
  animation: fadeInSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-token-popover.hidden {
  display: none !important;
}

.token-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
  color: #f8fafc;
}

.token-popover-title {
  font-size: 13px;
  letter-spacing: -0.2px;
}

.token-popover-fraction {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 12px;
  color: var(--primary-light, #a78bfa);
}

.token-usage-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.token-usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.token-popover-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3.5px 0;
  font-size: 12px;
  color: #94a3b8;
}

.token-popover-row .token-row-value {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  color: #e2e8f0;
  font-weight: 500;
}

.token-popover-row.total-row {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-weight: 600;
}

.token-popover-row.total-row .total-val {
  color: #f8fafc;
  font-weight: 700;
}

.token-popover-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px 0 10px 0;
}

.token-popover-section-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.cost-dual-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cost-idr-badge {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
}

.token-popover-disclaimer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10px;
  line-height: 1.45;
  color: #64748b;
}

.token-popover-disclaimer p {
  margin: 0;
}

.rate-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  margin-bottom: 6px;
}

/* 2-TIER CONTEXT WINDOW & TOKEN USAGE POPOVER ENHANCEMENTS */
.token-popover-section {
  padding: 2px 0;
}

.token-header-left {
  display: flex;
  align-items: center;
}

.token-popover-pct {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-green, #10b981);
}

.token-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 6px 8px;
}

.token-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.token-stat-label {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.token-stat-val {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 11.5px;
  font-weight: 600;
  color: #f1f5f9;
}

.token-lifetime-total {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan, #38bdf8);
}

.cache-val {
  color: var(--accent-green, #10b981) !important;
  font-weight: 600;
}

/* ==================== CONTEXT WARNING & HANDOVER BANNER ==================== */
.context-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(217, 119, 6, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-top: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  color: #fef3c7;
  font-size: 12px;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.08);
  animation: fadeInSlideUp 0.25s ease;
}

.context-warning-banner.hidden {
  display: none !important;
}

.warning-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.warning-banner-text i {
  color: #f59e0b;
  font-size: 15px;
  flex-shrink: 0;
}

.btn-summarize-rollover {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-summarize-rollover:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
  filter: brightness(1.1);
}

/* ==================== HERO FRESH CHAT BUTTON ==================== */
.hero-fresh-chat-wrap {
  margin-bottom: 12px;
  animation: fadeInSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-fresh-chat-wrap.hidden {
  display: none !important;
}

.btn-hero-fresh-chat {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(56, 189, 248, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding: 14px 18px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2), 0 0 0 1px rgba(99, 102, 241, 0.2);
  animation: pulseGlow 2.5s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2), 0 0 0 1px rgba(99, 102, 241, 0.2);
  }
  50% {
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.38), 0 0 16px rgba(56, 189, 248, 0.3);
    border-color: rgba(99, 102, 241, 0.7);
  }
}

.btn-hero-fresh-chat:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(56, 189, 248, 0.25));
  border-color: rgba(99, 102, 241, 0.8);
}

.hero-fresh-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  font-size: 18px;
  flex-shrink: 0;
}

.hero-fresh-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-fresh-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.2px;
}

.hero-fresh-sub {
  font-size: 12px;
  color: #94a3b8;
}

.hero-fresh-arrow {
  color: #818cf8;
  font-size: 15px;
  transition: transform 0.2s ease;
}

.btn-hero-fresh-chat:hover .hero-fresh-arrow {
  transform: translateX(4px);
  color: #a5b4fc;
}

/* ==================== EXECUTIVE CONTEXT SUMMARY CARD ==================== */
.executive-summary-card {
  background: rgba(18, 20, 30, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.summary-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.summary-card-title i {
  color: #818cf8;
}

.btn-copy-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-summary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.summary-card-body {
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
}

.nav-chevron {
  display: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* CHAT CONTAINER (RESPONSIVE & FLUID) */
.chat-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overflow-anchor: auto;
  overscroll-behavior-y: contain;
  padding: 16px 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.chat-container::-webkit-scrollbar {
  width: 8px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==================== GOOGLE AI STUDIO LANDING HOME HERO ==================== */
.home-hero-container {
  margin: auto;
  width: 100%;
  max-width: 1140px;
  text-align: center;
  padding: 30px 20px 40px;
  box-sizing: border-box;
  animation: fadeInHero 0.28s ease-out;
}

@keyframes fadeInHero {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-header-section {
  margin-bottom: 28px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  color: #818CF8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  margin-bottom: 14px;
  letter-spacing: 0.3px;
}

.hero-title {
  font-size: 27px;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: -0.6px;
  color: var(--text-main);
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto;
}

/* 6 FLOATING WORKSPACE CARDS GRID */
.workspace-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: left;
}

.workspace-card {
  background: rgba(18, 18, 24, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 145px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.workspace-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.15);
  background: rgba(26, 26, 36, 0.85);
}

.ws-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ws-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ws-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.ws-card-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-card-open-icon {
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.workspace-card:hover .ws-card-open-icon {
  color: #818CF8;
  transform: translate(2px, -2px);
}

.ws-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}

.ws-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
  margin-top: auto;
}

.ws-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  padding: 2.5px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
}

.ws-card-time {
  font-size: 10.5px;
  color: var(--text-dim);
}

/* ACTION CARD (+ NEW / VIEW ALL) */
.workspace-card.action-card {
  border: 1px dashed rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 145px;
}

.workspace-card.action-card:hover {
  border-color: rgba(99, 102, 241, 0.75);
  background: rgba(99, 102, 241, 0.09);
}

.ws-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.16);
  color: #818CF8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-bottom: 2px;
}

.ws-action-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.ws-action-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 220px;
}

@media (max-width: 1020px) {
  .workspace-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .workspace-cards-grid {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 12px !important;
    padding: 6px 4px 14px 4px !important;
    margin: 0 -12px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    scrollbar-width: none !important;
  }
  .workspace-cards-grid::-webkit-scrollbar {
    display: none !important;
  }
  .workspace-card {
    flex: 0 0 230px !important;
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
    min-height: 110px !important;
    padding: 14px 14px !important;
    border-radius: 14px !important;
    scroll-snap-align: start !important;
    box-sizing: border-box !important;
  }
  .ws-card-desc {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 11.5px !important;
    color: var(--text-dim) !important;
    margin-top: 4px !important;
  }
  .ws-card-title,
  .ws-card-name {
    font-size: 13.5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 140px !important;
    font-weight: 600 !important;
  }
  .ws-card-icon,
  .ws-card-icon-wrap {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
  }
  .ws-card-open-icon,
  .ws-card-arrow {
    font-size: 12px !important;
  }
  .ws-card-footer {
    margin-top: 10px !important;
    gap: 6px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
  }
  .ws-card-badges {
    gap: 6px !important;
    flex-wrap: nowrap !important;
    display: flex !important;
    align-items: center !important;
  }
  .ws-pill-badge {
    padding: 2px 7px !important;
    font-size: 10px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
  }
  .ws-card-time {
    font-size: 10px !important;
    white-space: nowrap !important;
    color: var(--text-dim) !important;
    opacity: 0.8 !important;
  }
  .workspace-card.action-card {
    flex: 0 0 170px !important;
    width: 170px !important;
    min-width: 170px !important;
    max-width: 170px !important;
    padding: 12px 10px !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
  .workspace-card.action-card .ws-action-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
    margin-bottom: 6px !important;
  }
  .workspace-card.action-card .ws-action-title {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }
  .workspace-card.action-card .ws-action-sub {
    display: block !important;
    font-size: 10.5px !important;
    opacity: 0.75 !important;
  }
  .workspace-card.action-card .ws-action-link {
    font-size: 11px !important;
    padding: 4px 8px !important;
    margin-top: 6px !important;
  }

  .hero-title {
    font-size: 19px !important;
    margin-bottom: 4px !important;
  }
  .hero-subtitle {
    font-size: 11.5px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    margin-bottom: 12px !important;
  }
  .home-hero-container {
    padding: 10px 6px 14px !important;
  }
}

/* WELCOME SCREEN (LEGACY FALLBACK) */

.f-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.f-card h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.f-card p {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.45;
}

/* MESSAGES LIST (GOOGLE AI STUDIO FOCUSED READING COLUMN - 1000PX) */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 80px;
  width: 100%;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  min-width: 0;
}

.message-wrapper {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.2s ease-out;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-wrapper.user-msg {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md, 8px);
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.message-wrapper.user-msg:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.09);
}

.message-wrapper.ai-msg {
  padding: 4px 2px;
}

.message-avatar-inline {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
}

.user-msg .message-avatar-inline {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

.ai-msg .message-avatar-inline {
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  box-shadow: 0 0 10px var(--primary-glow);
}

.message-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1;
  box-sizing: border-box;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.message-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* BUBBLE ACTION BAR */
.bubble-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.message-wrapper:hover .bubble-actions {
  opacity: 1;
}

.btn-bubble-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-bubble-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.message-content {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-main);
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow-y: clip;
  position: relative;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 6px;
}

.message-content p {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  overflow-y: clip;
  line-height: 1.85;
  isolation: isolate;
}
.message-content p:last-child { margin-bottom: 0; }

.message-content h1, .message-content h2, .message-content h3 {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 18px;
  margin-bottom: 8px;
  color: #fff;
  font-weight: 700;
  overflow-y: clip;
}

.message-content hr {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 18px 0;
}

.message-content ul,
.message-content ol {
  margin: 0 0 12px 0;
  padding-left: 24px;
  box-sizing: border-box;
}

.message-content li {
  margin-bottom: 4px;
  line-height: 1.75;
  box-sizing: border-box;
  overflow-y: clip;
}

.message-content li > ul,
.message-content li > ol {
  margin-top: 4px;
  margin-bottom: 4px;
  padding-left: 20px;
}

.message-content blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid #0284c7;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #d4d4d4;
  font-style: normal;
  box-sizing: border-box;
}

.message-content blockquote blockquote {
  margin: 6px 0;
  padding-left: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-left-color: var(--accent-cyan);
}

.message-content blockquote p {
  margin-bottom: 6px;
}
.message-content blockquote p:last-child {
  margin-bottom: 0;
}

.message-content blockquote ul,
.message-content blockquote ol {
  padding-left: 20px;
  margin-bottom: 8px;
}

.message-content code:not(pre code) {
  font-family: var(--font-mono);
  background: rgba(30, 38, 60, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #93c5fd;
}

/* KEYBOARD SHORTCUTS <kbd> */
kbd,
.message-content kbd,
.doc-reader-body kbd,
.thinking-content kbd,
.modal-body kbd {
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #444444;
  border-bottom: 2px solid #555555;
  background: #222222;
  font-family: var(--font-mono, monospace);
  font-size: 0.85em;
  color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  display: inline-block;
  line-height: 1.2;
  vertical-align: baseline;
  white-space: nowrap;
}



/* ==================== MARKDOWN LINKS ==================== */

.message-content a,
.doc-reader-body a,
.citation-snippet-content a,
a.markdown-link {
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  transition: color 0.15s ease;
}

.message-content a:hover,
.doc-reader-body a:hover,
.citation-snippet-content a:hover,
a.markdown-link:hover {
  color: #7dd3fc;
}

/* ANTI-PHISHING SUSPICIOUS LINK BADGE */
a.markdown-link.link-suspicious {
  color: #fbbf24 !important;
  text-decoration-style: dashed !important;
}
a.markdown-link.link-suspicious::after {
  content: " ⚠️";
  font-size: 0.85em;
}

/* ==================== GLOBAL MEDIA DIMENSION CONTAINMENT ==================== */
.message-content img,
.message-content img.markdown-image,
.message-content svg.markdown-svg-inline,
.message-content svg:not(.mermaid-diagram-card svg):not(.katex svg):not(.svg-inline--fa),
.doc-reader-body img,
.doc-reader-body svg:not(.svg-inline--fa),
.citation-snippet-content img {
  max-width: 100% !important;
  max-height: 450px !important;
  height: auto !important;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
  margin: 10px 0;
  box-sizing: border-box;
}

.message-content video,
.message-content canvas,
.message-content iframe:not(.artifact-preview-frame) {
  max-width: 100% !important;
  max-height: 450px !important;
  height: auto !important;
  object-fit: contain;
  box-sizing: border-box;
}

.message-content img[alt] {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}



/* ==================== MARKDOWN TABLES (ANTIGRAVITY THEME & MOBILE SCROLL) ==================== */

.markdown-table-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: #1a1a1a;
  box-sizing: border-box;
  scrollbar-width: thin;
}

.markdown-table-wrapper::-webkit-scrollbar {
  height: 6px;
}
.markdown-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.markdown-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.markdown-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.message-content table,
table.markdown-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  margin: 0;
  background-color: transparent;
  border: none;
  table-layout: auto;
}

.message-content th,
table.markdown-table th {
  background-color: #282828;
  color: #FFFFFF;
  font-weight: 600;
  padding: 10px 16px;
  border: 1px solid var(--border-input);
  text-align: left;
  white-space: nowrap;
  min-width: 160px;
}

.message-content td,
table.markdown-table td {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
  min-width: 180px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.message-content td a,
table.markdown-table td a {
  white-space: nowrap !important;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.message-content tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.message-content tr:hover {
  background-color: rgba(255, 255, 255, 0.04);
}



/* ==================== TASK LIST CHECKBOXES FIX ==================== */

.message-content li:has(> input[type="checkbox"]) {
  list-style: none !important;
  margin: 4px 0;
  display: block;
}

.message-content li:has(> input[type="checkbox"]) input[type="checkbox"],
.message-content input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  cursor: pointer;
}



/* ==================== MERMAID DIAGRAM CONTAINER ==================== */

.mermaid-diagram-card {
  margin: 16px 0;
  background: #181818;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.mermaid-diagram-card svg {
  max-width: 100%;
  height: auto;
}



/* ==================== KATEX MATH BLOCK & INLINE ==================== */

.katex-display-wrap,
.katex-display {
  margin: 14px 0;
  padding: 8px 12px;
  background: var(--bg-code, #10131E);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-sm);
  overflow-x: auto !important;
  overflow-y: hidden !important;
  text-align: center;
  max-width: 100%;
  scrollbar-width: thin;
}

.katex {
  font-size: 1.05em;
  text-rendering: auto;
}

.message-content .katex {
  font-size: 1.05em;
}



/* ==================== CODEBLOCK CONTAINER ==================== */

.code-block-container {
  margin: 14px 0;
  border-radius: var(--radius-md);
  background-color: #10131E;
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background-color: rgba(19, 24, 38, 0.95);
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  gap: 8px;
  flex-wrap: wrap;
}

.code-lang-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.code-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-code-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  min-width: 28px;
  width: auto;
  height: 26px;
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-code-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.code-block-container pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 480px;
  background: #0C0E17;
  border: none;
  max-width: 100%;
  box-sizing: border-box;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.code-block-container pre code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
}

/* GIT DIFF SYNTAX HIGHLIGHTING */
.diff-line {
  display: block;
  padding: 0 4px;
  font-family: var(--font-mono);
  border-radius: 2px;
}
.diff-line.diff-add {
  color: #4ade80 !important;
  background: rgba(74, 222, 128, 0.12);
}
.diff-line.diff-del {
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.12);
}
.diff-line.diff-info {
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.08);
}

.code-block-container.collapsed pre {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0;
  overflow: hidden;
}

.code-block-container.collapsed .code-block-header {
  border-bottom: none;
}

/* GROUNDED CITATION BADGES */
.citation-badges-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.citation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.citation-badge:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--primary);
}

/* SEARCH GROUNDING WEB LINKS */
.search-links-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.search-link-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: #67e8f9;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.15s ease;
}

.search-link-pill:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
}

/* MESSAGE FOOTER & UNIFIED 1-FRAME META CAPSULE */
.message-meta {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important; /* Desktop: Ujung Kanan */
  width: 100% !important;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  isolation: isolate;
  clear: both;
}

.unified-meta-capsule {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  background: rgba(18, 23, 36, 0.75) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 20px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  color: var(--text-dim) !important;
  font-family: var(--font-mono) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  max-width: 100% !important;
  white-space: nowrap !important;
}

.capsule-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.capsule-divider {
  color: rgba(255, 255, 255, 0.15) !important;
  font-size: 10px !important;
  user-select: none !important;
}

.capsule-cache.is-hit {
  color: var(--accent-green) !important;
  font-weight: 600 !important;
}

.capsule-cache.is-miss {
  color: var(--text-muted) !important;
}

@media (max-width: 768px) {
  .message-meta {
    justify-content: center !important; /* Mobile: Center */
    margin-top: 8px !important;
    padding-top: 6px !important;
  }
  .unified-meta-capsule {
    margin: 0 auto !important;
    padding: 3px 8px !important;
    font-size: 10px !important;
    gap: 5px !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
}

.msg-actions {
  display: flex;
  gap: 4px;
}



/* ==================== NUMBERED MICRO-PILLS CITATION ==================== */

.citation-badges-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.citation-badge-micro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.citation-badge-micro:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px) scale(1.08);
  box-shadow: 0 0 10px var(--primary-glow);
}



/* ==================== CITATION SOURCE INSPECTOR ==================== */

.modal-citation-card {
  width: 640px;
  max-width: 95vw;
}

.citation-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.citation-snippet-box {
  background: rgba(11, 13, 20, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.snippet-header {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.citation-snippet-content {
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-main);
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.citation-snippet-content mark {
  background: rgba(234, 179, 8, 0.28);
  color: #fef08a;
  border-bottom: 2px solid #eab308;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}



/* ==================== INTERACTIVE CODE SANDBOX RUNNER ==================== */

.btn-code-run {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
  transition: all 0.2s ease;
}

.btn-code-run:hover {
  background: #22c55e;
  color: #000;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.code-output-terminal {
  background: #090a10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: #a7f3d0;
  overflow-x: auto;
  animation: slashFadeIn 0.2s ease;
}

.code-output-terminal.error-output {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}

.sandbox-stdin-card {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sandbox-stdin-header {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sandbox-stdin-row {
  display: flex;
  gap: 6px;
}

.sandbox-stdin-input {
  flex: 1;
  background: #090a10;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11.5px;
  outline: none;
}

.sandbox-stdin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.btn-stdin-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-stdin-submit:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 10px var(--primary-glow);
}



/* ==================== DYNAMIC THINKING ACCORDION ==================== */

.thinking-accordion {
  margin-bottom: 12px;
  background: rgba(18, 22, 35, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-left: 3px solid #8b5cf6;
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.thinking-accordion summary {
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(139, 92, 246, 0.08);
  transition: background 0.15s ease;
}

.thinking-accordion summary:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-bright);
}

.thinking-badge {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: #c084fc;
}

.thinking-status {
  font-size: 11px;
  color: var(--text-dim);
}

.thinking-content {
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #94a3b8;
  border-top: 1px solid var(--border-color);
  max-height: 320px;
  overflow-y: auto;
  font-family: var(--font-sans);
}



/* ==================== ARTIFACTS / LIVE CANVAS PREVIEWER ==================== */

.code-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.artifact-tabs-group {
  display: inline-flex;
  align-items: center;
  background: rgba(16, 21, 34, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.btn-artifact-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-artifact-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-artifact-tab.active {
  background: var(--primary);
  color: #FFFFFF;
}

.artifact-preview-frame {
  width: 100%;
  min-height: 380px;
  border: none;
  background: #FFFFFF;
  display: block;
}



/* ==================== PYTHON SANDBOX & MATPLOTLIB AUTO-PLOT ==================== */

.btn-code-run-sandbox {
  background: rgba(30, 36, 52, 0.8) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-top: 1px solid var(--border-glass-specular) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 0 10px !important;
  height: 24px !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}

.btn-code-run-sandbox:hover {
  background: rgba(45, 55, 80, 0.9) !important;
  border-color: var(--primary) !important;
}

.sandbox-terminal-output {
  margin-top: 2px;
  background: #090B12;
  border-top: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 12px;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #111420;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.terminal-status.status-ok { color: var(--accent-green); }
.terminal-status.status-err { color: #ef4444; }

.terminal-body {
  padding: 10px 14px;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.5;
}

.sandbox-plot-card {
  margin: 10px 12px 14px;
  background: #111420;
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.plot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.btn-download-plot {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-download-plot:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--primary);
}

.sandbox-plot-img {
  width: 100%;
  max-width: 650px;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.sandbox-plot-img:hover {
  transform: scale(1.01);
}

.plot-card-hint {
  font-size: 10.5px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 6px;
}

/* SPEAKER BUTTON ACTIVE ANIMATION */
.btn-bubble-speak.speaking {
  color: var(--primary) !important;
  animation: pulseSpeak 1.2s infinite ease-in-out;
}

@keyframes pulseSpeak {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.75; }
}

/* ==================== FOOTNOTES STYLING ==================== */
.footnote-ref {
  font-size: 0.78em;
  font-weight: 700;
  vertical-align: super;
  margin-left: 2px;
  line-height: 0;
}

.footnote-link {
  color: var(--primary) !important;
  text-decoration: none !important;
  padding: 0 2px;
  border-radius: 2px;
}

.footnote-link:hover {
  text-decoration: underline !important;
  color: var(--accent-cyan) !important;
  background: rgba(99, 102, 241, 0.15);
}

.footnotes-section {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  font-size: 13px;
  color: var(--text-muted);
}

.footnotes-heading {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.footnotes-list {
  padding-left: 22px;
  margin: 0;
}

.footnote-item {
  margin-bottom: 6px;
  line-height: 1.55;
  color: var(--text-main);
}

.footnote-backref {
  color: var(--primary) !important;
  text-decoration: none !important;
  font-weight: 700;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 3px;
}

.footnote-backref:hover {
  color: var(--accent-cyan) !important;
  background: rgba(99, 102, 241, 0.15);
}

/* ==================== MERMAID DIAGRAM CARD ==================== */
.mermaid-diagram-card {
  margin: 16px 0;
  background: #10131E;
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-md);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  box-sizing: border-box;
}

.mermaid-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(19, 24, 38, 0.95);
  border-bottom: 1px solid var(--border-color);
}

.mermaid-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mermaid-actions {
  display: flex;
  gap: 6px;
}

.btn-mermaid-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mermaid-action:hover,
.btn-mermaid-action.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-color);
}

.mermaid-svg-container {
  padding: 20px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: thin;
}

.mermaid-svg-container svg {
  max-width: 100% !important;
  height: auto !important;
}

.mermaid-raw-code {
  margin: 0;
  padding: 14px;
  background: #141414;
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
}

.mermaid-raw-code.hidden {
  display: none;
}

.mermaid-fallback-box {
  width: 100%;
  border-radius: var(--radius-sm);
  background: #141414;
  border: 1px solid var(--border-color);
}

.mermaid-fallback-title {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: #1f1f1f;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==================== GFM ADMONITIONS / CALLOUT BANNERS ==================== */
.markdown-callout {
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow-sm);
}

.markdown-callout p {
  margin: 4px 0;
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
}

.callout-note {
  border-left-color: #0078D4 !important;
  background: rgba(0, 120, 212, 0.08) !important;
}
.callout-note .callout-header {
  color: #58a6ff;
}

.callout-tip {
  border-left-color: #238636 !important;
  background: rgba(35, 134, 54, 0.08) !important;
}
.callout-tip .callout-header {
  color: #3fb950;
}

.callout-important {
  border-left-color: #8957e5 !important;
  background: rgba(137, 87, 229, 0.08) !important;
}
.callout-important .callout-header {
  color: #a371f7;
}

.callout-warning {
  border-left-color: #d29922 !important;
  background: rgba(210, 153, 34, 0.08) !important;
}
.callout-warning .callout-header {
  color: #d29922;
}

.callout-caution {
  border-left-color: #da3633 !important;
  background: rgba(218, 54, 51, 0.08) !important;
}
.callout-caution .callout-header {
  color: #f85149;
}

/* ==================== AGENTIC TOOL ACTIVITY PILLS ==================== */
.tool-activity-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.tool-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color, #333333);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary, #cccccc);
  width: fit-content;
  max-width: 100%;
  transition: all 0.2s ease;
}

.tool-call-pill.running {
  border-color: rgba(0, 120, 212, 0.4);
  background: rgba(0, 120, 212, 0.08);
  color: #58a6ff;
}

.tool-call-pill.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
}

.tool-call-pill.failed {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
}

.tool-call-pill .tool-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(0, 120, 212, 0.2);
  border-top-color: var(--primary, #0078D4);
  border-radius: 50%;
  animation: toolSpin 0.75s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes toolSpin {
  to { transform: rotate(360deg); }
}

.text-green {
  color: #4ade80 !important;
}

.text-red {
  color: #f87171 !important;
}


/* ==================== TURN 3: AT-MENTION AUTOCOMPLETE POPOVER ==================== */

.at-mention-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 14px;
  width: 380px;
  max-width: calc(100% - 28px);
  background: rgba(13, 17, 28, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-top: 1px solid rgba(129, 140, 248, 0.55);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(99, 102, 241, 0.22);
  z-index: 1000;
  overflow: hidden;
  animation: popoverSlideUp 0.15s ease-out;
}

.at-mention-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  color: #a78bfa;
  white-space: nowrap;
}

.at-mention-hint {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  font-family: var(--font-mono, monospace);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.at-mention-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.at-mention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
  gap: 8px;
  border: 1px solid transparent;
}

.at-mention-item:hover, .at-mention-item.selected {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
}

.at-mention-item-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.at-mention-icon {
  color: #818cf8;
  font-size: 12px;
  flex-shrink: 0;
}

.at-mention-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-mention-item.selected .at-mention-title {
  color: #fff;
  font-weight: 600;
}

.at-mention-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.at-mention-scope-badge {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.at-mention-scope-badge.project {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

/* ==================== GOOGLE AI STUDIO CENTER CANVAS SPINNER ==================== */
.canvas-loading-spinner {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: absolute !important;
  inset: 0 !important;
  background: rgba(10, 12, 18, 0.88) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  z-index: 40 !important;
  transition: opacity 0.18s ease !important;
}

.canvas-loading-spinner.hidden {
  display: none !important;
}

.ai-studio-spinner-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-cyan, #38bdf8);
  border-right-color: var(--primary, #6366f1);
  animation: aiStudioSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}

@keyframes aiStudioSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Silky Fade-In Animation for Loaded Chat & Hub Content */
.fade-in {
  animation: smoothContentFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes smoothContentFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

