/* AI-Powered Sorting Interface */
.sorting-card-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 1rem;
  margin-top: 1rem;
  min-height: 180px; /* Maintain original height */
  perspective: 1000px; /* For 3D hover effects */
  position: relative; /* Contain stacking context */
  z-index: 1; /* Contain stacking context */
}

.sorting-card[data-type="People"] {
  grid-column: 1 / -1; /* Span across both columns */
}

.sorting-card {
  position: relative;
  padding: 1.5rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(30, 35, 50, 0.95), rgba(20, 25, 40, 0.98));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform-style: preserve-3d;
}

/* Glitchy scanline effect */
.sorting-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 4px, 3px 100%;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: scan 12s linear infinite;
  pointer-events: none;
}

.sorting-card:hover::after {
  opacity: 1;
}

/* Unique animated patterns for each type */
.sorting-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transition: all 0.5s ease-out;
  z-index: 0;
}

.sorting-card[data-type="Date"]::before {
  background-image: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
  transform: scale(0);
}

.sorting-card[data-type="Location"]::before {
  background-image: 
    radial-gradient(circle at 50% 50%, transparent 40%, rgba(16, 185, 129, 0.05) 41%, rgba(16, 185, 129, 0.1) 42%, transparent 43%),
    radial-gradient(circle at 50% 50%, transparent 60%, rgba(16, 185, 129, 0.05) 61%, rgba(16, 185, 129, 0.1) 62%, transparent 63%);
  animation: radar-sweep 4s linear infinite;
}

.sorting-card[data-type="People"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:rgba(168,85,247,0.1);stroke-width:1;stroke-linecap:round;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M20,20 C40,40 60,40 80,20'/%3E%3Cpath class='a' d='M20,50 C40,70 60,70 80,50'/%3E%3Cpath class='a' d='M20,80 C40,100 60,100 80,80'/%3E%3C/svg%3E");
  background-size: 80%;
  animation: neural-pulse 3s ease-in-out infinite;
}

.sorting-card:hover::before {
  opacity: 1;
  transform: scale(2.5);
}
.sorting-card[data-type="Location"]:hover::before,
.sorting-card[data-type="People"]:hover::before {
  transform: none; /* Disable scale for animations that don't need it */
}

.sorting-card:hover {
  transform: translateY(-5px) rotateX(8deg) rotateY(-3deg);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 
    0 12px 35px rgba(59, 130, 246, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sorting-card.selected {
  border-color: var(--color-primary);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.15), rgba(30, 35, 50, 0.95));
  box-shadow: 
    0 0 25px rgba(59, 130, 246, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.4),
    inset 0 0 10px rgba(59, 130, 246, 0.15),
    inset 0 1px 0 rgba(59, 130, 246, 0.2);
  transform: translateY(-2px) rotateX(0) rotateY(0);
}

.sorting-card.selected::before {
  opacity: 1;
  transform: scale(2.5);
}
.sorting-card[data-type="Location"].selected::before,
.sorting-card[data-type="People"].selected::before {
  transform: none;
}

/* Holographic edge effect for selected */
.sorting-card.selected::after {
  opacity: 1;
  background: linear-gradient(90deg, transparent, var(--color-primary-light), transparent);
  background-size: 200% 1px;
  animation: hologram-edge 3s ease-in-out infinite;
  background-repeat: no-repeat;
}

.sorting-card.disabled {
  cursor: not-allowed;
  opacity: 0.4;
  background: linear-gradient(145deg, rgba(60, 60, 60, 0.3), rgba(40, 40, 40, 0.4));
  filter: grayscale(0.8);
  transform-style: flat;
}

