/* ==========================================
   ATS Analysis Theater - Immersive Loading Experience
   All selectors prefixed with ats- to avoid conflicts
   ========================================== */

/* Body scroll lock when theater is open */
body.ats-theater-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* CSS Variables */
:root {
  --ats-primary: #0ea5e9;
  --ats-primary-dark: #0284c7;
  --ats-primary-light: #7dd3fc;
  --ats-secondary: #8b5cf6;
  --ats-secondary-dark: #7c3aed;
  --ats-background: #0a192f;
  --ats-background-light: #112240;
  --ats-text: #f8f9fa;
  --ats-text-muted: rgba(248, 249, 250, 0.7);
  --ats-border: rgba(255, 255, 255, 0.08);
  --ats-success: #10b981;
  --ats-warning: #f59e0b;
  --ats-error: #ef4444;
  --ats-glass: rgba(22, 36, 71, 0.85);
  --ats-transition-fast: 0.2s ease;
  --ats-transition-normal: 0.3s ease;
  --ats-transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Overlay */
.ats-theater-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ats-transition-normal), visibility var(--ats-transition-normal);
}

.ats-theater-overlay.ats-visible {
  opacity: 1;
  visibility: visible;
}

/* Background */
.ats-theater-bg {
  position: absolute;
  inset: 0;
  background-color: rgba(10, 25, 47, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

/* Animated grid pattern */
.ats-grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  animation: ats-grid-move 30s linear infinite;
}

@keyframes ats-grid-move {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

/* Floating particles container */
.ats-theater-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(14, 165, 233, 0.5), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(139, 92, 246, 0.5), transparent),
    radial-gradient(1px 1px at 60% 20%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(2px 2px at 80% 60%, rgba(16, 185, 129, 0.5), transparent),
    radial-gradient(1px 1px at 10% 80%, rgba(14, 165, 233, 0.4), transparent),
    radial-gradient(2px 2px at 90% 40%, rgba(139, 92, 246, 0.4), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.3), transparent);
  background-size: 200% 200%;
  animation: ats-particles-drift 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ats-particles-drift {
  0%, 100% { background-position: 0% 0%; }
  25% { background-position: 100% 50%; }
  50% { background-position: 50% 100%; }
  75% { background-position: 0% 50%; }
}

/* Data stream effect (vertical lines) */
.ats-theater-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(14, 165, 233, 0.02) 50%, transparent 100%),
    repeating-linear-gradient(90deg,
      transparent,
      transparent 100px,
      rgba(14, 165, 233, 0.015) 100px,
      rgba(14, 165, 233, 0.015) 101px);
  animation: ats-data-pulse 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ats-data-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.ats-gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  pointer-events: none;
}

.ats-orb-1 {
  width: 50vw;
  height: 50vw;
  max-width: 700px;
  max-height: 700px;
  top: -10%;
  right: -10%;
  background: radial-gradient(circle, var(--ats-primary) 0%, rgba(14, 165, 233, 0.3) 40%, transparent 70%);
  animation: ats-orb-float-1 25s ease-in-out infinite;
}

.ats-orb-2 {
  width: 45vw;
  height: 45vw;
  max-width: 600px;
  max-height: 600px;
  bottom: -10%;
  left: -10%;
  background: radial-gradient(circle, var(--ats-secondary) 0%, rgba(139, 92, 246, 0.3) 40%, transparent 70%);
  animation: ats-orb-float-2 22s ease-in-out infinite;
}

/* Enhanced orb animations with more movement */
@keyframes ats-orb-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
  25% { transform: translate(-5%, 10%) scale(1.05); opacity: 0.4; }
  50% { transform: translate(-10%, 5%) scale(1.1); opacity: 0.35; }
  75% { transform: translate(-5%, -5%) scale(1.05); opacity: 0.4; }
}

@keyframes ats-orb-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
  25% { transform: translate(5%, -5%) scale(1.05); opacity: 0.3; }
  50% { transform: translate(10%, -10%) scale(1.1); opacity: 0.35; }
  75% { transform: translate(5%, 5%) scale(1.05); opacity: 0.4; }
}

/* Main Container */
.ats-theater-container {
  position: relative;
  width: 90%;
  max-width: 700px;
  padding: 2rem;
  background-color: var(--ats-glass);
  border-radius: 24px;
  border: 1px solid var(--ats-border);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  z-index: 10;
  animation: ats-appear 0.5s var(--ats-transition-slow) forwards;
}

/* Header */
.ats-theater-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.ats-logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.ats-logo {
  filter: drop-shadow(0 4px 12px rgba(14, 165, 233, 0.4));
}

.ats-theater-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ats-text);
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

/* Progress Bar (YouTube-style thin bar) */
.ats-progress-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.ats-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ats-primary), var(--ats-secondary));
  border-radius: 4px;
  transition: width 0.5s ease-out;
  position: relative;
}

.ats-progress-shimmer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: ats-shimmer 2s infinite;
}

.ats-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ats-progress-percent {
  font-size: 0.75rem;
  color: var(--ats-text-muted);
}

