/* ===== Thư viện dụng cụ thí nghiệm — giao diện ===== */
:root {
  --side-w: 248px;
  --brand: #1f4e79;
  --brand-2: #2e75b6;
  --bg: #f3f6fa;
  --line: #e3e8ef;
}
body { background: var(--bg); font-size: .925rem; color: #1e293b; }
body.guest { min-height: 100vh; }

/* Sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: linear-gradient(180deg, #17375a 0%, #1f4e79 100%); color: #cfe0f3; display: flex; flex-direction: column; z-index: 1040; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-icon { width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--brand); display: grid; place-items: center; font-size: 1.3rem; }
.brand-text { font-weight: 700; line-height: 1.15; }
.brand-text small { font-weight: 400; opacity: .75; font-size: .78rem; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .6rem .6rem 1rem; }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; opacity: .55; padding: .9rem .7rem .35rem; }
.side-nav .nav-link { display: flex; align-items: center; gap: .65rem; color: #d7e5f5; padding: .5rem .75rem; border-radius: 8px; margin-bottom: 2px; }
.side-nav .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.side-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav .nav-link.active { background: #fff; color: var(--brand); font-weight: 600; }
.side-foot { padding: .6rem 1rem; font-size: .72rem; opacity: .5; border-top: 1px solid rgba(255,255,255,.08); }

.main { margin-left: var(--side-w); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 1rem; background: #fff; border-bottom: 1px solid var(--line); padding: .6rem 1.4rem; }
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; color: #0f2a45; }
.top-search { position: relative; align-items: center; width: 280px; }
.top-search i { position: absolute; left: .65rem; color: #94a3b8; }
.top-search input { padding-left: 2rem; background: #f1f5f9; border-color: transparent; }
.top-icon { position: relative; color: #475569; font-size: 1.25rem; }
.top-icon .badge { position: absolute; top: -4px; right: -10px; font-size: .62rem; }
.user-chip { display: flex; align-items: center; gap: .5rem; color: #1e293b; text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-2); color: #fff; display: grid; place-items: center; font-weight: 700; }
.content { padding: 1.3rem 1.4rem 3rem; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .main { margin-left: 0; }
  .content { padding: 1rem .8rem 3rem; }
}

/* Thẻ, bảng */
.card { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; padding: .75rem 1rem; }
.table { margin-bottom: 0; }
.table > thead th { background: #f1f5f9; color: #475569; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fbff; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar .form-control, .toolbar .form-select { width: auto; min-width: 150px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; color: #0f4c81; }
.text-muted-sm { color: #64748b; font-size: .8rem; }
.btn-icon { padding: .2rem .45rem; }

/* Thống kê */
.stat { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; }
.stat-val { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: #0f2a45; }
.stat-lbl { color: #64748b; font-size: .8rem; }
.bg-soft-blue { background: #e7f0fb; color: #1f4e79; }
.bg-soft-green { background: #e6f6ee; color: #198754; }
.bg-soft-orange { background: #fff1e3; color: #e8710a; }
.bg-soft-red { background: #fdecec; color: #c62828; }

/* Đăng nhập */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #17375a, #2e75b6); padding: 1rem; }
.login-card { width: 100%; max-width: 400px; border-radius: 16px; border: 0; }

/* Ma trận quyền */
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table .form-check-input { width: 1.15em; height: 1.15em; cursor: pointer; }

/* Chữ ký */
.signpad { border: 2px dashed #b6c6da; border-radius: 10px; background: #fff; position: relative; }
.signpad canvas { width: 100%; height: 200px; display: block; touch-action: none; cursor: crosshair; }
.signpad .hint { position: absolute; left: 12px; bottom: 8px; color: #9aa8b8; font-size: .75rem; pointer-events: none; }
.sig-thumb { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; background: #fff; text-align: center; }
.sig-thumb img { max-height: 70px; max-width: 100%; }
.sig-thumb.default { border-color: #198754; box-shadow: 0 0 0 2px #19875433; }

/* Tem QR */
.qr-sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.qr-label { border: 1px dashed #999; padding: 6px; text-align: center; font-size: 10px; line-height: 1.2; page-break-inside: avoid; background: #fff; }
.qr-label .qr-box { display: flex; justify-content: center; margin: 2px 0; }
.qr-label b { font-size: 11px; }
@media print {
  .sidebar, .topbar, .no-print, .alert { display: none !important; }
  .main { margin: 0; } .content { padding: 0; } body { background: #fff; }
}

/* Live update */
.update-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #1f4e79; color: #fff; padding: .6rem .9rem; border-radius: 10px; display: flex; gap: .7rem; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 2000; font-size: .88rem; }
.update-banner[hidden] { display: none; }
.live-toast { position: fixed; right: 18px; bottom: 18px; background: #0f2a45; color: #fff; padding: .55rem .9rem; border-radius: 8px; z-index: 2000; font-size: .85rem; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hazard-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; }

/* ===== Giai đoạn 2: chữ ký trên chứng từ, lịch phòng, cấp phát ===== */
.sig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.sig-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; background: #fff; min-height: 150px; }
.sig-label { font-size: .72rem; font-weight: 700; letter-spacing: .03em; color: #475569; }
.sig-img { height: 58px; max-width: 100%; object-fit: contain; margin: 6px 0 4px; }
.sig-name { font-weight: 700; font-size: .9rem; }
.sig-time { font-size: .7rem; color: #64748b; font-style: italic; }
.sig-empty { height: 80px; display: grid; place-items: center; color: #b0bccb; font-style: italic; font-size: .85rem; }
.pin-input { letter-spacing: .5em; font-weight: 700; }
.timeline .list-group-item { border-left: 3px solid #e3e8ef; }
.item-pick { cursor: pointer; background: #fff; }
.item-pick.border-primary { background: #eef5ff; }
.sched td.slot { height: 54px; min-width: 120px; vertical-align: top; padding: 4px 6px; }
.sched td.past { background: #fafbfc; }
.sched td.busy-loan { background: #e7f0fb; border-left: 3px solid #0d6efd; }
.sched td.busy-booking { background: #e6f6ee; border-left: 3px solid #198754; }
.sched td.busy-blocked { background: #fdecec; border-left: 3px solid #dc3545; }
.sched th.today { background: #fff3cd !important; }
.sched .add-slot { opacity: 0; } .sched td.slot:hover .add-slot { opacity: 1; }
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
@media print { .no-print-badge { display: none; } }

/* ===== Cửa sổ thông báo (chuông) ===== */
.notif-dialog { max-width: 460px; margin-right: 1rem; margin-left: auto; margin-top: 3.6rem; }
@media (max-width: 575.98px) { .notif-dialog { margin: 3.6rem .5rem 0; } }
.notif-item { display: flex; gap: .7rem; padding: .7rem 1rem; text-decoration: none; color: inherit; border-left: 3px solid transparent; }
.notif-item:hover { background: #f5f8fc; }
.notif-item.unread { background: #eef5ff; border-left-color: #0d6efd; }
.notif-item .n-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center; background: #e7f0fb; color: #1f4e79; }
.notif-item.warn .n-icon { background: #fdecec; color: #c62828; }
.notif-item .n-title { font-size: .88rem; font-weight: 600; line-height: 1.25; }
.notif-item.unread .n-title { color: #0b3a6e; }
.notif-item .n-body { font-size: .8rem; color: #475569; }
.notif-item .n-time { font-size: .72rem; color: #94a3b8; }

/* ===== Cấu hình giao diện ===== */
.brand-preview { height: 160px; border: 1px dashed #c4d0de; border-radius: 10px; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.brand-preview img { max-width: 100%; max-height: 100%; object-fit: cover; }
.brand-preview.is-icon img { width: 96px; height: 96px; object-fit: contain; }
.brand-preview.is-bg img { width: 100%; height: 100%; object-fit: contain; }
.login-wrap .login-card { position: relative; z-index: 1; }
body.has-bg .card { box-shadow: 0 2px 10px rgba(15,23,42,.08); }

/* ===== Trang đăng nhập chia 2 bên: ảnh trái — khung đăng nhập phải ===== */
.login-split { min-height: 100vh; display: flex; background: #fff; }
.login-hero { flex: 1 1 auto; position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: flex-end;
  background: linear-gradient(135deg, #17375a, #2e75b6); }
.login-hero::before, .login-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.login-hero::before { z-index: -2; }
.login-hero::after { z-index: -1; }
.hero-caption { width: 100%; color: #fff; padding: 2.5rem 2.5rem 2rem; background: linear-gradient(transparent, rgba(8, 28, 52, .78)); text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.login-panel { flex: 0 0 440px; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; background: #fff; box-shadow: -12px 0 30px rgba(15,23,42,.10); z-index: 1; }
.login-inner { width: 100%; max-width: 360px; }
@media (max-width: 991.98px) {
  .login-split { flex-direction: column; }
  .login-hero { flex: 0 0 38vh; }
  .hero-caption { padding: 1.2rem 1.25rem; }
  .hero-caption .fs-4 { font-size: 1.1rem !important; }
  .login-panel { flex: 1 0 auto; box-shadow: none; align-items: flex-start; padding: 1.75rem 1.25rem; }
}

/* ===== Hiệu ứng 2 bên ảnh trang đăng nhập ===== */
.login-hero.fx-stars, .login-hero.fx-gallery { background: radial-gradient(ellipse at 50% 120%, #1d4f86 0%, #0d2647 45%, #050f22 100%); }
.hero-stars { position: absolute; inset: 0; z-index: 0; }
.hero-blur { position: absolute; inset: 0; z-index: 0; background: center/cover no-repeat; filter: blur(26px) brightness(.8); transform: scale(1.15); }
.hero-photo { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); height: 100%; width: auto; max-width: 100%;
  object-fit: contain; z-index: 1; box-shadow: 0 0 60px rgba(0,0,0,.55); }
.hero-caption { position: relative; z-index: 2; }
.hero-col { position: absolute; top: 0; bottom: 0; width: var(--band, 0px); overflow: hidden; z-index: 0;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent); }
.hero-col.left { left: 0; } .hero-col.right { right: 0; }
.hero-col .track { display: flex; flex-direction: column; gap: 12px; padding: 12px; animation: heroUp var(--dur, 40s) linear infinite; }
.hero-col.right .track { animation-duration: calc(var(--dur, 40s) * 1.25); }
.hero-col img { width: 100%; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.45); opacity: .92; }
.login-hero.no-band .hero-col { display: none; }
@keyframes heroUp { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@media (prefers-reduced-motion: reduce) { .hero-col .track { animation: none; } }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery-thumb { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 4/3; background: #eef2f6; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb form { position: absolute; top: 4px; right: 4px; }
/* Sao / ảnh hoạt động: ảnh chính thành khung ảnh ở giữa để 2 bên đủ rộng cho hiệu ứng */
.fx-stars .hero-photo, .fx-gallery .hero-photo { top: 6%; bottom: auto; height: 70%; max-width: 62%; border-radius: 14px;
  border: 5px solid rgba(255,255,255,.9); background: #0d2647; box-shadow: 0 18px 50px rgba(0,0,0,.6); }
@media (max-width: 991.98px) { .fx-stars .hero-photo, .fx-gallery .hero-photo { top: 7%; height: 62%; max-width: 70%; border-width: 3px; } }
@media (max-width: 991.98px) {
  .login-hero { flex-basis: 42vh; }
  .fx-stars .hero-photo, .fx-gallery .hero-photo { top: 5%; height: 56%; }
  .hero-caption { padding: .8rem 1.1rem; }
  .hero-caption > div:last-child { display: none; }
}
