/*
 * Hermes Projects Dashboard — Glassmorphism + Alexandria Design
 * 
 * Design system: Apple-inspired glassmorphism with Alexandria typography
 * Tokens from: google-stitch-design/glassmorphism_design_spec.md
 * Surface system from: google-stitch-design/alexandria/DESIGN.md
 */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Canvas — soft warm light gradient */
  --bg-canvas: #F8F9FA;
  --bg-canvas-deep: #E9ECEF;

  /* Glass surface tiers (Alexandria) */
  --surface-container-lowest: rgba(255, 255, 255, 0.30);
  --surface-container-low: rgba(255, 255, 255, 0.50);
  --surface-container: rgba(255, 255, 255, 0.70);
  --surface-container-high: rgba(255, 255, 255, 0.85);

  /* Backdrop blur strengths */
  --blur-card: 12px;
  --blur-header: 20px;

  /* Accent — Alexandria primary + glassmorphism blue gradient */
  --accent-primary: #094cb2;
  --accent-blue: #3366CC;
  --accent-gradient-start: #3366CC;
  --accent-gradient-end: #5B8DEF;
  --accent-hover: #2A55B8;

  /* Tertiary — archival gold (Alexandria) */
  --tertiary-gold: #6d5e00;
  --tertiary-gold-bg: rgba(109, 94, 0, 0.08);

  /* Text */
  --text-primary: #1A1A1A;
  --text-secondary: #6C757D;
  --text-tertiary: #8E96A0;
  --text-quaternary: #B0B8C0;

  /* Ghost borders (Alexandria — "no lines" rule) */
  --border-ghost: rgba(255, 255, 255, 0.4);
  --border-outer: rgba(0, 0, 0, 0.04);
  --border-divider: rgba(0, 0, 0, 0.06);
  --border-focus: rgba(9, 76, 178, 0.30);

  /* Shadows — ultra-soft diffusion */
  --shadow-card: 0 8px 32px 0 rgba(31, 38, 135, 0.06);
  --shadow-card-hover: 0 16px 48px 0 rgba(31, 38, 135, 0.10);
  --shadow-modal: 0 24px 64px 0 rgba(31, 38, 135, 0.06);

  /* Success */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  /* Spacing — generous whitespace per design spec */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Typography */
  --font-serif: 'Noto Serif', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-label: 'Public Sans', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --ease-card: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-fast: 0.15s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: linear-gradient(135deg, var(--bg-canvas) 0%, var(--bg-canvas-deep) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background: transparent;
  line-height: 1.6;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(51, 102, 204, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(9, 76, 178, 0.03) 0%, transparent 60%),
    linear-gradient(135deg, var(--bg-canvas) 0%, var(--bg-canvas-deep) 100%);
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--ease-fast);
}
a:hover { color: var(--accent-hover); }

/* ============================================================
   GLASS UTILITY
   ============================================================ */
.glass-card {
  background: var(--surface-container);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  border: 1px solid var(--border-ghost);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
}

.glass-card-elevated {
  background: var(--surface-container-high);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  border: 1px solid var(--border-ghost);
  box-shadow: var(--shadow-card-hover);
  border-radius: var(--radius-lg);
}

.glass-header {
  background: var(--surface-container-high);
  backdrop-filter: blur(var(--blur-header));
  -webkit-backdrop-filter: blur(var(--blur-header));
  border-bottom: 1px solid var(--border-outer);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-gradient-start), var(--accent-gradient-end));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform var(--ease-fast), box-shadow var(--ease-fast);
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px 0 rgba(51, 102, 204, 0.30);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--surface-container-low);
  color: var(--accent-primary);
  border: 1px solid var(--border-ghost);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-label);
  cursor: pointer;
  transition: all var(--ease-fast);
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  background: var(--surface-container);
  color: var(--accent-hover);
  border-color: rgba(9, 76, 178, 0.20);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: var(--space-lg);
}

.login-card {
  background: var(--surface-container-high);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  border: 1px solid var(--border-ghost);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo {
  width: 48px;
  height: 48px;
  color: var(--accent-blue);
  margin-bottom: var(--space-md);
  opacity: 0.85;
}

.login-header h1 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  font-family: var(--font-label);
  font-size: 0.875rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* Forms */
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.input-group label {
  font-family: var(--font-label);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-group input {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}
.input-group input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}
.input-group input::placeholder {
  color: var(--text-quaternary);
}

.login-options {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-label);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
}

.login-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-label);
  font-size: 0.8125rem;
  color: #dc2626;
}

.setup-notice {
  background: var(--surface-container-low);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}
.setup-notice p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.setup-cmd {
  background: var(--surface-container);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  overflow-x: auto;
}

/* ============================================================
   NAVIGATION HEADER
   ============================================================ */
