/* =========================================================
   HỆ THỐNG XEM GIÁO ÁN STEAM 4.0 - DRM & DUAL THEME CSS
   ========================================================= */

:root {
  /* DARK THEME (Default) */
  --bg-primary: #0b0f17;
  --bg-secondary: #131b26;
  --bg-tertiary: #1b2636;
  --bg-viewport: #070a10;
  --bg-card: rgba(22, 32, 46, 0.95);
  --bg-thumb: #17212f;
  --bg-input: #0b0f17;
  --bg-table-header: #1b2636;
  --bg-table-hover: rgba(255, 255, 255, 0.03);
  
  --border-color: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-highlight: rgba(56, 189, 248, 0.35);
  
  /* Vibrant Accents */
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Geometry & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-page: 0 12px 36px rgba(0, 0, 0, 0.65);
  
  --header-height: 68px;
  --nav-height: 54px;
  --toolbar-height: 52px;
}

/* =========================================================
   LIGHT THEME PALETTE (COMPLETE PROFESSIONAL REFINEMENT)
   ========================================================= */
body.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-viewport: #e2e8f0;
  --bg-card: #ffffff;
  --bg-thumb: #ffffff;
  --bg-input: #ffffff;
  --bg-table-header: #f1f5f9;
  --bg-table-hover: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-highlight: #0284c7;
  
  --accent-cyan: #0284c7;
  --accent-cyan-glow: rgba(2, 132, 199, 0.15);
  --accent-blue: #2563eb;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.12);
  --shadow-page: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* 🔒 GLOBAL HARDENED ANTI-COPY STYLING */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

input, select, textarea, button {
  -webkit-user-select: auto !important;
  user-select: auto !important;
  font-family: inherit;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* =========================================================
   HEADER
   ========================================================= */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #0284c7, #4f46e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark-theme .brand-title {
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.4px;
  margin-top: 2px;
}

/* DRM Badge */
.drm-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  color: #059669;
  letter-spacing: 0.5px;
}

body.dark-theme .drm-badge {
  color: #34d399;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}

.status-dot.pulse {
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* User Profile Badge */
.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-full);
}

.user-role-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-theme .user-role-icon {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.user-role-icon.admin {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

body.dark-theme .user-role-icon.admin {
  color: #fbbf24;
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  outline: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.76rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(2, 132, 199, 0.08);
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--border-highlight);
  background: rgba(2, 132, 199, 0.06);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #e11d48;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

body.dark-theme .btn-danger {
  color: #fb7185;
}

.btn-danger:hover {
  background: #e11d48;
  color: #ffffff;
  border-color: #e11d48;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-icon-sm:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

body.dark-theme .btn-icon-sm:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* =========================================================
   GRADE NAVIGATION TABS
   ========================================================= */
.grade-nav {
  height: var(--nav-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 40;
}

.grade-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.grade-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.84rem;
}

.grade-code {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.grade-name {
  font-weight: 500;
  opacity: 0.8;
}

.grade-pages-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}

body.dark-theme .grade-pages-badge {
  background: rgba(255, 255, 255, 0.07);
}

.grade-tab:hover {
  background: rgba(2, 132, 199, 0.08);
  color: var(--text-primary);
}

.grade-tab.active {
  background: #e0f2fe;
  border: 1px solid #0284c7;
  color: #0369a1;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.15);
}

body.dark-theme .grade-tab.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid var(--border-highlight);
  color: #38bdf8;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.15);
}

.grade-tab.active .grade-pages-badge {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
}

body.dark-theme .grade-tab.active .grade-pages-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
}

.doc-summary-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.badge-separator {
  color: var(--text-muted);
}

/* =========================================================
   TOOLBAR
   ========================================================= */
.viewer-toolbar {
  height: var(--toolbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  z-index: 30;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

.tool-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

.page-nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-primary);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.page-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0 4px;
}

.page-indicator input {
  width: 48px;
  height: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
}

.page-indicator input:focus {
  border-color: var(--accent-cyan);
}

.security-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-level {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 42px;
  text-align: center;
}

/* =========================================================
   MAIN VIEWPORT & CANVAS (EDGE SCROLL NAVIGATION)
   ========================================================= */
.viewer-layout {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  background: var(--bg-viewport);
  transition: background-color 0.25s ease;
}

.thumbnails-sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
}