.ats-time-estimate {
  font-size: 0.7rem;
  color: var(--ats-text-muted);
  opacity: 0.7;
  font-style: italic;
}

/* Visualization Area */
.ats-visualization-area {
  min-height: 280px;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  border: 1px solid var(--ats-border);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ats-stage-content {
  width: 100%;
  text-align: center;
  animation: ats-stage-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ats-stage-enter {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ats-stage-content.hidden {
  display: none;
}

.ats-stage-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ats-text);
  margin-bottom: 0.75rem;
  animation: ats-title-glow 3s ease-in-out infinite;
}

@keyframes ats-title-glow {
  0%, 100% { text-shadow: 0 0 10px rgba(14, 165, 233, 0); }
  50% { text-shadow: 0 0 20px rgba(14, 165, 233, 0.3); }
}

.ats-stage-subtitle {
  font-size: 0.95rem;
  color: var(--ats-text-muted);
  margin-bottom: 1rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Stage 1: Scanning Icon */
.ats-stage-icon-large {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
}

.ats-stage-icon-large svg {
  width: 100%;
  height: 100%;
  color: var(--ats-primary);
}

.ats-scan-pulse {
  position: absolute;
  inset: -10px;
  border: 2px solid var(--ats-primary);
  border-radius: 50%;
  animation: ats-scan-pulse 2s ease-out infinite;
}

/* Stage 2: Keywords Display */
.ats-keywords-display {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.ats-keywords-column {
  text-align: left;
}

.ats-column-header {
  margin-bottom: 0.5rem;
}

.ats-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ats-badge-critical {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.ats-badge-important {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.ats-badge-nice {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.ats-keywords-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-height: 80px;
}

.ats-keyword-item {
  padding: 0.375rem 0.625rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--ats-text);
  animation: ats-keyword-appear 0.3s ease forwards;
  opacity: 0;
  transform: translateY(-5px);
}

.ats-counter {
  font-size: 0.9rem;
  color: var(--ats-text-muted);
  padding-top: 0.5rem;
  border-top: 1px solid var(--ats-border);
}

.ats-counter span {
  color: var(--ats-primary-light);
  font-weight: 600;
}

/* Stage 3: Matching Display */
.ats-matching-display {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ats-match-panel {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid var(--ats-border);
  overflow: hidden;
}

.ats-panel-header {
  padding: 0.625rem;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ats-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ats-panel-content {
  padding: 0.75rem;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.ats-match-keyword {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  font-size: 0.8rem;
  animation: ats-fly-across 0.4s ease forwards;
}

.ats-match-keyword.matched {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.ats-match-keyword.missing {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

.ats-match-keyword svg {
  width: 14px;
  height: 14px;
}

.ats-match-arrow {
  flex-shrink: 0;
}

.ats-match-arrow svg {
  width: 24px;
  height: 24px;
  color: var(--ats-text-muted);
  animation: ats-arrow-pulse 1.5s ease-in-out infinite;
}

.ats-match-counter {
  text-align: center;
  padding-top: 0.75rem;
}

.ats-match-counter .ats-match-found {
  color: var(--ats-success);
  font-weight: 700;
  font-size: 1.1rem;
}

.ats-match-counter .ats-match-total {
  color: var(--ats-text-muted);
  font-weight: 600;
}

.ats-match-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.ats-match-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ats-success), var(--ats-primary));
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

/* Stage 4: Score Components */
.ats-score-components {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.ats-score-component {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ats-component-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ats-component-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ats-text);
  text-align: left;
}

.ats-component-weight {
  font-size: 0.75rem;
  color: var(--ats-primary);
  font-weight: 600;
  background: rgba(14, 165, 233, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.ats-component-desc {
  font-size: 0.75rem;
  color: var(--ats-text-muted);
  margin-bottom: 0.25rem;
}

.ats-component-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ats-component-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.ats-component-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ats-primary), var(--ats-secondary));
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ats-component-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ats-text);
  text-align: right;
  min-width: 45px;
}

.ats-final-score {
  text-align: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ats-border);
  position: relative;
}

/* Glow effect behind score */
.ats-final-score::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, transparent 70%);
  transform: translate(-50%, -30%);
  animation: ats-score-glow-pulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ats-score-glow-pulse {
  0%, 100% { transform: translate(-50%, -30%) scale(1); opacity: 0.5; }
  50% { transform: translate(-50%, -30%) scale(1.2); opacity: 0.8; }
}

.ats-score-label {
  font-size: 0.85rem;
  color: var(--ats-text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
}

.ats-score-value {
  display: inline-block;
  position: relative;
  animation: ats-score-appear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ats-score-appear {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  60% {
    transform: scale(1.1) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ats-score-number {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--ats-primary) 0%, var(--ats-secondary) 50%, var(--ats-success) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  animation: ats-score-gradient 4s ease-in-out infinite;
  position: relative;
}

@keyframes ats-score-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Number counting animation */
.ats-score-number.counting {
  animation: ats-score-gradient 4s ease-in-out infinite, ats-score-count-pop 0.15s ease-out;
}

@keyframes ats-score-count-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.ats-score-suffix {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ats-text-muted);
  vertical-align: baseline;
}

/* Celebration effect for high scores */
.ats-final-score.high-score::after {
  content: '';
  position: absolute;
  inset: -20px;
  background:
    radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.3), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(14, 165, 233, 0.3), transparent 25%),
    radial-gradient(circle at 60% 80%, rgba(139, 92, 246, 0.3), transparent 30%);
  animation: ats-celebration 2s ease-out forwards;
  pointer-events: none;
}

@keyframes ats-celebration {
  0% { opacity: 0; transform: scale(0.8); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Loading state for Stage 4 simulation (no fake percentages) */
.ats-component-fill.ats-loading-bar {
  background: linear-gradient(90deg,
    var(--ats-primary) 0%,
    var(--ats-secondary) 50%,
    var(--ats-primary) 100%);
  background-size: 200% 100%;
  animation: ats-loading-shimmer 1.5s ease-in-out infinite;
}

@keyframes ats-loading-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.ats-component-value.ats-calculating,
.ats-score-number.ats-calculating {
  opacity: 0.6;
  animation: ats-calculating-pulse 1s ease-in-out infinite;
}

@keyframes ats-calculating-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.ats-final-score.ats-loading .ats-score-number {
  font-size: 2.5rem;
  color: var(--ats-text-muted);
  -webkit-text-fill-color: var(--ats-text-muted);
  animation: ats-calculating-pulse 1s ease-in-out infinite;
}

/* Stage 4 Redesign: Educational Info Cards */
.ats-score-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ats-score-info-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  opacity: 0;
  transform: translateY(10px);
  animation: ats-info-card-appear 0.4s ease-out forwards;
}

.ats-score-info-card[data-component="critical"] { animation-delay: 0s; }
.ats-score-info-card[data-component="skills"] { animation-delay: 0.15s; }
.ats-score-info-card[data-component="profile"] { animation-delay: 0.3s; }
.ats-score-info-card[data-component="format"] { animation-delay: 0.45s; }

@keyframes ats-info-card-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ats-info-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ats-info-card-icon svg {
  width: 18px;
  height: 18px;
}

.ats-info-card-icon.ats-icon-critical {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.ats-info-card-icon.ats-icon-skills {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
}

.ats-info-card-icon.ats-icon-profile {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.ats-info-card-icon.ats-icon-format {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.ats-info-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ats-info-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ats-text);
  line-height: 1.2;
}

.ats-info-card-weight {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--ats-primary-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ats-info-card-desc {
  font-size: 0.65rem;
  color: var(--ats-text-muted);
  line-height: 1.3;
  margin: 0;
  margin-top: 0.15rem;
}

.ats-info-card-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0);
}

.ats-info-card-check svg {
  width: 12px;
  height: 12px;
  color: #10b981;
}

.ats-score-info-card.checked .ats-info-card-check {
  opacity: 1;
  transform: scale(1);
  animation: ats-check-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ats-check-pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Calculating Score Animation */
.ats-calculating-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(14, 165, 233, 0.05);
  border: 1px solid rgba(14, 165, 233, 0.1);
  border-radius: 8px;
  margin-top: 0.5rem;
}

.ats-calc-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(14, 165, 233, 0.2);
  border-top-color: var(--ats-primary);
  border-radius: 50%;
  animation: ats-calc-spin 0.8s linear infinite;
}

@keyframes ats-calc-spin {
  to { transform: rotate(360deg); }
}

.ats-calc-text {
  font-size: 0.85rem;
  color: var(--ats-text-muted);
  font-weight: 500;
}

/* Stage 5: Report Preview Cards */
.ats-report-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ats-report-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--ats-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(20px);
  animation: ats-card-appear 0.5s ease forwards;
}

.ats-report-card:nth-child(2) {
  animation-delay: 0.15s;
}

.ats-report-card:nth-child(3) {
  animation-delay: 0.3s;
}

.ats-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ats-card-icon svg {
  width: 20px;
  height: 20px;
}

.ats-icon-green {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.ats-icon-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.ats-icon-blue {
  background: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
}

.ats-card-content {
  text-align: center;
}

.ats-card-number {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ats-text);
  line-height: 1.2;
}

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

.ats-view-report-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--ats-primary), var(--ats-secondary));
  color: white;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--ats-transition-fast);
  animation: ats-pulse-glow 2s infinite;
}

