/* Quick Performance CSS Optimizations */
:root {
  /* Consolidate color variables */
  --gradient-bg: linear-gradient(135deg, #fbecec 0%, #f0f4f8 100%);
  --card-hover-transform: translateY(-2px);
  --transition-fast: all 0.15s ease;
  --transition-medium: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Critical above-the-fold styles */
.loading-state { 
  position: fixed; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%); 
  z-index: 9999; 
}

/* Optimize animations */
.student-card, .section {
  will-change: transform;
  contain: layout style paint;
}

/* Lazy load non-critical styles */
.student-profile { content-visibility: auto; }

/* Reduce reflows */
.selected-students { 
  contain: layout; 
  min-height: 120px; /* Prevent layout shift */
}

/* Mobile-Optimized Student Cards */
@media (max-width: 768px) {
  .selected-students {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
  }

  .student-card {
    padding: 16px 12px;
    min-height: 140px;
  }

  .student-photo {
    width: 50px;
    height: 50px;
    margin-bottom: 8px;
  }

  .student-name {
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .student-details {
    font-size: 0.7rem;
  }

  /* Touch-friendly remove button */
  .remove-student {
    width: 28px;
    height: 28px;
    font-size: 14px;
    top: 8px;
    right: 8px;
  }
}

/* Swipe gestures for mobile */
.student-card {
  position: relative;
  overflow: hidden;
}

.student-card.swiping {
  transform: translateX(-80px);
  transition: transform 0.3s ease;
}

.student-card .swipe-action {
  position: absolute;
  right: -80px;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--error);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: right 0.3s ease;
}

.student-card.swiping .swipe-action {
  right: 0;
}

.validation-message {
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  margin-top: 8px;
  display: none;
}

.validation-message.error {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
}

.submit-btn-ready {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
  transform: scale(1.02);
}

.submit-btn-ready:hover {
  transform: scale(1.05) translateY(-2px);
}

.skeleton-loader {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.skeleton-header {
  height: 60px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
  margin-bottom: 20px;
}

.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.skeleton-card {
  height: 120px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Enhanced Footer */
.footer {
  margin-top: 40px;
  padding: 28px 20px;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0,0,0,0.1);
  text-align: center;
  color: #666;
  font-size: 0.9em;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.footer a:hover {
  color: var(--primary);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
