/* ============================================================
   Smart Homework & Quiz Management System — Shared Styles
   ============================================================ */

:root {
  --shqms-primary:   #4f46e5;
  --shqms-secondary: #7c3aed;
  --shqms-success:   #059669;
  --shqms-danger:    #dc2626;
  --shqms-warning:   #d97706;
  --shqms-info:      #0284c7;
  --shqms-light:     #f8fafc;
  --shqms-dark:      #1e293b;
  --shqms-border:    #e2e8f0;
  --shqms-radius:    12px;
  --shqms-shadow:    0 4px 24px rgba(79, 70, 229, 0.10);
  --shqms-shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
}

/* ── Layout ── */
.shqms-wrap {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--shqms-dark);
  background: #f1f5f9;
  min-height: 100vh;
  padding: 0;
}

/* ── Header bar ── */
.shqms-header {
  background: linear-gradient(135deg, var(--shqms-primary) 0%, var(--shqms-secondary) 100%);
  color: #fff;
  padding: 20px 32px;
  border-radius: 0 0 var(--shqms-radius) var(--shqms-radius);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shqms-shadow);
}
.shqms-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}
.shqms-header .badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
}

/* ── Stat cards ── */
.shqms-stat-card {
  background: #fff;
  border-radius: var(--shqms-radius);
  padding: 24px;
  box-shadow: var(--shqms-shadow-sm);
  border: 1px solid var(--shqms-border);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.shqms-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shqms-shadow);
}
.shqms-stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
}
.shqms-stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--shqms-dark);
  line-height: 1;
}
.shqms-stat-card .stat-label {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 4px;
}
.shqms-stat-card .stat-badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 0.7rem; padding: 3px 8px;
  border-radius: 20px;
}
.shqms-stat-card.primary   .stat-icon { background: #ede9fe; color: var(--shqms-primary); }
.shqms-stat-card.success   .stat-icon { background: #d1fae5; color: var(--shqms-success); }
.shqms-stat-card.warning   .stat-icon { background: #fef3c7; color: var(--shqms-warning); }
.shqms-stat-card.info      .stat-icon { background: #e0f2fe; color: var(--shqms-info); }
.shqms-stat-card.danger    .stat-icon { background: #fee2e2; color: var(--shqms-danger); }

/* ── Data cards / panels ── */
.shqms-card {
  background: #fff;
  border-radius: var(--shqms-radius);
  box-shadow: var(--shqms-shadow-sm);
  border: 1px solid var(--shqms-border);
  margin-bottom: 24px;
  overflow: hidden;
}
.shqms-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--shqms-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--shqms-light);
}
.shqms-card-header h3,
.shqms-card-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--shqms-dark);
}
.shqms-card-body { padding: 20px 24px; }

/* ── Tables ── */
.shqms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.shqms-table thead tr {
  background: linear-gradient(135deg, var(--shqms-primary) 0%, var(--shqms-secondary) 100%);
  color: #fff;
}
.shqms-table thead th {
  padding: 12px 16px;
  font-weight: 600;
  text-align: left;
  border: none;
}
.shqms-table tbody tr {
  border-bottom: 1px solid var(--shqms-border);
  transition: background 0.15s;
}
.shqms-table tbody tr:hover { background: #f8fafc; }
.shqms-table tbody td { padding: 12px 16px; }

/* ── Badges & pills ── */
.shqms-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.shqms-badge.passed  { background: #d1fae5; color: #065f46; }
.shqms-badge.failed  { background: #fee2e2; color: #991b1b; }
.shqms-badge.late    { background: #fef3c7; color: #92400e; }
.shqms-badge.graded  { background: #e0f2fe; color: #075985; }

/* ── Buttons ── */
.shqms-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.shqms-btn-primary   { background: var(--shqms-primary);   color: #fff; }
.shqms-btn-primary:hover  { background: #4338ca; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,0.4); }
.shqms-btn-success   { background: var(--shqms-success);   color: #fff; }
.shqms-btn-success:hover  { background: #047857; }
.shqms-btn-danger    { background: var(--shqms-danger);    color: #fff; }
.shqms-btn-danger:hover   { background: #b91c1c; }
.shqms-btn-outline   { background: transparent; border: 2px solid var(--shqms-primary); color: var(--shqms-primary); }
.shqms-btn-outline:hover  { background: var(--shqms-primary); color: #fff; }
.shqms-btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ── Forms ── */
.shqms-form-group { margin-bottom: 18px; }
.shqms-form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}
.shqms-form-group input,
.shqms-form-group select,
.shqms-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--shqms-border);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.shqms-form-group input:focus,
.shqms-form-group select:focus,
.shqms-form-group textarea:focus {
  border-color: var(--shqms-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
  outline: none;
}

/* ── Quiz attempt UI ── */
.shqms-quiz-container {
  max-width: 800px;
  margin: 0 auto;
}
.shqms-question-card {
  background: #fff;
  border-radius: var(--shqms-radius);
  padding: 28px;
  margin-bottom: 20px;
  border: 1.5px solid var(--shqms-border);
  box-shadow: var(--shqms-shadow-sm);
  transition: border-color 0.2s;
}
.shqms-question-card.answered { border-color: var(--shqms-primary); }
.shqms-question-card .question-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--shqms-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.shqms-question-card .question-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--shqms-dark);
  margin-bottom: 18px;
  line-height: 1.5;
}
.shqms-question-card .marks-badge {
  float: right;
  font-size: 0.75rem;
  background: #ede9fe;
  color: var(--shqms-primary);
  padding: 3px 10px;
  border-radius: 20px;
}
.shqms-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--shqms-border);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.shqms-option:hover   { border-color: var(--shqms-primary); background: #f5f3ff; }
.shqms-option.selected { border-color: var(--shqms-primary); background: #ede9fe; }
.shqms-option.correct  { border-color: var(--shqms-success); background: #d1fae5; }
.shqms-option.incorrect { border-color: var(--shqms-danger);  background: #fee2e2; }
.shqms-option input { pointer-events: none; }
.shqms-option-label { font-size: 0.9rem; }

/* ── Timer ── */
.shqms-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--shqms-dark);
  background: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  box-shadow: var(--shqms-shadow-sm);
  border: 1.5px solid var(--shqms-border);
}
.shqms-timer.warning { color: var(--shqms-danger); animation: pulse 1s infinite; }

/* ── Result card ── */
.shqms-result-hero {
  text-align: center;
  padding: 40px 20px;
}
.shqms-result-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  border: 8px solid;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  margin: 0 auto 24px;
  font-size: 2rem;
  font-weight: 800;
}
.shqms-result-circle.passed { border-color: var(--shqms-success); color: var(--shqms-success); }
.shqms-result-circle.failed { border-color: var(--shqms-danger);  color: var(--shqms-danger); }

/* ── Leaderboard ── */
.shqms-leaderboard .rank-1 { background: linear-gradient(135deg,#fef3c7,#fde68a); }
.shqms-leaderboard .rank-2 { background: linear-gradient(135deg,#f1f5f9,#e2e8f0); }
.shqms-leaderboard .rank-3 { background: linear-gradient(135deg,#fef3c7,#fed7aa); }

/* ── Progress bars ── */
.shqms-progress {
  height: 8px;
  border-radius: 4px;
  background: var(--shqms-border);
  overflow: hidden;
}
.shqms-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--shqms-primary), var(--shqms-secondary));
  transition: width 0.6s ease;
}

/* ── Modals ── */
.shqms-modal .modal-content {
  border: none;
  border-radius: var(--shqms-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.shqms-modal .modal-header {
  background: linear-gradient(135deg, var(--shqms-primary), var(--shqms-secondary));
  color: #fff;
  border-radius: var(--shqms-radius) var(--shqms-radius) 0 0;
}
.shqms-modal .modal-header .btn-close { filter: invert(1); }
.shqms-modal .modal-title { color: #fff; font-weight: 700; }

/* ── Nav tabs ── */
.shqms-tabs .nav-link {
  color: #64748b;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
}
.shqms-tabs .nav-link.active {
  color: var(--shqms-primary);
  border-bottom: 3px solid var(--shqms-primary);
  background: transparent;
}
.shqms-tabs .nav-link:hover { color: var(--shqms-primary); }

/* ── Alerts ── */
.shqms-alert {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.shqms-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.shqms-alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.shqms-alert-info    { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* ── Homework file upload area ── */
.shqms-upload-zone {
  border: 2px dashed var(--shqms-border);
  border-radius: var(--shqms-radius);
  padding: 36px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.shqms-upload-zone:hover,
.shqms-upload-zone.dragover {
  border-color: var(--shqms-primary);
  background: #f5f3ff;
}
.shqms-upload-zone .upload-icon { font-size: 2rem; color: var(--shqms-primary); }

/* ── Chart containers ── */
.shqms-chart-wrap {
  position: relative;
  width: 100%;
  max-height: 320px;
}

/* ── Spinner ── */
.shqms-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.shqms-spinner.dark {
  border-color: rgba(79,70,229,0.2);
  border-top-color: var(--shqms-primary);
}

/* ── Animations ── */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
@keyframes slideUp {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}
.shqms-animate-in { animation: slideUp 0.35s ease; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .shqms-header { padding: 16px; flex-direction: column; gap: 10px; }
  .shqms-card-body { padding: 14px; }
  .shqms-question-card { padding: 18px; }
  .shqms-table { font-size: 0.8rem; }
  .shqms-table thead th,
  .shqms-table tbody td { padding: 8px 10px; }
}
