@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color Palette - Minimalist Dark */
  --bg-base: #0f0f0f;
  --bg-base-rgb: 15, 15, 15;
  --bg-surface: #1a1a1a;
  --border-color: #2a2a2a;
  --border-color-active: #ffffff;
  
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-muted: #555555;
  
  --accent: #ffffff;
  --error: #ff4d4d;
  --success: #00e676;
  
  --max-width: 1024px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --search-shadow: none;
}

[data-theme="light"] {
  /* Color Palette - Minimalist Light */
  --bg-base: #ffffff;
  --bg-base-rgb: 255, 255, 255;
  --bg-surface: #f9f9f9;
  --border-color: #e5e5e5;
  --border-color-active: #000000;
  
  --text-primary: #111111;
  --text-secondary: #555555;
  --text-muted: #aaaaaa;
  
  --accent: #000000;
  --error: #d32f2f;
  --success: #388e3c;
  
  --search-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
  position: relative;
}

.app-container {
  width: 100%;
  max-width: var(--max-width);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Header logo in top left corner (hidden on landing, visible on results) */
.logo {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1100;
  user-select: none;
}

/* Fade in top-left logo when landing is inactive (results active) */
body:not(.landing-active) .logo {
  opacity: 0.35;
  pointer-events: auto;
  transform: translateY(0);
}

.logo:hover {
  opacity: 0.85;
}

.logo-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-primary);
  border-radius: 50%;
}

.header-actions {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1100;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.1s ease;
  position: relative;
}

.icon-btn:hover {
  opacity: 0.85;
}

.icon-btn:active {
  transform: scale(0.95);
}

.key-status-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--error);
}

.key-status-dot.active {
  background-color: var(--success);
}

/* Centered Search Section */
.search-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 35vh; /* Sits higher up on screen */
  width: 100%;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-section.minimized {
  min-height: auto;
  margin-top: 0;
  margin-bottom: 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-base);
  padding: 1.25rem 0 1rem;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
}

.search-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* Centered big logo title sits in normal flow above search bar */
.landing-logo-title {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  margin-bottom: 1.5rem;
  opacity: 0.95;
  transition: opacity 0.4s ease, transform 0.4s ease, height 0.4s ease, margin 0.4s ease;
  transform: scale(1);
  height: auto;
  user-select: none;
}

