/* Optimized Re-engagement Room Styles */
/* Modern design system aligned with home.html patterns */
/* Performance-first, WCAG AA compliant, D1-optimized */

/**
 * ⚠️ IMPORTANT: All CSS variables are centralized in unified-base.css
 * This file should only contain component-specific styles for the re-engagement room.
 * 
 * Available variables from unified-base.css:
 * - Colors: --primary-blue, --primary-gold, --secondary-navy, --success-green, etc.
 * - Grays: --gray-50 through --gray-900
 * - Spacing: --space-1 through --space-12
 * - Typography: --text-xs through --text-3xl
 * - Shadows: --shadow-xs through --shadow-xl
 * - Border radius: --radius-sm through --radius-2xl
 * - Animations: --duration-150, --duration-200, --duration-300
 */

:root {
  /* Component-specific variables for re-engagement room (not in unified-base.css) */
  --duration-500: 500ms;
}

/* Performance-Optimized Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--gray-700);
  background: linear-gradient(135deg, var(--gray-50) 0%, #ffffff 100%);
  min-height: 100vh;
  font-display: swap; /* Performance optimization */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Modern Navigation System */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-blue);
  color: white;
  padding: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-logo {
  height: 36px;
  width: auto;
  transition: transform var(--duration-200) var(--ease-out);
}

.nav-logo:hover {
  transform: scale(1.05);
}

.nav-title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Optimized Loading States */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--duration-300) var(--ease-out);
}

.loading-content {
  text-align: center;
  max-width: 400px;
  padding: var(--space-8);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-4);
}

.loading-progress {
  width: 100%;
  height: 4px;
  background: var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--space-4);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue), var(--primary-gold));
  border-radius: var(--radius-sm);
  transition: width var(--duration-300) var(--ease-out);
  width: 0%;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modern Card System */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: all var(--duration-200) var(--ease-out);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* Student Management Components */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
  padding: var(--space-6);
}

.student-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: all var(--duration-200) var(--ease-out);
}

.student-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.student-info {
  padding: var(--space-6);
}

.student-name {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
}

.student-details {
  font-size: var(--text-sm);
  color: var(--gray-600);
  display: flex;
  gap: var(--space-4);
}

.student-actions {
  padding: var(--space-4);
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* Modern Button System */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
  line-height: 1;
  user-select: none;
}

.btn:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.btn-primary:hover {
  background: var(--secondary-navy);
  border-color: var(--secondary-navy);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-success {
  background: var(--success-green);
  color: white;
  border-color: var(--success-green);
}

.btn-success:hover {
  background: #2f855a;
  border-color: #2f855a;
}

.btn-warning {
  background: var(--warning-amber);
  color: white;
  border-color: var(--warning-amber);
}

.btn-warning:hover {
  background: #dd6b20;
  border-color: #dd6b20;
}

.btn-danger {
  background: var(--error-red);
  color: white;
  border-color: var(--error-red);
}

.btn-danger:hover {
  background: #c53030;
  border-color: #c53030;
}

/* Form Components */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  transition: all var(--duration-200) var(--ease-out);
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-select {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: white;
  cursor: pointer;
}

/* Status Indicators */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-xl);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-active {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success-green);
}

.status-inactive {
  background: rgba(160, 174, 192, 0.2);
  color: var(--gray-600);
}

.status-warning {
  background: rgba(237, 137, 54, 0.1);
  color: var(--warning-amber);
}

.status-error {
  background: rgba(229, 62, 62, 0.1);
  color: var(--error-red);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-bar {
    padding: var(--space-3);
  }
  
  .nav-title {
    font-size: var(--text-lg);
  }
  
  .student-grid {
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }
  
  .student-actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --primary-blue: #000080;
    --gray-700: #000000;
    --gray-300: #808080;
  }
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-50: #1a202c;
    --gray-100: #2d3748;
    --gray-700: #e2e8f0;
    --gray-800: #f7fafc;
  }
}

/* Error State */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: var(--space-8);
}

.error-state h2 {
  font-size: var(--text-2xl);
  color: var(--gray-800);
  margin-bottom: var(--space-4);
}

.error-state p {
  color: var(--gray-600);
  margin-bottom: var(--space-6);
}

/* Performance Optimizations */
.will-change-transform {
  will-change: transform;
}

.gpu-accelerated {
  transform: translateZ(0);
}

/* Print Styles */
@media print {
  .nav-bar,
  .btn,
  .loading-overlay {
    display: none !important;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #000;
  }
}