/* SJM Library module styles (Admin layout, Bootstrap 5 present) */
.lib-page-wrap { max-width: 1280px; margin: 0 auto; }
.lib-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.lib-card h2, .lib-card h3 { font-size: 1.05rem; margin: 0 0 12px; font-weight: 600; }
.lib-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.lib-toolbar .lib-field { min-width: 150px; flex: 1 1 150px; margin: 0; }
.lib-toolbar .lib-field-wide { flex: 3 1 260px; }
.lib-field { margin-bottom: 10px; }
.lib-field label { display: block; font-size: .8rem; font-weight: 600; color: #374151; margin-bottom: 3px; }
.lib-field-check { display: flex; align-items: center; gap: 8px; }
.lib-field-check label { margin: 0; }
.lib-hint { font-size: .78rem; color: #6b7280; margin-top: 2px; }
.lib-grid-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.lib-grid-summary { color: #6b7280; font-size: .85rem; }
.lib-pager { display: flex; gap: 4px; flex-wrap: wrap; }
.lib-page { border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 4px 10px; font-size: .85rem; min-height: 32px; }
.lib-page:disabled { opacity: .45; }
.lib-page-current { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.lib-sort { background: none; border: 0; padding: 0; font-weight: 700; color: inherit; cursor: pointer; }
.lib-sort:hover, .lib-sort:focus-visible { text-decoration: underline; }
.lib-table th { white-space: nowrap; font-size: .82rem; }
.lib-table td { vertical-align: middle; font-size: .9rem; }
.lib-loading, .lib-empty { padding: 22px !important; text-align: center; color: #6b7280; }
.lib-row-bad { background: #fef2f2 !important; }
.lib-row-warn { background: #fffbeb !important; }

.lib-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.lib-pill-ok { background: #dcfce7; color: #166534; }
.lib-pill-info { background: #dbeafe; color: #1e40af; }
.lib-pill-warn { background: #fef3c7; color: #92400e; }
.lib-pill-bad { background: #fee2e2; color: #991b1b; }
.lib-pill-muted { background: #e5e7eb; color: #374151; }

/* stat tiles */
.lib-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.lib-tile { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; }
.lib-tile .n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.lib-tile .t { font-size: .78rem; color: #6b7280; text-transform: uppercase; letter-spacing: .03em; }
.lib-tile.bad .n { color: #b91c1c; } .lib-tile.warn .n { color: #b45309; } .lib-tile.ok .n { color: #15803d; }
.lib-chart { width: 100%; height: auto; }
.lib-legend { display: flex; gap: 14px; font-size: .8rem; color: #374151; }
.lib-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.lib-hbar { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: .85rem; }
.lib-hbar-label { width: 130px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-hbar-track { flex: 1; background: #f1f5f9; border-radius: 4px; height: 12px; overflow: hidden; }
.lib-hbar-fill { display: block; height: 100%; border-radius: 4px; }
.lib-hbar-count { width: 34px; text-align: right; font-weight: 600; }

/* scanner screens */
.lib-scan-grid { display: grid; grid-template-columns: minmax(300px, 5fr) 7fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .lib-scan-grid { grid-template-columns: 1fr; } }
/* Bootstrap rows use negative side margins that push a phone-width page past the edge. */
@media (max-width: 575px) { .lib-page-wrap .row { margin-left: 0; margin-right: 0; } .lib-page-wrap .row > [class*="col-"] { padding-left: 0; padding-right: 0; } }
.lib-scan-input { font-size: 1.5rem; padding: 14px 16px; border: 3px solid #1d4ed8; border-radius: 10px; width: 100%; letter-spacing: .04em; }
.lib-scan-input:focus { outline: 3px solid #93c5fd; }
.lib-scan-input:disabled { background: #f3f4f6; border-color: #9ca3af; }
.lib-scan-label { font-weight: 700; font-size: .9rem; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lib-student { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.lib-avatar { width: 48px; height: 48px; border-radius: 50%; background: #1d4ed8; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.lib-student h3 { margin: 0; font-size: 1.15rem; }
.lib-banner { border-radius: 10px; padding: 12px 14px; margin: 10px 0; font-weight: 600; }
.lib-banner-ok { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.lib-banner-bad { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.lib-banner-warn { background: #fef3c7; color: #78350f; border: 1px solid #fcd34d; }
.lib-banner-info { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }
.lib-overdue-banner { background: #b91c1c; color: #fff; font-size: 1.3rem; text-align: center; padding: 14px; border-radius: 10px; margin: 10px 0; letter-spacing: .05em; }
.lib-flash { animation: libflash .6s ease-out; }
@keyframes libflash { from { box-shadow: 0 0 0 6px rgba(34,197,94,.55); } to { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.lib-flash-bad { animation: libflashbad .6s ease-out; }
@keyframes libflashbad { from { box-shadow: 0 0 0 6px rgba(239,68,68,.6); } to { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
.lib-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .92rem; }
.lib-kv dt { color: #6b7280; font-weight: 500; margin: 0; } .lib-kv dd { margin: 0; font-weight: 600; }
.lib-session-list { list-style: none; margin: 0; padding: 0; }
.lib-session-list li { padding: 8px 0; border-bottom: 1px solid #eef0f3; display: flex; justify-content: space-between; gap: 10px; }
.lib-cover { width: 110px; height: 150px; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; background: #f3f4f6; }
.lib-cover-sm { width: 36px; height: 50px; }
.lib-cover-ph { display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: .7rem; text-align: center; }
.lib-book-head { display: flex; gap: 16px; flex-wrap: wrap; }
.lib-tabs { display: flex; gap: 4px; border-bottom: 2px solid #e5e7eb; margin-bottom: 12px; flex-wrap: wrap; }
.lib-tab { border: 0; background: none; padding: 8px 14px; font-weight: 600; color: #4b5563; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.lib-tab[aria-selected="true"] { color: #1d4ed8; border-bottom-color: #1d4ed8; }
.lib-hidden { display: none !important; }

/* toasts + dialogs */
.lib-toasts { position: fixed; top: 70px; right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.lib-toast { padding: 11px 14px; border-radius: 8px; color: #fff; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.2); transition: opacity .3s; }
.lib-toast-info { background: #1d4ed8; } .lib-toast-success { background: #15803d; } .lib-toast-error { background: #b91c1c; } .lib-toast-warn { background: #b45309; }
.lib-toast-out { opacity: 0; }
.lib-dialog { border: 0; border-radius: 12px; padding: 20px 22px; width: min(460px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lib-dialog-wide { width: min(760px, calc(100vw - 24px)); }
.lib-dialog::backdrop { background: rgba(15,23,42,.55); }
.lib-dialog h3 { font-size: 1.15rem; margin: 0 0 12px; }
.lib-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.btn:focus-visible, .form-control:focus-visible, .lib-scan-input:focus-visible { outline: 3px solid #93c5fd; outline-offset: 1px; }

/* barcode labels */
.lib-labels { display: grid; grid-template-columns: repeat(auto-fill, 2.4in); gap: .12in; }
.lib-label { width: 2.4in; height: 1.15in; border: 1px dashed #cbd5e1; padding: .06in; text-align: center; overflow: hidden; page-break-inside: avoid; }
.lib-label img { max-width: 100%; height: .55in; }
.lib-label .t { font-size: 9pt; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-label .c { font-size: 8pt; letter-spacing: .06em; }

@media print {
    .main-header, .main-sidebar, .main-footer, .content-header, .lib-noprint, .lib-toasts { display: none !important; }
    .content-wrapper { margin: 0 !important; padding: 0 !important; background: #fff !important; }
    body { background: #fff !important; }
    .lib-card { border: 0; box-shadow: none; padding: 0; }
    .lib-label { border: 1px solid #999; }
    .lib-print-only { display: block !important; }
    .lib-table th, .lib-table td { font-size: 9pt; padding: 3px 5px; }
    a { color: inherit; text-decoration: none; }
}
.lib-print-only { display: none; }