.nav-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-container-high);
  backdrop-filter: blur(var(--blur-header));
  -webkit-backdrop-filter: blur(var(--blur-header));
  border-bottom: 1px solid var(--border-outer);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 56px;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -0.2px;
}
.nav-brand:hover {
  color: var(--accent-primary);
}

.nav-logo {
  width: 22px;
  height: 22px;
  color: var(--accent-blue);
}

.nav-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-label);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  overflow: hidden;
}

.breadcrumb-sep {
  color: var(--text-quaternary);
}

.breadcrumb-link {
  color: var(--text-tertiary);
  text-decoration: none;
  font-family: var(--font-label);
}
.breadcrumb-link:hover {
  color: var(--accent-primary);
}

.breadcrumb-current {
  font-family: var(--font-serif);
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Search */
.nav-search {
  flex: 1;
  max-width: 400px;
  margin: 0 auto;
}

.search-form {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface-container-low);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}
.search-form:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}

.search-icon {
  color: var(--text-quaternary);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
}
.search-input::placeholder {
  color: var(--text-quaternary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-3xl);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.section-header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.section-header h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.project-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.back-link {
  font-family: var(--font-label);
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-decoration: none;
}
.back-link:hover {
  color: var(--accent-primary);
}

.result-count {
  font-family: var(--font-label);
  font-size: 0.8125rem;
  color: var(--text-quaternary);
  font-weight: 500;
  background: var(--surface-container-lowest);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.empty-state {
  color: var(--text-quaternary);
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: var(--space-2xl) 0;
  text-align: center;
}

/* ============================================================
   PROJECT GRID (Dashboard)
   ============================================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.project-card {
  display: block;
  background: var(--surface-container);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  border: 1px solid var(--border-ghost);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  text-decoration: none;
  transition: transform var(--ease-card), box-shadow var(--ease-card), border-color var(--ease-card);
}
.project-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(51, 102, 204, 0.20);
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.project-card-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  word-break: break-word;
  line-height: 1.3;
}

.project-card-badge {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-pipeline {
  background: rgba(51, 102, 204, 0.10);
  color: var(--accent-blue);
  border: 1px solid rgba(51, 102, 204, 0.15);
}

.badge-custom {
  background: var(--tertiary-gold-bg);
  color: var(--tertiary-gold);
  border: 1px solid rgba(109, 94, 0, 0.15);
}

/* Progress Bar */
.progress-bar-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-container-lowest);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-lg {
  height: 8px;
  border-radius: 4px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gradient-start), var(--accent-gradient-end));
  border-radius: inherit;
  transition: width 0.5s ease;
}

.progress-label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Stage Dots (dashboard cards) */
.stage-dots {
  display: flex;
  gap: 6px;
}

.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0;
}
.dot-complete {
  background: var(--success);
  box-shadow: 0 0 6px 0 rgba(16, 185, 129, 0.4);
}
.dot-partial {
  background: var(--accent-blue);
  box-shadow: 0 0 6px 0 rgba(51, 102, 204, 0.3);
}
.dot-missing {
  background: var(--text-quaternary);
  opacity: 0.3;
}

/* Card Footer */
.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-outer);
}

.project-file-count {
  font-family: var(--font-label);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.card-arrow {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  transition: transform var(--ease-fast);
}
.project-card:hover .card-arrow {
  transform: translateX(3px);
  color: var(--accent-blue);
}

/* ============================================================
   PIPELINE SECTION (Project Detail)
   ============================================================ */
.pipeline-section {
  background: var(--surface-container);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  border: 1px solid var(--border-ghost);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.stage-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.stage-done {
  background: var(--success-bg);
}
.stage-active {
  background: rgba(51, 102, 204, 0.06);
}
.stage-pending {
  background: transparent;
}

.stage-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0;
}
.stage-done .stage-indicator {
  background: var(--success);
  box-shadow: 0 0 6px 0 rgba(16, 185, 129, 0.4);
}
.stage-active .stage-indicator {
  background: var(--accent-blue);
  box-shadow: 0 0 6px 0 rgba(51, 102, 204, 0.3);
}
.stage-pending .stage-indicator {
  background: var(--text-quaternary);
  opacity: 0.25;
}

.stage-name {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.stage-label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.stage-done .stage-label {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================================
   FILE TREE (Project Detail)
   ============================================================ */
.file-tree {
  border-radius: var(--radius-lg);
  padding: var(--space-sm) 0;
}

.tree-list {
  list-style: none;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px var(--space-md);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  margin: 1px var(--space-sm);
  transition: background var(--ease-fast);
}
.tree-row:hover {
  background: var(--surface-container-low);
}

.tree-dir {
  /* Directory rows */ }

.tree-icon {
  color: var(--text-tertiary);
  font-size: 0.625rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.tree-dir-name {
  font-family: var(--font-sans);
  color: var(--text-secondary);
  font-weight: 500;
}

.tree-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
  color: var(--text-primary);
  text-decoration: none;
  overflow: hidden;
}
.tree-link:hover {
  color: var(--accent-blue);
}

.tree-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-size {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--text-quaternary);
  flex-shrink: 0;
  margin-left: auto;
}

/* Nested tree */
.tree-list .tree-list {
  padding-left: var(--space-lg);
}

/* ============================================================
   PREVIEW PAGE
   ============================================================ */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.preview-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.preview-filename {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.preview-ext {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--surface-container-low);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
}

.preview-size {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--text-quaternary);
}

.preview-nav {
  display: flex;
  gap: var(--space-sm);
}

.preview-content {
  background: var(--surface-container);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  border: 1px solid var(--border-ghost);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  overflow: auto;
}

/* Markdown content */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  margin: var(--space-xl) 0 var(--space-sm);
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.preview-content h1 { font-size: 2rem; }
.preview-content h2 { font-size: 1.5rem; }
.preview-content h3 { font-size: 1.25rem; }
.preview-content h4 { font-size: 1.1rem; }

.preview-content p {
  margin-bottom: var(--space-md);
  line-height: 1.7;
  color: var(--text-secondary);
}

.preview-content a {
  color: var(--accent-blue);
}

.preview-content code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--surface-container-low);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
}

