/* ============================================================
   EduChain — Blockchain Student Verification Platform
   Main Stylesheet
   ============================================================ */

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

/* ── CSS Custom Properties ──────────────────────────────── */
:root {
  /* Brand */
  --primary:        #0052CC;
  --primary-dark:   #0043A4;
  --primary-light:  #E6EFFE;
  --secondary:      #00875A;
  --secondary-light:#E3FCEF;
  --warning:        #FF8B00;
  --warning-light:  #FFFAE6;
  --danger:         #DE350B;
  --danger-light:   #FFEBE6;
  --info:           #0065FF;
  --info-light:     #DEEBFF;

  /* Neutrals */
  --white:          #FFFFFF;
  --bg:             #F4F5F7;
  --surface:        #FFFFFF;
  --border:         #DFE1E6;
  --border-hover:   #B3BAC5;
  --text-primary:   #172B4D;
  --text-secondary: #5E6C84;
  --text-muted:     #97A0AF;
  --text-inverse:   #FFFFFF;

  /* Blockchain accent */
  --chain-blue:     #0052CC;
  --chain-green:    #00875A;
  --chain-hash:     #6554C0;

  /* Shadows */
  --shadow-xs:   0 1px 2px rgba(23,43,77,.06);
  --shadow-sm:   0 2px 4px rgba(23,43,77,.08), 0 0 2px rgba(23,43,77,.04);
  --shadow-md:   0 4px 8px rgba(23,43,77,.1), 0 0 2px rgba(23,43,77,.06);
  --shadow-lg:   0 8px 24px rgba(23,43,77,.12), 0 0 4px rgba(23,43,77,.06);
  --shadow-xl:   0 16px 40px rgba(23,43,77,.15);

  /* Layout */
  --sidebar-w:   260px;
  --header-h:    64px;
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }
.text-sm   { font-size: 0.8125rem; }
.text-xs   { font-size: 0.75rem; }
.text-muted { color: var(--text-secondary); }
.font-mono { font-family: 'Roboto Mono', monospace; font-size: 0.8125rem; }

/* ── Utility ────────────────────────────────────────────── */
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.mt-1   { margin-top: 0.25rem; }
.mt-2   { margin-top: 0.5rem; }
.mt-3   { margin-top: 0.75rem; }
.mt-4   { margin-top: 1rem; }
.mb-1   { margin-bottom: 0.25rem; }
.mb-2   { margin-bottom: 0.5rem; }
.mb-3   { margin-bottom: 0.75rem; }
.mb-4   { margin-bottom: 1rem; }
.w-100  { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }



/* =============================================================
   BLOCKCHAIN LOADER OVERLAY
   ============================================================= */
#blockchainLoader {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#blockchainLoader.active {
  opacity: 1;
  visibility: visible;
}
.loader-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}
.loader-brand .brand-icon {
  width: 48px;
  height: 48px;
}
.loader-nodes {
  position: relative;
  width: 180px;
  height: 80px;
}
.loader-nodes .node {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  animation: nodePulse 1.4s ease-in-out infinite;
}
.loader-nodes .node:nth-child(1) { left: 0;    top: 50%; transform: translateY(-50%); animation-delay: 0s; }
.loader-nodes .node:nth-child(2) { left: 42px; top: 0;                               animation-delay: 0.1s; }
.loader-nodes .node:nth-child(3) { left: 84px; top: 50%; transform: translateY(-50%); animation-delay: 0.2s; }
.loader-nodes .node:nth-child(4) { left: 126px;top: 100%;transform: translateY(-100%); animation-delay: 0.3s; }
.loader-nodes .node:nth-child(5) { left: 166px;top: 50%; transform: translateY(-50%); animation-delay: 0.4s; }

