/* ============================================================ */
/* Masar Edu System — Students Styles (v1.0.0)                  */
/* ============================================================ */

:root {
  --st-radius: 14px;
  --st-radius-sm: 10px;
  --st-focus: rgba(99, 102, 241, 0.18);
}

/* ============================================================ */
/* 1) Toolbar                                                    */
/* ============================================================ */
.st-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ============================================================ */
/* 2) Grid الكروت                                                */
/* ============================================================ */
.st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

@media (max-width: 480px) {
  .st-grid { grid-template-columns: 1fr; }
}

/* ============================================================ */
/* 3) الكارت                                                     */
/* ============================================================ */
.st-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--st-radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  max-width: 240px;
  margin: 0 auto;
}

.st-card:hover {
  border-color: #6366f1;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}

/* شارة الحالة */
.st-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.st-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.st-badge.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* الصورة */
.st-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--card-border);
  background: var(--hover-bg);
  flex-shrink: 0;
}
.st-avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  border: 3px solid var(--card-border);
  flex-shrink: 0;
}
.st-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  border: 3px solid var(--card-border);
  flex-shrink: 0;
}

/* الاسم */
.st-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}
.st-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
}
.st-stage {
  font-size: 0.8rem;
  color: #6366f1;
  font-weight: 700;
  margin: 0;
}

.st-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
  width: 100%;
}
.st-info strong { color: var(--text-main); font-weight: 700; }

