/* ===== Manage Students: New Styles Only ===== */

/* Page scaffold inside your existing wrapper */
.manage-students {}

/* Header */
.mgmt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.mgmt-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.mgmt-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  opacity: 0.85;
}

/* KPI Cards */
.kpi-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.75rem;
}
.kpi-card {
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: radial-gradient(1200px 500px at 10% -10%, rgba(59,130,246,.10), transparent),
              #ffffff;
  border: 1px solid #eef2f7;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #334155;
  margin-bottom: 0.35rem;
}
.kpi-label { font-size: 0.85rem; font-weight: 600; letter-spacing: .2px; }
.kpi-value { font-size: 1.6rem; font-weight: 800; color: #0f172a; }

/* Buttons under KPIs */
.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.under-kpis { margin: 0.4rem 0 0.8rem; }
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 10px;
  padding: 8px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: none;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 60%, #60a5fa 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.primary-btn:hover { 
    background-color: #14409f;
}

.secondary-btn {
  background: #f6f8fb;
  color: #0f172a;
  border: 1px solid #e6ebf2;
}

.secondary-btn:hover { box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08); }

/* Toolbar: wide search + filters + export on same row */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 30px 10px;
}
.search-input {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  height: 50px;
}
.search-input.wide {
  min-width: 520px;
  flex: 1 1 auto; /* grow to take space */
}
.toolbar-right-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

/* Filter buttons (reactstrap DropdownToggle) */
.filter-btn {
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e6ebf2 !important;
  font-weight: 600 !important;
}

/* Student row packed into the single "message" column */
.student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.25rem;
}
.student-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Avatar + initials fallback */
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  background: #e2e8f0;
}
.initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0f172a;
}