.ats-view-report-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(14, 165, 233, 0.5);
}

.ats-view-report-btn svg {
  width: 18px;
  height: 18px;
}

.ats-view-report-btn.hidden {
  display: none;
}

/* Timeline */
.ats-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.ats-timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.ats-timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all var(--ats-transition-normal);
}

.ats-timeline-item.ats-active .ats-timeline-dot {
  background: var(--ats-primary);
  border-color: var(--ats-primary);
  box-shadow: 0 0 12px var(--ats-primary);
}

.ats-timeline-item.ats-completed .ats-timeline-dot {
  background: var(--ats-success);
  border-color: var(--ats-success);
}

.ats-timeline-label {
  font-size: 0.7rem;
  color: var(--ats-text-muted);
  transition: color var(--ats-transition-normal);
}

.ats-timeline-item.ats-active .ats-timeline-label {
  color: var(--ats-primary-light);
  font-weight: 600;
}

.ats-timeline-item.ats-completed .ats-timeline-label {
  color: var(--ats-success);
}

.ats-timeline-connector {
  width: 40px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 0.25rem;
  margin-bottom: 1.25rem;
  transition: background var(--ats-transition-normal);
}

.ats-timeline-connector.ats-completed {
  background: var(--ats-success);
}

/* Facts Section */
.ats-facts-section {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(139, 92, 246, 0.1));
  border-radius: 12px;
  border: 1px solid var(--ats-border);
}

