@charset "UTF-8";
/* =======================
   BASE (giữ cấu trúc cũ)
   ======================= */

body {
  background: url('../img/bg/bg-home.jpg') center center/cover no-repeat, #f5f5f5 !important;
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
}

.custom-navbar {
  background: url('../img/bg/bghead6.jpg') center center/cover no-repeat, #e7ecf3 !important;
  min-height: 62px;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 2px 8px #e2e6ed;
  color: blue;
}
.navbar-brand { color: #000088 !important; }
.navbar-brand:hover { color: #fd5a36; }

.wrapper-main { display: flex; gap: 0; min-height: 100vh; }
.sidebar {
  width: 330px;
  background: url('../img/bg/bghead7.gif') center center/cover no-repeat, #e7ecf3 !important;
  padding: 28px 20px 16px 20px;
  min-height: 100vh;
  border-radius: 0 14px 14px 0;
  box-shadow: 1px 0 8px #f1f1f1;
  transition: width 0.2s;
}
.main { flex: 1; padding: 32px; min-width: 0; }

.stat-card, .admin-section {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px #ececec;
  padding: 20px 20px 10px 20px;
  margin-bottom: 28px;
}
.stat-card .big-num { font-size: 2.3rem; font-weight: bold; margin-bottom: 6px; color: #d33439; }
.stat-card .label-small { font-size: 1.05rem; margin-bottom: 2px; }
.stat-card .card-title { font-size: 1.15rem; font-weight: 500; margin-bottom: 10px; color: #333; letter-spacing: 0.3px; }

#imagePreview img {
  max-width:120px; margin-top:12px; border-radius:10px; box-shadow:0 3px 9px #eee;
}

.zoom-controls-fixed {
  position: fixed; top: 68px; right: 18px; z-index: 1050;
  background: transparent; border-radius: 18px;
  box-shadow: 0 2px 9px rgba(0,0,0,0.08);
  padding: 8px 16px 8px 12px; display: flex; align-items: center; gap: 8px; font-size: 15px;
}
.zoom-btn {
  width: 28px; height: 28px; line-height: 24px; text-align: center;
  font-size: 20px; font-weight: bold; border: none; background: #66FFFF;
  border-radius: 80%; cursor: pointer; margin: 0 2px; transition: background 0.18s; box-shadow: 0 1px 2px #ececec;
}
.zoom-btn:hover { background: #e7eaf1; }
.zoom-slider { width: 95px; margin: 0 2px; vertical-align: middle; }
.zoom-value { font-weight:600; margin-left:4px; min-width:40px; display:inline-block; text-align:right; }

.table { font-size: 1rem; border-radius: 9px; overflow: hidden; }
.table thead th { background: #f6f7f9; font-weight: 600; border-bottom: 2px solid #ececec !important; }
.table td, .table th { vertical-align: middle !important; padding: 10px 7px !important; }

.btn, .form-select, .form-control { border-radius: 7px !important; }

hr { border-top: 2px solid #e5e6eb; margin: 1rem 0; }
.sidebar-title { margin-bottom: 30px; }

#uploadBtn:disabled {
  background: #bbb !important; border-color: #bbb !important; color: #eee !important;
  opacity: 0.6 !important; cursor: not-allowed !important; box-shadow: none;
}

@media (max-width: 1023px) {
  .wrapper-main { flex-direction: column;}
  .sidebar {
    width: 100%; min-height: unset; border-radius: 0 0 14px 14px;
    box-shadow: none; margin-bottom: 12px; padding: 20px 10px 10px 10px;
  }
  .main { padding: 14px 5px;}
  .zoom-controls-fixed { right: 6px; top: 66px;}
}
@media (max-width: 600px) {
  .stat-card, .admin-section { padding: 13px 6px 7px 6px;}
  .sidebar { padding: 12px 2vw;}
  .main { padding: 7px 0;}
  .table td, .table th { font-size: 0.97em; padding: 8px 3px;}
  .stat-card .big-num { font-size: 1.39rem; }
}

/* ==========================================
   UPGRADE: Hiệu ứng QUAY (lóe sáng mạnh + lướt)
   ========================================== */

/* Nhấp nháy nền rất nhẹ toàn lưới khi chạy */
.mosaic-flash .avatar-img,
#mosaicGrid.mosaic-run .avatar-img {
  animation: mosaicTwinkle 1.1s ease-in-out infinite alternate;
  will-change: transform, filter;
}
@keyframes mosaicTwinkle {
  0%   { filter: brightness(1) contrast(1);   transform: scale(1); }
  100% { filter: brightness(1.22) contrast(1.08); transform: scale(1.05); }
}

/* Cell “bị quét” — tăng độ lóe & zoom rõ hơn */
.avatar-cell.glint > .avatar-img,
#mosaicGrid.mosaic-run .avatar-cell.shine > .avatar-img {
  transform: scale(1.28);
  filter: brightness(2.25) contrast(1.2) saturate(1.15)
          drop-shadow(0 0 10px rgba(255,255,255,.85));
  transition: transform 200ms ease, filter 200ms ease;
  will-change: transform, filter;
}
.avatar-cell.glint,
#mosaicGrid.mosaic-run .avatar-cell.shine {
  z-index: 98 !important;
  position: absolute;
  overflow: hidden;
  border-radius: 10px;
}

/* Vệt sáng lướt ngang, hẹp & sáng hơn để “lóe” rõ */
.avatar-cell.glint::after,
#mosaicGrid.mosaic-run .avatar-cell.shine::after {
  content: "";
  position: absolute;
  inset: -3px;
  pointer-events: none;
  border-radius: 12px;
  background:
    linear-gradient(120deg,
      rgba(255,255,255,0) 40%,
      rgba(255,255,255,1) 50%,
      rgba(255,255,255,0) 60%);
  mix-blend-mode: screen;
  filter: blur(.8px);
  transform: translateX(-140%) rotate(18deg);
  animation: glintSweep 480ms cubic-bezier(.17,.67,.3,1) forwards;
}
@keyframes glintSweep {
  100% { transform: translateX(140%) rotate(18deg); }
}

/* ==========================================
   UPGRADE: ẢNH THẮNG bay vào giữa rồi “POP-OUT”
   ========================================== */

/* Clone bay (đã có trong JS). Chỉ tinh chỉnh bóng/độ rực */
.flyout {
  position: fixed; pointer-events: none;
  transition: transform 820ms cubic-bezier(.2,.8,.2,1), opacity 820ms, filter 820ms;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,.28)) saturate(1.05);
  border-radius: 12px;
  z-index: 1065;
  will-change: transform, opacity, filter;
}

