/* ContextPort - AI Memory Migration Tool */
/* Design System */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-hover: #22222e;
  
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent-primary: #8b5cf6;
  --accent-secondary: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.3);
  
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  
  --chatgpt: #10a37f;
  --claude: #cc785c;
  --gemini: #4285f4;
  --copilot: #0078d4;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(139, 92, 246, 0.5);
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

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

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-secondary);
  box-shadow: var(--shadow-glow);
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

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

.btn-outline:hover {
  background: var(--bg-card);
  border-color: var(--border-active);
}

/* Main Content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2xl);
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Steps Indicator */
.steps {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.step-number {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.3s;
}

.step.active .step-number {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.step.completed .step-number {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.step.active .step-label {
  color: var(--text-primary);
}

.step-line {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin-bottom: 20px;
}

/* Panels */
.panel {
  width: 100%;
  animation: fadeIn 0.4s ease;
}

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

.panel-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-sm);
}

.panel-subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.hidden {
  display: none !important;
}

/* Source Grid (Step 1) */
.source-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.source-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
}

.source-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.source-card.selected {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.source-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.source-icon svg {
  width: 28px;
  height: 28px;
}

.source-icon.chatgpt {
  background: rgba(16, 163, 127, 0.15);
  color: var(--chatgpt);
}

.source-icon.claude {
  background: rgba(204, 120, 92, 0.15);
  color: var(--claude);
}

.source-icon.gemini {
  background: rgba(66, 133, 244, 0.15);
  color: var(--gemini);
}

.source-icon.copilot {
  background: rgba(0, 120, 212, 0.15);
  color: var(--copilot);
}

.source-name {
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Upload Area */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-2xl);
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.05);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.upload-text {
  color: var(--text-secondary);
}

.upload-link {
  color: var(--accent-primary);
  cursor: pointer;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Analysis (Step 2) */
.analysis-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
  width: 100%;
}

.analysis-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.progress-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-bg {
  fill: none;
  stroke: var(--bg-card);
  stroke-width: 8;
}

.progress-bar {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 700;
}

.progress-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.extracted-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  max-width: 600px;
}

.extracted-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: 0.85rem;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.extracted-item svg {
  width: 14px;
  height: 14px;
  color: var(--success);
}

/* Profile (Step 3) */
.profile-container {
  display: grid;
  gap: var(--space-lg);
  width: 100%;
  margin-bottom: var(--space-xl);
}

.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.section-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

.profile-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.profile-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.profile-item:last-child {
  border-bottom: none;
}

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

.item-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tag {
  padding: var(--space-xs) var(--space-md);
  background: rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  color: var(--accent-secondary);
}

.tag.tech {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

/* Topic Bars */
.topic-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.topic-bar {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  align-items: center;
  gap: var(--space-md);
}

.topic-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.topic-progress {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.topic-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 3px;
}

.topic-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

/* Export Grid */
.export-section {
  width: 100%;
}

.export-section .section-title {
  margin-bottom: var(--space-md);
  font-size: 1.1rem;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.export-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
}

.export-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.export-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.export-icon svg {
  width: 24px;
  height: 24px;
}

.export-icon.claude {
  background: rgba(204, 120, 92, 0.15);
  color: var(--claude);
}

.export-icon.chatgpt {
  background: rgba(16, 163, 127, 0.15);
  color: var(--chatgpt);
}

.export-icon.markdown {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-primary);
}

.export-icon.json {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.export-name {
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 500px;
  width: 90%;
  text-align: center;
}

.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-icon.success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.modal-icon svg {
  width: 32px;
  height: 32px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.modal-text {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.modal-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: left;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

/* Footer */
.footer {
  padding: var(--space-md);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .source-grid,
  .export-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .steps {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .step-line {
    display: none;
  }
  
  .topic-bar {
    grid-template-columns: 100px 1fr 30px;
  }
  
  .header {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .nav {
    width: 100%;
    justify-content: center;
  }
}
