/* ============================================================
   Admin Panel  –  admin.css
   Scoped to .admin-body / .login-screen / .admin-shell
   Reuses design tokens from ../css/styles.css
   ============================================================ */

.admin-body { background: var(--bg-alt); }
.hidden { display: none !important; }

/* ── Login screen ─────────────────────────────────────────── */
.login-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-hero);
  padding: 1.5rem;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  max-width: 380px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.login-logo { width: 110px; margin: 0 auto 1.25rem; object-fit: contain; }
.login-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: .4rem; }
.login-sub { font-size: .88rem; color: var(--text-secondary); margin-bottom: 1.75rem; }
.login-card form { text-align: left; }

.fg { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.fg label { font-size: .82rem; font-weight: 700; color: var(--text-primary); }
.fg input, .fg select, .fg textarea {
  padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: .65rem;
  font-size: .9rem; font-family: var(--font-sans);
  background: var(--bg); color: var(--text-primary);
  outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(58,126,240,.12);
}
.fg-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 600; cursor: pointer; }
.checkbox-label input { accent-color: var(--blue-500); width: 1.1rem; height: 1.1rem; }

.alert { padding: .75rem 1rem; border-radius: .65rem; font-size: .85rem; font-weight: 600; margin-bottom: 1rem; }
.alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }

/* ── Admin shell ──────────────────────────────────────────── */
.admin-shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--grey-900); color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
}
[data-theme="dark"] .sidebar { background: #050b13; }
.sidebar-brand { padding: 1.5rem 1.25rem; }
.sidebar-brand img { width: 110px; filter: brightness(1.3); }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: .15rem; padding: 0 .85rem; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem .85rem; border-radius: .6rem;
  font-size: .88rem; font-weight: 600; color: rgba(255,255,255,.65);
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--grad-primary); color: #fff; }
.ni { font-size: 1rem; width: 1.3rem; text-align: center; }
.sidebar-footer {
  padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
#admin-name-display { font-size: .8rem; color: rgba(255,255,255,.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-ghost-dark { color: rgba(255,255,255,.8); border: 1.5px solid rgba(255,255,255,.25); background: transparent; }
.btn-ghost-dark:hover { background: rgba(255,255,255,.08); }
.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { opacity: .9; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 1.15rem; font-weight: 800; }
.admin-content { padding: 2rem; flex: 1; }

/* ── Page switching ───────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Stats grid ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; align-items: center; gap: .9rem; }
.sc-icon { width: 42px; height: 42px; border-radius: .7rem; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.sc-icon.blue   { background: var(--blue-100); }
.sc-icon.green  { background: #dcfce7; }
.sc-icon.yellow { background: #fef9c3; }
.sc-icon.purple { background: var(--purple-100); }
.sc-icon.orange { background: #ffedd5; }
.sc-icon.red    { background: #fee2e2; }
.sc-num { font-size: 1.35rem; font-weight: 800; line-height: 1; }
.sc-lbl { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

.section-h { font-size: 1rem; font-weight: 800; margin-bottom: 1rem; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table-wrap th { text-align: left; padding: .85rem 1.1rem; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap td { padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-wrap tbody tr:hover { background: var(--bg-alt); }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.loading, .empty { padding: 2.5rem; text-align: center; color: var(--text-muted); font-size: .9rem; }

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 2rem; font-size: .72rem; font-weight: 700; }
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #dc2626; }

/* ── Forms ────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: .25rem; }
.page-header p  { font-size: .88rem; color: var(--text-secondary); }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.75rem; max-width: 900px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.form-actions { display: flex; gap: .75rem; margin-top: .5rem; }

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-brand { padding: .75rem 1rem; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: .5rem; }
  .nav-item { white-space: nowrap; }
  .sidebar-footer { border-top: none; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ── Course detail tab content editor ────────────────────────── */
.course-detail-divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 2rem 0 .25rem;
}
.course-detail-divider::before,
.course-detail-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.course-detail-divider span {
  font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap;
}
.section-hint { font-size: .82rem; color: var(--text-muted); margin-bottom: 1rem; }
.hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-muted); font-size: .78rem; }

.detail-block {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.25rem; margin-bottom: 1.25rem;
}
.detail-block h3 { font-size: .92rem; font-weight: 800; margin-bottom: 1rem; }

