/*
 * NephScola table-system prototype
 * Scope: Élèves > Tous les élèves only.
 * This file deliberately does not style other application tables yet.
 */

.ns-table-preview-page {
  --ns-table-ink: #122a43;
  --ns-table-muted: #61758a;
  --ns-table-border: #d7e2ec;
  --ns-table-header: #edf4fa;
  --ns-table-row-alt: #fbfdff;
  --ns-table-row-hover: #edf6ff;
  --ns-table-accent: var(--primary, #1b75ce);
}

.ns-table-preview-page .student-filter-panel,
.ns-table-preview-page .ns-table-preview-panel {
  border-color: var(--ns-table-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(10, 37, 64, .045);
}

.ns-table-preview-page .student-filter-panel {
  padding: 13px;
}

.ns-table-preview-page .student-filter-row input,
.ns-table-preview-page .student-filter-row select,
.ns-table-preview-page .student-advanced-filters input,
.ns-table-preview-page .student-advanced-filters select {
  border-color: #cbdbe8;
  background: #f9fbfd;
}

.ns-table-preview-page .student-filter-row input:focus,
.ns-table-preview-page .student-filter-row select:focus,
.ns-table-preview-page .student-advanced-filters input:focus,
.ns-table-preview-page .student-advanced-filters select:focus {
  border-color: var(--ns-table-accent);
  outline: 3px solid color-mix(in srgb, var(--ns-table-accent) 14%, transparent);
}

.ns-table-preview-page .student-list-summary {
  min-height: 38px;
  padding: 6px 12px;
  border-color: var(--ns-table-border);
  background: #fff;
}

.ns-table-preview-page .student-list-summary strong {
  display: inline-grid;
  min-width: 30px;
  height: 26px;
  padding: 0 7px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--ns-table-accent);
  font-size: 12px;
}

.ns-table-preview-panel .scrollable-data-table,
.ns-table-preview-panel .csn-table-wrap {
  min-width: 0;
}

.ns-table-preview-panel .table-scroll-top {
  height: 6px;
  margin: 5px 12px 4px;
  background: #edf2f6;
  scrollbar-color: color-mix(in srgb, var(--ns-table-accent) 48%, #aebfcd) #edf2f6;
  scrollbar-width: thin;
}

.ns-table-preview-panel .table-scroll-top::-webkit-scrollbar,
.ns-table-preview-panel .csn-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.ns-table-preview-panel .table-scroll-top::-webkit-scrollbar-track,
.ns-table-preview-panel .csn-table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #edf2f6;
}

.ns-table-preview-panel .table-scroll-top::-webkit-scrollbar-thumb,
.ns-table-preview-panel .csn-table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--ns-table-accent) 48%, #aebfcd);
}

.ns-table-preview-panel .csn-table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

table.ns-table--students-preview {
  width: 100%;
  min-width: 1160px;
  table-layout: fixed;
  color: var(--ns-table-ink);
}

.ns-table--students-preview thead tr {
  height: 30px;
}

.ns-table--students-preview tbody tr {
  height: 31.5px;
}

.ns-table--students-preview th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 30px;
  padding: 0;
  box-sizing: border-box;
  border-right: 1px solid #f4f6f8;
  border-bottom: 1px solid #cbd9e5;
  color: #243d56;
  background: var(--ns-table-header);
  font-size: 12px;
  font-weight: 650;
}

.ns-table--students-preview th:last-child {
  border-right: 0;
}

.ns-table--students-preview .sortable-header,
.ns-table--students-preview .table-static-header {
  height: 30px;
  min-height: 0;
  padding: 0 9px;
  box-sizing: border-box;
  font: inherit;
}

.ns-table--students-preview .sortable-header:hover,
.ns-table--students-preview .sortable-header:focus-visible {
  color: var(--ns-table-accent);
  background: color-mix(in srgb, var(--ns-table-accent) 7%, var(--ns-table-header));
}

.ns-table--students-preview td {
  height: 31.5px;
  padding: 0 9px;
  box-sizing: border-box;
  border-right: 1px solid #f7f8fa;
  border-bottom: 1px solid #e2eaf1;
  color: var(--ns-table-ink);
  background: #fff;
  font-size: 12.5px;
  line-height: 1.15;
}

.ns-table--students-preview td:last-child {
  border-right: 0;
}