.thumbnails-sidebar.collapsed {
  transform: translateX(-100%);
  position: absolute;
  height: 100%;
}

.sidebar-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.thumbnails-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 10px 12px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  position: relative;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumb-item:hover {
  transform: translateY(-2px);
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(2, 132, 199, 0.15);
}

body.dark-theme .thumb-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(56, 189, 248, 0.2);
}

.thumb-card {
  width: 100%;
  aspect-ratio: 1 / 1.4142;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme .thumb-card {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.08);
}

.thumb-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, var(--bg-tertiary) 20%, var(--border-color) 40%, var(--bg-tertiary) 60%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite linear;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.thumb-item:hover .thumb-card {
  border-color: #38bdf8;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.18);
}

/* =========================================================
   PROMINENT ACTIVE & FOCUSED THUMBNAIL HIGHLIGHT
   Định vị trang đang xem rõ nét 100%, màu sắc nổi bật, không thể nhầm lẫn
   ========================================================= */
.thumb-item.active {
  background: #eff6ff; /* Soft pastel sky-blue highlight */
  border-color: #2563eb;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.16);
  transform: translateY(-2px);
}

body.dark-theme .thumb-item.active {
  background: rgba(30, 58, 138, 0.35);
  border-color: #38bdf8;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* Left Indicator Bar - Thanh chỉ thị mép trái sắc sảo */
.thumb-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 5px;
  background: linear-gradient(180deg, #2563eb, #0284c7);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.6);
}

body.dark-theme .thumb-item.active::before {
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

/* Bold Card Border & Glowing Ring */
.thumb-item.active .thumb-card {
  border: 3px solid #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28), 0 8px 24px rgba(37, 99, 235, 0.25);
  transform: scale(1.02);
}

body.dark-theme .thumb-item.active .thumb-card {
  border: 3px solid #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35), 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Badge 'ĐANG XEM' trên góc phải thẻ */
.thumb-card::after {
  content: 'ĐANG XEM';
  position: absolute;
  top: 6px;
  right: 6px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 5;
}

.thumb-item.active .thumb-card::after {
  opacity: 1;
  transform: translateY(0);
}

body.dark-theme .thumb-item.active .thumb-card::after {
  background: #0284c7;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.7);
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  background: #ffffff;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}

.thumb-img.loaded {
  opacity: 1;
}

.thumb-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 5;
}

.thumb-item.active .thumb-badge {
  background: #2563eb;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.6);
}

body.dark-theme .thumb-item.active .thumb-badge {
  background: #0284c7;
  border-color: #38bdf8;
}

.thumb-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 20px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thumb-item:hover .thumb-label {
  color: var(--text-primary);
}

.thumb-item.active .thumb-label {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 3px 16px;
  border-radius: 20px;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
  letter-spacing: 0.2px;
}

body.dark-theme .thumb-item.active .thumb-label {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  box-shadow: 0 3px 12px rgba(2, 132, 199, 0.5);
}

/* Document Viewport with Continuous Page Flow (Native 60/120fps Smooth Scrolling) */
.doc-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  cursor: default;
  /* Removed scroll-behavior: smooth to prevent fighting mouse wheel / trackpad momentum */
}

.canvas-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transition: filter 0.25s ease;
}

.pages-stream {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
}

.page-container {
  position: relative;
  box-shadow: var(--shadow-page);
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  user-select: none;
  -webkit-user-select: none;
  contain: layout size paint;
  content-visibility: auto;
  contain-intrinsic-size: 800px 1131px;
  transition: box-shadow 0.2s ease;
}

.doc-page-img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  background-color: #ffffff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.doc-page-img.loaded {
  opacity: 1;
}

.page-shield-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