.ats-fact-icon {
  flex-shrink: 0;
  color: var(--ats-primary-light);
}

.ats-fact-icon svg {
  width: 20px;
  height: 20px;
}

.ats-fact-text {
  font-size: 0.875rem;
  color: var(--ats-text);
  line-height: 1.5;
  margin: 0;
  transition: opacity var(--ats-transition-normal);
}

/* Animations */
@keyframes ats-appear {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

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

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

@keyframes ats-scan-pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes ats-keyword-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ats-fly-across {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes ats-arrow-pulse {
  0%, 100% {
    opacity: 0.5;
    transform: translateX(0);
  }
  50% {
    opacity: 1;
    transform: translateX(3px);
  }
}

@keyframes ats-card-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ats-pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 16px -2px rgba(14, 165, 233, 0.4);
  }
  50% {
    box-shadow: 0 4px 24px -2px rgba(14, 165, 233, 0.6);
  }
}

/* ============================================
   ENHANCED MOMENTUM ANIMATIONS
   Keep users engaged with continuous motion
   ============================================ */

/* Rotating scanner effect for Stage 1 icon */
@keyframes ats-rotate-scan {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Scanner orbit ring */
.ats-stage-icon-large::before {
  content: '';
  position: absolute;
  inset: -15px;
  border: 2px dashed rgba(14, 165, 233, 0.3);
  border-radius: 50%;
  animation: ats-rotate-scan 8s linear infinite;
}

/* Secondary scan pulse that expands outward */
.ats-scan-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--ats-secondary);
  border-radius: 50%;
  animation: ats-scan-pulse 2s ease-out infinite;
  animation-delay: 1s;
}

/* Logo breathing animation */
.ats-logo {
  animation: ats-logo-breathe 3s ease-in-out infinite;
}

@keyframes ats-logo-breathe {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 4px 12px rgba(14, 165, 233, 0.4));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 18px rgba(14, 165, 233, 0.6));
  }
}

/* Active timeline dot enhanced pulse */
.ats-timeline-item.ats-active .ats-timeline-dot::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--ats-primary);
  border-radius: 50%;
  animation: ats-dot-ripple 1.5s ease-out infinite;
}

.ats-timeline-dot {
  position: relative;
}

@keyframes ats-dot-ripple {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Keyword shimmer effect */
.ats-keyword-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: ats-keyword-shimmer 2s ease-in-out infinite;
}

.ats-keyword-item {
  position: relative;
  overflow: hidden;
}

@keyframes ats-keyword-shimmer {
  0% {
    left: -100%;
  }
  50%, 100% {
    left: 100%;
  }
}

/* Match keyword glow pulse on appearance */
.ats-match-keyword.matched {
  animation: ats-fly-across 0.4s ease forwards, ats-match-glow 2s ease-in-out infinite;
  animation-delay: 0s, 0.4s;
}

@keyframes ats-match-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
  50% {
    box-shadow: 0 0 12px 2px rgba(16, 185, 129, 0.3);
  }
}

/* Score bar fill shimmer */
.ats-component-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: ats-bar-shimmer 1.5s ease-in-out infinite;
}

.ats-component-fill {
  position: relative;
  overflow: hidden;
}

@keyframes ats-bar-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Final score number pulse when revealed */
.ats-score-number {
  animation: ats-score-pulse 2.5s ease-in-out infinite;
}

@keyframes ats-score-pulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.02);
    filter: brightness(1.1);
  }
}

/* Floating particles in background */
.ats-theater-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(14, 165, 233, 0.4), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(139, 92, 246, 0.3), transparent),
    radial-gradient(2px 2px at 60px 110px, rgba(14, 165, 233, 0.3), transparent),
    radial-gradient(2px 2px at 80px 150px, rgba(139, 92, 246, 0.4), transparent),
    radial-gradient(2px 2px at 100px 190px, rgba(14, 165, 233, 0.3), transparent),
    radial-gradient(2px 2px at 120px 230px, rgba(139, 92, 246, 0.3), transparent);
  background-size: 200px 240px;
  animation: ats-particles-float 15s linear infinite;
  pointer-events: none;
}

@keyframes ats-particles-float {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-240px);
  }
}

