/* ==========================================================================
   NESPL Portal — Super Admin · Bootcamp Management
   All classes namespaced .sab- (HANDOFF.md §3.1). CSS-only entrance (§3.2).
   ========================================================================== */

@keyframes sabRise { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform:none; } }
@keyframes sabPop  { from { opacity:0; transform: scale(.96); }       to { opacity:1; transform:none; } }
@keyframes sabFade { from { opacity:0; }                              to { opacity:1; } }

.sab-in   { animation: sabRise .45s cubic-bezier(.2,.8,.2,1) both; }
.sab-in-2 { animation: sabRise .45s cubic-bezier(.2,.8,.2,1) .08s both; }

/* ---------- Hero ---------- */
.sab-hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3.5vw, 2.4rem); margin-bottom: 1.4rem; color: #fff;
  background: linear-gradient(125deg, #1e3a8a 0%, #2563eb 45%, #4f46e5 100%);
}
.sab-hero::after {
  content: ""; position: absolute; inset: auto -60px -120px auto;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 68%);
  pointer-events: none;
}
.sab-hero__in {
  position: relative; z-index: 1; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 1.6rem; flex-wrap: wrap;
}
.sab-hero__text { min-width: 0; flex: 1 1 340px; }
.sab-hero__eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-size: .72rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: rgba(255,255,255,.86); background: rgba(255,255,255,.14);
  padding: .34rem .78rem; border-radius: 999px; margin-bottom: .85rem;
}
.sab-hero h1 {
  color: #fff; font-size: clamp(1.45rem, 3vw, 2.05rem);
  margin: 0 0 .45rem; letter-spacing: -.02em;
}
.sab-hero p { color: rgba(255,255,255,.84); margin: 0; max-width: 56ch; font-size: .95rem; }
.sab-hero__stats { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 1.5rem; }
.sab-hero__stat b {
  display: block; font-family: var(--font-display); font-size: 1.7rem;
  font-weight: 700; line-height: 1.1; color: #fff;
}
.sab-hero__stat span {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .09em;
  color: rgba(255,255,255,.72); font-weight: 600;
}
.sab-hero__cta {
  display: inline-flex; align-items: center; gap: .55rem; flex: 0 0 auto;
  background: #fff; color: var(--blue-700); border: none;
  font-family: var(--font-display); font-weight: 600; font-size: .93rem;
  padding: .8rem 1.4rem; border-radius: 12px; cursor: pointer;
  box-shadow: 0 10px 26px rgba(8,20,54,.24);
  transition: transform .18s ease, box-shadow .25s ease;
}
.sab-hero__cta:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(8,20,54,.32); }

/* ---------- Toolbar ---------- */
.sab-tools {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.05rem 1.15rem; margin-bottom: 1.2rem;
  box-shadow: var(--shadow-xs);
}
.sab-tools__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .85rem; }