.page-skeleton {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f8fafc 25%, #f1f5f9 50%, #f8fafc 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 500;
}

body.dark-theme .page-skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
  color: #94a3b8;
}

.page-skeleton-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(2, 132, 199, 0.15);
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.page-number-pill {
  position: absolute;
  bottom: 12px;
  right: 14px;
  z-index: 6;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.3px;
}

.page-container:hover .page-number-pill {
  opacity: 1;
}

/* Loading Spinner */
.viewer-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  padding: 24px 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 25;
  transition: opacity 0.2s ease;
}

.viewer-loader.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.spinner-ring {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* =========================================================
   SECURITY SHIELD OVERLAY
   ========================================================= */
.security-shield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(25px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.security-shield.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.shield-card {
  background: var(--bg-card);
  border: 1px solid rgba(244, 63, 94, 0.4);
  box-shadow: 0 0 50px rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  max-width: 520px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: shieldPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes shieldPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.shield-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.3);
}

.shield-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.shield-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.shield-meta {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  width: 100%;
  font-size: 0.78rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
}

.shield-meta strong {
  color: var(--text-primary);
}

/* =========================================================
   MODALS (LOGIN, PRINT, AUDIT LOGS)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-card-lg {
  max-width: 1050px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-backdrop.open .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-theme .modal-icon-badge {
  color: #38bdf8;
}

.modal-icon-badge.info {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
}

body.dark-theme .modal-icon-badge.info {
  color: #38bdf8;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-tertiary);
}


/* =========================================================
   STREAMLINED PRINT SCOPE CARDS
   ========================================================= */
.print-scope-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.print-radio-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.print-radio-item:hover {
  border-color: var(--accent-cyan);
  background: rgba(2, 132, 199, 0.05);
}

.print-radio-item input[type="radio"] {
  margin-top: 3px;
  accent-color: #0284c7;
  transform: scale(1.1);
}

.print-radio-item:has(input:checked) {
  border-color: var(--accent-cyan);
  background: rgba(2, 132, 199, 0.08);
}

.radio-content {
  flex: 1;
}

.radio-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.radio-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.range-inputs-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.range-num-input {
  width: 64px;
  height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-align: center;
  font-size: 0.84rem;
  font-weight: 600;
  outline: none;
}

.range-num-input:focus {
  border-color: var(--accent-cyan);
}

/* Print Progress Bar */
.print-progress-bar {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.print-progress-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 0.15s ease;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 44px 0 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.btn-toggle-eye:hover {
  color: var(--text-primary);
}

.error-msg {
  font-size: 0.78rem;
  color: var(--accent-rose);
  min-height: 18px;
  font-weight: 500;
}

/* Logs Filter Bar */
.logs-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.filter-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 0.78rem;
  outline: none;
}

.filter-search-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 34px;
}

.filter-search-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.78rem;
  outline: none;
}

/* Logs Table */
.logs-table-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-height: 460px;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  text-align: left;
}

.logs-table th {
  background: var(--bg-table-header);
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 5;
}

.logs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.logs-table tr:hover td {
  background: var(--bg-table-hover);
  color: var(--text-primary);
}

.badge-action {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
}

.badge-action.success {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

body.dark-theme .badge-action.success {
  color: #34d399;
}

.badge-action.danger {
  background: rgba(244, 63, 94, 0.15);
  color: #e11d48;
}

body.dark-theme .badge-action.danger {
  color: #fb7185;
}

.badge-action.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

body.dark-theme .badge-action.warning {
  color: #fcd34d;
}

.badge-action.info {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
}

body.dark-theme .badge-action.info {
  color: #38bdf8;
}

.logs-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastSlideUp 0.3s ease;
}

.toast.warning {
  border-color: rgba(245, 158, 11, 0.5);
  background: #fffbeb;
  color: #92400e;
}

body.dark-theme .toast.warning {
  background: #1c1507;
  color: #fde68a;
}

.toast.danger {
  border-color: rgba(244, 63, 94, 0.5);
  background: #fff1f2;
  color: #9f1239;
}