.preview-content pre {
  background: var(--surface-container-low);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

.preview-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.preview-content ul,
.preview-content ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
  color: var(--text-secondary);
}

.preview-content li {
  margin-bottom: var(--space-xs);
  line-height: 1.6;
}

.preview-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-md);
}

.preview-content th,
.preview-content td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.preview-content th {
  font-family: var(--font-label);
  background: var(--surface-container-low);
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 2px solid var(--border-outer);
}

.preview-content td {
  border-bottom: 1px solid var(--border-divider);
}

.preview-content blockquote {
  border-left: 3px solid var(--accent-blue);
  padding: var(--space-sm) var(--space-lg);
  margin: var(--space-md) 0;
  color: var(--text-tertiary);
  background: var(--surface-container-lowest);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.preview-content hr {
  border: none;
  border-top: 1px solid var(--border-divider);
  margin: var(--space-xl) 0;
}

/* Images */
.preview-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--ease-fast);
}
.preview-image:hover {
  transform: scale(1.01);
}

/* Video / Audio */
.preview-video,
.preview-audio {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

/* IFrame (HTML prototypes) */
.preview-iframe {
  width: 100%;
  min-height: 600px;
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-md);
  background: #ffffff;
}

/* CSV Tables */
.csv-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.csv-table th {
  font-family: var(--font-label);
  background: var(--surface-container-low);
  color: var(--text-primary);
  font-weight: 600;
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  border-bottom: 2px solid var(--border-outer);
}

.csv-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-divider);
  color: var(--text-secondary);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.csv-table tbody tr:nth-child(even) {
  background: var(--surface-container-lowest);
}

.truncation-note {
  font-family: var(--font-label);
  font-size: 0.8125rem;
  color: var(--text-quaternary);
  margin-top: var(--space-sm);
  text-align: center;
}

/* Code blocks */
.code-block {
  background: var(--surface-container-low);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.code-highlight {
  background: var(--surface-container-low);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* ============================================================
   SEARCH RESULTS
   ============================================================ */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-lg);
  background: var(--surface-container);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  border: 1px solid var(--border-ghost);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform var(--ease-card), box-shadow var(--ease-card), border-color var(--ease-card);
}
.search-result-item:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(51, 102, 204, 0.20);
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.search-result-project {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.search-result-type {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--surface-container-low);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
}

.search-result-file {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.search-result-snippet {
  font-size: 0.8125rem;
  color: var(--text-quaternary);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-back {
  margin-top: var(--space-md);
}

/* ============================================================
   ERROR
   ============================================================ */
.error {
  color: #dc2626;
  font-family: var(--font-label);
  font-size: 0.875rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
  .stage-list {
    grid-template-columns: 1fr;
  }
  .nav-inner {
    padding: 0 var(--space-md);
  }
  .main-content {
    padding: var(--space-md) var(--space-md) var(--space-xl);
  }
  .preview-iframe {
    min-height: 400px;
  }
  .section-header h1 {
    font-size: 1.5rem;
  }
  .section-header h2 {
    font-size: 1.25rem;
  }
  .project-title {
    font-size: 1.5rem;
  }
  .login-card {
    padding: var(--space-xl);
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: var(--space-lg);
  }
  .nav-search {
    max-width: none;
  }
  .project-card {
    padding: var(--space-lg);
  }
  .pipeline-section {
    padding: var(--space-lg);
  }
  .preview-content {
    padding: var(--space-md);
  }
}

/* ============================================================
   REDUCED MOTION (accessibility)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .project-card,
  .search-result-item {
    transition: none;
  }
  .project-card:hover,
  .search-result-item:hover {
    transform: none;
  }
  .progress-bar-fill {
    transition: none;
  }
}