/* Collapse landing-logo-title smoothly when search is executed */
.search-section.minimized .landing-logo-title {
  opacity: 0;
  transform: scale(0.9);
  height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Search Box aligned vertically */
.search-box-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.55rem 0.65rem 0.55rem 1rem;
  box-shadow: var(--search-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.search-box-wrapper:focus-within {
  border-color: var(--border-color-active);
  transform: translateY(-1px);
}

/* New Search plus button placed inside search bar on the left */
.search-box-action-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.3;
  margin-right: 0.65rem;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.search-box-action-btn:hover {
  opacity: 0.85;
}

/* Expandable Textarea */
.search-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  padding: 0.25rem 0;
  width: 100%;
  resize: none;
  height: 28px;
  max-height: 180px;
  line-height: 1.4;
  overflow-y: hidden;
}

.search-input::placeholder {
  color: var(--text-secondary);
  font-weight: 500;
}

.search-submit-btn {
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  padding: 0.4rem 0.95rem;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.1s ease;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.search-submit-btn:hover {
  opacity: 0.9;
}

/* Inline Model Switcher inside search bar */
.model-switcher-inline {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.model-switcher-inline .model-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.45;
  transition: all 0.15s ease;
}

.model-switcher-inline .model-toggle-btn:hover {
  opacity: 0.85;
  background-color: var(--border-color);
  color: var(--text-primary);
}

.model-switcher-inline .model-toggle-btn.active {
  opacity: 1;
  color: var(--text-primary);
  background-color: var(--border-color);
}

/* CSS Tooltips */
.tooltip {
  position: relative;
}

.tooltip .tooltiptext {
  visibility: hidden;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  text-align: center;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-sans);
  white-space: nowrap;
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  pointer-events: none;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Results Display Area */
.results-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.results-container.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Q&A Notebook/Results Layout */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.qa-turn {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  animation: fadeIn 0.3s ease-out;
  padding: 2.5rem 0;
  scroll-margin-top: 130px; /* Offset for sticky header when scrolling to turn */
}

/* Force the very last question block to expand to the bottom of the screen. 
   This elegantly creates necessary scrolling room for new questions without leaving permanently huge whitespace. */
.qa-turn:last-child {
  min-height: calc(100vh - 130px);
}

.qa-query-header {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  border-left: 3px solid var(--border-color-active);
  padding-left: 0.75rem;
}

.qa-query-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
}

.qa-answer {
  width: 100%;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.qa-metadata {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}



.qa-attribution {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.85rem;
}

/* Brutal override of all inline Google branding colors */
.qa-attribution * {
  background-color: transparent !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  box-shadow: none !important;
}

.qa-attribution a {
  background-color: var(--bg-surface) !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  transition: all 0.2s ease !important;
}

.qa-attribution a:hover,
.qa-attribution a:hover * {
  border-color: var(--border-color-active) !important;
  color: var(--text-primary) !important;
}

.qa-attribution svg {
  opacity: 0.5;
  filter: grayscale(100%);
  transition: all 0.2s ease;
}

.qa-attribution:hover svg {
  opacity: 0.8;
  filter: grayscale(0%);
}

.google-search-chip {
  margin-top: 0.25rem;
}

.qa-sources {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

/* Page rule / divider between Q&A turns */
.qa-divider {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 0.75rem 0;
}

/* Shared styling for streamed text body inside the turn container */
.answer-body p {
  margin-bottom: 0.85rem;
}

.answer-body h1, .answer-body h2, .answer-body h3 {
  color: var(--text-primary);
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.answer-body h1 { font-size: 1.25rem; }
.answer-body h2 { font-size: 1.15rem; }
.answer-body h3 { font-size: 1.05rem; }

.answer-body ul {
  list-style-type: disc;
  margin-bottom: 0.85rem;
  padding-left: 1.15rem;
}

.answer-body ol {
  list-style-type: decimal;
  margin-bottom: 0.85rem;
  padding-left: 1.15rem;
}

/* Markdown Table Styles */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.answer-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9rem;
}

.answer-body th, .answer-body td {
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  text-align: left;
}

.answer-body th:last-child, .answer-body td:last-child {
  border-right: none;
}

.answer-body th {
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--text-primary);
}

.answer-body tr:last-child td {
  border-bottom: none;
}

.answer-body li {
  margin-bottom: 0.2rem;
}

.answer-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.25rem;
  border-radius: 2px;
}

.answer-body pre {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.8rem;
  border-radius: 3px;
  overflow-x: auto;
  margin-bottom: 0.85rem;
}

.answer-body pre code {
  background: transparent;
  border: none;
  padding: 0;
}

/* Standard Links Styling */
.answer-body a:not(.citation) {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-color);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
  font-weight: 500;
}

.answer-body a:not(.citation):hover {
  text-decoration-color: var(--border-color-active);
}

/* Citations Styling */
.citation-group {
  display: inline;
}

.citation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 500;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  margin: 0 1px;
  cursor: pointer;
  text-decoration: none;
  vertical-align: super;
  transition: all 0.1s ease;
}

.citation:hover {
  border-color: var(--border-color-active);
  color: var(--text-primary);
}

/* Sources Section */
.sources-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.sources-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

/* Compact Horizontal shelf of sources */
.sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Capsule source item */
.source-item {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--text-secondary);
  position: relative;
  cursor: pointer;
}

.source-item:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.source-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.35rem;
}

.source-title-text {
  max-width: 160px; /* Restrict width so horizontal layout fits */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}





/* Google Search Entry Point */
.google-attribution {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0;
  margin-top: 0.5rem;
}

