/* ==========================================================================
   CÂY TRI ÂN TÂY NGUYÊN – TRANG QR CODE THUYẾT TRÌNH KHÁN PHÒNG (qr.html)
   Bảo đảm đồng bộ mỹ thuật giấy thủ công, màu xanh đại ngàn & vàng dã quỳ
   ========================================================================== */

:root {
  --qr-forest-deep: #143D28;
  --qr-forest-dark: #0A2216;
  --qr-basalt-red: #993D1B;
  --qr-flag-red: #D32F2F;
  --qr-da-quy-gold: #FBC02D;
  --qr-paper-cream: #FAF5E8;
  --qr-paper-card: #FFFDF8;
  --qr-rule-line: rgba(184, 150, 90, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body.qr-body {
  margin: 0;
  padding: 24px 16px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1E4F37 0%, var(--qr-forest-deep) 45%, var(--qr-forest-dark) 100%);
  color: #1F2937;
  font-family: var(--font-body, 'Lora', serif);
  position: relative;
  overflow-x: hidden;
}

/* Nền cánh lá đại ngàn bay nhẹ nhàng */
.qr-ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.ambient-leaf {
  position: absolute;
  font-size: 24px;
  opacity: 0.18;
  animation: qrLeafFloat 18s linear infinite;
}

.ambient-leaf.l1 { left: 8%;  top: -40px; animation-duration: 20s; animation-delay: 0s; }
.ambient-leaf.l2 { left: 24%; top: -40px; animation-duration: 25s; animation-delay: 4s; }
.ambient-leaf.l3 { left: 52%; top: -40px; animation-duration: 22s; animation-delay: 2s; }
.ambient-leaf.l4 { left: 78%; top: -40px; animation-duration: 19s; animation-delay: 6s; }
.ambient-leaf.l5 { left: 90%; top: -40px; animation-duration: 24s; animation-delay: 1s; }
.ambient-leaf.l6 { left: 40%; top: -40px; animation-duration: 26s; animation-delay: 8s; }

@keyframes qrLeafFloat {
  0% {
    transform: translateY(-40px) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 0.22;
  }
  85% {
    opacity: 0.22;
  }
  100% {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0;
  }
}

/* Khung trang trung tâm */
.qr-page-container {
  width: 100%;
  max-width: 660px;
  position: relative;
  z-index: 2;
  margin: auto;
}

/* Thẻ báo tường giấy thủ công nghệ thuật */
.qr-card {
  background: linear-gradient(180deg, var(--qr-paper-card) 0%, var(--qr-paper-cream) 100%);
  border: 2px solid rgba(251, 192, 45, 0.55);
  border-radius: 24px;
  padding: 30px 36px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  position: relative;
  text-align: center;
}

/* Khung chỉ vàng kép bên trong */
.qr-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px dashed var(--qr-rule-line);
  border-radius: 16px;
  pointer-events: none;
}

/* Header thẻ: Huy hiệu & Tên trường */
.qr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--qr-rule-line);
  position: relative;
  z-index: 2;
}

.qr-org-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.qr-doan-badge {
  width: 44px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.qr-org-names {
  display: flex;
  flex-direction: column;
}

.qr-org-row1 {
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--qr-forest-deep);
  letter-spacing: 0.05em;
}

.qr-org-row2 {
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--qr-basalt-red);
  letter-spacing: 0.03em;
}

.qr-event-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
}

.qr-badge-num {
  background: var(--qr-flag-red);
  color: #FFFDF8;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 6px rgba(211, 47, 47, 0.3);
}

.qr-badge-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: #555;
  margin-top: 3px;
}

/* Khối tiêu đề chính */
.qr-title-block {
  margin-top: 18px;
  position: relative;
  z-index: 2;
}

.qr-lotus-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.qr-lotus-accent {
  width: 28px;
  height: auto;
  opacity: 0.85;
}

.qr-lotus-accent.right {
  transform: scaleX(-1);
}

.qr-kicker {
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--qr-basalt-red);
  letter-spacing: 0.1em;
}

.qr-main-title {
  margin: 6px 0 6px;
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-size: clamp(28px, 3.8vw, 38px);
  font-weight: 700;
  color: var(--qr-forest-deep);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(20, 61, 40, 0.1);
  line-height: 1.15;
}

.qr-subtitle {
  margin: 0 auto;
  max-width: 44ch;
  font-family: var(--font-body, 'Lora', serif);
  font-size: clamp(15.5px, 2vw, 18px);
  font-style: italic;
  color: var(--qr-basalt-red);
  line-height: 1.45;
}