/* Curriculum section rows */
.curr-edit-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: .65rem;
  padding: 1rem; margin-bottom: .85rem;
}
.curr-edit-section-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .75rem; }
.curr-edit-section-head input { flex: 1; }
.curr-edit-lessons { display: flex; flex-direction: column; gap: .5rem; margin: .5rem 0 .65rem 1rem; }
.curr-edit-lesson { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.curr-edit-lesson input[type="text"] { flex: 2; min-width: 140px; }
.curr-edit-lesson input.curr-duration { flex: 1; min-width: 90px; }
.curr-edit-lesson label.checkbox-label { font-size: .78rem; white-space: nowrap; gap: .3rem; }

/* Generic repeatable rows (prerequisites, FAQs) */
.repeat-row {
  display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .6rem;
}
.repeat-row input, .repeat-row textarea { flex: 1; }
.repeat-row .faq-q-input { flex: 1; }
.faq-edit-row { display: flex; flex-direction: column; gap: .4rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: .65rem; padding: .85rem; margin-bottom: .6rem; }
.faq-edit-row-top { display: flex; gap: .5rem; align-items: center; }
.faq-edit-row-top input { flex: 1; }

.btn-icon-remove {
  width: 1.9rem; height: 1.9rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: .4rem; background: #fee2e2; color: #dc2626;
  font-size: .9rem; font-weight: 800; line-height: 1; border: none; cursor: pointer;
}
.btn-icon-remove:hover { background: #fecaca; }

/* Instructor checklist */
.instructor-checklist { display: flex; flex-direction: column; gap: .5rem; max-height: 220px; overflow-y: auto; }
.instructor-check-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem; border: 1px solid var(--border); border-radius: .5rem;
  background: var(--surface); cursor: pointer; font-size: .85rem;
}
.instructor-check-item input { accent-color: var(--blue-500); width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.instructor-check-item .ic-desig { color: var(--text-muted); font-size: .78rem; }

/* ── Instructor photo upload widget ─────────────────────────── */
.photo-upload-row {
  display: flex; align-items: center; gap: .85rem; flex-wrap: wrap;
}
.photo-upload-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border: 1.5px dashed var(--border);
  border-radius: .65rem; font-size: .85rem; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  background: var(--bg-alt); transition: border-color .15s, color .15s;
}
.photo-upload-btn:hover { border-color: var(--blue-400); color: var(--blue-500); }
.photo-preview-wrap { display: flex; align-items: center; gap: .5rem; }
.photo-preview-img {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border);
}
.photo-filename {
  font-size: .78rem; color: var(--text-muted); max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Instructor photo in the table */
.inst-table-photo {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border);
}
.inst-table-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--grad-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800;
}
.inst-name-cell { display: flex; align-items: center; gap: .65rem; }

