/* ==============================================================================
   IMPERIAL APEX UNIVERSITY - STUDENT RESULT MANAGEMENT SYSTEM (SRMS)
   Modern Design System & Component Library
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Brand Color Palette */
  --primary: #0f2744;          /* Imperial Deep Navy */
  --primary-light: #1e3a5f;
  --primary-dark: #0a192f;
  --primary-hover: #162f4d;
  
  --secondary: #d97706;        /* Academic Royal Gold */
  --secondary-light: #fef3c7;
  --secondary-hover: #b45309;

  --accent-blue: #2563eb;
  --accent-cyan: #0891b2;
  --accent-emerald: #059669;
  --accent-rose: #e11d48;
  --accent-amber: #d97706;
  --accent-purple: #7c3aed;

  /* Surfaces & Backgrounds */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #edf2f7;
  
  /* Text & Typography */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Layout Dimensions */
  --sidebar-width: 260px;
  --topbar-height: 70px;
  --bottom-nav-height: 64px;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  min-height: 100vh;
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary);
}

img {
  max-width: 100%;
  display: block;
}

/* ==============================================================================
   TYPOGRAPHY & UTILITIES
   ============================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--primary);
  font-weight: 700;
  line-height: 1.25;
}

.text-muted { color: var(--text-muted) !important; }
.text-gold { color: var(--secondary) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-blue { color: var(--accent-blue) !important; }
.text-rose { color: var(--accent-rose) !important; }
.font-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ==============================================================================
   BUTTONS
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  line-height: 1.2;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--text-inverse);
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(15, 39, 68, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--text-inverse);
  box-shadow: 0 4px 8px rgba(15, 39, 68, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-hover));
  color: #ffffff;
  border-color: var(--secondary);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--accent-emerald);
  color: #ffffff;
}
.btn-success:hover {
  background: #047857;
}

.btn-danger {
  background: var(--accent-rose);
  color: #ffffff;
}
.btn-danger:hover {
  background: #be123c;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.825rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

/* ==============================================================================
   BADGES & CHIPS
   ============================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.775rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-emerald, .badge-published, .badge-approved, .badge-active, .badge-pass {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-blue, .badge-registered, .badge-student {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-amber, .badge-submitted_to_hod, .badge-submitted_to_admin, .badge-in_progress, .badge-lecturer {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-rose, .badge-rejected_by_hod, .badge-rejected_by_admin, .badge-fail, .badge-inactive, .badge-suspended {
  background-color: #ffe4e6;
  color: #9f1239;
}

.badge-slate, .badge-draft {
  background-color: #f1f5f9;
  color: #475569;
}

.badge-purple, .badge-hod, .badge-admin {
  background-color: #f3e8ff;
  color: #6b21a8;
}

/* ==============================================================================
   CARDS & PANELS
   ============================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

/* Stat Card */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat-card.stat-gold::before { background: var(--secondary); }
.stat-card.stat-emerald::before { background: var(--accent-emerald); }
.stat-card.stat-blue::before { background: var(--accent-blue); }
.stat-card.stat-rose::before { background: var(--accent-rose); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--bg-subtle);
  color: var(--primary);
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  margin-top: 0.25rem;
}

/* ==============================================================================
   DATA TABLES
   ============================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ==============================================================================
   FORMS & INPUTS
   ============================================================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-size: 0.925rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

/* ==============================================================================
   FLASH ALERTS
   ============================================================================== */
.flash-container {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.flash-alert {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  animation: slideInDown 0.3s ease-out;
}

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

.flash-alert.flash-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.flash-alert.flash-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.flash-alert.flash-warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.flash-alert.flash-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.flash-icon {
  font-weight: bold;
  font-size: 1.1rem;
}

.flash-text {
  flex-grow: 1;
}

.flash-close {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.flash-close:hover {
  opacity: 1;
}

/* ==============================================================================
   DASHBOARD LAYOUT (DESKTOP & RESPONSIVE SHELL)
   ============================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 2px;
  object-fit: contain;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-nav {
  flex-grow: 1;
  padding: 1.25rem 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-title {
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.08em;
  padding: 0.75rem 0.75rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(90deg, var(--secondary) 0%, #f59e0b 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
}

.nav-icon {
  font-size: 1.15rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-mini-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--secondary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-meta-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta-role {
  font-size: 0.725rem;
  color: var(--secondary-light);
}

/* Main Content Area */
.app-main {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}

/* Topbar */
.app-topbar {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.topbar-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-body {
  flex-grow: 1;
  padding: 2rem;
  background-color: var(--bg-page);
}

/* ==============================================================================
   MODAL COMPONENT
   ============================================================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #f8fafc;
}
