/**
 * ENHANCED STUDENT PROFILE MODAL STYLES
 * Comprehensive modal design for student insights
 * 
 * Features:
 * - Full-screen modal overlay
 * - Tabbed interface for different views
 * - Timeline visualization
 * - Chart integration
 * - Responsive design
 * - Dark mode support
 * - Print styles
 * 
 * @version 1.0.0
 * @date 2025-11-26
 */

/* ===== MODAL CONTAINER ===== */
.student-profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.student-profile-modal.active {
  display: block;
  opacity: 1;
}

.student-profile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.student-profile-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 1400px;
  max-height: 90vh;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* ===== MODAL HEADER ===== */
.student-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: relative;
}

.profile-header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

.profile-photo-large {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.profile-photo-large img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.photo-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border: 4px solid rgba(255, 255, 255, 0.3);
}

.profile-header-info h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.75rem;
  font-weight: 700;
}

.profile-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.profile-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.badge-id {
  background: rgba(59, 130, 246, 0.3);
}

.badge-year {
  background: rgba(16, 185, 129, 0.3);
}

.badge-house {
  background: rgba(245, 158, 11, 0.3);
}

.profile-homegroup {
  margin: 0;
  font-size: 0.875rem;
  opacity: 0.9;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: white;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* ===== QUICK STATS BAR ===== */
.profile-quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  font-size: 2rem;
  line-height: 1;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.stat-infringements .stat-icon { color: #ef4444; }
.stat-affirmations .stat-icon { color: #10b981; }
.stat-outofclass .stat-icon { color: #f59e0b; }
.stat-ratio .stat-icon { color: #3b82f6; }

/* ===== TAB NAVIGATION ===== */
.profile-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 2rem;
  background: white;
  border-bottom: 2px solid #e5e7eb;
  overflow-x: auto;
}

.profile-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.profile-tab:hover {
  color: #1f2937;
  background: #f9fafb;
}

.profile-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.tab-icon {
  font-size: 1.125rem;
}

/* ===== MODAL BODY ===== */
.student-profile-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: white;
}

.profile-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.profile-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== TIMELINE STYLES ===== */
.timeline-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.timeline-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.timeline-filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s ease;
}

.timeline-filter-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.timeline-filter-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.timeline-period-select {
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  font-size: 0.875rem;
  cursor: pointer;
}

.timeline-container {
  position: relative;
}

.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #e5e7eb, transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 2rem;
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.timeline-content {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.timeline-item:hover .timeline-content {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateX(4px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.timeline-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.timeline-date {
  font-size: 0.8125rem;
  color: #6b7280;
  white-space: nowrap;
}

.timeline-description {
  margin: 0 0 0.5rem 0;
  font-size: 0.9375rem;
  color: #4b5563;
  line-height: 1.5;
}

.timeline-staff {
  margin: 0;
  font-size: 0.8125rem;
  color: #6b7280;
  font-style: italic;
}

.timeline-loading,
.timeline-error,
.timeline-empty {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
  font-size: 0.9375rem;
}

.timeline-error {
  color: #ef4444;
}

/* ===== TRENDS STYLES ===== */
.trends-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.trends-controls h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.trends-period-select {
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  font-size: 0.875rem;
  cursor: pointer;
}

.chart-container {
  position: relative;
  height: 400px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.trends-insights {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
}

.trends-insights h4 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.insight-item {
  display: flex;
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  border-left: 4px solid #e5e7eb;
}

.insight-item.insight-success {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.insight-item.insight-warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.insight-item.insight-info {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.insight-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.insight-text {
  flex: 1;
  font-size: 0.9375rem;
  color: #374151;
  line-height: 1.5;
}

.insight-loading,
.insight-empty {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
  font-size: 0.9375rem;
}

/* ===== INTERVENTIONS STYLES ===== */
.interventions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.interventions-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.interventions-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.intervention-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.intervention-card.intervention-priority-high {
  border-left: 4px solid #ef4444;
}

.intervention-card.intervention-priority-medium {
  border-left: 4px solid #f59e0b;
}

.intervention-card.intervention-priority-low {
  border-left: 4px solid #3b82f6;
}

.intervention-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.intervention-header h4 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
}

.priority-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.priority-badge.priority-high {
  background: #fee2e2;
  color: #991b1b;
}

.priority-badge.priority-medium {
  background: #fef3c7;
  color: #92400e;
}

.priority-badge.priority-low {
  background: #dbeafe;
  color: #1e40af;
}

.intervention-description {
  margin: 0 0 1rem 0;
  font-size: 0.9375rem;
  color: #4b5563;
  line-height: 1.6;
}

.intervention-actions strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
}

.intervention-actions ul {
  margin: 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.intervention-actions li {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.5;
}

.intervention-loading,
.intervention-error,
.intervention-empty {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
  font-size: 0.9375rem;
}

.intervention-error {
  color: #ef4444;
}

/* ===== COMMUNICATIONS STYLES ===== */
.communications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.communications-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.communications-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.communication-empty {
  text-align: center;
  padding: 3rem;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
}

.communication-empty p {
  margin: 0 0 1rem 0;
  color: #6b7280;
  font-size: 0.9375rem;
}

.communications-loading {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
  font-size: 0.9375rem;
}

/* ===== MODAL FOOTER ===== */
.student-profile-footer {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: white;
  color: #1f2937;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-ghost {
  background: transparent;
  color: #6b7280;
}

.btn-ghost:hover {
  background: #f3f4f6;
  color: #1f2937;
}

/* ===== DARK MODE SUPPORT ===== */
[data-theme="dark"] .student-profile-container {
  background: #1f2937;
  color: #f9fafb;
}

[data-theme="dark"] .profile-quick-stats {
  background: #111827;
  border-bottom-color: #374151;
}

[data-theme="dark"] .stat-card {
  background: #374151;
  border-color: #4b5563;
}

[data-theme="dark"] .stat-value {
  color: #f9fafb;
}

[data-theme="dark"] .profile-tabs {
  background: #1f2937;
  border-bottom-color: #374151;
}

[data-theme="dark"] .profile-tab {
  color: #9ca3af;
}

[data-theme="dark"] .profile-tab:hover {
  color: #f9fafb;
  background: #374151;
}

[data-theme="dark"] .profile-tab.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

[data-theme="dark"] .student-profile-body {
  background: #1f2937;
}

[data-theme="dark"] .timeline-content {
  background: #374151;
  border-color: #4b5563;
}

[data-theme="dark"] .timeline-header h4 {
  color: #f9fafb;
}

[data-theme="dark"] .timeline-description {
  color: #d1d5db;
}

[data-theme="dark"] .chart-container {
  background: #374151;
  border-color: #4b5563;
}

[data-theme="dark"] .trends-insights {
  background: #111827;
  border-color: #374151;
}

[data-theme="dark"] .insight-item {
  background: #374151;
}

[data-theme="dark"] .intervention-card {
  background: #374151;
  border-color: #4b5563;
}

[data-theme="dark"] .student-profile-footer {
  background: #111827;
  border-top-color: #374151;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .profile-quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .student-profile-container {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .student-profile-header {
    padding: 1.5rem;
  }
  
  .profile-header-left {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-photo-large {
    width: 80px;
    height: 80px;
  }
  
  .profile-quick-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .profile-tabs {
    padding: 0 1rem;
  }
  
  .profile-tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .student-profile-body {
    padding: 1rem;
  }
  
  .timeline-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .timeline-filters {
    justify-content: center;
  }
  
  .chart-container {
    height: 300px;
    padding: 1rem;
  }
  
  .student-profile-footer {
    padding: 1rem;
    flex-wrap: wrap;
  }
  
  .btn-primary,
  .btn-secondary,
  .btn-ghost {
    flex: 1;
    justify-content: center;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .student-profile-modal {
    position: static;
    display: block !important;
  }
  
  .student-profile-overlay {
    display: none;
  }
  
  .student-profile-container {
    position: static;
    transform: none;
    max-width: 100%;
    max-height: none;
    box-shadow: none;
  }
  
  .modal-close-btn,
  .profile-tabs,
  .timeline-controls,
  .trends-controls,
  .interventions-header button,
  .communications-header button,
  .student-profile-footer {
    display: none !important;
  }
  
  .profile-tab-content {
    display: block !important;
    page-break-inside: avoid;
  }
  
  .timeline-item,
  .intervention-card {
    page-break-inside: avoid;
  }
}
