@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.1);
  --secondary: #0f172a;
  --background: #f1f5f9;
  --surface: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --danger: #ef4444;
  --success: #10b981;
  --border: rgba(226, 232, 240, 0.8);
  --radius: 16px;
  
  /* Modern soft shadows */
  --shadow-sm: 0 2px 4px rgba(148, 163, 184, 0.05);
  --shadow: 0 4px 20px rgba(148, 163, 184, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 30px rgba(37, 99, 235, 0.1), 0 4px 6px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 15px 35px rgba(37, 99, 235, 0.15), 0 5px 15px rgba(0, 0, 0, 0.05);
  
  /* Transition timings */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background);
  background-image: 
    radial-gradient(at 0% 0%, hsla(217, 100%, 96%, 1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(217, 100%, 94%, 1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: -0.02em;
}

/* Base Layout Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  flex: 1;
}

/* Glass Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  padding: 1rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 1.5rem;
}

.brand i {
  color: var(--primary);
  filter: drop-shadow(0 2px 4px rgba(37,99,235,0.4));
}

.brand h2 {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  letter-spacing: -0.03em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* Enhanced Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem 1.75rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: white;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  color: white;
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background-color: transparent;
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--primary);
}
.btn-outline:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #f87171);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.35);
}

/* Glass & Elevated Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

/* Add a subtle highlight to cards */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  opacity: 0;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--border);
}
.card:hover::before {
  opacity: 1;
}

/* Layout Grids */
.grid {
  display: grid;
  gap: 2rem;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* Modern Forms */
.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--secondary);
}
.form-control {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  transition: var(--transition);
  background-color: #f8fafc;
  color: var(--text-main);
  font-family: inherit;
}
.form-control:hover {
  background-color: var(--surface);
  border-color: #cbd5e1;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
  background-color: var(--surface);
}

/* Elegant Admin Sidebar */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 76px); 
}
.sidebar {
  width: 280px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar a {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}
.sidebar a i {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}
.sidebar a:hover {
  background: var(--surface);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}
.sidebar a:hover i {
  transform: scale(1.1);
  color: var(--primary);
}
.sidebar a.active {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: white;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}
.sidebar a.active i {
  color: white;
}

.main-content {
  flex: 1;
  padding: 3rem;
  width: 100%;
  overflow-x: auto;
}

/* Highly Polished Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
}
th, td {
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-size: 0.95rem;
}
td {
  border-bottom: 1px solid var(--border);
}
th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--border);
}
tr:last-child td {
  border-bottom: none;
}
tr {
  transition: var(--transition);
}
tr:hover td {
  background-color: #f8fafc;
}

/* Beautiful Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.badge-success { background: #ecfdf5; color: #059669; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-primary { background: #eff6ff; color: #2563eb; }

/* Alerts / Notifications */
.alert-container {
  margin-bottom: 2rem;
}
.alert {
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow);
}
.alert-success { background: #ecfdf5; color: #059669; border-left: 4px solid #10b981; }
.alert-error { background: #fef2f2; color: #dc2626; border-left: 4px solid #ef4444; }
.alert-info { background: #eff6ff; color: #2563eb; border-left: 4px solid #3b82f6; }

/* Smooth Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal.active { 
  display: flex; 
  opacity: 1;
}
.modal-content {
  background: var(--surface);
  border-radius: 24px;
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95) translateY(20px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal.active .modal-content {
  transform: scale(1) translateY(0);
}
.modal-header {
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-size: 1.35rem;
}
.modal-body { padding: 2rem; }
.close-btn { 
  background: var(--background); 
  border: none; 
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; 
  cursor: pointer; 
  color: var(--text-muted); 
  transition: var(--transition);
}
.close-btn:hover {
  background: #e2e8f0;
  color: var(--secondary);
  transform: rotate(90deg);
}

/* Student Specific Elements */
.stat-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(180deg, var(--surface) 0%, #f8fafc 100%);
}
.stat-card .value {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Outfit';
  line-height: 1.1;
}
.stat-card .label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  letter-spacing: 0.05em;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsiveness Enhancements */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .sidebar { 
    width: 100%; 
    border-right: none; 
    border-bottom: 1px solid var(--border); 
    flex-direction: row; 
    flex-wrap: nowrap; 
    overflow-x: auto;
    padding: 1rem;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-items: center;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar a {
    white-space: nowrap;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    margin: 0 !important; /* Override auto margins for mobile flex row */
    border: none !important; /* Remove top borders on mobile */
  }
  
  .main-content { padding: 1.5rem 1rem; }
  
  /* Stack grids into single columns */
  .grid, .grid-2, .grid-3, .grid-4 { 
    grid-template-columns: 1fr !important; 
    gap: 1.5rem; 
  }
  
  .card { padding: 1.5rem; }
  
  .navbar { 
    padding: 1rem; 
    flex-direction: column;
    gap: 1rem;
  }
  
  /* Tables horizontally scrollable */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  th, td {
    padding: 1rem;
    white-space: nowrap; /* Prevent breaking table layout */
  }
  
  /* Modals */
  .modal-content {
    margin: 1rem;
    max-height: 85vh;
  }
  .modal-header {
    padding: 1.25rem 1.5rem;
  }
  .modal-body {
    padding: 1.5rem;
  }
  
  /* Action buttons */
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
    justify-content: center;
  }
  
  /* Flexbox overrides for card headers and actions */
  div[style*="display: flex; justify-content: space-between"] {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }
}