.google-search-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.7rem;
  border-radius: 3px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.google-search-chip:hover {
  border-color: var(--border-color-active);
  color: var(--text-primary);
}

.google-logo-svg {
  width: 12px;
  height: 12px;
}

/* Skeletons */
.skeleton-bar {
  height: 0.85rem;
  background: var(--border-color);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.skeleton-bar::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

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

/* Modal Backdrop */
.drawer-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Login Modal */
.login-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 280px;
  background: var(--bg-surface);
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  padding: 1.25rem;
  z-index: 1000;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  20%, 60% { transform: translate(calc(-50% - 4px), -50%) scale(1); }
  40%, 80% { transform: translate(calc(-50% + 4px), -50%) scale(1); }
}

.login-modal.shake {
  animation: shake 0.4s ease-in-out;
}

.login-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.drawer-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.drawer-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  flex-grow: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.form-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  width: 100%;
}

.form-input:focus {
  border-color: var(--border-color-active);
  outline: none;
}

/* System Instructions Textarea Height */
textarea.form-input {
  resize: vertical;
  min-height: 180px;
}

.drawer-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.btn {
  padding: 0.5rem 0.75rem;
  border-radius: 3px;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  flex-grow: 1;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-base);
  border: none;
}

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

.btn-secondary:hover {
  background: var(--bg-surface);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 300px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  border-radius: 4px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  font-size: 1rem;
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: auto;
  padding: 3rem 0 1rem;
}

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

/* Stop button state */
.search-submit-btn.stop-mode {
  background: var(--error);
  color: #ffffff;
}

.search-submit-btn.stop-mode:hover {
  opacity: 0.85;
}

@media (max-width: 640px) {
  .logo, .header-actions {
    top: 1rem;
  }
  .logo { left: 1rem; }
  .header-actions { right: 1rem; }

  /* Prevent minimized search bar from overlapping the fixed logo/actions row */
  .search-section.minimized {
    padding-top: 3.25rem;
  }
  
  /* Mobile Model Switcher: Single icon that expands */
  .model-switcher-inline {
    gap: 0;
  }
  .model-switcher-inline .model-toggle-btn:not(.active) {
    display: none;
  }
  .model-switcher-inline:focus-within .model-toggle-btn,
  .model-switcher-inline:hover .model-toggle-btn {
    display: grid;
  }
  .model-switcher-inline:focus-within,
  .model-switcher-inline:hover {
    position: absolute;
    right: 3rem;
    top: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    flex-direction: row;
    gap: 0.25rem;
    padding: 0.15rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 100;
  }
  
  /* Mobile Search Button: Arrow Icon */
  .search-submit-btn span.search-btn-text {
    display: none;
  }
  .search-submit-btn svg.search-btn-icon {
    display: block !important;
  }
  .search-submit-btn {
    padding: 0.45rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
  }

  /* Mobile floating history: keep clear of bottom edge */
  .floating-history {
    bottom: 1.25rem;
    right: 1.25rem;
  }
  .history-fab {
    width: 42px;
    height: 42px;
  }
  .history-dropdown {
    width: 240px;
  }
}

/* Floating History Menu */
.floating-history {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body:not(.landing-active) .floating-history {
  opacity: 1;
  pointer-events: auto;
}

.history-fab {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--search-shadow);
  transition: all 0.2s ease;
  position: relative;
}

.history-fab:hover {
  background: var(--bg-base);
  border-color: var(--border-color-active);
  transform: translateY(-2px);
}

.history-fab .tooltiptext {
  right: calc(100% + 10px);
  bottom: auto;
  left: auto;
  transform: none;
  white-space: nowrap;
}

.history-dropdown {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  width: 280px;
  max-height: 50vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.floating-history:hover .history-dropdown,
.floating-history:focus-within .history-dropdown {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.history-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 0.25rem 0;
}

.history-item:hover {
  color: var(--text-primary);
}
