/* ==========================================================================
   AI Project History GUI — Modern Dark Glassmorphism CSS Design System
   ========================================================================== */

:root {
  --bg-dark: #070a12;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: rgba(15, 23, 42, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.35);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --accent-glow: 0 0 20px rgba(99, 102, 241, 0.35);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --badge-walkthrough: #10b981;
  --badge-plan: #3b82f6;
  --badge-task: #f59e0b;
  --badge-memory: #8b5cf6;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.6);
}

/* ==========================================================================
   Header Navbar
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--accent-glow);
}

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

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

.header-stats {
  display: flex;
  gap: 0.5rem;
}

.stat-pill {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
}
.stat-pill strong {
  color: var(--accent-primary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: var(--accent-primary);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 2rem;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ==========================================================================
   Search View
   ========================================================================== */
.search-hero {
  margin-bottom: 2rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1.25rem;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  color: var(--text-muted);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 1rem 3.5rem 1rem 3.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1.05rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s ease;
}

#searchInput:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(15, 23, 42, 0.9);
}

.keyboard-hint {
  position: absolute;
  right: 1.25rem;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.btn-clear {
  position: absolute;
  right: 3rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}
.btn-clear:hover { color: #fff; }

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.select-input {
  padding: 0.45rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}
.select-input:focus {
  border-color: var(--accent-primary);
}

.pill-group {
  display: flex;
  gap: 0.35rem;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pill-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.pill-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.pill-count {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  margin-left: 0.35rem;
}
.pill-btn.active .pill-count {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.filter-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Search Result Cards */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.result-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  background: var(--bg-card-hover);
}

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

.result-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-project {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-walkthrough { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-plan { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-task { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-memory { background: rgba(139, 92, 246, 0.15); color: #c084fc; }
.badge-other { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }

.score-tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.35rem;
}

.result-path {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  transition: all 0.25s ease;
}

.result-card:hover .result-path {
  opacity: 1;
  max-height: 40px;
  margin-top: 0.35rem;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
}

.result-snippet {
  font-size: 0.9rem;
  color: #d1d5db;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
}

mark {
  background: rgba(245, 158, 11, 0.3);
  color: #fef08a;
  border-radius: 2px;
  padding: 0 2px;
}

/* ==========================================================================
   Projects Grid View
   ========================================================================== */
.section-header {
  margin-bottom: 2rem;
}
.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.section-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25 ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  background: var(--bg-card-hover);
}

.project-card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.project-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.project-card-stats span strong {
  color: var(--text-main);
}

.btn-primary {
  width: 100%;
  padding: 0.6rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.btn-primary:hover {
  opacity: 0.9;
  box-shadow: var(--accent-glow);
}

/* ==========================================================================
   Timeline View
   ========================================================================== */
.timeline-container {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--border-color);
  margin-left: 1rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-marker {
  position: absolute;
  left: -2.45rem;
  top: 0.25rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 3px solid var(--bg-dark);
  box-shadow: 0 0 10px var(--accent-primary);
}

.timeline-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.timeline-card:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.timeline-date {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  margin-bottom: 0.25rem;
}

.timeline-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Modal Document Reader
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-window {
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-color);
}

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-title-box h3 {
  font-size: 1rem;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.view-toggle-group {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
}

.btn-toggle {
  padding: 0.35rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-toggle.active {
  background: var(--accent-primary);
  color: #fff;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
}
.btn-close:hover { color: #fff; }

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

.doc-toc-sidebar {
  width: 260px;
  background: rgba(10, 15, 28, 0.8);
  border-right: 1px solid var(--border-color);
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.85rem;
}

.doc-toc-sidebar h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.doc-toc-sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.doc-toc-sidebar a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-toc-sidebar a:hover {
  color: var(--accent-primary);
}

.sibling-files-box {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.doc-content-main {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
  background: #0b1120;
}

/* Markdown Rendered Typography */
.markdown-body {
  color: #e2e8f0;
  font-size: 1rem;
  line-height: 1.7;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  color: #fff;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 1.8rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.markdown-body h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3rem; }
.markdown-body h3 { font-size: 1.15rem; }

.markdown-body p { margin-bottom: 1rem; }

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  color: #38bdf8;
}

.markdown-body pre {
  margin: 1.25rem 0;
  padding: 1.25rem;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  position: relative;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: inherit;
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
  padding: 0.75rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

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

.markdown-body th, .markdown-body td {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-color);
  text-align: left;
}
.markdown-body th {
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
}

.raw-code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: #a7f3d0;
  white-space: pre-wrap;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  background: var(--accent-gradient);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 300;
  animation: slideUp 0.3s ease;
}

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

/* Analytics Drawer Panel */
.analytics-drawer {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.chart-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.chart-card h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.canvas-container {
  position: relative;
  height: 200px;
  width: 100%;
}

/* Search Graphical Analytics Summary Bar */
.search-analytics-bar {
  margin-bottom: 1.5rem;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  animation: fadeIn 0.3s ease;
}

.search-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.search-chart-card {
  display: flex;
  flex-direction: column;
}

.chart-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mini-canvas-container {
  position: relative;
  height: 130px;
  width: 100%;
}

/* --- Mobile & Responsive Touch Optimizations (Pixel 10 Pro) --- */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .header-brand {
    justify-content: center;
  }

  .header-stats {
    justify-content: center;
    font-size: 0.75rem;
    gap: 0.5rem;
  }

  .header-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .nav-tabs {
    width: 100%;
    justify-content: space-around;
  }

  .nav-tab {
    flex: 1;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  .search-hero {
    padding: 1.25rem 1rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .filter-group {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
  }

  .pill-group {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }

  .results-container {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .modal-window {
    width: 98vw;
    height: 94vh;
    border-radius: 12px;
  }

  .modal-body {
    flex-direction: column;
  }

  .doc-toc-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    max-height: 160px;
    overflow-y: auto;
  }
}

/* --- 3-Line Vertical Compact Mobile Layout (Pixel 10 Pro & Smartphones) --- */
.results-container.compact-mode {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.compact-3line-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.compact-3line-card:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px);
  background: var(--bg-card-hover);
}

.compact-line-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.compact-line-2-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compact-line-3-summary {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.results-container.compact-mode .result-card:hover {
  transform: translateX(4px);
}

.timeline-container.compact-mode {
  padding-left: 1.2rem;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

.timeline-container.compact-mode .timeline-item {
  margin-bottom: 0.5rem;
  box-sizing: border-box;
  max-width: 100%;
}

.timeline-container.compact-mode .compact-3line-card {
  padding: 0.6rem 0.8rem;
  box-sizing: border-box;
  max-width: 100%;
}

/* --- Session File Selector Bar & Interactive Touch Badges --- */
.session-file-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-color);
}

.session-file-selector-bar label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
  white-space: nowrap;
}

.modal-file-select {
  flex: 1;
  background: #090d16;
  color: #ffffff;
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
}

.session-file-badge {
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, filter 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.session-file-badge:hover, .session-file-badge:active {
  transform: scale(1.06);
  filter: brightness(1.25);
  border-color: #38bdf8;
}

/* --- Interactive Image Viewer with Pan & Zoom --- */
.image-viewer-wrapper {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 380px;
  background: rgba(4, 7, 13, 0.85);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  touch-action: none;
}

.image-viewer-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.img-tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-tool-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #38bdf8;
}

.img-tool-btn:active {
  transform: scale(0.92);
}

.img-zoom-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
  padding: 2px 8px;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
}

.image-pan-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.image-pan-viewport.grabbing {
  cursor: grabbing !important;
}

#modalImageViewer {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  transition: transform 0.05s ease-out;
  transform-origin: center center;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  pointer-events: auto;
}

/* --- Modal Header Quick Actions Toolbar --- */
.modal-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.btn-action-sm {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-action-sm:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.btn-action-sm:active {
  transform: scale(0.94);
}

.btn-action-sm.btn-primary-action {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

.btn-action-sm.btn-primary-action:hover {
  background: rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

/* --- Card & Compact Image Thumbnail Preview --- */
.card-image-preview-container {
  margin-top: 0.85rem;
  width: 100%;
  height: 180px;
  background: rgba(4, 7, 13, 0.6);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.15s ease;
}

.card-image-preview-container:hover {
  border-color: #38bdf8;
}

.card-image-preview-container img {
  max-width: 98%;
  max-height: 98%;
  object-fit: contain;
  border-radius: 4px;
}

.card-image-preview-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #38bdf8;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.compact-thumbnail-box {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: #04070d;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.compact-thumbnail-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}