/* Pulsing border on visualization area */
.ats-visualization-area {
  animation: ats-area-pulse 4s ease-in-out infinite;
}

@keyframes ats-area-pulse {
  0%, 100% {
    border-color: var(--ats-border);
    box-shadow: inset 0 0 0 0 rgba(14, 165, 233, 0);
  }
  50% {
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow: inset 0 0 30px -10px rgba(14, 165, 233, 0.15);
  }
}

/* Enhanced orb animations with more movement */
.ats-orb-1 {
  animation: ats-orb-dance-1 12s ease-in-out infinite;
}

.ats-orb-2 {
  animation: ats-orb-dance-2 14s ease-in-out infinite;
}

@keyframes ats-orb-dance-1 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(-30px, 20px) scale(1.05);
  }
  50% {
    transform: translate(-20px, -30px) scale(0.95);
  }
  75% {
    transform: translate(20px, -10px) scale(1.02);
  }
}

@keyframes ats-orb-dance-2 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(25px, -15px) scale(0.98);
  }
  50% {
    transform: translate(15px, 25px) scale(1.04);
  }
  75% {
    transform: translate(-20px, 10px) scale(1);
  }
}

/* Report card hover wiggle */
.ats-report-card {
  transition: transform 0.3s ease;
}

.ats-report-card:hover {
  transform: translateY(-4px) rotate(1deg);
}

/* Facts text slide-up animation */
.ats-fact-text {
  animation: ats-fact-slide 6s ease-in-out infinite;
}

@keyframes ats-fact-slide {
  0%, 90%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  95% {
    transform: translateY(-5px);
    opacity: 0.5;
  }
}

/* Scanning line effect for Stage 1 */
.ats-stage-icon-large::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--ats-primary), transparent);
  animation: ats-scan-line 2s ease-in-out infinite;
  border-radius: 2px;
}

@keyframes ats-scan-line {
  0%, 100% {
    top: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* Arrow bounce animation enhanced */
.ats-match-arrow svg {
  animation: ats-arrow-bounce 1s ease-in-out infinite;
}

@keyframes ats-arrow-bounce {
  0%, 100% {
    transform: translateX(0);
    opacity: 0.7;
  }
  50% {
    transform: translateX(5px);
    opacity: 1;
  }
}

/* Progress percent counter bounce */
.ats-progress-percent {
  animation: ats-percent-bounce 0.5s ease;
}

/* Timeline connector fill animation */
.ats-timeline-connector.ats-completed {
  animation: ats-connector-fill 0.5s ease forwards;
  background: linear-gradient(90deg, var(--ats-success), var(--ats-primary));
  background-size: 200% 100%;
}

@keyframes ats-connector-fill {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* View Report button enhanced glow */
.ats-view-report-btn {
  animation: ats-button-glow 2s ease-in-out infinite, ats-button-bounce 3s ease-in-out infinite;
}

@keyframes ats-button-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes ats-button-glow {
  0%, 100% {
    box-shadow: 0 4px 16px -2px rgba(14, 165, 233, 0.4),
                0 0 0 0 rgba(139, 92, 246, 0);
  }
  50% {
    box-shadow: 0 6px 24px -2px rgba(14, 165, 233, 0.6),
                0 0 20px 5px rgba(139, 92, 246, 0.2);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .ats-theater-container {
    padding: 1.5rem;
    border-radius: 20px;
  }

  .ats-theater-title {
    font-size: 1.25rem;
  }

  .ats-visualization-area {
    min-height: 240px;
    padding: 1rem;
  }

  .ats-keywords-display {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .ats-keywords-list {
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .ats-matching-display {
    flex-direction: column;
    gap: 0.75rem;
  }

  .ats-match-arrow {
    transform: rotate(90deg);
  }

  .ats-match-panel {
    width: 100%;
  }

  .ats-panel-content {
    min-height: 80px;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ats-score-component {
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .ats-component-label {
    font-size: 0.8rem;
  }

  .ats-component-weight {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
  }

  .ats-component-desc {
    font-size: 0.7rem;
  }

  .ats-component-bar-row {
    gap: 0.5rem;
  }

  .ats-component-value {
    font-size: 0.8rem;
    min-width: 40px;
  }

  .ats-score-number {
    font-size: 2.5rem;
  }

  /* Stage 4 Info Cards - Mobile */
  .ats-score-info-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .ats-score-info-card {
    padding: 0.625rem;
    gap: 0.5rem;
  }

  .ats-info-card-icon {
    width: 28px;
    height: 28px;
  }

  .ats-info-card-icon svg {
    width: 14px;
    height: 14px;
  }

  .ats-info-card-name {
    font-size: 0.75rem;
  }

  .ats-info-card-weight {
    font-size: 0.55rem;
  }

  .ats-info-card-desc {
    font-size: 0.6rem;
  }

  .ats-info-card-check {
    width: 18px;
    height: 18px;
  }

  .ats-info-card-check svg {
    width: 9px;
    height: 9px;
  }

  .ats-calculating-score {
    padding: 0.625rem;
    gap: 0.5rem;
  }

  .ats-calc-spinner {
    width: 14px;
    height: 14px;
  }

  .ats-calc-text {
    font-size: 0.7rem;
  }

  .ats-report-preview {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .ats-report-card {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
  }

  .ats-card-content {
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
  }

  .ats-card-number {
    font-size: 1.25rem;
  }

  .ats-timeline {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .ats-timeline-connector {
    width: 20px;
  }

  .ats-timeline-label {
    font-size: 0.65rem;
  }
}

@media (max-width: 480px) {
  .ats-theater-container {
    padding: 1.25rem 1rem;
    width: 95%;
  }

  .ats-progress-info {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }

  .ats-time-estimate {
    font-size: 0.65rem;
  }

  .ats-stage-title {
    font-size: 1.1rem;
  }

  .ats-stage-icon-large {
    width: 60px;
    height: 60px;
  }

  .ats-score-component {
    padding: 0.4rem;
    gap: 0.2rem;
  }

  .ats-component-label {
    font-size: 0.75rem;
  }

  .ats-component-desc {
    font-size: 0.65rem;
  }

  .ats-component-bar {
    height: 6px;
  }

  .ats-component-value {
    font-size: 0.75rem;
    min-width: 35px;
  }

  .ats-score-number {
    font-size: 2rem;
  }

  .ats-view-report-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.5rem;
  }

  .ats-facts-section {
    flex-direction: column;
    text-align: center;
  }

  .ats-fact-icon {
    align-self: center;
  }
}

/* ============================================
   DOCUMENT SCANNER VISUALIZATION
   Stage 2: Shows actual JD sentences scrolling
   ============================================ */

.ats-document-scanner {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: 1px solid var(--ats-border);
  overflow: hidden;
  margin-top: 1rem;
}

.ats-scanner-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--ats-border);
}

.ats-scanner-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ats-primary);
}

.ats-scanner-icon svg {
  width: 20px;
  height: 20px;
}

.ats-scanner-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ats-text);
  flex: 1;
}

.ats-scanner-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--ats-success);
}

.ats-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ats-success);
  animation: ats-status-pulse 1.5s ease-in-out infinite;
}