/* المالية */
.st-finance {
  width: 100%;
  background: var(--hover-bg);
  border-radius: var(--st-radius-sm);
  padding: 10px;
  margin-top: 4px;
  font-size: 0.78rem;
  text-align: right;
}
.st-finance-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: center;
}
.st-fin-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}
.st-fin-row span { color: var(--text-muted); }
.st-fin-row strong { color: var(--text-main); }
.st-fin-row strong.paid { color: #10b981; }
.st-fin-row strong.due  { color: #ef4444; }

/* أزرار الكارت */
.st-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
}

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #6366f1;
  border: none;
  border-radius: var(--st-radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.st-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.st-btn:active { transform: translateY(0); }
.st-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.st-btn-primary { background: var(--primary); }
.st-btn-success { background: var(--success, #10b981); }
.st-btn-warning { background: var(--warning, #f59e0b); }
.st-btn-danger  { background: var(--danger, #ef4444); }
.st-btn-ghost   {
  background: var(--hover-bg);
  color: var(--text-main);
  border: 1px solid var(--card-border);
}
.st-btn-ghost:hover { background: var(--active-bg); filter: none; }

/* ============================================================ */
/* 4) الحقول                                                     */
/* ============================================================ */
.st-form .form-group { margin-bottom: 12px; }
.st-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.st-form .input-box {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.92rem;
  color: var(--text-main);
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--st-radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.st-form .input-box:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px var(--st-focus);
}

/* ============================================================ */
/* 5) رفع الصورة                                                 */
/* ============================================================ */
.st-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.st-upload-preview {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px dashed var(--card-border);
  object-fit: cover;
  background: var(--hover-bg);
}
.st-upload-btn {
  padding: 7px 14px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--st-radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}
.st-upload-btn:hover { background: rgba(99, 102, 241, 0.2); }

/* ============================================================ */
/* 6) Loading / Empty / Error                                    */
/* ============================================================ */
.st-loading,
.st-empty,
.st-error {
  text-align: center;
  font-size: 0.85rem;
  padding: 20px 0;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.st-error { color: var(--danger); }

/* ============================================================ */
/* 7) المالية داخل التفاصيل                                      */
/* ============================================================ */
.st-details-section {
  background: var(--hover-bg);
  border-radius: var(--st-radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}
.st-details-section h4 {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 8px;
}
.st-details-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.82rem;
}
.st-details-row span { color: var(--text-muted); }
.st-details-row strong { color: var(--text-main); }
.st-details-row strong.paid { color: #10b981; }
.st-details-row strong.due  { color: #ef4444; }

/* ============================================================ */
/* 8) الوضع الداكن                                              */
/* ============================================================ */
[data-theme="dark"] .st-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  border-color: rgba(148, 163, 184, 0.2);
}
[data-theme="dark"] .st-card:hover {
  border-color: #6366f1;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}
[data-theme="dark"] .st-avatar,
[data-theme="dark"] .st-avatar-placeholder {
  border-color: rgba(148, 163, 184, 0.2);
}
[data-theme="dark"] .st-form .input-box {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-main);
}
[data-theme="dark"] .st-form .input-box:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
[data-theme="dark"] .st-btn-ghost {
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-main);
  border-color: rgba(148, 163, 184, 0.25);
}
[data-theme="dark"] .st-btn-ghost:hover { background: rgba(99, 102, 241, 0.15); }
[data-theme="dark"] .st-upload-btn {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}
[data-theme="dark"] .st-upload-btn:hover { background: rgba(99, 102, 241, 0.25); }
[data-theme="dark"] .st-badge.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
}
[data-theme="dark"] .st-badge.inactive {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}
[data-theme="dark"] .st-finance,
[data-theme="dark"] .st-details-section {
  background: rgba(30, 41, 59, 0.7);
}

/* الوضع الفاتح */
[data-theme="light"] .st-card {
  background: #ffffff;
  border-color: #e2e8f0;
}
[data-theme="light"] .st-card:hover {
  border-color: #6366f1;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}
[data-theme="light"] .st-avatar,
[data-theme="light"] .st-avatar-placeholder {
  border-color: #e2e8f0;
}
[data-theme="light"] .st-form .input-box {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] .st-btn-ghost {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #e2e8f0;
}
[data-theme="light"] .st-btn-ghost:hover { background: #e2e8f0; }
[data-theme="light"] .st-upload-btn {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
}
[data-theme="light"] .st-finance,
[data-theme="light"] .st-details-section {
  background: #f8fafc;
}
/* ============================================================
   ✅ Attendance Report Styles
   ============================================================ */
#attendanceReportModal .report-container {
  background: #ffffff !important;
  color: #0f172a !important;
  padding: 24px !important;
  border-radius: 12px;
  margin: 0 auto;
  direction: rtl;
}
#attendanceReportModal .report-header-centered { text-align: center; border-bottom: 3px solid #1e40af; padding-bottom: 16px; margin-bottom: 20px; }
#attendanceReportModal .report-logo { width: 60px; height: 60px; object-fit: contain; display: block; margin: 0 auto 10px; }
#attendanceReportModal .report-app-name { font-size: 1.5rem; font-weight: 800; color: #1e40af; margin: 0; }
#attendanceReportModal .report-app-subtitle { font-size: 0.85rem; color: #64748b; margin: 4px 0 0; }
#attendanceReportModal .report-title { font-size: 1.2rem; font-weight: 800; color: #1e40af; margin: 12px 0; }
#attendanceReportModal .report-meta { font-size: 0.85rem; color: #64748b; background: #f8fafc; padding: 10px; border-radius: 8px; line-height: 1.7; }
#attendanceReportModal .report-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
#attendanceReportModal .report-stat { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; text-align: center; }
#attendanceReportModal .report-stat h3 { font-size: 1.3rem; font-weight: 800; margin: 0 0 4px; }
#attendanceReportModal .report-stat p { font-size: 0.75rem; color: #64748b; margin: 0; }
#attendanceReportModal .report-section h4 { font-size: 1rem; font-weight: 800; color: #1e40af; margin: 0 0 10px; }
#attendanceReportModal .report-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
#attendanceReportModal .report-table th { background: #1e40af; color: #fff; padding: 8px; text-align: right; font-weight: 700; }
#attendanceReportModal .report-table td { padding: 6px 8px; border: 1px solid #e2e8f0; color: #0f172a; }
#attendanceReportModal .report-table tr:nth-child(even) { background: #f8fafc; }
#attendanceReportModal .report-footer { margin-top: 20px; padding-top: 12px; border-top: 2px solid #e2e8f0; text-align: center; font-size: 0.75rem; color: #94a3b8; }
@media (max-width: 600px) { #attendanceReportModal .report-stats { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================ */
/* v1.2 — ترتيب الأزرار                                           */
/* ============================================================ */
.st-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.st-toolbar .st-tb-main { flex: 1; padding: 11px 16px; font-size: .88rem; }
.st-toolbar .st-tb-icon { width: 46px; padding: 0; font-size: .95rem; }
.st-tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 12px; }
.st-tools .st-btn { flex-direction: column; gap: 4px; padding: 9px 4px; font-size: .72rem; line-height: 1.3; min-height: 58px; }
.st-tools .st-btn i { font-size: 1.05rem; }
.st-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.st-actions > .st-btn { flex-direction: column; gap: 3px; padding: 7px 2px; font-size: .66rem; min-height: 50px; }
.st-actions > .st-btn i { font-size: .95rem; }
.st-actions .st-more-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.st-more { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 8px; margin-top: 2px;
  background: var(--hover-bg); border: 1px dashed var(--card-border); border-radius: 12px; }
.st-more[hidden] { display: none; }
.st-more .st-btn { justify-content: flex-start; padding: 8px; font-size: .72rem; }
.st-term-tab { transition: all .15s ease; }
@media (max-width: 380px) {
  .st-actions > .st-btn span { display: none; }
  .st-actions > .st-btn { min-height: 40px; }
  .st-more { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 640px) { .st-tools { grid-template-columns: repeat(4, 1fr); } }

/* ============================================================ */
/* كارت الطالب v2 — مضغوط على الموبايل وعريض على الكمبيوتر       */
/* ============================================================ */
#stGrid.st-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.st-card.stc { max-width: none; margin: 0; padding: 0; align-items: stretch; text-align: start; gap: 0; border-radius: 18px; overflow: visible; }
.st-card.stc:hover { transform: none; }
.stc-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 10px; }
.stc-av { flex: none; }
.stc-av .st-avatar, .stc-av .st-avatar-placeholder { width: 58px !important; height: 58px !important; margin: 0 !important; font-size: 1.2rem; border-radius: 16px; }
.stc-who { min-width: 0; flex: 1; }
.stc-who .st-name { margin: 0; font-size: 1.05rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stc-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: .78rem; color: var(--text-muted, #64748b); }
.stc-sub .st-code { margin: 0; font-size: .72rem; padding: 1px 8px; border-radius: 99px; background: var(--active-bg, #eef2ff); }
.stc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.stc-tag { font-size: .68rem; font-weight: 800; padding: 2px 9px; border-radius: 99px; border: 1px solid transparent; white-space: nowrap; }
.stc-tag.green { background: rgba(16,185,129,.12); color: #059669; border-color: rgba(16,185,129,.3); }
.stc-tag.gray { background: rgba(100,116,139,.12); color: #64748b; border-color: rgba(100,116,139,.3); }
.stc-tag.indigo { background: rgba(99,102,241,.12); color: #6366f1; border-color: rgba(99,102,241,.3); }
.stc-tag.red { background: #dc2626; color: #fff; }
.stc-tag.amber { background: #fef3c7; color: #92400e; }
.stc-body { padding: 0 14px 10px; display: grid; gap: 10px; }
.stc-info { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.stc-i { display: flex; align-items: center; gap: 6px; font-size: .78rem; min-width: 0; color: var(--text-muted, #64748b); }
.stc-i span { flex: none; }
.stc-i b { color: var(--text-main); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stc-i i { width: 14px; text-align: center; flex: none; }
.stc-fin { border-radius: 14px; background: var(--active-bg, #f1f5f9); padding: 8px 10px; }
.stc-fin-h { display: flex; justify-content: space-between; align-items: center; font-size: .74rem; font-weight: 700; margin-bottom: 6px; gap: 6px; }
.stc-owe { color: #ef4444; background: rgba(239,68,68,.1); padding: 1px 8px; border-radius: 99px; }
.stc-ok { color: #059669; }
.stc-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stc-cells small { display: block; font-size: .64rem; color: var(--text-muted, #64748b); }
.stc-cells b { font-size: .8rem; }
.stc-cells .paid { color: #059669; } .stc-cells .due { color: #ef4444; }
.stc-body > .st-finance { margin: 0; }
.st-actions.stc-actions { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 8px 10px 10px; border-top: 1px solid var(--card-border, #e2e8f0); margin: 0; }
.stc-actions > .stc-b { flex-direction: column; gap: 3px; padding: 7px 0; min-height: 52px; font-size: .64rem; font-weight: 700; border-radius: 12px; background: transparent; color: var(--text-main); border: 1px solid transparent; box-shadow: none; }
.stc-actions > .stc-b i { font-size: 1.05rem; }
.stc-actions > .stc-b:hover { background: var(--active-bg, #eef2ff); filter: none; transform: none; }
.stc-actions > .stc-b.blue i { color: #6366f1; } .stc-actions > .stc-b.green i { color: #10b981; } .stc-actions > .stc-b.amber i { color: #f59e0b; }
.stc-actions > .stc-b span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stc-actions .st-more-btn.on { background: var(--primary); color: #fff; }
.stc-actions .st-more-btn.on i { color: #fff; }
.stc-actions .st-more { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

/* 💻 الكمبيوتر: الكارت بالعرض (البيانات يمين — الفلوس شمال — الزراير تحت) */
@media (min-width: 900px) {
  #stGrid.st-grid { grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); }
  .stc-body { grid-template-columns: 1.25fr 1fr; align-items: start; }
  .stc-head { padding-bottom: 12px; }
}
/* 📱 موبايل صغير */
@media (max-width: 640px) { .st-actions.stc-actions { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 420px) { #stGrid.st-grid { grid-template-columns: 1fr; } }
[data-theme="dark"] .stc-fin { background: rgba(255,255,255,.04); }
[data-theme="dark"] .stc-sub .st-code { background: rgba(99,102,241,.18); }

.stc-i.wide { grid-column: 1 / -1; }
.stc-actions > .stc-b span { display: block !important; }
.stc-actions > .mcTw { width: auto; height: auto; min-height: 52px; margin: 0; border: 0; border-radius: 12px; display: flex; flex-direction: column; gap: 3px; background: transparent; color: var(--text-main); }
.stc-actions > .mcTw img { width: 20px; height: 20px; }
.stc-actions > .mcTw:hover { background: var(--active-bg, #eef2ff); }
