/* Lớp theme 3T Construction phủ lên Bootstrap 5: đỏ thương hiệu + xám than, chữ Times New Roman */

/* Tinos: cùng số đo với Times New Roman, dùng khi máy người xem không có sẵn Times New Roman */
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-Bold.ttf') format('truetype'); font-weight: 600 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Tinos'; src: url('/fonts/Tinos-BoldItalic.ttf') format('truetype'); font-weight: 600 900; font-style: italic; font-display: swap; }

:root {
  --brand: #d71f26;
  --brand-hover: #b3161c;
  --brand-active: #9c1218;
  --brand-soft: #fdecec;
  --ink: #36373b;
  --bs-primary: #d71f26;
  --bs-primary-rgb: 215, 31, 38;
  --bs-primary-text-emphasis: #8f1419;
  --bs-primary-bg-subtle: #fdecec;
  --bs-primary-border-subtle: #f4b9bc;
  --bs-link-color: #d71f26;
  --bs-link-color-rgb: 215, 31, 38;
  --bs-link-hover-color: #b3161c;
  --bs-link-hover-color-rgb: 179, 22, 28;
  --bs-body-font-family: 'Times New Roman', Tinos, Times, serif;
  --bs-body-font-size: 1.0625rem;
  --bs-body-color: #1f2937;
}
body { background-color: #f3f4f6; }
[hidden] { display: none !important; }

.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-hover); --bs-btn-hover-border-color: var(--brand-hover);
  --bs-btn-active-bg: var(--brand-active); --bs-btn-active-border-color: var(--brand-active);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 215, 31, 38;
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-active); --bs-btn-active-border-color: var(--brand-active);
  --bs-btn-focus-shadow-rgb: 215, 31, 38;
}
.form-control:focus, .form-select:focus { border-color: #ec8a8e; box-shadow: 0 0 0 0.25rem rgba(215, 31, 38, 0.15); }
.form-check-input:focus { border-color: #ec8a8e; box-shadow: 0 0 0 0.25rem rgba(215, 31, 38, 0.15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.nav-underline .nav-link { color: #6b7280; font-weight: 600; }
.nav-underline .nav-link.active, .nav-underline .nav-link:hover { color: var(--brand); }
.text-ink { color: var(--ink) !important; }
.fw-semibold { font-weight: 600 !important; }

/* ---------- Thương hiệu ---------- */
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; line-height: 1.15; }
.brand img { height: 42px; width: auto; }
.brand strong { display: block; font-size: 1rem; }
.brand small { display: block; font-size: 0.7rem; color: #6b7280; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.company { font-size: 0.8rem; color: #6b7280; line-height: 1.6; }
.company strong { color: var(--ink); letter-spacing: 0.04em; }

/* ---------- Đăng nhập ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 1.25rem; padding: 1.5rem 1rem; background: radial-gradient(1200px 500px at 50% -10%, #f8dcdd, transparent), #f3f4f6; }
.auth-card { width: 100%; max-width: 420px; border: 0; border-top: 4px solid var(--brand); }
.auth-logo { display: block; width: 140px; height: auto; margin: 0 auto 1rem; }

/* ---------- Thư viện ---------- */
.dropzone {
  border: 2px dashed #f0b7b9; border-radius: 0.75rem; background: #fffafa;
  display: grid; place-items: center; text-align: center; padding: 1.5rem 1rem; cursor: pointer;
  min-height: 210px; height: 100%; transition: background 0.15s, border-color 0.15s;
}
.dropzone:hover, .dropzone.drag { background: var(--brand-soft); border-color: var(--brand); }
.dropzone .bi { font-size: 2.4rem; color: var(--brand); }
.user-picker { max-height: 160px; overflow: auto; }
.doc-card { transition: box-shadow 0.15s, transform 0.15s; }
.doc-card:hover { box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.1) !important; transform: translateY(-1px); }
.doc-icon { font-size: 2.3rem; line-height: 1; }
.doc-icon.pdf { color: #dc2626; }
.doc-icon.docx { color: #2563eb; }
.doc-icon.image { color: #059669; }
.doc-title { font-size: 1rem; word-break: break-word; }
.table thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; white-space: nowrap; }
.stat-pill { font-variant-numeric: tabular-nums; }

/* ---------- Trình xem ---------- */
body.viewer {
  background: #3b4250; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.vbar {
  position: fixed; inset: 0 0 auto 0; height: 56px; z-index: 30;
  display: flex; align-items: center; gap: 0.75rem; padding: 0 0.75rem;
  background: #1f2430; color: #e5e7eb; border-bottom: 1px solid #111827;
}
.vlogo { height: 38px; width: auto; background: #fff; border-radius: 0.4rem; padding: 2px 6px; }
.vtitle { flex: 1; min-width: 0; font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vctrl .label { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; color: #cbd5e1; font-size: 0.85rem; }

#stage { position: fixed; inset: 56px 0 0 0; overflow: auto; overscroll-behavior: contain; }
#pages { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1.25rem 0.75rem 4rem; }
.page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.page canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.page .loading { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; font-size: 0.85rem; }
.page .pno { position: absolute; left: 100%; bottom: 0; margin-left: 8px; font-size: 0.75rem; color: #9ca3af; }

/* Watermark nổi phía trên trang, đổi giờ liên tục: ảnh chụp nào cũng mang dấu người xem */
.wm-overlay { position: fixed; inset: 56px 0 0 0; z-index: 25; pointer-events: none; background-repeat: repeat; }

/* Đèn soi trên điện thoại (web): chỉ dải quanh ngón tay rõ nét, phần còn lại mờ ngay trên màn hình,
   nên ảnh chụp bằng phím cứng chỉ lấy được một dải nhỏ */
.spotlight {
  --y: 40%; --h: 34%; --edge: 28px;
  position: fixed; inset: 56px 0 0 0; z-index: 26; pointer-events: none;
  background: rgba(31, 36, 48, 0.18);
  -webkit-backdrop-filter: blur(10px) saturate(0.5); backdrop-filter: blur(10px) saturate(0.5);
  --band: linear-gradient(to bottom, #000 0, #000 calc(var(--y) - var(--h) / 2), transparent calc(var(--y) - var(--h) / 2 + var(--edge)),
          transparent calc(var(--y) + var(--h) / 2 - var(--edge)), #000 calc(var(--y) + var(--h) / 2), #000 100%);
  -webkit-mask-image: var(--band); mask-image: var(--band);
}
.spotlight-hint {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 27; max-width: calc(100vw - 24px);
  background: rgba(17, 24, 39, 0.88); color: #e5e7eb; font-size: 0.8rem; padding: 0.4rem 0.8rem; border-radius: 999px; text-align: center;
}

/* Tấm che: bật khi cửa sổ mất focus, chuột rời cửa sổ, giữ phím chụp màn hình… */
.shield {
  position: fixed; inset: 56px 0 0 0; z-index: 40;
  display: none; place-items: center; padding: 1rem;
  background: #1f2430;
  pointer-events: none; /* chuột vẫn đi xuyên qua để nhận biết lúc quay lại */
}
body.shielded .shield { display: grid; }
body.shielded #pages { visibility: hidden; }
.shield-box { max-width: 440px; text-align: center; color: #e5e7eb; }
.shield-box .bi { font-size: 2.8rem; color: #f87171; }
.shield-box h2 { font-size: 1.2rem; margin: 0.75rem 0 0.4rem; }
.shield-box p { color: #9ca3af; margin: 0; }
.blocked { position: fixed; inset: 56px 0 0 0; display: grid; place-items: center; padding: 1rem; }

@media print {
  body * { display: none !important; }
  body::after { content: 'Tài liệu này chỉ được xem trên màn hình, không được in.'; display: block; padding: 40px; font: 16px sans-serif; }
}

@media (max-width: 767.98px) {
  .brand > span { display: none; }
  .vlogo, .vctrl .hide-sm, .protect-badge { display: none !important; }
}
