/* ==========================================================================
   Informatics - additions on top of the Soujanaars theme (soujanaars.css)
   ========================================================================== */

/* ---------- performance level badges (EE green, ME blue, AE amber, BE red) ---------- */
.lk-lvl { display: inline-block; min-width: 40px; padding: 3px 8px; border-radius: 7px; font-size: 12px; font-weight: 700; text-align: center; letter-spacing: .02em; }
/* same scale as the charts: blue arm (EE darker, ME lighter) and red arm (AE lighter, BE darker) */
.lk-lvl-ee { background: #0f4a96; color: #fff; }
.lk-lvl-me { background: #cce3fd; color: #0e3d7e; }
.lk-lvl-ae { background: #fde2e2; color: #8f1d1d; }
.lk-lvl-be { background: #a12223; color: #fff; }
.lk-lvl-na { background: rgba(11, 18, 32, .06); color: #6b7280; }
.lk-lvl-ab { background: #fff3cd; color: #7a5b00; }   /* ABS: absent, not counted */

/* ---------- avatars ---------- */
.lk-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: 0 0 38px; display: inline-flex; align-items: center; justify-content: center; }
.lk-avatar-txt { background: linear-gradient(135deg, #1e3a8a, #0f2557); color: #fff; font-weight: 700; font-size: 13px; }
.lk-avatar-lg { width: 112px; height: 112px; flex: 0 0 112px; border-radius: 18px; object-fit: cover; font-size: 34px; border: 4px solid #fff; box-shadow: 0 10px 30px -12px rgba(11, 18, 32, .45); }
.lk-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lk-person a { font-weight: 600; color: var(--sj-ink); text-decoration: none; }
.lk-person a:hover { color: rgb(var(--primary)); }
.lk-person small { display: block; color: var(--sj-ink-2); font-size: 11.5px; }

/* ---------- header search ---------- */
.lk-head-search { position: relative; margin: 0; }
.lk-head-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8a94a6; }
.lk-head-search input { border: 1px solid var(--sj-line); background: rgba(var(--primary), .04); border-radius: 999px; padding: 8px 14px 8px 34px; width: 280px; font-size: 13.5px; outline: 0; }
.lk-head-search input:focus { border-color: rgb(var(--primary)); background: #fff; box-shadow: 0 0 0 4px rgba(var(--primary), .1); }

/* ---------- filter bar ---------- */
.lk-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.lk-filters > div { min-width: 150px; }
.lk-filters .form-label { margin-bottom: 4px; }

/* ---------- mark entry grid ---------- */
.lk-grid-wrap { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--sj-line); border-radius: 14px; }
.lk-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.lk-grid th { position: sticky; top: 0; z-index: 2; background: #0f2557; color: #fff; font-weight: 600; padding: 10px 8px; white-space: nowrap; text-align: center; }
.lk-grid th:first-child, .lk-grid th:nth-child(2) { text-align: left; }
.lk-grid td { padding: 6px 8px; border-bottom: 1px solid var(--sj-line); background: #fff; vertical-align: middle; }
.lk-grid tr:nth-child(even) td { background: #f8fafd; }
.lk-grid tr.is-focus td { background: rgba(var(--primary), .06); }
.lk-grid td.lk-sticky { position: sticky; left: 0; z-index: 1; }
.lk-grid input.lk-mark { width: 74px; text-align: center; border: 1px solid rgba(11, 18, 32, .15); border-radius: 8px; padding: 6px 4px; font-weight: 600; font-size: 14px; outline: 0; transition: border-color .15s, background .15s; }
.lk-grid input.lk-mark:focus { border-color: rgb(var(--primary)); box-shadow: 0 0 0 3px rgba(var(--primary), .15); }
.lk-grid input.lk-mark.is-saving { background: #fffbea; }
.lk-grid input.lk-mark.is-saved { background: #ecfdf3; border-color: #34c27a; }
.lk-grid input.lk-mark.is-error { background: #fef2f2; border-color: #dc2626; }
.lk-grid .lk-total { font-weight: 800; font-size: 14px; min-width: 40px; display: inline-block; text-align: center; }
.lk-legend { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- progress bars on marks progress ---------- */
.lk-progress { height: 8px; border-radius: 99px; background: rgba(11, 18, 32, .08); overflow: hidden; min-width: 90px; }
.lk-progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1e3a8a, #15803d); }

/* ---------- student profile ---------- */
.lk-profile-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.lk-profile-hero h3 { margin: 0; font-family: "Sora", var(--theme-fonts); font-weight: 800; color: var(--sj-ink); }
.lk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lk-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(var(--primary), .08); color: #0f2557; }
.lk-chip.is-red { background: rgba(212, 20, 28, .1); color: #a31515; }
.lk-chip.is-green { background: rgba(21, 128, 61, .12); color: #0f6a33; }

/* ---------- numbers ---------- */
.lk-num { font-variant-numeric: tabular-nums; }
.lk-up { color: #15803d; font-weight: 700; }
.lk-down { color: #dc2626; font-weight: 700; }
.lk-same { color: #6b7280; font-weight: 600; }
.text-navy { color: #0f2557 !important; }

/* ---------- OTP boxes ---------- */
.lk-otp { display: flex; gap: 8px; justify-content: center; margin: 10px 0 18px; }
.lk-otp-box { width: 48px; height: 56px; text-align: center; font-size: 24px; font-weight: 800; border: 1.5px solid rgba(11, 18, 32, .18); border-radius: 12px; outline: 0; color: #0f2557; font-family: "Sora", sans-serif; }
.lk-otp-box:focus { border-color: #0f2557; box-shadow: 0 0 0 4px rgba(15, 37, 87, .12); }
@media (max-width: 400px) { .lk-otp-box { width: 40px; height: 50px; font-size: 20px; } .lk-otp { gap: 5px; } }
.lk-test-code { background: #fffbea; border: 1px dashed #d97706; border-radius: 12px; padding: 10px 14px; font-size: 13px; color: #7a4100; margin-bottom: 14px; }
.lk-test-code strong { font-size: 18px; letter-spacing: 4px; color: #0f2557; }

/* ---------- demo school ---------- */
.lk-demo { background: #eef4ff; border: 1px dashed #2370cd; border-radius: 12px; padding: 10px 12px; font-size: 13px; color: #0b2a55; margin-bottom: 14px; }
.lk-demo-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: #fff; border: 1px solid #cfdcf3; border-radius: 9px; padding: 6px 10px; margin-top: 6px; color: inherit; }
.lk-demo-row:hover { border-color: #2370cd; }
.lk-demo-row code { color: #0f2557; font-weight: 700; }
.lk-demo-row small { color: #4a5568; margin-left: auto; text-align: right; }
.lk-demo-bar { background: #0f2557; color: #fff; border-radius: 10px; padding: 7px 12px; font-size: 13px; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
body.dark .lk-demo, body.dark .lk-demo-row { background: #16213a; color: #dbe6ff; border-color: #2d4473; }

/* ---------- busy buttons ---------- */
button.is-busy { opacity: .7; pointer-events: none; }
button.is-busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: lkspin .7s linear infinite; margin-left: 6px; }
@keyframes lkspin { to { transform: rotate(360deg); } }

/* ---------- select2 inside the theme ---------- */
.select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple { border-radius: 10px; border-color: rgba(11, 18, 32, .15); min-height: 42px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; }

/* ---------- small helpers ---------- */
.lk-kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 14px; }
.lk-kv dt { color: var(--sj-ink-2); font-weight: 500; }
.lk-kv dd { margin: 0; font-weight: 600; color: var(--sj-ink); overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .lk-kv { grid-template-columns: 1fr; } .lk-kv dd { margin-bottom: 6px; } }
.lk-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--sj-line); }
.lk-step:last-child { border-bottom: 0; }
.lk-step-n { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: var(--school, #0f2557); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.lk-step.is-done .lk-step-n { background: #15803d; }

/* ---------- "I'm a parent" button on the staff sign-in page ---------- */
.lk-parent-btn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--school, #0f2557); border-radius: 14px; color: var(--school, #0f2557); text-decoration: none; }
.lk-parent-btn > i:first-child { font-size: 24px; }
.lk-parent-btn span { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.lk-parent-btn small { color: #4a5568; font-size: 12px; }
.lk-parent-btn:hover { background: rgba(var(--primary, 15, 37, 87), .06); color: var(--school, #0f2557); }

/* ---------- floating help button ---------- */
.lk-help-btn { position: fixed; right: 22px; bottom: 84px; z-index: 1040; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--school, #0f2557); color: #fff; font-size: 22px; box-shadow: 0 10px 24px -8px rgba(11, 18, 32, .5); text-decoration: none; }
.lk-help-btn:hover { color: #fff; transform: translateY(-2px); }

/* ---------- printing (any page) ---------- */
@media print {
  /* no fixed size here: wide pages are switched to landscape by app.js, others keep the print dialog's Portrait/Landscape choice */
  @page { margin: 10mm 10mm 12mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff !important; }
  /* nothing on paper that you can't use on paper */
  .app-navbar, .header-main, .sj-footer, .go-top, .no-print, .sj-pagehead, .dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info,
  .dt-buttons, .lk-help-btn, .lk-filters, .card:has(> .card-body > .lk-filters), .btn, .modal, .alert .btn, form .form-control, form .form-select { display: none !important; }
  .app-content, main, .container-fluid { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 0 !important; margin-bottom: 8px !important; }
  .card::before { display: none !important; }
  .card-header { padding: 4px 0 !important; border-bottom: 2px solid var(--school, #0f2557) !important; }
  .card-header h5 { color: var(--school, #0f2557) !important; font-size: 11pt !important; }
  .card-body { padding: 4px 0 !important; }
  /* letterhead in the school's colour, with a double rule under it */
  .sj-print-lh { border-bottom: 2.5px solid var(--school, #0f2557) !important; box-shadow: 0 2px 0 #fff, 0 3px 0 #d4141c; margin-bottom: 14px !important; }
  .sj-print-lh-school strong, .sj-print-lh-doc span { color: var(--school, #0f2557) !important; border-color: var(--school, #0f2557) !important; }
  /* tables: full grid lines, shaded head row that repeats on every page */
  table.table, table.dataTable { width: 100% !important; border-collapse: collapse !important; font-size: 9.5pt !important; }
  table.table th, table.table td, table.dataTable th, table.dataTable td { border: 1px solid #8f98aa !important; padding: 3px 6px !important; background: #fff !important; }
  table.table thead th, table.dataTable thead th { background: #e9eef6 !important; color: #0b1220 !important; font-weight: 700 !important; text-transform: none !important; }
  table.table tfoot td, table.table tfoot th { background: #f4f6fa !important; font-weight: 700 !important; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }
  th.no-export, td.no-export { display: none !important; }
  table td, table th, .text-nowrap { white-space: normal !important; }
  table.dataTable thead th { background-image: none !important; }
  table.dataTable thead th::before, table.dataTable thead th::after { display: none !important; }
  .row > [class*="col-"] .card { border: 1px solid #c9d1de !important; border-radius: 4px !important; }
  .stat-card { background: #fff !important; }
  a { color: inherit !important; text-decoration: none !important; }
  .lk-avatar, .lk-avatar-txt { display: none !important; }
  .lk-lvl { border: 1px solid currentColor; }
  .lk-grid-wrap { max-height: none; overflow: visible; border: 0; }
  .lk-grid th { background: #e9eef6 !important; color: #0b1220 !important; }
  .lk-grid input.lk-mark { border: 0 !important; background: none !important; }
}