@keyframes ats-status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

.ats-scanner-window {
  position: relative;
  height: 140px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(14, 165, 233, 0.08) 0%, transparent 30%, transparent 70%, rgba(139, 92, 246, 0.08) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(255, 255, 255, 0.01) 20px, rgba(255, 255, 255, 0.01) 21px);
}

/* Data stream effect in background */
.ats-scanner-window::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(14, 165, 233, 0.03) 50%, transparent 100%);
  animation: ats-data-stream 4s linear infinite;
  pointer-events: none;
}

@keyframes ats-data-stream {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Primary scanline with enhanced multi-layer glow */
.ats-scanner-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--ats-primary) 15%,
    white 30%,
    var(--ats-secondary) 50%,
    white 70%,
    var(--ats-primary) 85%,
    transparent 100%);
  box-shadow:
    0 0 8px var(--ats-primary),
    0 0 16px var(--ats-primary),
    0 0 32px rgba(14, 165, 233, 0.6),
    0 -8px 20px rgba(14, 165, 233, 0.2),
    0 8px 20px rgba(139, 92, 246, 0.2);
  animation: ats-scanline-move 2.5s ease-in-out infinite;
  z-index: 2;
}

/* Trailing glow behind scanline */
.ats-scanner-scanline::before {
  content: '';
  position: absolute;
  left: 5%;
  right: 5%;
  height: 30px;
  top: -15px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(14, 165, 233, 0.15) 40%,
    rgba(139, 92, 246, 0.1) 60%,
    transparent 100%);
  filter: blur(10px);
  animation: ats-trail-pulse 1.5s ease-in-out infinite;
}

/* Bright spot that sweeps along scanline */
.ats-scanner-scanline::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, white, transparent);
  filter: blur(1px);
  animation: ats-scanline-sweep 2.5s ease-in-out infinite;
}

@keyframes ats-scanline-move {
  0% { top: -2px; opacity: 0.6; }
  5% { opacity: 1; }
  50% { top: calc(100% - 2px); }
  95% { opacity: 1; }
  100% { top: -2px; opacity: 0.6; }
}

@keyframes ats-scanline-sweep {
  0%, 100% { left: -80px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

@keyframes ats-trail-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.ats-scanner-content {
  position: relative;
  padding: 0.75rem 1rem;
  height: 100%;
  overflow: hidden;
}

.ats-scanner-text-item {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--ats-primary);
  border-radius: 0 6px 6px 0;
  font-size: 0.8rem;
  color: var(--ats-text);
  line-height: 1.4;
  opacity: 0;
  transform: translateX(-30px) scale(0.95);
  animation: ats-text-slide-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on new items */
.ats-scanner-text-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: ats-item-shimmer 1.5s ease-out forwards;
}

@keyframes ats-item-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.ats-scanner-text-item.processed {
  border-left-color: var(--ats-success);
  background: rgba(16, 185, 129, 0.12);
  animation: ats-text-slide-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             ats-processed-glow 0.5s ease-out;
}

/* Success checkmark indicator */
.ats-scanner-text-item.processed::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--ats-success);
  border-radius: 50%;
  opacity: 0;
  animation: ats-check-appear 0.4s ease forwards 0.2s;
}