.loader-nodes svg.chains {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.loader-nodes svg.chains line {
  stroke: var(--primary);
  stroke-width: 2;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: drawLine 1.4s ease-in-out infinite;
}
.loader-nodes svg.chains line:nth-child(1) { animation-delay: 0s; }
.loader-nodes svg.chains line:nth-child(2) { animation-delay: 0.15s; }
.loader-nodes svg.chains line:nth-child(3) { animation-delay: 0.3s; }
.loader-nodes svg.chains line:nth-child(4) { animation-delay: 0.45s; }

@keyframes drawLine {
  0%   { stroke-dashoffset: 60; opacity: 0.3; }
  50%  { stroke-dashoffset: 0;  opacity: 1; }
  100% { stroke-dashoffset: -60; opacity: 0.3; }
}
@keyframes nodePulse {
  0%, 100% { transform: translateY(var(--ty, -50%)) scale(1);   opacity: 0.5; background: var(--primary); }
  50%       { transform: translateY(var(--ty, -50%)) scale(1.3); opacity: 1;   background: var(--chain-hash); }
}

.loader-content { text-align: center; }
.loader-status {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  min-height: 1.6em;
}
.loader-hash {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  min-height: 1.4em;
  animation: hashScramble 0.1s linear infinite;
}
@keyframes hashScramble {
  0%  { opacity: 0.8; }
  50% { opacity: 1; }
}
.loader-progress-track {
  width: 320px;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.loader-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--chain-hash));
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.loader-step-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  text-align: left;
  min-width: 280px;
}
.loader-step {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.loader-step .step-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.loader-step.done   { color: var(--secondary); }
.loader-step.done   .step-icon { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.loader-step.active { color: var(--primary); font-weight: 500; }
.loader-step.active .step-icon { border-color: var(--primary); border-width: 2px;
  animation: spinIcon 0.8s linear infinite; }
@keyframes spinIcon {
  to { transform: rotate(360deg); }
}


/* =============================================================
   LOGIN PAGE
   ============================================================= */
.login-page { min-height: 100vh; display: flex; align-items: stretch; background: var(--white); }

/* ── Left Panel ── */
.login-panel-left {
  flex: 0 0 480px;
  background: linear-gradient(145deg, #0043A4 0%, #0052CC 40%, #0065FF 70%, #6554C0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.login-panel-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 50%);
}
/* Hex grid background */
.login-panel-left::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'%3E%3Cpolygon points='30,2 56,16 56,36 30,50 4,36 4,16' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 60px 52px;
}
.left-content { position: relative; z-index: 1; text-align: center; color: var(--white); max-width: 380px; }

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-xl);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
}
.brand-logo-wrap svg { width: 44px; height: 44px; }

.left-content h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.left-content p {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

/* Animated blockchain network */
.blockchain-net {
  position: relative;
  width: 100%;
  height: 160px;
  margin-top: 1rem;
}
.blockchain-net svg { width: 100%; height: 100%; }
.net-node { animation: netPulse 2s ease-in-out infinite; }
.net-node:nth-child(2) { animation-delay: 0.4s; }
.net-node:nth-child(3) { animation-delay: 0.8s; }
.net-node:nth-child(4) { animation-delay: 1.2s; }
.net-node:nth-child(5) { animation-delay: 1.6s; }
.net-edge {
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  animation: edgeDraw 3s ease-in-out infinite;
}
.net-edge:nth-child(6)  { animation-delay: 0.2s; }
.net-edge:nth-child(7)  { animation-delay: 0.6s; }
.net-edge:nth-child(8)  { animation-delay: 1.0s; }
.net-edge:nth-child(9)  { animation-delay: 1.4s; }
.net-edge:nth-child(10) { animation-delay: 1.8s; }
@keyframes netPulse {
  0%, 100% { opacity: 0.5; r: 6; }
  50%       { opacity: 1;   r: 9; }
}
@keyframes edgeDraw {
  0%   { stroke-dashoffset: 120; opacity: 0; }
  30%  { opacity: 1; }
  60%  { stroke-dashoffset: 0; opacity: 1; }
  90%  { stroke-dashoffset: -120; opacity: 0; }
  100% { stroke-dashoffset: 120; opacity: 0; }
}

.left-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  width: 100%;
  justify-content: center;
}
.left-stat { text-align: center; }
.left-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--white); }
.left-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.6); margin-top: 0.125rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Right Panel ── */
.login-panel-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--white);
}
.login-form-wrap {
  width: 100%;
  max-width: 420px;
}
.login-header { margin-bottom: 2rem; }
.login-header h2 { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); }
.login-header p { color: var(--text-secondary); margin-top: 0.25rem; }

