/* New screens of the Cloudflare build (header account controls, login, change password, setup).
   Not part of the ported styles: built only from the existing tokens and the look of the old header and modals. */

/* ========== المستخدم وزر الخروج في الترويسة ========== */
.header-user {
  position: absolute; left: 24px; top: 50%; transform: translateY(-50%); z-index: 1;
  display: flex; align-items: center; gap: 10px;
  color: white; font-weight: 600; font-size: 0.9rem;
}
.header-user-name { display: flex; align-items: center; gap: 6px; opacity: 0.95; }
.header-user-btn {
  background: rgba(255,255,255,0.2); border: none; color: white;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; text-decoration: none; transition: background 0.2s;
}
.header-user-btn:hover { background: rgba(255,255,255,0.3); }
.header-mobile-start, .header-mobile-end { position: absolute; top: calc(var(--safe-top) + 12px); }
.header-mobile-start { right: 12px; }
.header-mobile-end { left: 12px; }
@media (max-width: 1100px) {
  .header-user-name { display: none; }
}

/* ========== شاشات الدخول وتغيير كلمة المرور والإعداد ========== */
.auth-page {
  min-height: 100vh; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.auth-page .pin-modal-box { max-width: 440px; }
.auth-page .pin-modal-header { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.auth-page .form-input { margin-bottom: 0; }
.auth-page .pin-modal-footer .btn-primary { margin-top: 0; }
.auth-note { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.7; margin-bottom: 18px; }
.auth-links { text-align: center; font-size: 0.9rem; }
.auth-links a { color: white; font-weight: 600; text-decoration: none; opacity: 0.9; }
.auth-links a:hover { opacity: 1; text-decoration: underline; }
.auth-ltr { direction: ltr; text-align: right; }

@media (max-width: 768px) {
  body.auth-body { padding-top: 0; padding-bottom: 0; }
  .auth-brand .header-icon-desktop { width: 44px; height: 44px; font-size: 1.3rem; }
  .auth-brand .header-title-desktop { font-size: 1.25rem; }
}

/* ========== الرصد: الدرجات غير المرسلة والمرفوضة وانتهاء الجلسة ========== */
.grade-input.cell-pending { border-color: #f59e0b; background: rgba(245,158,11,0.08); }
.grade-input.cell-rejected { border-color: #dc2626; background: rgba(239,68,68,0.1); color: #b91c1c; }
.queue-banners { margin-bottom: 16px; }
.queue-banner {
  display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 10px; border-radius: 12px;
  font-size: 0.9rem; line-height: 1.7; border: 1px solid transparent;
}
.queue-banner > i { font-size: 1.15rem; line-height: 1.5; }
.queue-banner > div { flex: 1 1 220px; min-width: 0; }
.queue-banner a { color: inherit; font-weight: 700; text-decoration: underline; }
.queue-banner-login { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.35); color: #991b1b; }
.queue-banner-warn { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.4); color: #92400e; }
.queue-banner-danger { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.35); color: #991b1b; }
.queue-banner-btn { padding: 6px 12px; font-size: 0.8rem; }
.queue-rejected-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.82rem; background: white; border-radius: 8px; }
.queue-rejected-table th, .queue-rejected-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-color); text-align: right; color: var(--text-primary); }
.queue-rejected-table th { color: var(--text-secondary); font-weight: 700; }
@media (max-width: 768px) {
  .queue-banner { font-size: 0.82rem; padding: 10px 12px; }
  .queue-rejected-table thead { display: none; }
  .queue-rejected-table tr { display: block; border-bottom: 1px solid var(--border-color); padding: 6px 0; }
  .queue-rejected-table td { display: block; border: none; padding: 2px 8px; }
}

/* ========== الإعدادات: معلم الشعبة، أسماء الاختبارات، المعلمون ========== */
.class-row select {
  width: 100%; padding: 8px 12px; font-family: inherit; font-size: 0.9rem; background: white;
  border: 1px solid var(--border-color); border-radius: 8px;
  transition: border-color 0.2s, background-color 0.2s;
}
.class-row select:focus { outline: none; border-color: var(--primary); }
.class-row select.saving, .name-row input.saving { border-color: #3b82f6; background: #eff6ff; }
.class-row select.saved, .name-row input.saved { border-color: #22c55e; background: #f0fdf4; }
.class-row select.save-error, .name-row input.save-error { border-color: #ef4444; background: #fef2f2; }
.name-row, .teacher-row {
  display: grid; gap: 10px; align-items: center;
  padding: 8px 16px; border-top: 1px solid var(--border-color);
}
.class-group > .name-row:first-child, .class-group > .teacher-row:first-child { border-top: none; }
.name-row { grid-template-columns: 32px 1fr 40px; }
.name-row input {
  width: 100%; padding: 8px 12px; font-family: inherit; font-size: 0.9rem;
  border: 1px solid var(--border-color); border-radius: 8px;
  transition: border-color 0.2s, background-color 0.2s;
}
.name-row input:focus { outline: none; border-color: var(--primary); }
.teacher-row { grid-template-columns: 1fr 1fr auto auto; }
.teacher-row.is-off .class-row-name, .teacher-row.is-off .teacher-username { color: var(--text-muted); }
.teacher-username { font-size: 0.9rem; color: var(--text-secondary); text-align: right; }
.status-chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.status-chip.on { background: #dcfce7; color: #166534; }
.status-chip.wait { background: #fef3c7; color: #92400e; }
.status-chip.off { background: #f3f4f6; color: #6b7280; }
.teacher-row .action-btns { display: flex; gap: 6px; }
.teachers-textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.checkbox-option.is-locked { cursor: not-allowed; opacity: 0.8; }
.checkbox-option.is-locked:hover { border-color: var(--border-color); background: inherit; }
@media (max-width: 768px) {
  .class-row select { grid-column: 1 / -1; grid-row: 2; }
  .teacher-row { grid-template-columns: 1fr auto; }
  .teacher-row .teacher-username { grid-row: 2; }
}

/* ========== معاينة ملف الطلاب: التغييرات والقرارات ========== */
.students-summary.preview-changes { grid-template-columns: repeat(4, 1fr); }
.preview-changes .change-add .stat-card-value { color: #15803d; }
.preview-changes .change-move .stat-card-value { color: #1d4ed8; }
.preview-changes .change-back .stat-card-value { color: #7c3aed; }
.preview-changes .change-off .stat-card-value { color: #b45309; }
.preview-list { margin-bottom: 10px; font-size: 0.88rem; }
.preview-list summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.preview-list ul { margin: 8px 0 0; padding-inline-start: 22px; line-height: 1.8; color: var(--text-secondary); }
.preview-decide {
  border: 1px solid #fde68a; background: #fffbeb; border-radius: 12px;
  padding: 12px 14px; margin: 6px 0 14px;
}
.preview-decide h4 { font-size: 0.95rem; font-weight: 700; color: #92400e; margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
.decide-row {
  display: grid; grid-template-columns: 1fr minmax(180px, 1.2fr); gap: 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid #fde68a; font-size: 0.9rem;
}
.decide-row .custom-select { margin: 0; }
@media (max-width: 768px) {
  .students-summary.preview-changes { grid-template-columns: repeat(2, 1fr); }
  .decide-row { grid-template-columns: 1fr; }
}
