/* ========== STUDENT ALERT POPUP ========== */
.sa-popup-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 16px;
  animation: sa-fade-in 0.25s ease-out;
}
@keyframes sa-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
.sa-popup {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
  max-width: 1080px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: sa-slide-up 0.3s cubic-bezier(0.16,1,0.3,1);
}
@keyframes sa-slide-up {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 2-column grid for student cards */
.sa-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

/* Section labels — sticky */
.sa-section-label {
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@media (min-width: 900px) {
  .sa-popup-header { padding: 22px 28px 18px; }
  .sa-popup-body   { padding: 22px 28px 8px; }
  .sa-popup-footer { padding: 18px 28px; }
  .sa-close-reminder { margin: 10px 28px 0; padding: 14px 18px; }
}

/* Header */
.sa-popup-header {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 20px 20px 0 0;
  color: #fff;
}
.sa-popup-header-title {
  font-size: 1.05rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 10px;
}
.sa-popup-header-title i { color: #fbbf24; font-size: 1.1rem; }
.sa-header-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 7px;
  background: #ef4444; color: #fff;
  font-size: 0.75rem; font-weight: 800;
  border-radius: 999px;
}
.sa-popup-close {
  width: 34px; height: 34px;
  border: none; border-radius: 10px;
  background: rgba(255,255,255,0.12); color: #94a3b8;
  font-size: 1rem; cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.15s ease;
}
.sa-popup-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* Body */
.sa-popup-body { padding: 20px 24px 8px; }
.sa-popup-time {
  font-size: 0.82rem; color: #64748b;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.sa-popup-time strong { color: #0f172a; }

/* Section labels */
.sa-section-label {
  font-size: 0.85rem; font-weight: 700;
  margin-bottom: 10px; padding: 8px 14px;
  border-radius: 10px;
  display: flex; align-items: center; gap: 8px;
}
.sa-section-label.warn {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border: 1px solid #fcd34d;
}
.sa-section-label.danger {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Section instruction tip */
.sa-section-tip {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 0.83rem; line-height: 1.55; margin-bottom: 12px;
}
.sa-section-tip > i.fa-circle-info { font-size: 0.95rem; margin-top: 2px; flex-shrink: 0; }
.sa-section-tip.warn-tip {
  background: #fffbeb; border: 1px dashed #fcd34d; color: #78350f;
}
.sa-section-tip.warn-tip > i.fa-circle-info { color: #d97706; }
.sa-section-tip.danger-tip {
  background: #fef2f2; border: 1px dashed #fca5a5; color: #7f1d1d;
}
.sa-section-tip.danger-tip > i.fa-circle-info { color: #dc2626; }
.sa-section-tip.danger-tip b { color: #991b1b; font-weight: 700; }

/* Call link inside warn tip */
.sa-call-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; margin: 0 2px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff !important; text-decoration: none !important;
  border-radius: 7px; font-weight: 700; font-size: 0.78rem;
  vertical-align: middle;
  box-shadow: 0 2px 6px rgba(22,163,74,0.25);
  transition: all 0.15s ease;
}
.sa-call-link i { font-size: 0.72rem; }
.sa-call-link:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  box-shadow: 0 4px 12px rgba(22,163,74,0.4);
  transform: translateY(-1px);
}

/* Count badges */
.sa-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 800; margin-left: auto;
}
.sa-count-badge.warn-badge { background: #92400e; color: #fff; }
.sa-count-badge.danger-count-badge { background: #991b1b; color: #fff; }

/* Student cards */
.sa-student-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.sa-student-card:hover { transform: translateY(-1px); }
.sa-student-card.warn-card {
  background: #fffbeb; border: 1px solid #fde68a;
}
.sa-student-card.danger-card {
  background: #fef2f2; border: 1px solid #fecaca;
}
.sa-student-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff; font-size: 0.9rem;
  box-shadow: 0 3px 8px rgba(245,158,11,0.3);
}
.sa-student-avatar.danger-avatar {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 3px 8px rgba(239,68,68,0.3);
}
.sa-student-info { flex: 1; min-width: 0; }
.sa-student-name { font-weight: 700; font-size: 0.88rem; color: #0f172a; }
.sa-student-detail { font-size: 0.78rem; color: #475569; margin-top: 2px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.sa-late-text { color: #b45309; font-weight: 700; }
.sa-exceeded-text { color: #dc2626; font-weight: 700; }

/* Close reminder */
.sa-close-reminder {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 8px 24px 0; padding: 12px 16px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd; border-radius: 12px;
  font-size: 0.82rem; color: #1e40af; line-height: 1.45;
}
.sa-close-reminder i { color: #2563eb; font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.sa-close-reminder b { color: #1d4ed8; }

/* Footer */
.sa-popup-footer {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid #f1f5f9;
  flex-wrap: wrap; gap: 10px; margin-top: 12px;
}
.sa-popup-link {
  font-size: 0.82rem; font-weight: 700;
  color: #2563eb; text-decoration: none;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; background: #eff6ff;
  transition: all 0.15s ease;
}
.sa-popup-link:hover { background: #dbeafe; text-decoration: none; }

/* Floating badge */
.sa-floating-badge {
  position: fixed; bottom: 24px; right: 24px; z-index: 9998;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; border-radius: 999px;
  font-size: 0.88rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(245,158,11,0.4);
  animation: sa-badge-pulse 2s ease-in-out infinite;
  transition: transform 0.1s ease;
}
.sa-floating-badge:hover { transform: scale(1.05); }
@keyframes sa-badge-pulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(245,158,11,0.4); }
  50% { box-shadow: 0 6px 32px rgba(245,158,11,0.65); }
}
.sa-floating-badge.danger-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 6px 24px rgba(239,68,68,0.4);
}

@media (max-width: 768px) {
  .sa-popup { max-width: 100%; border-radius: 16px; }
  .sa-popup-header { border-radius: 16px 16px 0 0; padding: 16px 18px 14px; }
  .sa-popup-body { padding: 16px 18px 8px; }
  .sa-close-reminder { margin: 8px 18px 0; }
  .sa-popup-footer { padding: 14px 18px; }
  .sa-floating-badge { bottom: 16px; right: 16px; font-size: 0.82rem; padding: 10px 16px; }
}

/* ========== CONFIRM MODAL ========== */
.sa-confirm-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15,23,42,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 16px;
  animation: sa-fade-in 0.2s ease-out;
}
.sa-confirm-box {
  background: #fff; border-radius: 20px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05);
  max-width: 420px; width: 100%;
  padding: 28px 28px 22px; text-align: center;
  animation: sa-confirm-pop 0.3s cubic-bezier(0.16,1,0.3,1);
}
@keyframes sa-confirm-pop {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.sa-confirm-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-radius: 50%; display: grid; place-items: center;
  color: #2563eb; font-size: 1.6rem;
  box-shadow: 0 8px 20px rgba(37,99,235,0.2);
  animation: sa-icon-bounce 1.2s ease-in-out infinite;
}
@keyframes sa-icon-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.sa-confirm-title { font-size: 1.2rem; font-weight: 700; color: #0f172a; margin-bottom: 10px; }
.sa-confirm-text { font-size: 0.92rem; color: #475569; line-height: 1.5; margin-bottom: 22px; padding: 0 8px; }
.sa-confirm-text b { color: #1d4ed8; font-weight: 700; }
.sa-confirm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sa-confirm-btn {
  flex: 1; min-width: 130px; padding: 12px 18px;
  border: none; border-radius: 12px;
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.sa-confirm-cancel { background: #f1f5f9; color: #475569; }
.sa-confirm-cancel:hover { background: #e2e8f0; color: #0f172a; }
.sa-confirm-ok {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}
.sa-confirm-ok:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 6px 20px rgba(37,99,235,0.45);
  transform: translateY(-1px);
}
.sa-confirm-ok:active { transform: translateY(0); }

@media (max-width: 480px) {
  .sa-confirm-box { padding: 22px 20px 18px; border-radius: 16px; }
  .sa-confirm-icon { width: 56px; height: 56px; font-size: 1.4rem; }
  .sa-confirm-title { font-size: 1.08rem; }
  .sa-confirm-actions { flex-direction: column-reverse; }
  .sa-confirm-btn { width: 100%; }
}