*{
  box-sizing:border-box;
  margin:0;
  padding:0;
  font-family:Segoe UI, Arial, sans-serif;
}

body{
  min-height:100vh;
  background:linear-gradient(135deg,#e8f0ff,#f8fbff);
  color:#111827;
}

/* AUTH PAGE */

.auth-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.auth-card{
  width:100%;
  max-width:520px;
  background:#ffffff;
  border-radius:20px;
  padding:32px;
  box-shadow:0 18px 45px rgba(0,0,0,0.08);
}

.auth-header{
  margin-bottom:28px;
}

.auth-header h1{
  font-size:36px;
  margin-bottom:10px;
  font-weight:700;
}

.auth-header p{
  color:#6b7280;
  line-height:1.5;
  font-size:16px;
}

.role-section{
  margin-bottom:28px;
}

.role-section h2,
.auth-form h2,
.register-form h2{
  font-size:28px;
  margin-bottom:16px;
  font-weight:700;
}

.role-buttons{
  display:grid;
  gap:12px;
}

.role-btn{
  border:none;
  border-radius:12px;
  padding:14px 18px;
  font-size:16px;
  cursor:pointer;
  background:#e5edff;
  color:#111827;
  transition:0.2s ease;
}

.role-btn:hover{
  transform:translateY(-1px);
  background:#d8e5ff;
}

.auth-form,
.register-form{
  display:grid;
  gap:12px;
}

.auth-form label,
.register-form label{
  font-weight:600;
  font-size:15px;
}

.auth-form input,
.register-form input{
  width:100%;
  padding:14px 16px;
  border:1px solid #d1d5db;
  border-radius:12px;
  font-size:15px;
  outline:none;
  background:#fff;
}

.auth-form input:focus,
.register-form input:focus{
  border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,0.12);
}

.submit-btn{
  margin-top:8px;
  border:none;
  border-radius:12px;
  padding:14px 18px;
  font-size:16px;
  cursor:pointer;
  background:#111827;
  color:#ffffff;
  transition:0.2s ease;
  font-weight:600;
}

.submit-btn:hover{
  opacity:0.92;
}

.message{
  margin-top:18px;
  min-height:24px;
  font-size:14px;
}

.success{
  color:green;
}

.error{
  color:red;
}

/* NAVBAR */

.navbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:18px 40px;
  background:#0f172a;
  color:white;
}

.nav-left h2{
  font-weight:600;
}

.nav-right{
  display:flex;
  align-items:center;
  gap:20px;
}

.nav-right button{
  background:#ef4444;
  border:none;
  color:white;
  padding:10px 14px;
  border-radius:8px;
  cursor:pointer;
}

.nav-right button:hover{
  background:#dc2626;
}

/* DASHBOARD */

.dashboard{
  padding:40px;
  max-width:1000px;
  margin:auto;
}

.dashboard h1{
  margin-bottom:15px;
  font-size:28px;
}

.groups-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:15px;
  margin-top:20px;
}

.group-card{
  padding:18px;
  border:none;
  border-radius:12px;
  background:white;
  box-shadow:0 2px 8px rgba(0,0,0,0.08);
  cursor:pointer;
  font-size:16px;
  transition:0.2s;
}

.group-card:hover{
  transform:translateY(-3px);
  box-shadow:0 5px 15px rgba(0,0,0,0.12);
  background:#f9fafb;
}

.empty-text{
  color:#6b7280;
  font-size:14px;
  margin-top:10px;
}

/* GROUP PAGE */

.group-container{
  max-width:1000px;
  margin:auto;
  padding:40px;
}

.group-container h1{
  font-size:30px;
  margin-bottom:18px;
}

.group-container h2{
  font-size:22px;
  margin:34px 0 16px;
}

.add-student{
  display:flex;
  gap:12px;
  margin-bottom:30px;
}

.add-student input{
  flex:1;
  padding:14px 16px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:15px;
  outline:none;
}

.add-student input:focus{
  border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,0.12);
}

.students-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.student-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px;
  background:white;
  border-radius:12px;
  box-shadow:0 2px 8px rgba(0,0,0,0.08);
}