/* Name / email / chips */
.student-meta { display: grid; gap: 0.15rem; }
.student-primary { display: flex; align-items: center; gap: 0.5rem; }
.student-name { font-weight: 700; font-size: 0.98rem; color: #0f172a; }
.student-secondary { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: #475569; }
.student-email { text-decoration: none; color: inherit; border-bottom: 1px dashed rgba(71, 85, 105, 0.4); }
.chip {
  display: inline-flex; align-items: center;
  border: 1px solid #e6ebf2; padding: 0.15rem 0.5rem;
  border-radius: 999px; font-size: 0.75rem; background: #f8fafc; color: #0f172a;
}

/* Status badge */
.status-badge {
  display: inline-flex; align-items: center;
  padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2px; border: 1px solid transparent;
}
.status-badge.active   { background: rgba(34, 197, 94, 0.12);  color: #166534; border-color: rgba(34, 197, 94, 0.25); }
.status-badge.archived { background: rgba(148,163,184, 0.15); color: #334155; border-color: rgba(148,163,184, 0.3); }

/* Row action (only View) */
.student-actions { display: inline-flex; align-items: center; gap: 0.4rem; }
.ghost-btn {
  appearance: none;
  border: 1px dashed #d6dbe5;
  background: transparent;
  color: #0f172a;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.ghost-btn:hover { background: #f8fafc; transform: translateY(-1px); border-color: #cfd6e3; }

/* Rename the table header "Message" -> "Students" without changing your component */
.rdt_TableHead .rdt_TableCol:first-child .rdt_TableCol__content {
  color: transparent;            /* visually hide original label */
  position: relative;
}
.rdt_TableHead .rdt_TableCol:first-child .rdt_TableCol__content::after {
  content: "Students";
  color: #0f172a;
  position: absolute;
  left: 0;
  top: 0;
}

/* Responsive */
@media (max-width: 992px) {
  .kpi-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-input.wide { min-width: 100%; }
  .toolbar { flex-wrap: wrap; }
}
@media (max-width: 680px) {
  .kpi-cards { grid-template-columns: 1fr; }
  .student-row { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
}

/* Avatar + initials (iPhone-style) */
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    /* background set inline via style attr for stable gradient */
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12), inset 0 0 0 1px rgba(255,255,255,0.25);
  }
  .initials {
    /* keep as alias for semantic clarity; styles inherited from .avatar */
  }

  /* ===== NEW: View Student Offcanvas ===== */
.student-panel {}
.student-panel-heading {
  font-weight: 800;
  letter-spacing: .2px;
}
.student-panel-body { padding-top: .5rem; }

.panel-identity {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-bottom: .9rem;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.05rem;
  box-shadow: 0 6px 18px rgba(15,23,42,.12), inset 0 0 0 1px rgba(255,255,255,.25);
}
.id-block { display: grid; gap: .2rem; }
.id-name {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: #0f172a;
}
.id-email {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #475569;
  font-size: .9rem;
}

.panel-section {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  padding: .9rem;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.05);
  margin-bottom: 1rem;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .8rem;
}
.field {}
.field-label {
  font-size: .8rem;
  color: #64748b;
  margin-bottom: .15rem;
  font-weight: 600;
}
.field-value { font-weight: 700; color: #0f172a; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border: 1px solid #e6ebf2;
  border-radius: 999px;
  background: #f8fafc;
  font-size: .8rem;
  color: #0f172a;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}
.archive-btn { box-shadow: 0 6px 16px rgba(220,38,38,.2); }
.unarchive-btn { box-shadow: 0 6px 16px rgba(22,163,74,.2); }

/* ===== NEW: Add Student Offcanvas ===== */
.student-add-panel {}
.student-add-heading { font-weight: 800; letter-spacing: .2px; }
.student-add-body { padding-top: .5rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: .9rem .8rem;
}

.form-field {}

.form-label { font-weight: 700; font-size: .9rem; margin: 5px; }

.req { color: #ef4444; }

.helper {
  font-size: .8rem;
  color: #64748b;
  margin-top: .25rem;
}
.form-inline { display: flex; align-items: center; }

.form-label-inline { font-weight: 600; margin: 5px;}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 10px;
}
.cancel-btn {
  background: #f6f8fb;
  color: #0f172a;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  margin: 2px;
}
.save-btn {
  border-radius: 10px;
  padding: 8px;
  font-weight: 600;
  font-size: 14px;
  margin: 2px;
  box-shadow: 0 8px 20px rgba(37,99,235,.25);
}

/* Responsive for offcanvas content */
@media (max-width: 680px) {
  .field-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ===== AdminTable (NEW classes only) ===== */

.admin-table-wrap {
  position: relative;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,0.05);
  overflow: hidden;
}

/* scroll container with sticky header support */
.admin-table-scroll {
  max-height: 540px;              /* adjust as desired */
  overflow: auto;
  scrollbar-width: thin;
}

/* optional denser padding */
.admin-table-wrap.dense .admin-th-content,
.admin-table-wrap.dense .admin-td {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;            /* consistent cell layout */
}

/* Sticky header */
.admin-thead th.admin-th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e6ebf2;
}

.admin-th {
  text-align: left;
  padding: 0;
}
.admin-th-content {
  padding: 0.8rem 1rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #0f172a;
  text-transform: uppercase;
}

/* Body rows */
.admin-tr:nth-child(odd) .admin-td { background: #ffffff; }
.admin-tr:nth-child(even) .admin-td { background: #fbfdff; }

.admin-td {
  padding: 0.9rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f0f4f8;
}

/* Hover highlight */
.admin-tr:hover .admin-td {
  background: #f8fbff;
}

/* Empty state */
.admin-table-empty {
  text-align: center;
  padding: 2.25rem 1rem;
  color: #64748b;
  font-weight: 600;
}

/* bottom fade shadow to hint scroll */
.admin-table-shadow {
  pointer-events: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 12px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(15,23,42,0.06));
}

/* Bulk upload panel */
.bulk-panel { display: grid; gap: 1rem; }
.bulk-upload-row { }

.bulk-upload-drop {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: .8rem;
  border: 2px dashed #cfd6e3;
  border-radius: 14px;
  padding: 1rem;
  cursor: pointer;
  background: #f8fafc;
  color: #0f172a;
  transition: background 120ms ease, border-color 120ms ease;
}
.bulk-upload-drop:hover {
  background: #f1f5f9;
  border-color: #b9c2d3;
}
.bulk-upload-drop svg { width: 24px; height: 24px; }

.bulk-title { font-weight: 800; }
.bulk-subtitle { font-size: .9rem; color: #475569; }
.bulk-subtle { font-size: .8rem; color: #64748b; }
.bulk-filename { margin-top: .3rem; font-size: .85rem; color: #0f172a; font-weight: 700; }

.bulk-summary {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
}
.bulk-ok { color: #166534; display: inline-flex; gap: .4rem; align-items: center; font-weight: 700; }
.bulk-warn { color: #b45309; display: inline-flex; gap: .4rem; align-items: center; font-weight: 700; }
.bulk-error { color: #b91c1c; display: inline-flex; gap: .4rem; align-items: center; font-weight: 700; }

.bulk-preview-title { font-weight: 800; margin-top: .2rem; }
.bulk-issues { margin: 0; padding-left: 1rem; color: #6b7280; }
.bulk-issues li { margin: .15rem 0; }

.bulk-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* Segmented control container */
.segmented {
  display: inline-flex;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 4px;
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  gap: 4px;
  margin: 10px 0;
}

/* Each option pill */
.segmented-option {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.segmented-option:hover {
  background: #e5e7eb;
}

.segmented-option:active {
  transform: translateY(1px);
}

/* Selected states */
.segmented-option.is-selected {
  color: #fff;
}

.segmented-option.is-selected.active {
  background: #16a34a; /* green */
  box-shadow: 0 4px 12px rgba(22,163,74,0.28);
}

.segmented-option.is-selected.archived {
  background: #ef4444; /* red */
  box-shadow: 0 4px 12px rgba(239,68,68,0.28);
}

/* Helper line under the control */
.segmented-hint {
  margin-top: 8px;
  font-size: 0.88rem;
  font-weight: 500;
}

.segmented-hint.active {
  color: #166534; /* deep green */
}

.segmented-hint.archived {
  color: #991b1b; /* deep red */
}

/* course offcanvas body wrapper */
.course-canvas-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.offcanvas-flex .offcanvas-body,
.offcanvas-body-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;   
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Section blocks inside course panel */
.course-section {
  background: #ffffff;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(20, 40, 80, 0.05);
}

.course-section + .course-section {
  margin-top: 4px;
}

.course-section-title {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
  margin-bottom: 10px;
}

/* Instructor tile inside course offcanvas */
.instructor-tile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 6px;
}

.instructor-tile .tile-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar.avatar-md {
  width: 44px;
  height: 44px;
  font-size: 0.95rem;
}

.tile-meta {
  display: flex;
  flex-direction: column;
}

.tile-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #0f172a;
}

.tile-name {
  line-height: 1.1;
}

.tile-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 0.92rem;
}

.tile-email {
  font-weight: 500;
}

.tile-actions {
  display: flex;
  gap: 10px;
}

/* Danger ghost button (for remove) */
.danger-ghost-btn {
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  transition: background 0.15s ease, box-shadow 0.2s ease;
}
.danger-ghost-btn:hover {
  background: #fff5f5;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.15);
}
/* Chip showing total students in the course row */
.counter-chip {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #e0e7ff;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  margin-left: 8px;
}

/* “Add Course” button row above toolbar */
.above-toolbar-actions {
  display: flex;
  justify-content: flex-start;
  margin: 6px 0 10px;
}

/* 50% add course panel */
.addcourse-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Reusable section header inside offcanvas cards */
.section-header {
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
}

/* Picker layout: selected chip(s) + button */
.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* When nothing is selected yet */
.picker-empty {
  color: #6b7280;
  font-size: 0.92rem;
  margin-right: 6px;
}

/* Selected person pill */
.selected-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.pill-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #fff;
  font-weight: 800;
  border-radius: 50%;
}

.pill-text {
  font-weight: 600;
  color: #0f172a;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-x {
  border: none;
  background: #f3f4f6;
  color: #111827;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pill-x:hover { background: #e5e7eb; }

/* Selected students list container */
.selected-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 36px;
}

/* Search modal spacing */
.modal-search { margin-bottom: 10px; }
.modal-results { max-height: 50vh; overflow: auto; }

/* Compact inline edit bar at top of course panel */
.course-edit-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  padding: 10px 0 6px;
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 8px;
}
.course-edit-left {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.compact-field {
  min-width: 260px;
}
.ior-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ior-actions,
.students-actions {
  margin-top: 8px;
  display: flex;
  gap: 10px;
}

/* Counter chip already used in earlier pages */
.counter-chip {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #e0e7ff;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  margin-left: 8px;
}