/* Khung chứa mã QR trắng muốt, mã đen, viền chỉ vàng */
.qr-stage {
  margin: 20px auto 14px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.qr-canvas-wrapper {
  background: #FFFFFF;
  padding: 24px;
  border-radius: 20px;
  border: 2px solid rgba(251, 192, 45, 0.6);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 0 0 4px rgba(255, 255, 255, 0.8);
  position: relative;
  display: inline-block;
  line-height: 0;
}

#qrCanvas {
  display: block;
  margin: 0 auto;
  background: #FFFFFF;
  /* Kích thước được JS tính toán và điều khiển */
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Dấu mầm non nhỏ ở trung tâm mã (không che dữ liệu quét) */
.qr-center-watermark {
  display: none; /* Giữ tuyệt đối an toàn cho việc quét */
}

/* Dòng hiển thị địa chỉ URL */
.qr-url-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(20, 61, 40, 0.06);
  border: 1px solid var(--qr-rule-line);
  padding: 6px 14px;
  border-radius: 999px;
  margin: 6px auto 18px;
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
  max-width: 100%;
  position: relative;
  z-index: 2;
}

.qr-url-icon {
  font-size: 13px;
}

.qr-url-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--qr-forest-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-copy-btn {
  background: #FFFFFF;
  border: 1px solid rgba(20, 61, 40, 0.25);
  color: var(--qr-forest-deep);
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.qr-copy-btn:hover {
  background: var(--qr-forest-deep);
  color: #FFFDF8;
  border-color: var(--qr-forest-deep);
}

.qr-copy-btn.copied {
  background: #2E7D32;
  color: #FFFDF8;
  border-color: #2E7D32;
}

/* Thanh nút thao tác */
.qr-card-footer {
  margin-top: 8px;
  border-top: 1px solid var(--qr-rule-line);
  padding-top: 18px;
  position: relative;
  z-index: 2;
}

.qr-action-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.qr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
  font-size: 14.5px;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
}

/* Nút quay lại trang chính */
.qr-btn-back {
  background: #FFFFFF;
  color: var(--qr-forest-deep);
  border: 1.5px solid var(--qr-forest-deep);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.qr-btn-back:hover {
  background: #E8F5E9;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(20, 61, 40, 0.16);
}

/* Nút phóng to toàn màn hình */
.qr-btn-fullscreen {
  background: linear-gradient(135deg, var(--qr-forest-deep) 0%, #255C3E 100%);
  color: #FFFDF8;
  border: 1.5px solid rgba(251, 192, 45, 0.5);
  box-shadow: 0 4px 12px rgba(20, 61, 40, 0.3);
}

.qr-btn-fullscreen:hover {
  background: linear-gradient(135deg, #1C4D38 0%, #2E704D 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(20, 61, 40, 0.4), 0 0 0 2px rgba(251, 192, 45, 0.6);
}

.qr-keyboard-hint {
  margin: 14px 0 0;
  font-family: var(--font-ui, 'Be Vietnam Pro', sans-serif);
  font-size: 11.5px;
  color: #777;
}

.qr-keyboard-hint b {
  color: var(--qr-forest-deep);
}

/* ==========================================================================
   CHẾ ĐỘ TOÀN MÀN HÌNH (FULLSCREEN MODE DÀNH CHO MÁY CHIẾU)
   ========================================================================== */
body.in-fullscreen .qr-card {
  padding: 24px 36px 20px;
  max-width: 720px;
}

body.in-fullscreen .qr-stage {
  margin: 16px auto 12px;
}

/* ==========================================================================
   RESPONSIVE DESIGN (DESKTOP 1920, LAPTOP, TABLET, MOBILE)
   ========================================================================== */
@media (max-width: 680px) {
  body.qr-body {
    padding: 14px 10px;
  }

  .qr-card {
    padding: 20px 18px 20px;
    border-radius: 18px;
  }

  .qr-card::before {
    inset: 6px;
    border-radius: 12px;
  }

  .qr-card-header {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
  }

  .qr-org-brand {
    flex-direction: column;
    text-align: center;
  }

  .qr-event-badge {
    align-items: center;
  }

  .qr-main-title {
    font-size: 24px;
  }

  .qr-subtitle {
    font-size: 15px;
  }

  .qr-canvas-wrapper {
    padding: 14px;
    border-radius: 14px;
  }

  .qr-action-buttons {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .qr-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
  }

  .qr-url-row {
    width: 100%;
    box-sizing: border-box;
  }
}
