/**
 * landing/css/style.css
 * ============================================================================
 * PHASE 1 (bổ sung) — Public Check Page — thiết kế MỚI HOÀN TOÀN, không kế
 * thừa bảng màu/CSS của trang cũ (chỉ giữ lại Ý ĐỊNH thương hiệu: nghiêm túc,
 * đáng tin cậy — phù hợp bối cảnh xác thực dược phẩm chống giả).
 *
 * Token hệ màu:
 *   --ink        nền tối chủ đạo (khác nền kem/be mặc định thường gặp)
 *   --ink-2      lớp nền phụ (thẻ, gradient chiều sâu)
 *   --paper      nền thẻ kết quả/form (trắng ngà ấm, không phải trắng thuần)
 *   --verified   trạng thái xác thực thành công (lục lam, không dùng xanh lá
 *                mặc định để tránh trùng với các huy hiệu "verified" chung chung)
 *   --caution    trạng thái "đã kích hoạt trước đó" (hổ phách)
 *   --locked     trạng thái "đang khoá" (chàm) — màu RIÊNG, hệ cũ chưa từng
 *                có trạng thái này
 *   --danger     trạng thái "không tìm thấy"/lỗi (đỏ san hô)
 * ============================================================================
 */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --ink: #0E1B2B;
  --ink-2: #14263B;
  --ink-3: #1C3350;
  --paper: #FAF8F3;
  --ink-muted: #7C8AA0;
  --verified: #0FA37F;
  --verified-bg: #E4F6F1;
  --caution: #C9821A;
  --caution-bg: #FBF0DC;
  --locked: #5B4FD6;
  --locked-bg: #ECEAFB;
  --danger: #D3453B;
  --danger-bg: #FBE9E7;
  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow-card: 0 24px 60px -20px rgba(4, 12, 24, 0.55);
  --font-display: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 18px 140px;
  background:
    radial-gradient(circle at 18% 8%, rgba(15, 163, 127, 0.16), transparent 42%),
    radial-gradient(circle at 84% 92%, rgba(91, 79, 214, 0.14), transparent 46%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
}

.bbv-page {
  width: 100%;
  max-width: 420px;
}

/* ---------- Header thương hiệu ---------- */
.bbv-header { text-align: center; margin-bottom: 22px; }
.bbv-brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--paper);
  margin: 0 0 4px;
}
.bbv-brand-tagline { font-size: 0.82rem; color: var(--ink-muted); margin: 0; }

/* ---------- [Bug Fix Phase 1 — mục 1.3/2.1/3.1] Logo thật ở giữa header —
   ẨN mặc định (hidden trong HTML) nếu Tenant chưa cấu hình LOGO_URL, để
   KHÔNG hiện icon ảnh vỡ. Chỉ hiện khi JS gán src thành công. ---------- */
.bbv-brand-logo {
  display: block;
  max-width: 140px;
  max-height: 64px;
  margin: 0 auto 12px;
  object-fit: contain;
}
.bbv-brand-logo[hidden] { display: none; }

/* ---------- Seal — thành phần thị giác dấu ấn duy nhất của trang ---------- */
.bbv-seal {
  width: 84px; height: 84px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  transition: color .25s ease, background .25s ease, border-color .25s ease, transform .25s ease;
}
.bbv-seal svg { width: 42px; height: 42px; }
.bbv-seal.is-loading { animation: bbvSpin 1.1s linear infinite; }
.bbv-seal.is-success { color: var(--verified); background: rgba(15, 163, 127, .14); border-color: var(--verified); }
.bbv-seal.is-caution { color: var(--caution); background: rgba(201, 130, 26, .14); border-color: var(--caution); }
.bbv-seal.is-locked  { color: var(--locked);  background: rgba(91, 79, 214, .14);  border-color: var(--locked); }
.bbv-seal.is-danger  { color: var(--danger);  background: rgba(211, 69, 59, .14);  border-color: var(--danger); }
.bbv-seal-draw { stroke-dasharray: 32; stroke-dashoffset: 32; animation: bbvDraw .5s ease forwards .05s; }

@keyframes bbvSpin { to { transform: rotate(360deg); } }
@keyframes bbvDraw { to { stroke-dashoffset: 0; } }

/* ---------- Card form ---------- */
.bbv-card {
  background: var(--paper);
  color: #1C2430;
  border-radius: var(--radius-lg);
  padding: 26px 24px 24px;
  box-shadow: var(--shadow-card);
}
.bbv-card h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin: 0 0 4px;
  text-align: center;
}
.bbv-card .bbv-subtitle {
  text-align: center;
  font-size: 0.88rem;
  color: #5B6B7F;
  margin: 0 0 20px;
}

.bbv-field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#bbv_serialInput {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  padding: 15px 14px;
  border-radius: var(--radius-md);
  border: 2px solid #E4E1D8;
  background: #FFFFFF;
  color: #1C2430;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#bbv_serialInput::placeholder { font-weight: 500; letter-spacing: normal; text-transform: none; color: #A8ACB5; font-family: var(--font-display); }
#bbv_serialInput:focus-visible { border-color: var(--ink-3); box-shadow: 0 0 0 4px rgba(20, 38, 59, 0.12); }