.rank{
  width:44px;
  font-weight:bold;
  font-size:18px;
  color:#2563eb;
}

.student-name{
  flex:1;
  font-weight:500;
}

.points{
  font-weight:bold;
  color:#111827;
}

.tests-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:12px;
  margin-top:20px;
}

.test-card{
  padding:14px;
  border:none;
  border-radius:10px;
  background:#2563eb;
  color:white;
  cursor:pointer;
  font-weight:600;
  transition:0.2s;
}

.test-card:hover{
  background:#1d4ed8;
  transform:translateY(-2px);
}

/* MODAL */

.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.45);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:1000;
}

.modal.hidden{
  display:none !important;
}

.modal-content{
  background:white;
  width:100%;
  max-width:520px;
  max-height:85vh;
  overflow-y:auto;
  padding:30px;
  border-radius:18px;
  box-shadow:0 20px 60px rgba(0,0,0,0.25);
  display:flex;
  flex-direction:column;
  gap:14px;
}

.auth-modal-content{
  position:relative;
  max-width:460px;
}

.close-btn{
  position:absolute;
  top:14px;
  right:14px;
  border:none;
  background:transparent;
  font-size:28px;
  line-height:1;
  cursor:pointer;
  color:#374151;
}

.questions-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.question-card{
  background:#f9fafb;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.question-text{
  font-size:18px;
  color:#111827;
}

.answer-text{
  font-size:16px;
  color:#2563eb;
}

.question-form{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.question-form label{
  font-size:15px;
  font-weight:600;
  color:#1f2937;
}

.question-form input{
  width:100%;
  padding:14px 16px;
  border:1px solid #cbd5e1;
  border-radius:10px;
  font-size:15px;
  outline:none;
}

.question-form input:focus{
  border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,0.12);
}

/* BUTTONS */

.primary-btn{
  background:#2563eb !important;
  color:white !important;
  border:none !important;
  padding:14px 18px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
  transition:0.2s ease;
}

.primary-btn:hover{
  background:#1d4ed8 !important;
}

.secondary-btn{
  background:#ef4444 !important;
  color:white !important;
  border:none !important;
  padding:14px 18px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
  transition:0.2s ease;
}

.secondary-btn:hover{
  background:#dc2626 !important;
}

.danger-btn{
  background:#ef4444 !important;
  color:white !important;
  border:none !important;
  padding:14px 18px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
  transition:0.2s ease;
}

.danger-btn:hover{
  background:#dc2626 !important;
}

.small-btn{
  align-self:flex-start;
  padding:10px 14px;
  border-radius:8px;
  font-size:14px;
}

@media (max-width:700px){
  .navbar{
    padding:16px 20px;
  }

  .group-container,
  .dashboard{
    padding:24px;
  }

  .add-student{
    flex-direction:column;
  }

  .auth-card{
    padding:24px;
  }

  .auth-header h1{
    font-size:30px;
  }
}

.modal-content input{
  width:100%;
  padding:14px 16px;
  border:1px solid #cbd5e1;
  border-radius:10px;
  font-size:15px;
  outline:none;
  background:#f8fafc;
  color:#111827;
  transition:0.2s ease;
}

.modal-content input:focus{
  border-color:#2563eb;
  background:#ffffff;
  box-shadow:0 0 0 4px rgba(37,99,235,0.12);
}

.student-page{
  max-width:1000px;
  margin:auto;
  padding:40px;
}

.student-header-card{
  background:#ffffff;
  border-radius:18px;
  box-shadow:0 12px 30px rgba(0,0,0,0.08);
  padding:28px;
  margin-bottom:30px;
}

.student-header-card h1{
  font-size:30px;
  margin-bottom:10px;
}

.student-header-card p{
  color:#4b5563;
  margin-bottom:18px;
}

.student-stats{
  display:flex;
  gap:16px;
  flex-wrap:wrap;
}

.stat-box{
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:16px 20px;
  min-width:140px;
}

.stat-box span{
  display:block;
  color:#6b7280;
  margin-bottom:6px;
}

.stat-box strong{
  font-size:24px;
  color:#111827;
}

.empty-state{
  background:#ffffff;
  border-radius:18px;
  box-shadow:0 12px 30px rgba(0,0,0,0.08);
  padding:28px;
}