.ns-table--students-preview tbody tr:nth-child(even) td {
  background: var(--ns-table-row-alt);
}

.ns-table--students-preview tbody tr:hover td {
  background: var(--ns-table-row-hover);
}

.ns-table--students-preview th:nth-child(1),
.ns-table--students-preview td:nth-child(1) { width: 125px; }
.ns-table--students-preview th:nth-child(2),
.ns-table--students-preview td:nth-child(2) { width: 180px; }
.ns-table--students-preview th:nth-child(3),
.ns-table--students-preview td:nth-child(3) { width: 78px; }
.ns-table--students-preview th:nth-child(4),
.ns-table--students-preview td:nth-child(4) { width: 125px; }
.ns-table--students-preview th:nth-child(5),
.ns-table--students-preview td:nth-child(5) { width: 145px; }
.ns-table--students-preview th:nth-child(6),
.ns-table--students-preview td:nth-child(6) { width: 138px; }
.ns-table--students-preview th:nth-child(7),
.ns-table--students-preview td:nth-child(7) { width: 140px; }
.ns-table--students-preview th:nth-child(8),
.ns-table--students-preview td:nth-child(8) { width: 135px; text-align: center; }
.ns-table--students-preview th:nth-child(9),
.ns-table--students-preview td:nth-child(9) { width: 105px; }
.ns-table--students-preview th:nth-child(10),
.ns-table--students-preview td:nth-child(10) {
  position: sticky;
  right: 0;
  width: 70px;
  text-align: center;
  box-shadow: -8px 0 12px -11px rgba(18, 42, 67, .55);
}

.ns-table--students-preview th:nth-child(10) {
  z-index: 7;
  background: var(--ns-table-header);
}

.ns-table--students-preview td:nth-child(10) {
  z-index: 2;
  background: #fff;
}

.ns-table--students-preview tbody tr:nth-child(even) td:nth-child(10) {
  background: var(--ns-table-row-alt);
}

.ns-table--students-preview tbody tr:hover td:nth-child(10) {
  background: var(--ns-table-row-hover);
}

.ns-table--students-preview .text-link {
  max-width: 100%;
  overflow: hidden;
  color: #174d7d;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ns-table--students-preview .strong-link {
  color: var(--ns-table-ink);
  font-weight: 650;
}

.ns-table--students-preview .text-link:hover,
.ns-table--students-preview .text-link:focus-visible {
  color: var(--ns-table-accent);
}

.ns-table--students-preview .status-badge,
.ns-table--students-preview .badge-pill,
.ns-table--students-preview [class*="status-"] {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.ns-table--students-preview .student-action-menu summary {
  width: 30px;
  height: 30px;
  border-color: #c7d8e6;
  color: #294c68;
  background: #f7fafc;
}

.ns-table--students-preview .student-action-menu summary:hover,
.ns-table--students-preview .student-action-menu summary:focus-visible {
  border-color: var(--ns-table-accent);
  color: #fff;
  background: var(--ns-table-accent);
}

.ns-table-preview-panel .data-table-footer {
  min-height: 52px;
  padding: 9px 13px;
  border-top: 1px solid var(--ns-table-border);
  background: #fff;
}

.ns-table-preview-page .empty-state {
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--ns-table-muted);
  background: #fbfdff;
  text-align: center;
}