.bbv-btn-check {
  width: 100%;
  margin-top: 12px;
  padding: 15px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--ink-2);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform .1s ease, opacity .15s ease;
}
.bbv-btn-check:hover { opacity: .92; }
.bbv-btn-check:active { transform: scale(.98); }
.bbv-btn-check:disabled { opacity: .65; cursor: progress; }
.bbv-btn-check:focus-visible { outline: 3px solid var(--verified); outline-offset: 2px; }

/* ---------- Kết quả — 4 trạng thái màu RIÊNG BIỆT ---------- */
.bbv-result {
  margin-top: 18px;
  padding: 16px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  animation: bbvFadeUp .25s ease;
}
.bbv-result[hidden] { display: none; }
.bbv-result-title { font-weight: 800; font-size: 1rem; margin-bottom: 4px; }
.bbv-result-body { font-size: 0.88rem; line-height: 1.55; }
.bbv-result-product { font-weight: 700; margin-top: 6px; }
.bbv-result-meta { color: #6B7280; font-size: 0.82rem; margin-top: 2px; }
.bbv-result-warn { margin-top: 8px; font-weight: 600; }

.bbv-result.is-success { background: var(--verified-bg); border-color: var(--verified); color: #0B5C48; }
.bbv-result.is-caution { background: var(--caution-bg); border-color: var(--caution); color: #7A4E0C; }
.bbv-result.is-locked  { background: var(--locked-bg);  border-color: var(--locked);  color: #362C8C; }
.bbv-result.is-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: #8C2A22; }

@keyframes bbvFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Liên kết sang trang Tích điểm (Phase 2.5) ---------- */
.bbv-loyalty-link {
  display: block; text-align: center; margin-top: 16px; padding: 13px;
  border-radius: var(--radius-md); border: 2px solid var(--ink-3);
  color: var(--ink-2); font-weight: 700; text-decoration: none; font-size: 0.92rem;
  transition: background .15s ease, color .15s ease;
}
.bbv-loyalty-link:hover { background: var(--ink-3); color: #fff; }
.bbv-loyalty-link[hidden] { display: none; }

/* ---------- Chân trang thương hiệu (cố định, mọi kích thước màn hình) ---------- */
.bbv-footer {
  position: fixed; left: 0; bottom: 0; width: 100%;
  background: var(--paper); color: #1C2430;
  text-align: center; padding: 10px 14px;
  border-top: 3px solid var(--verified);
  box-shadow: 0 -8px 24px rgba(0,0,0,.18);
}
.bbv-footer strong { color: var(--verified); }
.bbv-footer .bbv-footer-line { font-size: 0.82rem; margin: 2px 0; }
.bbv-footer a { color: #B5651D; font-weight: 700; text-decoration: none; }
.bbv-footer .bbv-copyright { font-size: 0.72rem; color: #98A0AC; }

/* ---------- Responsive: Tablet 640-1023px — bổ sung Phase 9.6, nhất quán
   cách tiếp cận 3 tầng (Mobile/Tablet/Desktop) đã dùng ở Admin (Phase 9.3) ---------- */
@media (min-width: 640px) and (max-width: 1023px) {
  body { padding-bottom: 96px; }
  .bbv-page { max-width: 460px; }
  .bbv-card { padding: 34px 32px 30px; }
  .bbv-seal { width: 96px; height: 96px; }
  .bbv-seal svg { width: 48px; height: 48px; }
  .bbv-card h1 { font-size: 1.5rem; }
}

/* ---------- Responsive: Desktop ≥ 1024px — thêm chiều sâu, không đổi cấu trúc ---------- */
@media (min-width: 1024px) {
  body { padding-bottom: 96px; }
  .bbv-page { max-width: 480px; }
  .bbv-card { padding: 38px 36px 32px; }
  .bbv-seal { width: 100px; height: 100px; }
  .bbv-seal svg { width: 50px; height: 50px; }
  .bbv-card h1 { font-size: 1.55rem; }
}

/* ---------- Tôn trọng prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .bbv-seal.is-loading { animation: none; }
  .bbv-seal-draw { animation: none; stroke-dashoffset: 0; }
  .bbv-result { animation: none; }
}

/* ---------- Phase 3.5 — Màn hình đếm lùi cho trang QR Check (qr.html) ----------
   [SUB PHASE 1.1 — FIX] 2 lỗi được sửa tại đây, đúng phạm vi đã duyệt:
   1. Thiếu `text-align:center` khiến số đếm (là phần tử block) bị lệch
      trái theo mặc định trình duyệt, dù card cha (.bbv-card) không set
      text-align chung — ĐÃ THÊM `text-align:center`.
   2. `font-size` tăng từ 2.6rem -> 3.6rem theo đúng yêu cầu "to rõ hơn".
   KHÔNG đổi bất kỳ thuộc tính nào khác của class này (color/margin/
   min-height/font-family/font-weight giữ nguyên 100%) — đúng nguyên tắc
   "chỉ sửa đúng phạm vi Sub Phase". */
.qc-countdown {
  font-family: var(--font-mono);
  font-size: 3.6rem;
  font-weight: 700;
  color: var(--danger);
  margin: 10px 0 4px;
  min-height: 48px;
  text-align: center;
}
.qc-secure-note { font-size: 0.72rem; color: var(--ink-muted); margin-top: 8px; }