/* Pha cuối: phóng to nhanh và mờ dần (JS thêm class .fly-pop trước khi remove) */
.flyout.fly-pop {
  /* Không đụng translate hiện có; chỉ “zoom & fade”.
     Dùng CSS Transform Level 2 (scale) — trình duyệt hiện đại đều hỗ trợ. */
  transition: scale 360ms cubic-bezier(.16,.84,.36,1), opacity 300ms ease-out, filter 300ms ease-out;
  scale: 2.8;             /* phóng nhanh */
  opacity: 0;             /* mờ dần */
  filter: drop-shadow(0 18px 36px rgba(0,0,0,.22)) saturate(1.15) brightness(1.05);
}

/* Fallback nếu browser chưa hỗ trợ property `scale` (ghi đè nhẹ) */
@supports not (scale: 1) {
  .flyout.fly-pop {
    transform: scale(2.8) !important; /* giữ nguyên translate do JS đã set, chỉ nhân scale tổng */
  }
}

/* ===============================
   Overlay quay: timer không che UI
   =============================== */
#drawOverlay {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%);
  z-index: 1060; display: none; pointer-events: none;
}
#drawOverlay .do-card {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(231,246,255,.92));
  border: 1px solid rgba(56,139,253,.16);
  box-shadow: 0 6px 24px rgba(56,139,253,.18);
  backdrop-filter: blur(6px);
}
#drawOverlay .do-title { font-weight: 700; }
#drawOverlay .do-sub { font-size: 12px; color:#666; }
#drawOverlay .do-timer { min-width: 60px; text-align: right; font-weight: 800; font-size: 20px; }
@media (max-width:600px){
  #drawOverlay .do-card { padding: 8px 10px; }
  #drawOverlay .do-timer { min-width: 54px; font-size: 18px; }
}