@media (max-width: 680px) {
  .ns-table-preview-page {
    gap: 10px;
  }

  .ns-table-preview-page .student-filter-panel,
  .ns-table-preview-page .ns-table-preview-panel {
    border-radius: 9px;
  }

  .ns-table-preview-panel .table-scroll-top {
    display: none !important;
  }

  .ns-table-preview-panel .csn-table-wrap {
    overflow: visible;
  }

  table.ns-table--students-preview,
  .ns-table--students-preview tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .ns-table--students-preview thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ns-table--students-preview tbody {
    display: grid;
    gap: 9px;
    padding: 10px;
    background: #f3f7fa;
  }

  .ns-table--students-preview tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
    padding: 11px 12px;
    border: 1px solid var(--ns-table-border);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(10, 37, 64, .045);
  }

  .ns-table--students-preview tbody tr,
  .ns-table--students-preview td:nth-child(10) {
    height: auto;
  }

  .ns-table--students-preview td:nth-child(10) {
    position: static;
    box-shadow: none;
  }

  .ns-table--students-preview tbody tr:hover {
    border-color: color-mix(in srgb, var(--ns-table-accent) 38%, var(--ns-table-border));
  }

  .ns-table--students-preview td,
  .ns-table--students-preview tbody tr:nth-child(even) td,
  .ns-table--students-preview tbody tr:hover td {
    display: grid;
    width: auto !important;
    min-width: 0;
    height: auto;
    min-height: 40px;
    align-content: center;
    gap: 3px;
    padding: 7px 0;
    border-right: 0;
    border-bottom: 1px solid #edf2f6;
    background: transparent;
    font-size: 14px;
    text-align: left;
    white-space: normal;
  }

  .ns-table--students-preview td::before {
    content: attr(data-label);
    color: var(--ns-table-muted);
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.1;
  }

  .ns-table--students-preview td[data-priority="primary"] {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 40px;
    padding-top: 0;
    font-size: 16px;
  }

  .ns-table--students-preview td[data-priority="primary"] .text-link,
  .ns-table--students-preview td[data-priority="primary"] .strong-link {
    font-size: 16px !important;
    line-height: 1.25;
  }

  .ns-table--students-preview td[data-priority="supporting"] {
    grid-row: 2;
  }

  .ns-table--students-preview td[data-priority="status"] {
    grid-row: 2;
    justify-items: start;
  }

  .ns-table--students-preview td[data-priority="actions"] {
    grid-column: 1 / -1;
    justify-items: end;
    min-height: 40px;
    padding-bottom: 0;
    border-bottom: 0;
    overflow: visible;
  }

  .ns-table--students-preview td[data-priority="actions"]::before {
    display: none;
  }

  .ns-table--students-preview td:nth-last-child(2),
  .ns-table--students-preview td[data-priority="actions"] {
    border-bottom: 0;
  }

  .ns-table--students-preview .text-link {
    width: fit-content;
    white-space: normal;
  }

  .ns-table--students-preview .student-action-menu,
  .ns-table--students-preview .student-action-menu summary {
    width: 100%;
  }

  .ns-table--students-preview .student-action-menu summary {
    display: flex;
    height: 34px;
    justify-content: center;
    color: var(--color-primary);
    border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
    background: var(--color-primary-soft);
  }

  .ns-table--students-preview .student-action-menu summary::before {
    content: "Actions";
    margin-right: 7px;
    font-size: 11px;
  }

  .ns-table--students-preview .student-action-menu > div {
    position: static;
    z-index: auto;
    width: 100%;
    margin-top: 6px;
    padding: 5px;
    color: var(--color-sidebar-text);
    border-color: color-mix(in srgb, var(--color-sidebar-text) 22%, transparent);
    background: var(--color-sidebar-bg);
  }

  .ns-table--students-preview .student-action-menu[open] {
    position: relative;
    z-index: 1;
  }

  .ns-table--students-preview .student-action-menu > div button {
    color: var(--color-sidebar-text);
    border-bottom: 1px solid color-mix(in srgb, var(--color-sidebar-text) 18%, transparent);
    border-radius: 0;
    background: transparent;
  }

  .ns-table--students-preview .student-action-menu > div button:last-child {
    border-bottom: 0;
  }

  .ns-table--students-preview .student-action-menu > div button:hover,
  .ns-table--students-preview .student-action-menu > div button:focus-visible {
    color: var(--color-sidebar-text);
    background: color-mix(in srgb, var(--color-sidebar-text) 12%, transparent);
  }

  .ns-table-preview-panel .data-table-footer {
    display: grid;
    justify-content: stretch;
    gap: 9px;
  }

  .ns-table-preview-panel .data-table-footer > label,
  .ns-table-preview-panel .data-table-footer > div {
    justify-content: center;
  }
}

@media print {
  .ns-table--students-preview thead {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    clip-path: none;
  }

  table.ns-table--students-preview,
  .ns-table--students-preview tbody,
  .ns-table--students-preview tbody tr {
    display: table;
  }

  .ns-table--students-preview tbody {
    display: table-row-group;
  }

  .ns-table--students-preview tbody tr {
    display: table-row;
  }

  .ns-table--students-preview td {
    display: table-cell;
  }

  .ns-table--students-preview td::before {
    display: none;
  }
}