@keyframes ats-check-appear {
  0% { opacity: 0; transform: translateY(-50%) scale(0); }
  50% { transform: translateY(-50%) scale(1.2); }
  100% { opacity: 1; transform: translateY(-50%) scale(1); }
}

@keyframes ats-processed-glow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 20px 5px rgba(16, 185, 129, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ats-scanner-text-item.processing {
  border-left-color: var(--ats-secondary);
  background: rgba(139, 92, 246, 0.15);
  animation: ats-text-slide-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             ats-processing-pulse 1.2s ease-in-out infinite;
}

/* Scanning line effect on processing items */
.ats-scanner-text-item.processing::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--ats-secondary), transparent);
  animation: ats-processing-scan 0.8s ease-in-out infinite;
}

@keyframes ats-processing-scan {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50% { transform: translateX(100px); opacity: 0.3; }
}

@keyframes ats-text-slide-in {
  0% {
    opacity: 0;
    transform: translateX(-30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes ats-processing-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    border-left-color: var(--ats-secondary);
  }
  50% {
    box-shadow: 0 0 15px 3px rgba(139, 92, 246, 0.25);
    border-left-color: var(--ats-primary);
  }
}

.ats-scanner-gradient-top,
.ats-scanner-gradient-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 30px;
  pointer-events: none;
  z-index: 1;
}

.ats-scanner-gradient-top {
  top: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
}

.ats-scanner-gradient-bottom {
  bottom: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
}

.ats-scanner-footer {
  padding: 0.625rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--ats-border);
}

.ats-scanner-progress {
  font-size: 0.8rem;
  color: var(--ats-text-muted);
  text-align: center;
}

.ats-scanner-progress span {
  color: var(--ats-primary-light);
  font-weight: 600;
}

/* ============================================
   DUAL SCANNER - Stage 3 Matching
   Side by side JD vs Resume comparison
   ============================================ */

.ats-dual-scanner {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 1rem;
  position: relative;
}

/* Connection beam that fires between panels on match */
.ats-dual-scanner::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--ats-secondary), var(--ats-success));
  transform: translateX(-50%);
  opacity: 0;
  z-index: 5;
  pointer-events: none;
}

.ats-dual-scanner.beam-active::before {
  animation: ats-connection-beam 0.6s ease-out forwards;
}

@keyframes ats-connection-beam {
  0% { width: 0; opacity: 0; box-shadow: none; }
  30% { width: 40%; opacity: 1; box-shadow: 0 0 20px var(--ats-success); }
  100% { width: 80%; opacity: 0; box-shadow: 0 0 40px transparent; }
}

.ats-scanner-panel {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 1px solid var(--ats-border);
  overflow: hidden;
  position: relative;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ats-scanner-panel.active {
  border-color: var(--ats-primary);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.2);
}

.ats-panel-resume.matched-flash {
  animation: ats-panel-match-flash 0.5s ease-out;
}

@keyframes ats-panel-match-flash {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  50% { box-shadow: 0 0 30px 10px rgba(16, 185, 129, 0.3); border-color: var(--ats-success); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ats-scanner-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--ats-border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ats-text-muted);
}

.ats-scanner-panel-header svg {
  color: var(--ats-primary);
  transition: transform 0.3s ease;
}

.ats-scanner-panel.active .ats-scanner-panel-header svg {
  transform: scale(1.2);
}

.ats-panel-jd .ats-scanner-panel-header svg {
  color: var(--ats-secondary);
}

.ats-scanner-panel-content {
  height: 120px;
  overflow: hidden;
  padding: 0.5rem;
  position: relative;
}

/* Subtle scan line in each panel */
.ats-scanner-panel-content::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ats-primary), transparent);
  opacity: 0.3;
  animation: ats-panel-scan 2s ease-in-out infinite;
}

@keyframes ats-panel-scan {
  0%, 100% { top: 0; opacity: 0.1; }
  50% { top: 100%; opacity: 0.3; }
}

.ats-scanner-match-item {
  padding: 0.375rem 0.5rem;
  margin-bottom: 0.375rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--ats-text);
  line-height: 1.3;
  opacity: 0;
  animation: ats-match-item-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  position: relative;
  overflow: hidden;
}

.ats-scanner-match-item.requirement {
  background: rgba(139, 92, 246, 0.15);
  border-left: 2px solid var(--ats-secondary);
}

.ats-scanner-match-item.matched {
  background: rgba(16, 185, 129, 0.15);
  border-left: 2px solid var(--ats-success);
  animation: ats-match-item-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             ats-match-success-glow 0.6s ease-out;
}