.sorting-card.disabled:hover {
  transform: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.sorting-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.sorting-card-content {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  position: relative;
  z-index: 2;
  height: 100%;
  transform: translateZ(20px); /* Bring content forward in 3D space */
}

.sorting-card-icon {
  position: relative;
  font-size: 2.5rem;
  min-width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: 
    linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-shadow: 0 0 15px rgba(0,0,0,0.5);
}

/* AI-themed icon backgrounds */
.sorting-card[data-type="Date"] .sorting-card-icon {
  color: #60a5fa; /* Tailwind blue-400 */
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.sorting-card[data-type="Location"] .sorting-card-icon {
  color: #34d399; /* Tailwind emerald-400 */
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.sorting-card[data-type="People"] .sorting-card-icon {
  color: #a78bfa; /* Tailwind violet-400 */
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.sorting-card:hover .sorting-card-icon {
  transform: scale(1.05) translateZ(10px);
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.sorting-card-text {
  flex: 1;
}

.sorting-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 0.4rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
}

.sorting-card-description {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
  margin: 0;
}

/* AI Status indicator */
.sorting-card.selected .sorting-card-icon::after {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: linear-gradient(145deg, var(--color-primary), rgba(59, 130, 246, 0.8));
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  animation: aiConfirm 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform: translateZ(10px);
}

/* Neural Network Configuration Panel */
.face-mode-selector {
  margin-top: 1.2rem;
  padding: 1.2rem;
  background: 
    linear-gradient(145deg, rgba(30, 35, 50, 0.6), rgba(20, 25, 40, 0.8)),
    radial-gradient(circle at 20% 20%, rgba(168, 85, 247, 0.03), transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.15);
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Subtle data flow effect */
.face-mode-selector::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.5), transparent);
  animation: dataFlow 4s ease-in-out infinite;
}

.face-mode-selector .input-field {
  background: rgba(10, 12, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.95);
  padding: 0.7rem;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.face-mode-selector .input-field:focus {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
  outline: none;
  background-color: rgba(20, 25, 40, 0.7);
}

.face-mode-selector label {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  margin-bottom: 0.6rem;
  display: block;
  font-size: 0.95rem;
}

.face-mode-selector .description {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  margin-top: 0.6rem;
  margin-bottom: 0;
  line-height: 1.4;
}

/* Enhanced People Description Styling */
.people-description {
  display: flex;
  flex-direction: column;
}

.neural-status {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
  margin: 0;
}

.highlight-count {
  display: inline-block;
  background: linear-gradient(135deg, #a78bfa, #c084fc);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  box-shadow: 
    0 2px 8px rgba(168, 85, 247, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  animation: pulseGlow 2s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.highlight-count::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #a78bfa, #c084fc, #a78bfa);
  border-radius: 10px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sorting-card:hover .highlight-count::before {
  opacity: 0.3;
  animation: rotateGlow 3s linear infinite;
}

.ai-learning-tip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: linear-gradient(135deg, 
    rgba(168, 85, 247, 0.08), 
    rgba(192, 132, 252, 0.05)
  );
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.ai-learning-tip::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(168, 85, 247, 0.1), 
    transparent
  );
  transition: left 0.5s ease;
}

.sorting-card:hover .ai-learning-tip::before {
  left: 100%;
}

.tip-icon {
  font-size: 1rem;
  filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.6));
  animation: brainPulse 2.5s ease-in-out infinite;
}

.tip-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* AI Metrics Visualization */
.ai-metrics {
  margin: 0.8rem 0;
  padding: 0.8rem;
  background: linear-gradient(135deg, 
    rgba(168, 85, 247, 0.06), 
    rgba(192, 132, 252, 0.03)
  );
  border: 1px solid rgba(168, 85, 247, 0.12);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.ai-metrics::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(168, 85, 247, 0.3), 
    transparent
  );
  animation: dataFlow 3s ease-in-out infinite;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
}

.metric-row:last-child {
  margin-bottom: 0;
}

.metric-label {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  min-width: 120px;
  text-align: left;
}

/* Accuracy Bar */
.accuracy-bar {
  flex: 1;
  height: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-left: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.accuracy-fill {
  height: 100%;
  background: linear-gradient(90deg, #a78bfa, #c084fc);
  border-radius: 10px;
  position: relative;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 10px rgba(168, 85, 247, 0.3);
}

.accuracy-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.3), 
    transparent
  );
  animation: shimmer 2s ease-in-out infinite;
}

.accuracy-text {
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 1;
  position: relative;
}

/* Speed Status */
.speed-status {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
}

.speed-status.building-baseline {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.speed-status.learning-patterns {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.speed-status.optimizing-matches {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
}

.speed-status.peak-performance {
  background: rgba(168, 85, 247, 0.15);
  color: #a78bfa;
  border-color: rgba(168, 85, 247, 0.3);
}

/* Model Strength Visualization */
.model-strength {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.8rem;
}

.strength-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.strength-dot.active {
  background: linear-gradient(135deg, #a78bfa, #c084fc);
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 
    0 0 6px rgba(168, 85, 247, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: strengthPulse 2s ease-in-out infinite;
}

.strength-label {
  margin-left: 0.5rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* Enhanced AI Learning Tip */
.ai-learning-tip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, 
    rgba(168, 85, 247, 0.1), 
    rgba(192, 132, 252, 0.06)
  );
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.ai-learning-tip::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(168, 85, 247, 0.08), 
    transparent
  );
  transition: left 0.6s ease;
}

.sorting-card:hover .ai-learning-tip::before {
  left: 100%;
}

.tip-icon {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.8));
  animation: brainPulse 2.5s ease-in-out infinite;
}

.tip-text {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Enhanced animations */
@keyframes pulseGlow {
  0%, 100% { 
    box-shadow: 
      0 2px 8px rgba(168, 85, 247, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  50% { 
    box-shadow: 
      0 4px 16px rgba(168, 85, 247, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
  }
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes brainPulse {
  0%, 100% { 
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.6));
  }
  50% { 
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.8));
  }
}

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

@keyframes strengthPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.4);
  }
  50% { 
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
  }
}

@keyframes dataFlow {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: -100%; }
}

/* Responsive design */
@media (max-width: 768px) {
  .sorting-card-group {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    perspective: none;
  }
  
  .sorting-card {
    padding: 1.2rem 1rem;
  }
  
  .sorting-card:hover {
    transform: translateY(-3px); /* Simpler hover on mobile */
  }

  .sorting-card-content {
    gap: 1rem;
    transform: none;
  }
  
  .sorting-card-icon {
    min-width: 60px;
    height: 60px;
    font-size: 2rem;
  }
  
  .sorting-card-title {
    font-size: 1rem;
  }
  
  .sorting-card-description {
    font-size: 0.8rem;
  }
  
  .highlight-count {
    font-size: 0.8rem;
    padding: 0.1rem 0.4rem;
  }
  
  .ai-learning-tip {
    padding: 0.5rem 0.6rem;
  }
  
  .tip-text {
    font-size: 0.7rem;
  }

  .ai-metrics {
    padding: 0.6rem;
  }
  
  .metric-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  
  .accuracy-bar,
  .model-strength {
    margin-left: 0;
    width: 100%;
  }
  
  .metric-label {
    min-width: auto;
    font-size: 0.75rem;
  }
  
  .accuracy-text {
    font-size: 0.65rem;
  }
  
  .strength-dot {
    width: 6px;
    height: 6px;
  }
}