/* Role Toggle */
.role-toggle {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 1.75rem;
  border: 1px solid var(--border);
}
.role-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.role-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.role-btn i { font-size: 0.875rem; }

/* Form */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.input-wrap { position: relative; }
.input-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.form-input {
  width: 100%;
  padding: 0.6875rem 0.875rem 0.6875rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,82,204,0.12);
}
.form-input.error { border-color: var(--danger); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(222,53,11,0.12); }
.field-error { font-size: 0.8125rem; color: var(--danger); margin-top: 0.3rem; display: none; }
.field-error.visible { display: block; }

/* Password toggle */
.pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 2px 4px;
  hover: var(--text-primary);
  transition: color var(--transition);
}
.pwd-toggle:hover { color: var(--text-primary); }

/* reCAPTCHA Widget */
/* ── Math CAPTCHA ───────────────────────────────── */
.captcha-wrap { margin-bottom: 1.5rem; }
.captcha-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #F9F9F9;
  padding: 0.875rem 1rem;
  transition: border-color var(--transition), background var(--transition);
}
.captcha-widget.error-state  { border-color: var(--danger); }
.captcha-widget.verified      { border-color: var(--secondary); background: var(--secondary-light); }

/* Challenge row */
.captcha-challenge {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.captcha-canvas-col {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
#captchaCanvas {
  display: block;
  border-radius: 6px;
  border: 1px solid #D0D7E0;
  cursor: default;
  background: #fff;
}
.captcha-refresh-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  transition: all var(--transition);
  padding: 0;
}
.captcha-refresh-btn:hover { border-color: var(--primary); color: var(--primary); }

.captcha-input-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.captcha-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.captcha-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.captcha-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Roboto Mono', monospace;
  background: var(--white);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.captcha-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,82,204,0.1); }
.captcha-input.correct { border-color: var(--secondary); }
.captcha-input.wrong   { border-color: var(--danger); animation: captchaShake 0.4s ease; }
.captcha-icon {
  position: absolute;
  right: 0.625rem;
  font-size: 0.9375rem;
  pointer-events: none;
}

/* Verified banner */
.captcha-verified-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

@keyframes captchaShake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* Submit Button */
.btn-submit {
  width: 100%;
  padding: 0.8125rem 1.5rem;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}
.btn-submit:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(0,82,204,0.35);
  transform: translateY(-1px);
}
.btn-submit:active:not(:disabled) { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-submit .btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-submit.loading .btn-spinner { display: block; }
.btn-submit.loading .btn-text { display: none; }

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.login-footer a { color: var(--primary); font-weight: 500; }

.form-error-banner {
  background: var(--danger-light);
  border: 1px solid rgba(222,53,11,0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--danger);
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
}
.form-error-banner.visible { display: flex; }


/* =============================================================
   DASHBOARD LAYOUT
   ============================================================= */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow), width var(--transition-slow);
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  flex-shrink: 0;
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--chain-hash));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo svg { width: 20px; height: 20px; }
.sidebar-brand-text {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-slow), width var(--transition-slow);
}
.sidebar.collapsed .sidebar-brand-text { opacity: 0; width: 0; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0; }
.nav-section { margin-bottom: 0.25rem; }
.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 1.25rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-slow);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg); color: var(--text-primary); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.nav-item i { width: 20px; text-align: center; font-size: 0.9375rem; flex-shrink: 0; }
.nav-item-label { overflow: hidden; transition: opacity var(--transition-slow), width var(--transition-slow); }
.sidebar.collapsed .nav-item-label { opacity: 0; width: 0; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  background: var(--primary);
  color: var(--white);
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
  transition: opacity var(--transition-slow);
}
.sidebar.collapsed .nav-badge { opacity: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.user-info { overflow: hidden; transition: opacity var(--transition-slow), width var(--transition-slow); }
.sidebar.collapsed .user-info { opacity: 0; width: 0; }
.user-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.75rem; color: var(--text-secondary); }

