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

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-pink: #f472b6;
  --accent-green: #10b981;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  position: relative;
}

/* Background Effects */
.background-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--accent-purple);
  top: -200px;
  right: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-cyan);
  bottom: -150px;
  left: -150px;
  animation-delay: -7s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: var(--accent-pink);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(50px, -30px); }
  50% { transform: translate(-30px, 50px); }
  75% { transform: translate(-50px, -20px); }
}

/* Glass Panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
}

/* Header */
.app-header {
  position: relative;
  z-index: 1;
  padding: 30px 20px;
  text-align: center;
}

.header-content {
  max-width: 600px;
  margin: 0 auto;
}

.logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mascot {
  font-size: 48px;
  animation: wink 3s ease-in-out infinite;
}

@keyframes wink {
  0%, 90%, 100% { transform: scale(1); }
  95% { transform: scale(1.1) rotate(-5deg); }
}

h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-size: clamp(14px, 2vw, 18px);
  margin-top: 8px;
}

/* Step Indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 20px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.step-item.active {
  opacity: 1;
  transform: scale(1.1);
}

.step-item.completed {
  opacity: 1;
}

.step-icon {
  font-size: 28px;
  padding: 12px;
  background: var(--glass-bg);
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  transition: all 0.3s ease;
}

.step-item.active .step-icon {
  border-color: var(--accent-purple);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
  animation: pulse 1.5s ease-in-out infinite;
}

.step-item.completed .step-icon {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.2);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.5); }
  50% { box-shadow: 0 0 40px rgba(139, 92, 246, 0.8); }
}

.step-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.step-connector {
  width: 40px;
  height: 2px;
  background: var(--glass-border);
  position: absolute;
  right: -24px;
  top: 26px;
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .sidebar-left, .sidebar-right {
    order: 2;
  }
  
  .center-area {
    order: 1;
  }
}

/* File Tree */
.file-tree {
  height: fit-content;
  max-height: 500px;
  overflow-y: auto;
}

.file-tree-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--glass-border);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

.folder-icon {
  font-size: 20px;
}

.toggle-icon {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-secondary);
}

.file-list {
  padding-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: transparent;
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-item:hover {
  background: rgba(139, 92, 246, 0.1);
}

.file-item.processed {
  animation: fadeIn 0.3s ease forwards;
}

.file-item.selected {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-green);
}

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

