:root {
  /* Primary Colors - More Sophisticated */
  --primary-color: #1a365d;           /* Deep Navy Blue */
  --secondary-color: #2563eb;         /* Modern Blue */
  --accent-color: #dc2626;            /* Refined Red */
  
  /* Neutral Colors - Clean & Crisp */
  --success-color: #059669;           /* Professional Green */
  --warning-color: #d97706;           /* Warm Orange */
  --light-gray: #f8fafc;              /* Very Light Gray */
  --dark-gray: #475569;               /* Slate Gray */
  --border-color: #e2e8f0;            /* Light Border */
  
  /* Background Colors */
  --bg-primary: #ffffff;              /* Pure White */
  --bg-secondary: #f8fafc;            /* Light Gray Background */
  --bg-tertiary: #f1f5f9;             /* Slightly Darker Gray */
  
  /* Text Colors */
  --text-primary: #1e293b;            /* Dark Slate */
  --text-secondary: #64748b;          /* Medium Gray */
  --text-muted: #94a3b8;              /* Light Gray */
  
  /* Enhanced Shadows */
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --border-radius: 6px;               /* Slightly smaller for crispness */
  --transition: all 0.2s ease;        /* Faster transitions */
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Modern Navbar Styling */
.navbar {
  background: var(--primary-color) !important;
  box-shadow: var(--shadow);
  padding: 1rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: white !important;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand img {
  height: 40px;
  width: auto;
}

.navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: var(--border-radius);
  transition: var(--transition);
  margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
  color: white !important;
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: white !important;
}

.dropdown-menu {
  border: none;
  box-shadow: var(--shadow);
  border-radius: var(--border-radius);
  padding: 0.5rem 0;
}

.dropdown-item {
  padding: 0.75rem 1.5rem;
  transition: var(--transition);
}

.dropdown-item:hover {
  background-color: var(--bg-tertiary);
  transform: translateX(5px);
}

/* Table Scrolling and Responsive Design */
.table-responsive {
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}

.table-responsive::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.table-responsive table {
  margin-bottom: 0;
}

.table-responsive thead th {
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 10;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

/* Responsive table improvements */
@media (max-width: 768px) {
  .table-responsive {
    max-height: 60vh;
  }
  
  .table-responsive table {
    font-size: 0.875rem;
  }
  
  .table-responsive th,
  .table-responsive td {
    padding: 0.5rem 0.25rem;
  }
}

/* Modern Card Styling */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
  background: var(--bg-primary);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.card-header {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Modern Button Styling */
.btn {
  border-radius: var(--border-radius);
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  transition: var(--transition);
  border: none;
  text-transform: none;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--secondary-color);
  box-shadow: var(--shadow);
  border: none;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-color);
  box-shadow: var(--shadow);
  border: none;
}

.btn-success:hover {
  background: #047857;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning-color);
  box-shadow: var(--shadow);
  border: none;
}

.btn-warning:hover {
  background: #b45309;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.btn-outline-primary {
  border: 2px solid var(--secondary-color);
  color: var(--secondary-color);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
}

/* Form Styling */
.form-control {
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  transition: var(--transition);
  font-size: 1rem;
  background: var(--bg-primary);
}

.form-control:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: var(--bg-primary);
}

.form-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-select {
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  transition: var(--transition);
  background: var(--bg-primary);
}

.form-select:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Alert Styling */
.alert {
  border: none;
  border-radius: var(--border-radius);
  padding: 1rem 1.5rem;
  font-weight: 500;
}

.alert-success {
  background: #f0fdf4;
  color: var(--success-color);
  border: 1px solid #bbf7d0;
  border-left: 4px solid var(--success-color);
}

.alert-danger {
  background: #fef2f2;
  color: var(--accent-color);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--accent-color);
}

.alert-warning {
  background: #fffbeb;
  color: var(--warning-color);
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--warning-color);
}

/* Table Styling */
.table {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table thead th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  padding: 1rem;
  font-weight: 600;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background-color: var(--bg-tertiary);
}

/* Badge Styling */
.badge {
  border-radius: 20px;
  padding: 0.5rem 0.75rem;
  font-weight: 500;
  font-size: 0.75rem;
}

