/* ============================================================
   assets/css/students.css
   Student module specific styles
   ============================================================ */

/* ── Student List ─────────────────────────────────────────── */
.student-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.student-filters .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 140px;
}
.student-filters .btn { flex-shrink: 0; align-self: flex-end; }

/* Student Avatar in table */
.student-avatar-wrap {
  display: flex; align-items: center; gap: 10px;
}
.student-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
  flex-shrink: 0;
}
.student-avatar-initials {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-10);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.student-name { font-weight: 500; color: var(--gray-900); font-size: 13.5px; }
.student-id   { font-size: 11px; color: var(--gray-400); }

/* Status indicators */
.residential-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; padding: 2px 7px;
  border-radius: 20px;
  background: #ede9fe; color: #7c3aed;
  font-weight: 500;
}
.day-scholar-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; padding: 2px 7px;
  border-radius: 20px;
  background: var(--gray-100); color: var(--gray-500);
  font-weight: 500;
}

/* Pagination */
.pagination {
  display: flex; align-items: center; gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px 0;
}
.page-btn {
  min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer;
  background: #fff; color: var(--gray-700);
  transition: var(--transition);
  padding: 0 8px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary); font-weight: 600;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Add / Edit Form ──────────────────────────────────────── */
.form-section {
  margin-bottom: 28px;
}
.form-section-title {
  font-family: var(--font-heading);
  font-size: 14px; font-weight: 600;
  color: var(--primary);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-10);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* Photo upload */
.photo-upload-wrap {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 16px;
}
.photo-preview {
  width: 90px; height: 90px;
  border-radius: 12px;
  border: 2px dashed var(--gray-300);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-50);
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
}
.photo-preview:hover { border-color: var(--primary); background: var(--primary-10); }
.photo-preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.photo-preview .photo-placeholder {
  font-size: 32px; color: var(--gray-300);
}
.photo-upload-info { flex: 1; }
.photo-upload-info .form-label { margin-bottom: 6px; }
.photo-upload-info .form-hint { margin-top: 4px; }

/* Checkbox toggle */
.toggle-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: var(--transition);
}
.toggle-wrap:hover { border-color: var(--primary); background: var(--primary-10); }
.toggle-wrap input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer; flex-shrink: 0;
}
.toggle-wrap label {
  font-size: 13.5px; font-weight: 500;
  color: var(--gray-700); cursor: pointer;
}

/* ── Profile Page ─────────────────────────────────────────── */
.profile-header {
  display: flex; align-items: flex-start; gap: 24px;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
}
.profile-photo {
  width: 100px; height: 100px;
  border-radius: 16px;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,.4);
  flex-shrink: 0;
}
.profile-photo-initials {
  width: 100px; height: 100px;
  border-radius: 16px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 700;
  border: 3px solid rgba(255,255,255,.4);
  flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-name {
  font-family: var(--font-heading);
  font-size: 22px; font-weight: 700;
  line-height: 1.2; margin-bottom: 4px;
}
.profile-name-en {
  font-size: 14px; opacity: .8; margin-bottom: 8px;
}
.profile-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.profile-meta-item {
  background: rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px; font-weight: 500;
}
.profile-actions {
  display: flex; gap: 8px; margin-left: auto;
  align-self: flex-start;
}

/* Profile tabs */
.profile-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  background: #fff;
  overflow-x: auto;
}
.profile-tab {
  padding: 12px 20px;
  font-size: 13.5px; font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.profile-tab:hover { color: var(--primary); }
.profile-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; }

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.info-item {}
.info-label {
  font-size: 11px; color: var(--gray-400);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 3px;
}
.info-value {
  font-size: 14px; color: var(--gray-800); font-weight: 500;
}
.info-value a { color: var(--primary); }
.info-value.empty { color: var(--gray-300); font-style: italic; }

/* Attendance mini calendar */
.attendance-mini {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 12px 0;
}
.att-day {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 500;
  cursor: default;
}
.att-day.present  { background: #dcfce7; color: #16a34a; }
.att-day.absent   { background: #fee2e2; color: #dc2626; }
.att-day.leave    { background: #fef3c7; color: #d97706; }
.att-day.holiday  { background: var(--gray-100); color: var(--gray-400); }
.att-day.no-data  { background: var(--gray-50); color: var(--gray-300); border: 1px dashed var(--gray-200); }

/* ── Bulk Import ──────────────────────────────────────────── */
.import-steps {
  display: flex; gap: 0;
  margin-bottom: 28px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.import-step {
  flex: 1; padding: 14px 16px;
  background: var(--gray-50);
  text-align: center;
  border-right: 1px solid var(--gray-200);
  font-size: 13px; color: var(--gray-500);
}
.import-step:last-child { border-right: none; }
.import-step.active {
  background: var(--primary-10);
  color: var(--primary);
  font-weight: 600;
}
.import-step.done {
  background: #dcfce7; color: #16a34a;
}
.import-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gray-300); color: #fff;
  font-size: 11px; font-weight: 700;
  margin-bottom: 4px;
}
.import-step.active .import-step-num { background: var(--primary); }
.import-step.done   .import-step-num { background: #16a34a; }

.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-10);
}
.drop-zone-icon { font-size: 40px; margin-bottom: 10px; }
.drop-zone-text { font-size: 14px; color: var(--gray-600); margin-bottom: 6px; }
.drop-zone-hint { font-size: 12px; color: var(--gray-400); }

/* Preview table */
.preview-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}
.preview-table th { position: sticky; top: 0; z-index: 1; }

.import-result {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
}
.import-result.success { background: #dcfce7; border: 1px solid #86efac; }
.import-result.error   { background: #fee2e2; border: 1px solid #fca5a5; }
.import-result-title {
  font-weight: 600; font-size: 15px; margin-bottom: 8px;
}
.import-errors { font-size: 12.5px; color: var(--danger); margin-top: 8px; }
.import-errors li { margin-bottom: 3px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  .profile-header { flex-direction: column; align-items: center; text-align: center; }
  .profile-actions { margin-left: 0; }
  .student-filters { flex-direction: column; }
  .student-filters .form-group { min-width: 100%; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .import-steps { flex-direction: column; }
  .import-step { border-right: none; border-bottom: 1px solid var(--gray-200); }
}

@media (max-width: 480px) {
  .info-grid { grid-template-columns: 1fr; }
  .photo-upload-wrap { flex-direction: column; align-items: center; }
}

/* Print */
@media print {
  .student-filters, .pagination,
  .profile-tabs, .profile-actions,
  .btn, .topbar, .sidebar { display: none !important; }
  .profile-tab-content { display: block !important; }
  .profile-header {
    background: none !important;
    color: var(--gray-900) !important;
    border: 1px solid var(--gray-200);
  }
}