/* ======================================================
   Modal kết quả (xanh lam sáng, hiện đại) — giữ như bản trước
   ====================================================== */
.modal-backdrop.show,
.modal-backdrop.fade.show {
  background: radial-gradient(
    60% 60% at 50% 40%,
    rgba(56,139,253,.14) 0%,
    rgba(56,139,253,.22) 40%,
    rgba(12,74,179,.30) 100%
  ) !important;
  backdrop-filter: blur(2px);
}
#drawModal .modal-dialog { max-width: 1100px; }
#drawModal .modal-content {
  border: 1px solid transparent; border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, rgba(241,248,255,.96) 0%, rgba(224,241,255,.94) 100%) padding-box,
              linear-gradient(135deg, rgba(71,147,255,.28), rgba(71,147,255,0)) border-box;
  color: #0e2a47; backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(56,139,253,.25);
}
#drawModal .modal-header { background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%); color: #fff; border: 0; }
#drawModal .modal-title { font-weight: 800; letter-spacing: .2px; }
#drawModal .btn-close { filter: invert(1) grayscale(1) brightness(200%); opacity: .9; }

#drawStepResult .prize-head,
#drawStepResult .d-flex.align-items-center.gap-2 { align-items: center; gap: 12px !important; }
#prizeImgPreview {
  height: 54px !important; width: auto;
  border-radius: 12px; background: #fff; padding: 2px 6px;
  box-shadow: 0 6px 18px rgba(56,139,253,.25);
}
#prizeName {
  font-size: 1.35rem; font-weight: 900; margin-bottom: 2px;
  background: linear-gradient(90deg, #0b5394, #3b82f6, #0b5394);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#prizeValue {
  font-size: .95rem; color: #0b1a34; font-weight: 700;
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #dff3ff, #bfe6ff 60%, #a6dcff);
  box-shadow: 0 6px 16px rgba(56,139,253,.22);
}

#winnersGrid { margin-top: 8px; }
#winnersGrid .card {
  border: 1px solid rgba(56,139,253,.12); border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
  color: #0e2a47; box-shadow: 0 12px 30px rgba(56,139,253,.16);
  backdrop-filter: blur(4px);
  transform: translateY(0);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
#winnersGrid .card:hover { transform: translateY(-4px); box-shadow: 0 18px 38px rgba(56,139,253,.22); background: #ffffff; }
#winnersGrid .card-img-top { height: 160px; object-fit: cover; border-top-left-radius: 14px; border-top-right-radius: 14px; }
#winnersGrid .card .fw-bold.small { font-weight: 800 !important; letter-spacing: .1px; color: #0e2a47; }
#winnersGrid .card .text-muted.small { color: #5b6b88 !important; opacity: 1; }

/* Sparkle nhẹ khi hiển thị kết quả */
#drawModal.show #drawStepResult:not(.d-none)::before {
  content:""; position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(6px 6px at 20% 25%, rgba(255,255,255,.55), rgba(255,255,255,0) 60%),
    radial-gradient(5px 5px at 75% 30%, rgba(255,255,255,.50), rgba(255,255,255,0) 60%),
    radial-gradient(4px 4px at 40% 80%, rgba(255,255,255,.45), rgba(255,255,255,0) 60%),
    radial-gradient(5px 5px at 90% 70%, rgba(255,255,255,.40), rgba(255,255,255,0) 60%);
  animation: sparkFloat 2.2s ease-in-out infinite alternate;
}
@keyframes sparkFloat {
  0% { transform: translateY(0); opacity:.8; }
  100% { transform: translateY(-6px); opacity:1; }
}

