/**
 * ===================================================
 * FORM WORKFLOW POLISH - UI/UX IMPROVEMENTS 2026.3.11
 * ===================================================
 * 
 * Improvements for infringements.html and outofclass.html
 * - Smooth section transitions (fade, slide)
 * - Modal visual polish
 * - Enhanced student card styling
 * - Reduced visual noise
 * - Typography hierarchy
 * - Micro-interactions
 * 
 * Load AFTER all modern component stylesheets
 * Load BEFORE inline styles in HTML
 * 
 * Last Updated: March 11, 2026
 */

/* ===== SECTION VISIBILITY TRANSITIONS ===== */
/* Replace abrupt display:none/block transitions with smooth fades */
.unified-form-section {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out, visibility 0.25s ease-out;
  visibility: visible;
  pointer-events: auto;
}

/* Hidden state - smooth fade out and prevent interaction */
.unified-form-section[style*="display: none"],
.unified-form-section.hidden {
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease-out, transform 0.25s ease-out, visibility 0.25s ease-out;
}

/* Sequential entrance animations for workflow steps */
.unified-form-section.entrance-step-1 {
  animation: slideInLeft 0.5s ease-out;
}

.unified-form-section.entrance-step-2 {
  animation: slideInRight 0.5s ease-out 0.1s both;
}

.unified-form-section.entrance-step-3 {
  animation: slideInUp 0.5s ease-out 0.2s both;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== MODAL ENHANCEMENTS ===== */
.modal-overlay {
  animation: fadeIn 0.2s ease-out;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-container {
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  /* Reduced shadow for cleaner look */
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal header styling - consistent with form sections */
.modal-header {
  padding: 24px;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  font-family: 'Poppins', sans-serif;
}

.modal-header p {
  margin: 8px 0 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Modal body consistent spacing */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
}

.modal-body > * + * {
  margin-top: 20px;
}

/* Modal footer styling */
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #fafafa;
  border-radius: 0 0 12px 12px;
}

/* Summary section in modal */
.summary-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.summary-item {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.summary-item-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-item-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Duplicate warning styling */
.duplicate-warning {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.duplicate-warning-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
  color: #991b1b;
  font-size: 0.95rem;
}

.duplicate-warning-title span:first-child {
  font-size: 1.25rem;
}

/* ===== ENHANCED STUDENT CARDS ===== */
.student-card {
  /* Expanded from minmax(200px) to 280px for better visibility */
  padding: 28px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, white 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Improved hover state with smooth lift */
.student-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: #3b82f6;
  box-shadow: 
    0 12px 24px rgba(59, 130, 246, 0.15),
    0 0 0 1px rgba(59, 130, 246, 0.1);
}

.student-card:active {
  transform: translateY(-4px) scale(1.01);
}

/* Student photo - larger and more prominent */
.student-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #3b82f6;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.student-card:hover .student-photo {
  transform: scale(1.1);
  border-color: #2563eb;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

/* Student name styling */
.student-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 12px 0 4px 0;
  transition: color 0.3s ease;
}

.student-card:hover .student-name {
  color: #3b82f6;
}

/* Student details (secondary info) */
.student-details {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
  transition: color 0.3s ease;
}

.student-card:hover .student-details {
  color: #475569;
}

/* Remove button - enhanced size and visibility */
.remove-student {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
  transition: all 0.2s ease;
  opacity: 0.9;
  z-index: 10;
}

.remove-student:hover {
  opacity: 1;
  transform: scale(1.15) rotate(90deg);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.remove-student:active {
  transform: scale(0.95) rotate(90deg);
}

/* ===== REDUCED VISUAL NOISE ===== */
/* Simplify shadows palette - use only 3 levels */
:root {
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  /* Remove: --shadow-hover, --shadow-xl, etc. */
}

/* Reduce excessive decorative pseudo-elements */
.unified-form-section::before {
  /* Disable the animated gradient bar at top */
  display: none;
}

.analytics-card::before,
.analytics-card::after {
  /* Disable decorative pseudo-elements */
  display: none;
}

/* Simplify background complexity */
body::before {
  /* Disable animated ambient shift */
  display: none !important;
}

body::after {
  /* Reduce pattern overlay opacity */
  opacity: 0.15 !important;
}

/* ===== TYPOGRAPHY HIERARCHY ===== */
/* Establish 4-level scale as CSS variables */
:root {
  --text-size-title: 2rem;      /* Page titles */
  --text-size-heading: 1.5rem;  /* Section headings */
  --text-size-subheading: 1.1rem; /* Sub-sections */
  --text-size-body: 1rem;       /* Regular body text */
  --text-size-caption: 0.875rem; /* Small text, hints */
  --text-size-label: 0.75rem;   /* Form labels, metadata */
}

/* Apply hierarchy to headings */
h2 {
  font-size: var(--text-size-heading, 1.5rem);
  font-weight: 700;
  margin-bottom: 16px;
  color: #0f172a;
}

h3 {
  font-size: var(--text-size-subheading, 1.1rem);
  font-weight: 600;
  margin-bottom: 12px;
  color: #1e293b;
}

/* Form labels - proper hierarchy */
.form-label {
  font-size: var(--text-size-label, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 6px;
}

/* Body text */
p {
  font-size: var(--text-size-body, 1rem);
  line-height: 1.6;
  color: #475569;
}

/* Helper/hint text */
.form-help-text,
small {
  font-size: var(--text-size-caption, 0.875rem);
  color: #64748b;
}

/* ===== FORM WORKFLOW CLARITY ===== */
/* Step indicator styling */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 24px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
}

.section-header.active .step-number {
  background: #3b82f6;
  color: white;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Section icon with reduced animation */
.section-icon {
  font-size: 2rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
  animation: gentle-float 3s ease-in-out infinite;
}

@keyframes gentle-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ===== BUTTON & INTERACTION POLISH ===== */
/* Unified button styling */
.submit-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== SMOOTH TRANSITIONS FOR FORM ELEMENTS ===== */
.form-input,
.form-select {
  transition: all 0.2s ease;
  border-color: #e5e7eb;
  background: white;
}

.form-input:focus,
.form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: #f7fbff;
}

/* ===== SELECTED STUDENTS CONTAINER ===== */
.selected-students-container {
  animation: slideInUp 0.3s ease-out;
}

.selected-students {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

@media (max-width: 768px) {
  .selected-students {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .student-card {
    padding: 20px 16px;
  }

  .student-photo {
    width: 64px;
    height: 64px;
  }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  .modal-container,
  .student-card,
  .summary-item {
    background: #1f2937;
    color: #f3f4f6;
  }

  .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .modal-footer {
    border-top-color: #374151;
    background: #111827;
  }

  .student-card {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #374151;
  }

  .duplicate-warning {
    background: #7f1d1d;
    border-left-color: #fca5a5;
  }

  .form-input,
  .form-select {
    background: #1f2937;
    color: #f3f4f6;
    border-color: #374151;
  }

  .form-input:focus,
  .form-select:focus {
    background: #111827;
    border-color: #60a5fa;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .modal-overlay,
  .remove-student,
  .submit-btn {
    display: none !important;
  }
}