/* ── Main Content ── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}
.main-wrap.sidebar-collapsed { margin-left: 64px; }

/* ── Top Header ── */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 1rem;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.sidebar-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text-primary); }
.topbar-breadcrumb { display: flex; align-items: center; gap: 0.375rem; font-size: 0.875rem; }
.topbar-breadcrumb span { color: var(--text-muted); }
.topbar-breadcrumb .current { color: var(--text-primary); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search input {
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  width: 220px;
  transition: all var(--transition);
}
.topbar-search input:focus { background: var(--white); border-color: var(--primary); width: 280px; box-shadow: 0 0 0 3px rgba(0,82,204,0.1); }
.topbar-search i { position: absolute; left: 0.75rem; color: var(--text-muted); font-size: 0.875rem; }
.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg); color: var(--text-primary); }
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--white);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.topbar-user:hover { background: var(--bg); }
.topbar-user .user-avatar { width: 32px; height: 32px; font-size: 0.8125rem; }
.topbar-user .user-name { font-size: 0.875rem; font-weight: 500; }

/* ── Page Content ── */
.page-content { padding: 1.75rem 1.5rem; flex: 1; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.375rem; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.125rem; }
.page-actions { display: flex; align-items: center; gap: 0.75rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.5625rem 1.125rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 2px 8px rgba(0,82,204,0.3); }
.btn-secondary { background: var(--white); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--border-hover); }
.btn-success { background: var(--secondary); color: var(--white); border-color: var(--secondary); }
.btn-success:hover:not(:disabled) { background: #006644; box-shadow: 0 2px 8px rgba(0,135,90,0.3); }
.btn-danger { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-light); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.5625rem; aspect-ratio: 1; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.375rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-info {}
.stat-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.375rem; }
.stat-value { font-size: 1.875rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-change { font-size: 0.8125rem; margin-top: 0.375rem; display: flex; align-items: center; gap: 0.25rem; }
.stat-change.up   { color: var(--secondary); }
.stat-change.down { color: var(--danger); }
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light);  color: var(--primary); }
.stat-icon.green  { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.orange { background: var(--warning-light);   color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);    color: var(--danger); }
.stat-icon.purple { background: #EAE6FF; color: var(--chain-hash); }

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.card-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 0.125rem; }
.card-body { padding: 1.375rem; }
.card-actions { display: flex; align-items: center; gap: 0.5rem; }

/* ── Badges / Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-verified { background: var(--secondary-light); color: #006644; border: 1px solid rgba(0,135,90,0.2); }
.badge-pending  { background: var(--warning-light);   color: #974F0C; border: 1px solid rgba(255,139,0,0.2); }
.badge-rejected { background: var(--danger-light);    color: #BF2600; border: 1px solid rgba(222,53,11,0.2); }
.badge-processing { background: var(--info-light);   color: #0052CC; border: 1px solid rgba(0,82,204,0.2); }
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Table Toolbar ── */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.table-search {
  position: relative;
  display: flex;
  align-items: center;
}
.table-search input {
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  width: 280px;
  transition: all var(--transition);
}
.table-search input:focus { background: var(--white); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,82,204,0.1); }
.table-search i { position: absolute; left: 0.75rem; color: var(--text-muted); font-size: 0.875rem; }
.table-filters { display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap; }
.filter-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--white);
  color: var(--text-primary);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235E6C84' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