.file-icon {
  font-size: 14px;
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.similarity-score {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.similarity-score.high {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}

.similarity-score.medium {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.similarity-score.low {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
}

.checkmark {
  color: var(--accent-green);
  font-weight: bold;
}

/* Center Area */
.center-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Visualization Canvas */
.visualization-canvas {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.idle-state {
  text-align: center;
  color: var(--text-secondary);
}

.zip-icon-large {
  font-size: 80px;
  margin-bottom: 20px;
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.upload-state {
  position: relative;
}

.zip-icon-wobble {
  font-size: 100px;
  animation: wobble 0.5s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.upload-beam {
  position: absolute;
  width: 4px;
  height: 100px;
  background: linear-gradient(to bottom, var(--accent-cyan), transparent);
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  animation: beam 1s ease-in-out infinite;
}

@keyframes beam {
  0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  50% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* Floating Files */
.files-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-file {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  font-size: 12px;
}

.floating-file:hover {
  border-color: var(--accent-purple);
  transform: scale(1.1) !important;
}

.floating-file.explode {
  animation: explode 0.6s ease-out forwards;
}

@keyframes explode {
  0% { opacity: 0; transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.floating-file.vectorized {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  border-color: transparent;
}

.floating-file.vectorized .file-mini-icon {
  display: none;
}

.vector-arrow {
  font-size: 20px;
  animation: arrowPulse 1s ease-in-out infinite;
}

@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

.floating-file.relevant {
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
  border-color: var(--accent-green);
}

.floating-file.irrelevant.group {
  opacity: 0.2;
  transform: scale(0.8) !important;
}

.file-mini-icon {
  font-size: 24px;
}

.file-mini-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-secondary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Fix Description Beam */
.fix-description-beam {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  animation: descend 1s ease-out;
}

@keyframes descend {
  from { top: -50px; opacity: 0; }
  to { top: 20px; opacity: 1; }
}

.beam-text {
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
  padding: 10px 20px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  box-shadow: 0 0 30px rgba(244, 114, 182, 0.5);
}

/* Particles */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  animation: particleFade 2s ease-out forwards;
}

@keyframes particleFade {
  0% { opacity: 0; transform: scale(0); }
  20% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0) translateY(-50px); }
}

/* Merge Orb */
.merge-orb {
  position: absolute;
  animation: orbAppear 1s ease-out forwards;
}

@keyframes orbAppear {
  0% { opacity: 0; transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.orb-inner {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 0 50px rgba(16, 185, 129, 0.6);
  animation: orbGlow 1.5s ease-in-out infinite;
}

@keyframes orbGlow {
  0%, 100% { box-shadow: 0 0 50px rgba(16, 185, 129, 0.6); }
  50% { box-shadow: 0 0 80px rgba(16, 185, 129, 0.9); }
}

.orb-label {
  text-align: center;
  margin-top: 15px;
  font-weight: 600;
  color: var(--accent-green);
  font-size: 18px;
}

/* Confetti */
.confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(500px) rotate(720deg); opacity: 0; }
}

/* Control Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 15px;
}

.control-row label {
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 60px;
}

.start-btn {
  flex: 1;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Space Grotesk', sans-serif;
}

.start-btn:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}

.start-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.reset-btn {
  padding: 14px 20px;
  font-size: 14px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Space Grotesk', sans-serif;
}

.reset-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.speed-buttons {
  display: flex;
  gap: 8px;
}

.speed-btn {
  padding: 8px 16px;
  font-size: 12px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'JetBrains Mono', monospace;
}

.speed-btn.active {
  background: var(--accent-purple);
  color: white;
  border-color: var(--accent-purple);
}

.fix-input {
  flex-direction: column;
  align-items: stretch;
}

.fix-input label {
  margin-bottom: 8px;
}

.fix-description-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.3s ease;
}

.fix-description-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.fix-description-input::placeholder {
  color: var(--text-secondary);
}

/* Stats Panel */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border);
}

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

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
}

.token-count {
  color: var(--accent-cyan);
}

.threshold {
  color: var(--accent-pink);
}

/* Learn More */
.learn-more {
  margin-top: 20px;
}

.learn-more h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--accent-purple);
}

.learn-more p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-family: 'JetBrains Mono', monospace;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-btn:hover {
  color: var(--text-primary);
}

.diff-view {
  margin-bottom: 20px;
}

.diff-section {
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.diff-section.removed {
  background: rgba(239, 68, 68, 0.2);
  border-left: 3px solid #ef4444;
}

.diff-section.added {
  background: rgba(16, 185, 129, 0.2);
  border-left: 3px solid var(--accent-green);
}

.diff-label {
  font-size: 10px;
  margin-bottom: 5px;
  opacity: 0.7;
}

.code-preview {
  background: var(--bg-secondary);
  padding: 15px;
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  overflow-x: auto;
  color: var(--text-secondary);
}

/* Easter Egg Toast */
.easter-egg-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
  padding: 15px 25px;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  z-index: 1001;
  animation: toastIn 0.3s ease-out;
  max-width: 90%;
  text-align: center;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 30px 20px;
  position: relative;
  z-index: 1;
  color: var(--text-secondary);
  font-size: 14px;
}

.app-footer a {
  color: var(--accent-pink);
  text-decoration: none;
  transition: color 0.3s ease;
}

.app-footer a:hover {
  color: var(--accent-purple);
}

.footer-note {
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.7;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .step-indicator {
    gap: 4px;
    padding: 15px 10px;
  }
  
  .step-icon {
    font-size: 20px;
    padding: 8px;
  }
  
  .step-label {
    font-size: 9px;
  }
  
  .step-connector {
    width: 20px;
    right: -12px;
  }
  
  .visualization-canvas {
    min-height: 300px;
  }
  
  .floating-file {
    padding: 6px;
    font-size: 10px;
  }
  
  .file-mini-icon {
    font-size: 18px;
  }
  
  .orb-inner {
    width: 70px;
    height: 70px;
    font-size: 28px;
  }
  
  .sidebar-left, .sidebar-right {
    margin-top: 0;
  }
  
  .file-tree, .stats-panel, .learn-more {
    max-height: 300px;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-purple);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-pink);
}