/* Particle burst on matched items */
.ats-scanner-match-item.matched::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--ats-success);
  border-radius: 50%;
  transform: translateY(-50%);
  animation: ats-particle-burst 0.6s ease-out forwards;
}

@keyframes ats-particle-burst {
  0% { transform: translateY(-50%) scale(1); opacity: 1; }
  50% { transform: translateY(-50%) scale(3); opacity: 0.5; }
  100% { transform: translateY(-50%) scale(5); opacity: 0; }
}

@keyframes ats-match-success-glow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 15px 5px rgba(16, 185, 129, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ats-scanner-match-item.processing {
  background: rgba(14, 165, 233, 0.15);
  border-left: 2px solid var(--ats-primary);
  animation: ats-match-item-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             ats-match-processing 1.2s ease-in-out infinite;
}

/* Loading shimmer on processing items */
.ats-scanner-match-item.processing::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.2), transparent);
  animation: ats-processing-shimmer 1s ease-in-out infinite;
}

@keyframes ats-processing-shimmer {
  0% { left: -50%; }
  100% { left: 150%; }
}

.ats-match-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ats-match-icon.success {
  color: var(--ats-success);
  animation: ats-checkmark-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ats-checkmark-pop {
  0% { transform: scale(0) rotate(-45deg); }
  50% { transform: scale(1.3) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.ats-match-icon.pending {
  color: var(--ats-primary);
  animation: ats-icon-spin 0.8s linear infinite;
}

@keyframes ats-match-item-appear {
  from {
    opacity: 0;
    transform: translateX(-15px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes ats-match-processing {
  0%, 100% { opacity: 0.6; border-left-color: var(--ats-primary); }
  50% { opacity: 1; border-left-color: var(--ats-secondary); }
}

@keyframes ats-icon-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Match Connector in middle */
.ats-match-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  position: relative;
}

/* Animated data flow lines */
.ats-connector-line {
  width: 2px;
  flex: 1;
  background: linear-gradient(180deg, transparent, var(--ats-border), transparent);
  position: relative;
  overflow: hidden;
}

.ats-connector-line::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  width: 100%;
  height: 20px;
  background: linear-gradient(180deg, transparent, var(--ats-success), transparent);
  animation: ats-data-flow 1.5s ease-in-out infinite;
}

@keyframes ats-data-flow {
  0% { top: -20px; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { top: calc(100% + 20px); opacity: 0; }
}

.ats-connector-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ats-success) 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  animation: ats-connector-pulse 2s ease-in-out infinite;
  position: relative;
}

/* Outer glow ring */
.ats-connector-icon::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.3);
  animation: ats-ring-expand 2s ease-out infinite;
}

/* Inner rotating gradient */
.ats-connector-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: ats-inner-rotate 3s linear infinite;
}

@keyframes ats-ring-expand {
  0% { inset: -4px; opacity: 0.6; }
  50% { inset: -12px; opacity: 0; }
  100% { inset: -4px; opacity: 0; }
}

@keyframes ats-inner-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ats-connector-icon svg {
  width: 16px;
  height: 16px;
  position: relative;
  z-index: 1;
}

@keyframes ats-connector-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.6);
  }
}

/* Match Progress Section */
.ats-match-progress-section {
  margin-top: 1rem;
  text-align: center;
}

.ats-match-stats {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ats-match-stats .ats-match-found {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ats-success);
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Number pop animation when value changes */
.ats-match-stats .ats-match-found.counting {
  animation: ats-number-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ats-number-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

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

/* Enhanced match bar */
.ats-match-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.ats-match-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ats-primary), var(--ats-success));
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

/* Shimmer effect on progress bar */
.ats-match-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: ats-bar-shimmer 2s ease-in-out infinite;
}

@keyframes ats-bar-shimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* Mobile responsive for scanners */
@media (max-width: 768px) {
  .ats-document-scanner {
    margin-top: 0.75rem;
  }

  .ats-scanner-window {
    height: 120px;
  }

  .ats-scanner-text-item {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
  }

  .ats-dual-scanner {
    flex-direction: column;
    gap: 0.5rem;
  }

  .ats-match-connector {
    flex-direction: row;
    padding: 0.25rem 0;
  }

  .ats-connector-line {
    width: auto;
    height: 2px;
    flex: 1;
    background: linear-gradient(90deg, transparent, var(--ats-border), transparent);
  }

  .ats-scanner-panel-content {
    height: 80px;
  }

  .ats-scanner-match-item {
    font-size: 0.7rem;
    padding: 0.25rem 0.375rem;
  }
}

@media (max-width: 480px) {
  .ats-scanner-header {
    padding: 0.5rem 0.75rem;
  }

  .ats-scanner-label {
    font-size: 0.75rem;
  }

  .ats-scanner-status span:last-child {
    display: none;
  }

  .ats-scanner-window {
    height: 100px;
  }

  .ats-scanner-footer {
    padding: 0.5rem 0.75rem;
  }

  .ats-scanner-progress {
    font-size: 0.75rem;
  }

  .ats-match-stats .ats-match-found {
    font-size: 1.25rem;
  }
}