/* ── DataTable overrides ── */
.datatable-wrap { overflow-x: auto; }
table.dataTable { border-collapse: collapse !important; width: 100% !important; }
table.dataTable thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
table.dataTable thead th:hover { color: var(--text-primary); }
table.dataTable tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
}
table.dataTable tbody tr:last-child td { border-bottom: none; }
table.dataTable tbody tr:hover td { background: #FAFBFC; }
.dataTables_wrapper .dataTables_info { font-size: 0.8125rem; color: var(--text-secondary); padding: 0.75rem 0; }
.dataTables_wrapper .dataTables_paginate { padding: 0.75rem 0; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  border: 1px solid transparent !important;
  color: var(--text-secondary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  color: var(--white) !important;
  border-color: var(--primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
  background: var(--bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  outline: none;
}
.dataTables_wrapper .dataTables_filter { display: none; } /* using custom search */
.hash-cell {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  color: var(--chain-hash);
  max-width: 160px;
}

/* ── Upload Drop Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-icon { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.upload-zone:hover .upload-icon, .upload-zone.drag-over .upload-icon { color: var(--primary); }
.upload-title { font-weight: 600; color: var(--text-primary); margin-bottom: 0.25rem; }
.upload-subtitle { font-size: 0.875rem; color: var(--text-secondary); }
.upload-meta { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.75rem; }
#fileInput { display: none; }
.upload-progress-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.upload-progress-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.upload-file-icon { color: var(--primary); font-size: 1.25rem; }
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.upload-file-size { font-size: 0.75rem; color: var(--text-muted); }
.upload-bar-wrap { height: 4px; background: var(--border); border-radius: var(--radius-full); margin-top: 0.375rem; }
.upload-bar { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--primary), var(--chain-hash)); width: 0; transition: width 0.3s ease; }
.upload-status-icon { font-size: 1rem; }

/* ── Timeline / Audit Log ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 1rem; padding: 0.875rem 0; }
.timeline-item + .timeline-item { border-top: 1px solid var(--border); }
.timeline-dot-wrap { display: flex; flex-direction: column; align-items: center; gap: 0; flex-shrink: 0; padding-top: 4px; }
.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.dot-verify   { background: var(--secondary-light); color: var(--secondary); }
.dot-upload   { background: var(--info-light);      color: var(--info); }
.dot-reject   { background: var(--danger-light);    color: var(--danger); }
.dot-pending  { background: var(--warning-light);   color: var(--warning); }
.dot-system   { background: #EAE6FF;                color: var(--chain-hash); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.timeline-meta { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 0.125rem; }
.timeline-hash { font-family: 'Roboto Mono', monospace; font-size: 0.75rem; color: var(--chain-hash); margin-top: 0.25rem; }
.timeline-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; padding-top: 4px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23,43,77,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.0625rem; font-weight: 600; }
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ── Verification Status (Student) ── */
.verification-hero {
  background: linear-gradient(135deg, #F0F5FF 0%, #EAE6FF 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
}
.verification-hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,82,204,0.06) 0%, transparent 70%);
}
.verify-status-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  flex-shrink: 0;
}
.verify-status-icon.verified  { background: var(--secondary-light); color: var(--secondary); }
.verify-status-icon.pending   { background: var(--warning-light);   color: var(--warning); }
.verify-status-icon.unverified{ background: var(--danger-light);    color: var(--danger); }
.verify-hero-content { flex: 1; }
.verify-hero-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.verify-hero-sub { color: var(--text-secondary); font-size: 0.9375rem; }
.verify-hash-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.875rem;
  padding: 0.625rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 480px;
}
.verify-hash-row .hash-label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.verify-hash-row .hash-val { font-family: 'Roboto Mono', monospace; font-size: 0.8125rem; color: var(--chain-hash); flex: 1; }
.copy-btn { padding: 0.25rem 0.5rem; background: none; border: none; color: var(--text-muted); font-size: 0.875rem; cursor: pointer; transition: color var(--transition); }
.copy-btn:hover { color: var(--primary); }

/* ── Document Cards ── */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.doc-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
}
.doc-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.doc-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 0.875rem;
}
.doc-icon.blue   { background: var(--primary-light); color: var(--primary); }
.doc-icon.green  { background: var(--secondary-light); color: var(--secondary); }
.doc-icon.purple { background: #EAE6FF; color: var(--chain-hash); }
.doc-card-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.25rem; }
.doc-card-meta  { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.75rem; }

/* ── Chart container ── */
.chart-wrap { height: 240px; position: relative; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-icon { font-size: 3rem; color: var(--border); margin-bottom: 0.75rem; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.375rem; }
.empty-desc { font-size: 0.875rem; color: var(--text-muted); }

/* ── Toast Notifications ── */
#toastContainer {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
}
.toast {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.875rem 1.125rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show { transform: translateX(0); }
.toast.hide { transform: translateX(120%); }
.toast i { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.toast.success i { color: var(--secondary); }
.toast.error   i { color: var(--danger); }
.toast.warning i { color: var(--warning); }
.toast.info    i { color: var(--primary); }
.toast-content { flex: 1; }
.toast-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.toast-desc  { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 0.125rem; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .login-panel-left { flex: 0 0 360px; }
}
@media (max-width: 768px) {
  .login-panel-left { display: none; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-search input { width: 100%; }
  .verification-hero { flex-direction: column; text-align: center; }
  .verify-hash-row { max-width: 100%; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
}