#drawModal .modal-footer {
  border: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(219,234,254,.5));
}
#drawModal .btn-primary,
#drawModal .btn-outline-secondary,
#drawModal .btn-light { border-radius: 10px; }

/* QR modal – modern look */
  .qr-hero {
    background: linear-gradient(135deg,#f3f8ff 0%, #ffffff 60%);
    border-bottom: 1px solid #edf2f7;
    padding: 10px 16px;
  }
  .qr-title {
    display:flex;align-items:center;gap:10px;font-weight:700;
    letter-spacing:.2px
  }
  .qr-title .qr-badge {
    display:inline-flex;align-items:center;justify-content:center;
    width:36px;height:36px;border-radius:10px;background:#eaf3ff;color:#0b5ed7;
    font-size:18px
  }

  .qr-card {
    background:#fff;border:1px solid #e9eef5;border-radius:20px;
    padding:16px;box-shadow:0 10px 26px rgba(16,24,40,.06);
    display:inline-block
  }
  #qrBox canvas, #qrBox img {
    display:block;max-width:360px;width:100%;height:auto;border-radius:12px
  }
  .qr-caption{color:#64748b;font-size:.9rem;margin-top:10px}

  .qr-url {
    display:flex;align-items:center;gap:8px;
    background:#f8fafc;border:1px dashed #e2e8f0;border-radius:12px;
    padding:10px 12px;line-height:1.2
  }
  .qr-url code#qrUrlTxt{
    color:#0f172a; /* override mặc định bootstrap */
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
    font-size:.92rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:100%
  }
  .qr-actions .btn{border-radius:12px;padding:10px 14px}
  .qr-note {color:#6b7280;font-size:.9rem}

/* ==== Sidebar collapse ==== */
:root{ --sidebar-w: 360px; }
.sidebar{
  flex: 0 0 var(--sidebar-w);
  max-width: var(--sidebar-w);
  width: var(--sidebar-w);
  transition: flex-basis .28s ease, max-width .28s ease;
}
.sidebar-inner{
  transition: opacity .18s ease;
}
.main{ flex: 1 1 auto; min-width: 0; }

/* Trạng thái thu gọn */
body.is-sidebar-collapsed{ --sidebar-w: 0px; }
body.is-sidebar-collapsed .sidebar-inner{
  opacity: 0; pointer-events: none;
}

/* Nút nổi ẩn/hiện sidebar */
.sidebar-toggle{
  position: fixed;
  left: 12px; top: 92px;
  z-index: 1001;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.sidebar-toggle i{ font-size: 1.05rem; }
.sidebar-toggle .label{ font-weight:600; font-size:.92rem; }

@media (max-width: 1200px){
  :root{ --sidebar-w: 320px; }
}

        .find-photo-box input, .find-photo-box select { font-size:1.03em; }
        .found-highlight { animation: photoZoomFlash 1.8s cubic-bezier(.64,.04,.27,.99); z-index:99 !important;}
        @keyframes photoZoomFlash {
            0%   { box-shadow: 0 0 0 0 #d33439, 0 0 12px #fff; transform:scale(1);}
            20%  { box-shadow: 0 0 0 20px #ffd50066, 0 0 36px #fff; transform:scale(2.2);}
            45%  { box-shadow: 0 0 0 16px #ffd50033, 0 0 18px #fff; transform:scale(1.7);}
            75%  { box-shadow: 0 0 0 7px #d3343955, 0 0 9px #fff; transform:scale(1.3);}
            100% { box-shadow: 0 0 0 0 #fff0, 0 0 3px #fff; transform:scale(1);}
        }