body.dark-theme .toast.danger {
  background: #20080d;
  color: #fecdd3;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.5);
  background: #f0fdf4;
  color: #166534;
}

body.dark-theme .toast.success {
  background: #061912;
  color: #a7f3d0;
}

/* =========================================================
   📱 RESPONSIVE & MOBILE / TABLET REFINEMENTS (LIGHT & DARK)
   Tối ưu hóa hiển thị xuất sắc cho điện thoại và máy tính bảng
   ========================================================= */

/* Backdrop overlay for Mobile/Tablet Off-Canvas Sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Light Theme Component Polish */
body.light-theme .grade-tab {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .grade-tab:hover {
  border-color: #93c5fd;
  color: #1e40af;
  background: #f8fafc;
}

body.light-theme .grade-tab.active {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

body.light-theme .grade-tab.active .grade-name {
  color: rgba(255, 255, 255, 0.9);
}

body.light-theme .grade-tab.active .grade-pages-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

body.light-theme .tool-btn,
body.light-theme .tool-btn-icon {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.light-theme .tool-btn:hover,
body.light-theme .tool-btn-icon:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

body.light-theme .page-indicator {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.light-theme .page-indicator input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.light-theme .page-indicator input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

body.light-theme .doc-viewport {
  background: #eaedf2; /* Clean studio contrast */
}

body.light-theme .page-container {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .modal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

body.light-theme .modal-header {
  border-bottom: 1px solid #f1f5f9;
}

body.light-theme .modal-footer {
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
}

/* =========================================================
   TABLET BREAKPOINT (max-width: 1024px)
   ========================================================= */
@media (max-width: 1024px) {
  :root {
    --header-height: 60px;
    --nav-height: 50px;
    --toolbar-height: 48px;
  }

  .app-header {
    padding: 0 16px;
  }

  .brand-title {
    font-size: 0.92rem;
  }

  .brand-sub {
    font-size: 0.68rem;
  }

  .drm-badge {
    padding: 4px 10px;
    font-size: 0.72rem;
  }

  .grade-nav {
    padding: 0 12px;
    gap: 10px;
  }

  .grade-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    gap: 8px;
  }

  .grade-tabs::-webkit-scrollbar {
    display: none;
  }

  .doc-summary-badge {
    display: none; /* Hide summary badge on tablet to let tabs breathe */
  }

  .viewer-toolbar {
    padding: 0 12px;
  }

  .toolbar-center {
    display: none; /* Hide ticker to give full space to navigation and zoom */
  }

  .thumbnails-sidebar {
    width: 220px;
  }

  .doc-viewport {
    padding: 20px 12px;
  }
}

/* =========================================================
   MOBILE PHONES BREAKPOINT (max-width: 768px)
   ========================================================= */
@media (max-width: 768px) {
  :root {
    --header-height: 54px;
    --nav-height: 46px;
    --toolbar-height: 46px;
  }

  .app-header {
    padding: 0 10px;
  }

  .brand-badge {
    gap: 8px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.9rem;
  }

  .brand-title {
    font-size: 0.8rem;
    font-weight: 700;
  }

  .brand-sub {
    display: none; /* Hide subtitle on mobile for ultra-clean single row */
  }

  .drm-badge {
    display: none; /* Hide on mobile to prioritize action buttons */
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .btn {
    padding: 6px 10px;
    font-size: 0.74rem;
    height: 34px;
  }

  /* Compact header buttons on mobile: keep icon and short or hidden text */
  #btnOpenPrint span {
    display: none;
  }
  #btnOpenPrint {
    padding: 0 10px;
  }

  #btnOpenLogs span {
    display: none;
  }
  #btnOpenLogs {
    padding: 0 10px;
  }

  #btnLogout span {
    display: none;
  }
  #btnLogout {
    padding: 0 10px;
  }

  .btn-icon {
    width: 34px;
    height: 34px;
  }

  /* Grade Nav Tabs on Mobile */
  .grade-nav {
    padding: 0 8px;
  }

  .grade-tabs {
    gap: 6px;
    padding: 4px 0;
  }

  .grade-tab {
    padding: 4px 10px;
    gap: 6px;
    border-radius: 20px;
    min-width: auto;
    flex-shrink: 0;
  }

  .grade-code {
    font-size: 0.72rem;
    font-weight: 700;
  }

  .grade-name {
    display: none; /* "Lớp 1" hidden, "KHỐI 1" is enough on mobile */
  }

  .grade-pages-badge {
    font-size: 0.62rem;
    padding: 1px 6px;
  }

  /* Toolbar on Mobile */
  .viewer-toolbar {
    padding: 0 8px;
  }

  .toolbar-left {
    gap: 6px;
  }

  #btnToggleSidebar {
    padding: 0 8px;
    height: 32px;
    font-size: 0.72rem;
  }

  #btnToggleSidebar span {
    display: none;
  }

  .page-nav-controls {
    gap: 4px;
  }

  .tool-btn-icon {
    width: 28px;
    height: 28px;
  }

  .page-indicator {
    padding: 2px 6px;
    font-size: 0.72rem;
    gap: 3px;
  }

  .page-indicator input {
    width: 32px;
    height: 22px;
    font-size: 0.72rem;
  }

  .toolbar-right {
    gap: 4px;
  }

  #btnFitPage {
    display: none; /* Fit page is not useful on vertical phone screens */
  }

  #btnFitWidth {
    height: 28px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  #btnFitWidth span {
    display: none;
  }

  .zoom-level {
    font-size: 0.72rem;
    min-width: 32px;
  }

  /* Mobile Slide-Over Drawer for Thumbnails */
  .sidebar-backdrop {
    display: block;
  }

  .thumbnails-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 270px;
    max-width: 82vw;
    height: 100vh;
    z-index: 90;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.3);
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .thumbnails-sidebar.collapsed {
    transform: translateX(-100%);
    pointer-events: none;
  }

  /* Document Viewport on Mobile: Maximize Reading Area */
  .doc-viewport {
    padding: 8px 6px 24px;
  }

  .pages-stream {
    gap: 12px;
  }

  .page-container {
    width: 100% !important;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  }

  /* Modals on Mobile */
  .modal-card {
    width: calc(100vw - 20px);
    max-height: 90vh;
    border-radius: 14px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }
}