/* ── Profile / Change Password page ── */
.profile-wrap { max-width:520px; }
.profile-card  { display:flex; align-items:center; gap:1.25rem; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius,8px); padding:1.5rem; margin-bottom:1.5rem; }
.profile-avatar { width:60px; height:60px; border-radius:50%; background:linear-gradient(135deg,#2f81f7,#a371f7); display:flex; align-items:center; justify-content:center; font-size:1.6rem; font-weight:800; color:#fff; flex-shrink:0; }
.profile-info h2 { font-size:1.1rem; font-weight:800; margin-bottom:.2rem; }
.profile-role  { font-size:.78rem; text-transform:capitalize; color:var(--blue,#2f81f7); font-weight:700; margin-bottom:.2rem; }
.profile-email { font-size:.8rem; color:var(--text2,#666); }
.profile-section h3 { font-size:.95rem; font-weight:700; margin-bottom:1rem; padding-bottom:.5rem; border-bottom:1px solid var(--border); }
.profile-form  { display:flex; flex-direction:column; gap:.75rem; }
.form-msg  { padding:.55rem .875rem; border-radius:6px; font-size:.825rem; font-weight:600; margin-top:.5rem; }
.form-msg.error   { background:rgba(248,81,73,.12); border:1px solid #f85149; color:#f85149; }
.form-msg.success { background:rgba(63,185,80,.12);  border:1px solid #3fb950; color:#3fb950; }

/* ── Teacher Assignment page ── */
.nav-sep-label{margin:.5rem .75rem .25rem;font-size:.65rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--text3,#555)}
.ta-info{background:var(--blue-light,#dbeafe);border:1px solid var(--blue,#2f81f7);border-radius:var(--radius,8px);padding:.75rem 1rem;margin-bottom:1.25rem;font-size:.85rem;color:var(--blue-dark,#1d4ed8)}
.ta-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1.25rem}
.ta-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius,8px);overflow:hidden}
.ta-teacher-hdr{display:flex;align-items:center;gap:.75rem;padding:.875rem 1rem;background:var(--bg-alt,#f6f8fa);border-bottom:1px solid var(--border)}
.ta-av{width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,#2f81f7,#a371f7);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:.95rem;color:#fff;flex-shrink:0}
.ta-name{font-size:.875rem;font-weight:700}
.ta-email{font-size:.75rem;color:var(--text-muted,#666)}
.ta-courses{padding:.5rem}
.ta-course-row{display:flex;align-items:center;gap:.625rem;padding:.45rem .5rem;border-radius:6px;cursor:pointer;font-size:.82rem;transition:background .12s}
.ta-course-row:hover{background:var(--bg-alt,#f6f8fa)}
.ta-course-row input[type=checkbox]{accent-color:#2f81f7;width:.9rem;height:.9rem;cursor:pointer;flex-shrink:0}
.ta-course-title{flex:1;font-weight:500}
.ta-badge{font-size:.68rem;font-weight:700;padding:.15rem .45rem;border-radius:2rem}
.ta-badge.pub  {background:#dcfce7;color:#16a34a}
.ta-badge.draft{background:#fef9c3;color:#ca8a04}

/* ── Toast notification ── */
.toast-msg {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #161b22;
  border: 1px solid #30363d;
  color: #e6edf3;
  padding: .75rem 1.25rem;
  border-radius: .5rem;
  font-size: .85rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(.5rem);
  transition: all .25s;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.toast-msg.show { opacity: 1; transform: translateY(0); }

/* ── Admin Modal ── */
.adm-modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
  animation: fadeIn .15s ease;
}
.adm-modal-bg.hidden { display: none !important; }
.adm-modal {
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: .875rem;
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  animation: slideUp .18s ease;
}
.adm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, #30363d);
  position: sticky; top: 0;
  background: var(--surface, #161b22);
  z-index: 1;
}
.adm-modal-head h3 { font-size: .95rem; font-weight: 800; margin: 0; }
.adm-modal-x {
  background: none; border: none; color: var(--text2, #8b949e);
  cursor: pointer; font-size: 1.25rem; line-height: 1;
  padding: .25rem .4rem; border-radius: .375rem; transition: background .12s;
}
.adm-modal-x:hover { background: rgba(255,255,255,.08); color: #e6edf3; }
.adm-modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.adm-modal-body .fg { display: flex; flex-direction: column; gap: .35rem; }
.adm-modal-body .fg label { font-size: .8rem; font-weight: 700; color: var(--text2, #8b949e); }
.adm-modal-body .fg input,
.adm-modal-body .fg select,
.adm-modal-body .fg textarea {
  background: var(--bg, #0d1117); border: 1px solid var(--border, #30363d);
  border-radius: .375rem; color: var(--text, #e6edf3);
  padding: .5rem .75rem; font-size: .875rem; font-family: inherit;
  transition: border-color .15s;
}
.adm-modal-body .fg input:focus,
.adm-modal-body .fg select:focus,
.adm-modal-body .fg textarea:focus {
  outline: none; border-color: var(--blue, #2f81f7);
}
.adm-modal-foot {
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--border, #30363d);
  display: flex; gap: .625rem; justify-content: flex-end;
}
.modal-err {
  background: rgba(248,81,73,.12); border: 1px solid #f85149;
  color: #f85149; border-radius: .375rem;
  padding: .45rem .75rem; font-size: .8rem; font-weight: 600;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Translation Editor ── */
.trans-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem;
}
.trans-lang-switch { display: flex; gap: .5rem; }
.trans-hint {
  font-size: .82rem; color: var(--text2, #8b949e); line-height: 1.65;
  padding: .75rem 1rem; background: rgba(47,129,247,.07);
  border: 1px solid rgba(47,129,247,.2); border-radius: 6px; margin-bottom: 1rem;
}
.trans-label  { font-size: .82rem; font-weight: 700; margin-bottom: .2rem; }
.trans-key    { font-size: .72rem; color: var(--text3, #555); font-family: monospace; }
.trans-en-val { font-size: .8rem; color: var(--text2, #8b949e); display: block; line-height: 1.5; }
.trans-input  {
  width: 100%; padding: .45rem .625rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg, #0d1117); color: var(--text);
  font-size: .85rem; font-family: inherit; resize: vertical; min-height: 42px;
  transition: border-color .15s;
}
.trans-input:focus { outline: none; border-color: var(--blue, #2f81f7); }
.trans-actions { display: flex; flex-direction: column; gap: .35rem; min-width: 90px; }
.trans-row td { vertical-align: top; padding: .625rem .75rem; }
.trans-row:hover td { background: rgba(255,255,255,.02); }

/* ── Hero Slider Admin ── */
.slider-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.slide-card {
  border: 1px solid var(--border);
  border-radius: var(--radius, .625rem);
  overflow: hidden;
  background: var(--surface);
}
.slide-thumb {
  height: 175px;
  background-size: cover;
  background-position: center;
  background-color: #0d1117;
  position: relative;
}
.slide-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 60%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: .875rem 1rem;
  gap: .25rem;
}
.slide-badge {
  display: inline-block;
  background: rgba(47,129,247,.85);
  color: #fff; font-size: .65rem; font-weight: 800;
  padding: .15rem .5rem; border-radius: 2rem; width: fit-content;
}
.slide-headline {
  font-size: .95rem; font-weight: 800; color: #fff;
  line-height: 1.3;
}
.slide-sub {
  font-size: .75rem; color: rgba(255,255,255,.75); line-height: 1.5;
}
.slide-actions {
  display: flex; align-items: center; gap: .5rem;
  padding: .625rem .875rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Slide card improvements ── */
.slide-thumb {
  position: relative;
  overflow: hidden;
}
.slide-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.slider-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.slide-card {
  border: 1px solid var(--border);
  border-radius: .75rem;
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.slide-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 16px rgba(47,129,247,.15);
}