.sab-fld { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.sab-fld > label {
  font-size: .7rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.sab-fld--grow { flex: 1 1 260px; }
.sab-fld--pick { flex: 0 1 190px; }

.sab-search { position: relative; }
.sab-search > i {
  position: absolute; left: .95rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: .95rem; pointer-events: none;
}
.sab-search input {
  width: 100%; padding: .68rem .95rem .68rem 2.5rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--body);
  font-family: var(--font-body); font-size: .9rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.sab-search input:focus { outline: none; border-color: var(--blue-400); box-shadow: var(--ring); background: #fff; }

.sab-input, .sab-select, .sab-area {
  width: 100%; padding: .66rem .85rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--body);
  font-family: var(--font-body); font-size: .89rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.sab-input:focus, .sab-select:focus, .sab-area:focus {
  outline: none; border-color: var(--blue-400); box-shadow: var(--ring); background: #fff;
}
.sab-select {
  appearance: none; padding-right: 2.1rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%235b6b84'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 13px;
}
.sab-area { min-height: 118px; resize: vertical; line-height: 1.6; }

.sab-reset {
  display: inline-flex; align-items: center; gap: .45rem; flex: 0 0 auto;
  padding: .66rem 1.05rem; border: 1px solid var(--line);
  background: #fff; color: var(--muted); cursor: pointer;
  border-radius: var(--radius-sm); font-family: var(--font-display);
  font-weight: 600; font-size: .84rem;
  transition: border-color .2s, color .2s, background .2s;
}
.sab-reset:hover { border-color: var(--blue-200); color: var(--blue-700); background: var(--blue-50); }

/* ---------- Panel + table ---------- */
.sab-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.sab-scroll { overflow-x: auto; }
.sab-table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.sab-table thead th {
  background: var(--grad-green); color: #fff; text-align: left;
  font-family: var(--font-display); font-weight: 600; font-size: .78rem;
  letter-spacing: .05em; text-transform: uppercase;
  padding: .95rem .8rem; white-space: nowrap; border: none;
}
.sab-table tbody td {
  padding: .95rem .8rem; border-bottom: 1px solid var(--line-2);
  color: var(--body); vertical-align: top;
}

/* Eight columns never fit below ~1300px, so .sab-scroll scrolls. Pin the
   action column so edit/delete stay reachable instead of being clipped. */
.sab-table thead th:last-child,
.sab-table tbody td:last-child {
  position: sticky; right: 0; z-index: 2;
  box-shadow: -8px 0 12px -8px rgba(20,42,94,.18);
}
.sab-table tbody td:last-child { background: #fff; }
.sab-table tbody tr:nth-child(even) td:last-child { background: #f7faff; }
.sab-table tbody tr:hover td:last-child { background: var(--blue-50); }
.sab-table tbody tr:nth-child(even) { background: #f7faff; }
.sab-table tbody tr:hover { background: var(--blue-50); }
.sab-table tbody tr:last-child td { border-bottom: none; }
.sab-cell-k { display: none; }

.sab-skills { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 120px; }
.sab-skill {
  display: inline-block; padding: .24rem .6rem; border-radius: 999px;
  background: var(--blue-50); color: var(--blue-700);
  font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.sab-course { color: var(--ink); font-weight: 600; min-width: 150px; }
.sab-desc {
  min-width: 240px; max-width: 420px; color: var(--body); font-size: .86rem;
  line-height: 1.55;
}
/* Truncate rather than wrap. `word-break:break-all` here let the column
   collapse to ~31px and wrap one character per line — caught by layout_audit. */
.sab-url {
  display: inline-block; max-width: 210px; vertical-align: middle;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--blue-600); font-size: .85rem;
}
.sab-url:hover { text-decoration: underline; }
.sab-col-url { min-width: 150px; }
.sab-blank { color: var(--muted); font-style: italic; font-size: .84rem; }
.sab-dur {
  display: inline-flex; align-items: baseline; gap: .28rem;
  font-weight: 700; color: var(--ink); white-space: nowrap;
}
.sab-dur small { font-weight: 500; color: var(--muted); font-size: .76rem; }
.sab-score {
  display: inline-block; min-width: 40px; text-align: center;
  padding: .24rem .55rem; border-radius: 8px; font-weight: 700; font-size: .82rem;
  background: var(--green-soft); color: #15803d;
}
.sab-level {
  display: inline-block; padding: .24rem .62rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.sab-level--beginner     { background: var(--green-soft); color: #15803d; }
.sab-level--intermediate { background: #fef3c7;           color: #b45309; }
.sab-level--advanced     { background: #ede9fe;           color: #6d28d9; }

.sab-acts { display: flex; gap: .4rem; align-items: center; }
.sab-btn {
  width: 34px; height: 34px; border: none; cursor: pointer;
  border-radius: 9px; color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-size: .92rem;
  transition: transform .18s ease, box-shadow .25s ease, filter .2s;
}
.sab-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.sab-btn--edit { background: var(--grad-blue); box-shadow: 0 5px 14px rgba(37,99,235,.32); }
.sab-btn--del  { background: linear-gradient(135deg,#f87171,#ef4444); box-shadow: 0 5px 14px rgba(239,68,68,.30); }

/* Empty state */
.sab-empty { padding: 3.4rem 1.5rem; text-align: center; animation: sabFade .3s ease both; }
.sab-empty__ico {
  width: 62px; height: 62px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--blue-50); color: var(--blue-600);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.sab-empty h6 { font-family: var(--font-display); color: var(--ink); font-size: 1.05rem; margin: 0 0 .35rem; }
.sab-empty p { color: var(--muted); margin: 0 0 1.1rem; font-size: .9rem; }

/* Footer */
.sab-foot {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .95rem 1.15rem; border-top: 1px solid var(--line); background: var(--surface-2);
}
.sab-foot__per { display: flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--muted); }
.sab-foot__per select {
  padding: .34rem 1.7rem .34rem .6rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--body);
  font-size: .84rem; font-family: var(--font-body); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%235b6b84'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center; background-size: 12px;
}
.sab-foot__count { margin-left: auto; font-size: .84rem; color: var(--muted); }
.sab-pager { display: flex; gap: .3rem; align-items: center; }
.sab-pager button {
  min-width: 34px; height: 34px; padding: 0 .55rem; border: 1px solid var(--line);
  background: #fff; color: var(--body); border-radius: 9px; cursor: pointer;
  font-size: .84rem; font-weight: 600; font-family: var(--font-body);
  transition: all .18s ease;
}
.sab-pager button:hover:not(:disabled) { border-color: var(--blue-400); color: var(--blue-700); transform: translateY(-1px); }
.sab-pager button[aria-current="page"] { background: var(--grad-blue); border-color: transparent; color: #fff; }
.sab-pager button:disabled { opacity: .42; cursor: not-allowed; }

/* ---------- Modal ---------- */
.sab-modal {
  position: fixed; inset: 0; z-index: 1200; display: none;
  align-items: center; justify-content: center; padding: 1.2rem;
  background: rgba(9,18,44,.55); backdrop-filter: blur(3px);
}
.sab-modal.sab-open { display: flex; animation: sabFade .2s ease both; }
.sab-modal__card {
  background: #fff; border-radius: var(--radius); width: min(680px, 100%);
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: sabPop .28s cubic-bezier(.2,.8,.2,1) both;
}
.sab-modal--sm .sab-modal__card { width: min(430px, 100%); }
.sab-modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.sab-modal__head h3 { margin: 0; font-size: 1.1rem; color: var(--ink); }
.sab-modal__x {
  border: none; background: var(--surface-2); color: var(--muted);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  transition: background .2s, color .2s;
}
.sab-modal__x:hover { background: #fee2e2; color: var(--red); }
.sab-modal__body { padding: 1.3rem 1.4rem; overflow-y: auto; flex: 1 1 auto; }
.sab-modal__foot {
  display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap;
  padding: 1.05rem 1.4rem; border-top: 1px solid var(--line);
  background: var(--surface-2); flex: 0 0 auto;
}

/* Form grid inside modal */
.sab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.1rem; }
.sab-grid > .sab-wide { grid-column: 1 / -1; }
.sab-f { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.sab-f > label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.sab-f .sab-req { color: #dc2626; margin-left: .15rem; }
.sab-hint { font-size: .76rem; color: var(--muted); }
.sab-err { font-size: .78rem; color: var(--red); min-height: 1em; }
.sab-f--bad .sab-input, .sab-f--bad .sab-select,
.sab-f--bad .sab-area, .sab-f--bad .sab-chips { border-color: var(--red); }

/* Duration = unit select + number */
.sab-duo { display: flex; gap: .6rem; }
.sab-duo .sab-select { flex: 1 1 50%; }
.sab-duo .sab-input  { flex: 1 1 50%; }

/* Chip multi-select */
.sab-chips {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
  min-height: 44px; padding: .4rem .5rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: border-color .2s, box-shadow .2s, background .2s;
}
.sab-chips:focus-within { border-color: var(--blue-400); box-shadow: var(--ring); background: #fff; }
.sab-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--blue-600); color: #fff; border-radius: 7px;
  padding: .26rem .4rem .26rem .6rem; font-size: .8rem; font-weight: 600;
  animation: sabPop .2s ease both;
}
.sab-chip button {
  border: none; background: rgba(255,255,255,.24); color: #fff;
  width: 17px; height: 17px; border-radius: 4px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem; line-height: 1; transition: background .2s;
}
.sab-chip button:hover { background: rgba(255,255,255,.45); }
.sab-chips select {
  flex: 1 1 90px; min-width: 90px; border: none; background: transparent;
  font-family: var(--font-body); font-size: .86rem; color: var(--body);
  padding: .28rem .2rem; cursor: pointer;
}
.sab-chips select:focus { outline: none; }
.sab-chips__ph { color: var(--muted); font-size: .86rem; padding: .28rem .2rem; }

/* Delete confirm */
.sab-warn {
  display: flex; gap: .9rem; align-items: flex-start;
  padding: 1rem; border-radius: var(--radius-sm);
  background: #fef2f2; border: 1px solid #fecaca;
}
.sab-warn__ico {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  background: #fee2e2; color: var(--red);
  display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.sab-warn p { margin: 0; font-size: .9rem; color: #7f1d1d; line-height: 1.55; }
.sab-warn strong { color: #991b1b; }

.sab-danger {
  background: linear-gradient(135deg,#f87171,#ef4444); color: #fff; border: none;
  box-shadow: 0 8px 20px rgba(239,68,68,.30);
}
.sab-danger:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 28px rgba(239,68,68,.38); }

/* Toast */
.sab-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: .8rem 1.3rem; border-radius: 12px;
  font-size: .89rem; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  z-index: 1400; max-width: calc(100vw - 2rem);
}
.sab-toast.sab-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sab-fld--pick { flex: 1 1 170px; }
  .sab-desc { max-width: 300px; }
}

@media (max-width: 900px) {
  .sab-table, .sab-table tbody, .sab-table tr, .sab-table td { display: block; }
  .sab-table, .sab-table tbody, .sab-table td { width: 100%; }
  .sab-table thead { display: none; }
  .sab-scroll { overflow-x: visible; }
  .sab-table tbody { padding: .8rem; }
  .sab-table tbody tr {
    width: auto; border: 1px solid var(--line); border-radius: 16px;
    margin: 0 0 .8rem; padding: .3rem 0; background: #fff;
  }
  .sab-table tbody tr:nth-child(even) { background: #fff; }
  .sab-table tbody tr:last-child { margin-bottom: 0; }
  .sab-table tbody tr:hover { background: #fff; }
  .sab-table tbody td { border-bottom: 1px dashed var(--line); padding: .7rem 1rem; }
  .sab-table thead th:last-child,
  .sab-table tbody td:last-child {
    position: static; box-shadow: none; border-bottom: none; background: transparent;
  }
  .sab-table tbody tr:nth-child(even) td:last-child,
  .sab-table tbody tr:hover td:last-child { background: transparent; }
  .sab-cell-k {
    display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); font-weight: 700; margin-bottom: .35rem;
  }
  .sab-desc, .sab-course, .sab-skills { min-width: 0; max-width: none; }
  .sab-url { max-width: 100%; }
  .sab-acts { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .sab-hero__in { flex-direction: column; align-items: stretch; }
  .sab-hero__cta { width: 100%; justify-content: center; }
  .sab-hero__stats { gap: 1.3rem; }
  .sab-hero__stat b { font-size: 1.4rem; }
  .sab-fld--grow, .sab-fld--pick { flex: 1 1 100%; }
  .sab-reset { flex: 1 1 100%; justify-content: center; }
  .sab-grid { grid-template-columns: 1fr; }
  .sab-foot__count { order: 3; flex: 1 1 100%; text-align: left; margin-left: 0; }
  .sab-modal__foot .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sab-in, .sab-in-2, .sab-empty, .sab-modal.sab-open,
  .sab-modal__card, .sab-chip { animation: none; }
  .sab-hero__cta, .sab-btn, .sab-pager button, .sab-danger { transition: none; }
  .sab-hero__cta:hover, .sab-btn:hover, .sab-danger:hover,
  .sab-pager button:hover:not(:disabled) { transform: none; }
}