/* =========================================================
   🖨️ SECURE PRINT STYLESHEET (MULTI-PAGE PHYSICAL PRINT ONLY)
   ========================================================= */
.print-only {
  display: none;
}

@media print {
  .app-header,
  .grade-nav,
  .viewer-toolbar,
  .thumbnails-sidebar,
  .security-shield,
  .modal-backdrop,
  .toast-container,
  .viewer-loader,
  .doc-viewport {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
    height: auto !important;
  }

  .print-only {
    display: block !important;
    width: 100% !important;
  }

  .print-page-wrapper {
    position: relative !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    width: 100% !important;
    height: 100vh !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .print-page-image {
    max-width: 100% !important;
    max-height: 94vh !important;
    object-fit: contain !important;
    display: block !important;
  }

  /* Unremovable diagonal security stamp across printed physical pages */
  .print-watermark-stamp {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) rotate(-35deg) !important;
    font-size: 16pt !important;
    font-weight: 800 !important;
    color: rgba(0, 0, 0, 0.28) !important;
    border: 3px dashed rgba(0, 0, 0, 0.35) !important;
    padding: 14px 24px !important;
    text-align: center !important;
    width: 80% !important;
    line-height: 1.4 !important;
    letter-spacing: 0.8px !important;
    pointer-events: none !important;
  }

  .print-footer-banner {
    position: absolute !important;
    bottom: 6px !important;
    left: 0 !important;
    width: 100% !important;
    text-align: center !important;
    font-size: 7.5pt !important;
    color: rgba(0, 0, 0, 0.6) !important;
    font-weight: 600 !important;
  }

  @page {
    size: A4 portrait;
    margin: 6mm;
  }
}