/* Footer Styling */
.footer {
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 0;
  margin-top: auto;
  flex-shrink: 0;
}

.footer a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  color: white;
  text-decoration: underline;
}

/* Container and Layout */
.container {
  max-width: 1200px;
}

/* Main content area - ensures proper spacing from footer */
main {
  flex: 1;
  padding-bottom: 4rem;
}

/* Ensure tables don't get cut off by footer */
.table-responsive {
  margin-bottom: 3rem;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* Table container for better spacing */
.table-container {
  margin-bottom: 2rem;
}

/* Additional spacing for table pages */
.table-responsive + .pagination {
  margin-bottom: 3rem;
}

/* Pagination styling */
.pagination {
  margin-top: 1rem;
  margin-bottom: 2rem;
}

/* Ensure pagination is visible */
.pagination .page-link {
  color: var(--secondary-color);
  border-color: var(--border-color);
}

.pagination .page-item.active .page-link {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .navbar-brand img {
    height: 32px;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .btn {
    padding: 0.5rem 1rem;
  }
  
  /* Ensure proper spacing on mobile */
  main {
    padding-bottom: 2rem;
  }
  
  .table-responsive {
    margin-bottom: 2rem;
    max-height: 50vh;
  }
  
  .pagination {
    margin-bottom: 1.5rem;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
  background: var(--secondary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2980B9;
}

/* Focus Styles */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Logo Styling */
.logo-animation {
  /* Animation removed - static logo */
}

/* Modern Grid Layout */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

/* Glassmorphism Effect */
.glass-card {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--border-radius);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
}

.display-4 {
  font-weight: 700;
}

.lead {
  font-weight: 400;
  color: var(--text-secondary);
}

/* Text Colors */
.text-primary {
  color: var(--text-primary) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

.text-success {
  color: var(--success-color) !important;
}

.text-warning {
  color: var(--warning-color) !important;
}

.text-danger {
  color: var(--accent-color) !important;
}

/* Student Photo Styling */
.student-photo-thumbnail {
  border: 2px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
}

.student-photo-thumbnail:hover {
  border-color: var(--secondary-color);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.student-photo-placeholder {
  transition: var(--transition);
}

.student-photo-placeholder:hover {
  background-color: var(--border-color) !important;
  border-color: var(--secondary-color) !important;
}

/* Photo Upload Modal */
#photoUploadModal .modal-content {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-hover);
}

#photoUploadModal .modal-header {
  background: linear-gradient(135deg, var(--secondary-color), #2980B9);
  color: white;
  border: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

#photoUploadModal .modal-header .btn-close {
  filter: invert(1);
}

#photoPreview {
  text-align: center;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius);
}

#previewImage {
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow);
}

/* File Input Styling */
.form-control[type="file"] {
  padding: 0.5rem;
}

.form-control[type="file"]::-webkit-file-upload-button {
  background: linear-gradient(135deg, var(--secondary-color), #2980B9);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.form-control[type="file"]::-webkit-file-upload-button:hover {
  background: linear-gradient(135deg, #2980B9, var(--secondary-color));
  transform: translateY(-1px);
}

/* Camera Icon Button */
.btn .fas.fa-camera {
  font-size: 0.875rem;
}

/* Loading State */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

/* Responsive Photo Grid */
@media (max-width: 768px) {
  .student-photo-thumbnail,
  .student-photo-placeholder {
    width: 32px !important;
    height: 32px !important;
  }
  
  .student-photo-placeholder i {
    font-size: 16px !important;
  }
  
  .btn-sm .fas.fa-camera {
    font-size: 0.75rem;
  }
}

/* Camera Face Detection Styles */
#faceGuide {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

#cameraContainer {
  position: relative;
  display: inline-block;
}

#faceDetectionOverlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

#finalCropGuide {
  animation: none;
  border-color: #28a745 !important;
  border-width: 3px !important;
}

/* Selective Download Buttons */
.btn-group .btn-outline-success {
  border-color: var(--success-color);
  color: var(--success-color);
  transition: all 0.3s ease;
}

.btn-group .btn-outline-success:hover {
  background-color: var(--success-color);
  border-color: var(--success-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-group .btn-outline-success:disabled {
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}