.section-title{
  font-size:26px;
  margin:24px 0 18px;
}

.student-tests-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:18px;
}

.student-test-card{
  background:#ffffff;
  border-radius:16px;
  box-shadow:0 12px 30px rgba(0,0,0,0.08);
  padding:20px;
}

.student-test-card h3{
  font-size:20px;
  margin-bottom:12px;
}

.student-test-card p{
  margin-bottom:8px;
  color:#374151;
}

.student-test-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}

.student-answer-input{
  width:100%;
  padding:14px 16px;
  border:1px solid #cbd5e1;
  border-radius:10px;
  font-size:15px;
  outline:none;
  margin-top:10px;
}

.student-answer-input:focus{
  border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,0.12);
}

.result-summary{
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:16px;
  margin-bottom:16px;
}

.result-correct{
  color:#16a34a;
  font-weight:700;
}

.result-wrong{
  color:#dc2626;
  font-weight:700;
}

.hidden{
  display:none !important;
}

.student-page{
  max-width:1100px;
  margin:0 auto;
  padding:40px 24px 60px;
}

.student-header-card,
.empty-state,
.student-tests-section{
  background:#ffffff;
  border-radius:20px;
  box-shadow:0 10px 30px rgba(0,0,0,0.08);
  padding:28px;
  margin-bottom:28px;
}

.student-header-card h1{
  font-size:30px;
  margin-bottom:10px;
}

.student-header-card p{
  color:#475569;
  margin-bottom:12px;
  font-size:18px;
}

.student-stats{
  display:flex;
  gap:16px;
  flex-wrap:wrap;
  margin-top:18px;
}

.stat-box{
  min-width:140px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:16px;
  padding:18px 20px;
}

.stat-box span{
  display:block;
  color:#64748b;
  margin-bottom:8px;
  font-size:15px;
}

.stat-box strong{
  font-size:36px;
  color:#0f172a;
  line-height:1;
}

.empty-state h2{
  font-size:24px;
  margin-bottom:8px;
}

.empty-state p{
  color:#475569;
  font-size:18px;
}

.section-title{
  font-size:28px;
  margin-bottom:18px;
}

.student-tests-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:20px;
}

.student-test-card{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:18px;
  padding:22px;
}

.student-test-card h3{
  font-size:24px;
  margin-bottom:14px;
}

.student-test-card p{
  margin-bottom:10px;
  color:#334155;
  line-height:1.5;
  font-size:16px;
}

.student-test-actions{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:16px;
}

.student-test-actions .primary-btn,
.student-test-actions .secondary-btn{
  flex:1;
  min-width:140px;
}

@media (max-width: 768px){
  .student-page{
    padding:24px 16px 40px;
  }

  .student-header-card,
  .empty-state,
  .student-tests-section{
    padding:22px;
  }

  .student-header-card h1{
    font-size:26px;
  }

  .section-title{
    font-size:24px;
  }
}

button:disabled{
  opacity:0.6;
  cursor:not-allowed;
  pointer-events:none;
}

.accordion-section{
  margin-bottom:20px;
}

.accordion-toggle{
  width:100%;
  text-align:left;
  background:#0f172a;
  color:white;
  border:none;
  border-radius:14px;
  padding:16px 20px;
  font-size:18px;
  font-weight:700;
  cursor:pointer;
  margin-bottom:8px;
}

.accordion-toggle.active{
  background:#1e293b;
}

.accordion-content{
  display:none;
}

.accordion-content.open{
  display:block;
}

.tests-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:18px;
  margin-top:20px;
}

.tests-list .student-test-card{
  background:#ffffff;
  border:1px solid #e2e8f0;
  border-radius:18px;
  padding:20px;
  box-shadow:0 10px 24px rgba(0,0,0,0.06);
}

.tests-list .student-test-card h3{
  font-size:22px;
  margin-bottom:12px;
}

.tests-list .student-test-card p{
  margin-bottom:8px;
  color:#334155;
  font-size:15px;
}

.student-test-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}

.student-test-actions .primary-btn,
.student-test-actions .secondary-btn{
  flex:1;
  min-width:140px;
}