:root {
  --bg-base:      #0d1117;
  --bg-surface:   #161b22;
  --bg-elevated:  #1c2128;
  --bg-hover:     #21262d;
  --border:       #30363d;
  --accent:       #5c6bc0;
  --accent-glow:  rgba(92,107,192,0.20);
  --accent-light: #7986cb;
  --success:      #2ea043;
  --danger:       #f85149;
  --warning:      #d29922;
  --text-primary: #e6edf3;
  --text-muted:   #8b949e;
  --text-dim:     #484f58;
  --radius:       12px;

  /* Role colours */
  --role-admin:   #5c6bc0;
  --role-student: #2ea043;
  --role-teacher: #388bfd;
  --role-studio:  #d29922;
}

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

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── BACKGROUND MESH ── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-mesh::before {
  content: "";
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92,107,192,0.12) 0%, transparent 70%);
  top: -200px; left: -100px;
  animation: pulse 8s ease-in-out infinite alternate;
}
.bg-mesh::after {
  content: "";
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56,139,253,0.08) 0%, transparent 70%);
  bottom: -150px; right: -100px;
  animation: pulse 10s ease-in-out infinite alternate-reverse;
}
@keyframes pulse {
  from { transform: scale(1); opacity: .8; }
  to   { transform: scale(1.15); opacity: 1; }
}

/* ── GRID LINES ── */
.grid-lines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(92,107,192,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92,107,192,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── LAYOUT ── */
.login-wrap {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  padding: 20px;
  animation: slideUp .45s cubic-bezier(.16,1,.3,1) both;
}
@keyframes slideUp {
  from { opacity:0; transform:translateY(24px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── BRAND HEADER ── */
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.brand-logo {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 0 0 8px rgba(92,107,192,0.12), 0 8px 24px rgba(92,107,192,0.3);
}
.brand-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.4px;
}
.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── CARD ── */
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
}

/* ── ROLE SELECTOR ── */
.role-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.role-tile {
  position: relative;
  cursor: pointer;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  padding: 12px 6px 10px;
  text-align: center;
  transition: border-color .2s, background .2s, transform .15s;
  user-select: none;
}
.role-tile:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}
.role-tile input[type="radio"] {
  display: none;
}
.role-tile .role-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 7px;
  font-size: 18px;
  transition: background .2s;
}
.role-tile .role-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color .2s;
  letter-spacing: .1px;
}
.role-tile .role-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  font-size: 8px;
  color: #fff;
}

/* Active state per role */
.role-tile.active-admin   { border-color: var(--role-admin);   background: rgba(92,107,192,0.10); }
.role-tile.active-student { border-color: var(--role-student); background: rgba(46,160,67,0.10); }
.role-tile.active-teacher { border-color: var(--role-teacher); background: rgba(56,139,253,0.10); }
.role-tile.active-studio  { border-color: var(--role-studio);  background: rgba(210,153,34,0.10); }

.role-tile.active-admin   .role-icon { background: rgba(92,107,192,0.18);  color: var(--role-admin); }
.role-tile.active-student .role-icon { background: rgba(46,160,67,0.18);   color: var(--role-student); }
.role-tile.active-teacher .role-icon { background: rgba(56,139,253,0.18);  color: var(--role-teacher); }
.role-tile.active-studio  .role-icon { background: rgba(210,153,34,0.18);  color: var(--role-studio); }

.role-tile.active-admin   .role-icon { color: #7986cb; }
.role-tile.active-student .role-icon { color: #3fb950; }
.role-tile.active-teacher .role-icon { color: #79c0ff; }
.role-tile.active-studio  .role-icon { color: #e3b341; }

.role-tile.active-admin   .role-name { color: #7986cb; }
.role-tile.active-student .role-name { color: #3fb950; }
.role-tile.active-teacher .role-name { color: #79c0ff; }
.role-tile.active-studio  .role-name { color: #e3b341; }

.role-tile.active-admin   .role-check { background: var(--role-admin);   border-color: var(--role-admin); }
.role-tile.active-student .role-check { background: var(--role-student); border-color: var(--role-student); }
.role-tile.active-teacher .role-check { background: var(--role-teacher); border-color: var(--role-teacher); }
.role-tile.active-studio  .role-check { background: var(--role-studio);  border-color: var(--role-studio); }

/* Default icon colours (inactive) */
.role-tile[data-role="Admin"]   .role-icon { background: rgba(92,107,192,0.08);  color: var(--text-dim); }
.role-tile[data-role="Student"] .role-icon { background: rgba(46,160,67,0.08);   color: var(--text-dim); }
.role-tile[data-role="Teacher"] .role-icon { background: rgba(56,139,253,0.08);  color: var(--text-dim); }
.role-tile[data-role="Studio"]  .role-icon { background: rgba(210,153,34,0.08);  color: var(--text-dim); }

/* ── FORM FIELDS ── */
.field-group {
  margin-bottom: 14px;
}
.field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.field-label .material-icons-round { font-size: 14px; }

.field-wrap {
  position: relative;
}
.field-wrap .field-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
  z-index: 2;
}
.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 38px 10px 36px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.toggle-pass {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  display: flex; align-items: center;
  padding: 2px;
  z-index: 2;
  transition: color .2s;
}
.toggle-pass:hover { color: var(--text-muted); }
.toggle-pass .material-icons-round { font-size: 17px; }

/* ── STATUS BAR ── */
.status-bar {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
  margin: 6px 0 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transition: opacity .2s;
}
.status-bar.show { opacity: 1; }
.status-bar .material-icons-round { font-size: 14px; }
.status-bar.ok { color: var(--success); }

/* ── SUBMIT BUTTON ── */
.btn-login {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 18px rgba(92,107,192,0.3);
  letter-spacing: .1px;
}
.btn-login:hover:not(:disabled) {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(92,107,192,0.4);
}
.btn-login:active { transform: translateY(0); }
.btn-login:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
.btn-login .material-icons-round { font-size: 18px; }

/* Role-tinted submit button */
.btn-login.role-student { background: var(--role-student); box-shadow: 0 4px 18px rgba(46,160,67,0.3); }
.btn-login.role-teacher { background: var(--role-teacher); box-shadow: 0 4px 18px rgba(56,139,253,0.3); }
.btn-login.role-studio  { background: var(--role-studio);  box-shadow: 0 4px 18px rgba(210,153,34,0.3); }
.btn-login.role-student:hover:not(:disabled) { background: #3fb950; }
.btn-login.role-teacher:hover:not(:disabled) { background: #79c0ff; }
.btn-login.role-studio:hover:not(:disabled)  { background: #e3b341; }

/* ── SPINNER INSIDE BUTTON ── */
.spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ROLE BADGE STRIP ── */
.role-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 11px;
  color: var(--text-dim);
}
.role-strip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

/* ── FOOTER ── */
.login-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── USER PORTAL CARD (non-Admin) ── */
.portal-card {
  display: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  align-items: center;
  gap: 10px;
}
.portal-card.show { display: flex; }
.portal-card .pc-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
