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

:root {
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --primary-light: #4CAF50;
  --accent: #FFD700;
  --accent-dark: #F9A825;
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 60px;
  --text-dark: #1a1a2e;
  --text-muted: #6c757d;
  --bg-light: #f0f4f8;
  --white: #ffffff;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.wrapper { min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

.sidebar-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  margin-bottom: 12px;
}

.sidebar-logo-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  border: 3px solid var(--accent);
  font-size: 2rem;
  color: var(--accent);
}

.sidebar-school-name {
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0.95;
}

.sidebar-nav { padding: 16px 0; }

.sidebar-section {
  color: rgba(255,255,255,0.45);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 16px 20px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 2px 0;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border-left-color: rgba(255,215,0,0.5);
}

.sidebar-link.active {
  background: rgba(255,255,255,0.15);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-link i { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar { font-size: 2rem; color: rgba(255,255,255,0.7); }
.user-name { color: var(--white); font-size: 0.875rem; font-weight: 600; }
.user-role { color: var(--accent); font-size: 0.7rem; text-transform: capitalize; }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.8rem;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.15);
  width: 100%;
  justify-content: center;
}
.btn-logout:hover { background: rgba(220,53,69,0.3); color: #ff8a8a; border-color: rgba(220,53,69,0.4); }

/* ===== CONTENT WRAPPER ===== */
.content-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.topbar {
  height: var(--topbar-height);
  background: var(--white);
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.topbar-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.page-content { padding: 28px; flex-grow: 1; }

/* ===== CARDS ===== */
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.stat-card.green::before { background: var(--primary); }
.stat-card.gold::before { background: var(--accent); }
.stat-card.blue::before { background: #1976D2; }
.stat-card.red::before { background: #C62828; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
}
.stat-icon.green { background: #E8F5E9; color: var(--primary); }
.stat-icon.gold { background: #FFFDE7; color: var(--accent-dark); }
.stat-icon.blue { background: #E3F2FD; color: #1976D2; }
.stat-icon.red { background: #FFEBEE; color: #C62828; }

.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-dark); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }

/* ===== TABLES ===== */
.table-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.table-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-card-title { font-size: 1rem; font-weight: 600; color: var(--text-dark); }

.table { margin: 0; }
.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 20px;
  border-bottom: 2px solid var(--border-color);
}
.table tbody td { padding: 14px 20px; vertical-align: middle; font-size: 0.875rem; }
.table tbody tr:hover { background: #f8fafc; }

/* ===== FORMS ===== */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.form-label { font-weight: 600; font-size: 0.875rem; color: var(--text-dark); margin-bottom: 6px; }
.form-control, .form-select { border-radius: var(--radius-sm); border: 1.5px solid var(--border-color); font-size: 0.875rem; padding: 10px 14px; transition: var(--transition); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,0.15); }

/* ===== BUTTONS ===== */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: #2E7D32; border-color: #2E7D32; }

/* ===== BADGES ===== */
.badge-pass { background: #E8F5E9; color: #2E7D32; font-weight: 600; padding: 5px 10px; border-radius: 20px; font-size: 0.75rem; }
.badge-fail { background: #FFEBEE; color: #C62828; font-weight: 600; padding: 5px 10px; border-radius: 20px; font-size: 0.75rem; }
.badge-grade { background: #E3F2FD; color: #1565C0; font-weight: 700; padding: 5px 12px; border-radius: 20px; font-size: 0.8rem; }

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.page-header p { color: var(--text-muted); font-size: 0.875rem; }

/* ===== LOGIN PAGE ===== */
.login-body { background: var(--bg-light); }

.login-wrapper {
  display: flex;
  min-height: 100vh;
}

.login-left {
  width: 45%;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #388E3C 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--white);
}

.login-form-container { width: 100%; max-width: 400px; }

.login-logo-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--accent);
  border: 4px solid rgba(255,215,0,0.5);
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.login-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255,215,0,0.5);
  margin-bottom: 24px;
}

.login-school-name {
  color: var(--white);
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.login-school-address {
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  text-align: center;
}

.login-tagline {
  position: absolute;
  bottom: 32px;
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.deco-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.deco-1 { width: 200px; height: 200px; top: -60px; right: -60px; }
.deco-2 { width: 150px; height: 150px; bottom: 80px; left: -40px; }
.deco-3 { width: 80px; height: 80px; top: 40%; right: 20px; }

.login-title { font-size: 1.75rem; font-weight: 700; color: var(--text-dark); margin-bottom: 6px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 28px; }

.btn-login {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(46,125,50,0.35);
}
.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(46,125,50,0.45);
  background: linear-gradient(135deg, var(--primary), #388E3C);
  color: white;
}

/* ===== RESULT CARD (Print) ===== */
.result-card-preview {
  background: white;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 3px solid var(--primary);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.result-card-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.result-card-school-info h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.result-card-school-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-card-title {
  text-align: center;
  margin-bottom: 20px;
}

.result-card-title h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2px solid var(--primary);
  display: inline-block;
  padding: 6px 24px;
  border-radius: 4px;
}

.student-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.info-row { display: flex; gap: 8px; font-size: 0.85rem; }
.info-label { color: var(--text-muted); font-weight: 600; min-width: 100px; }
.info-value { color: var(--text-dark); font-weight: 500; }

.marks-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.marks-table th {
  background: var(--primary-dark);
  color: white;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.marks-table td { padding: 10px 14px; font-size: 0.875rem; border-bottom: 1px solid #eee; }
.marks-table tbody tr:nth-child(even) { background: #f9fafb; }
.marks-table tfoot td { background: #f0f4f0; font-weight: 700; border-top: 2px solid var(--primary); padding: 12px 14px; }

.result-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.signature-block { text-align: center; }
.signature-img { max-width: 120px; max-height: 60px; }
.signature-line { border-top: 1.5px solid var(--text-dark); width: 140px; margin: 8px auto 4px; }
.signature-title { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.qr-block { text-align: center; }
.qr-block img { width: 80px; height: 80px; }
.qr-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; }

.result-summary-box {
  background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.summary-item .value { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); }
.summary-item .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; }

.remarks-section { margin: 16px 0; }
.remarks-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.remarks-text { font-size: 0.875rem; color: var(--text-dark); border-left: 3px solid var(--primary); padding-left: 12px; font-style: italic; }

/* ===== PRINT STYLES ===== */
@media print {
  body { background: white !important; }
  .sidebar, .topbar, .no-print, .btn { display: none !important; }
  .content-wrapper { margin-left: 0 !important; }
  .result-card-preview { box-shadow: none !important; border: none !important; padding: 0 !important; }
  .page-content { padding: 0 !important; }
  @page { margin: 15mm; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .content-wrapper { margin-left: 0 !important; }
  .login-left { display: none; }
  .login-right { padding: 24px; }
  .student-info-grid { grid-template-columns: 1fr; }
}

/* ===== UTILITIES ===== */
.text-primary-green { color: var(--primary) !important; }
.bg-primary-green { background: var(--primary) !important; }
.border-primary-green { border-color: var(--primary) !important; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; display: block; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #E8F5E9; display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; }
