/* pwa/css/app.css — mobile-first, responsive, có animation nhẹ cho UX */
:root {
  --bbv-primary: #155E75;
  --bbv-gold: #C9A227;
  --bbv-bg: #F3F5F7;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Be Vietnam Pro', 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bbv-bg); min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}
.material-symbols-outlined { vertical-align: middle; }

.screen { display: none; min-height: 100vh; animation: fadeIn .25s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Login ---- */
#loginScreen {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(201,162,39,.18), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(21,94,117,.35), transparent 45%),
    linear-gradient(135deg, #0B1F2E 0%, #12384A 55%, #155E75 100%);
  padding: 24px;
}
#loginScreen.active { display: flex; }
.login-card {
  background: #fff; border-radius: 18px; padding: 30px 22px; width: 100%; max-width: 380px;
  box-shadow: 0 24px 70px rgba(0,0,0,.35); border-top: 4px solid var(--bbv-gold);
}
.brand-icon { font-size: 42px; color: var(--bbv-primary); }
.brand-title { font-weight: 800; font-size: 1.35rem; color: #0B1F2E; letter-spacing: -.02em; }
.brand-tagline { font-size: .82rem; color: var(--bbv-primary); font-weight: 600; margin-top: 2px; }
.login-footer { color: rgba(255,255,255,.65); font-size: .72rem; text-align: center; margin-top: 22px; line-height: 1.6; }

/* ---- Thanh loading chạy trái->phải khi đăng nhập ---- */
.login-progress-bar { height: 3px; width: 100%; background: rgba(0,0,0,.08); border-radius: 2px; overflow: hidden; margin-top: 10px; display: none; }
.login-progress-bar.active { display: block; }
.login-progress-bar .bar { height: 100%; width: 40%; background: var(--bbv-primary); border-radius: 2px; animation: loginProgressSlide 1.1s ease-in-out infinite; }
@keyframes loginProgressSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ---- Topbar ---- */
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #fff; border-bottom: 1px solid #e7eaf0;
  position: sticky; top: 0; z-index: 20;
}

/* ---- Home grid ---- */
.home-grid { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 20px; }
@media (min-width: 480px) { .home-grid { grid-template-columns: 1fr 1fr; } }
.home-tile {
  background: #fff; border: none; border-radius: 18px; padding: 28px 16px;
  box-shadow: 0 6px 24px rgba(11,31,46,.08); font-size: 1.02rem; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.home-tile .material-symbols-outlined { font-size: 40px; color: var(--bbv-primary); }
.home-tile:active { transform: scale(.96); box-shadow: 0 2px 8px rgba(20,30,60,.12); }

.pwa-footer { text-align: center; padding: 20px 16px; font-size: .72rem; color: #8a97a5; line-height: 1.7; }

/* ---- Forms ---- */
.scan-input { font-family: 'Courier New', monospace; letter-spacing: .04em; font-size: 1.1rem; }

/* ---- Offline banner ---- */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: #dc3545; color: #fff; text-align: center; padding: 8px; font-size: .85rem;
  animation: slideDown .2s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ---- Toasts (đơn giản, tự dựng) ---- */
#toastContainer { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.bbv-toast {
  padding: 12px 14px; border-radius: 10px; color: #fff; font-size: .9rem; box-shadow: 0 6px 18px rgba(0,0,0,.15);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.bbv-toast.success { background: #198754; }
.bbv-toast.danger { background: #dc3545; }
.bbv-toast.warning { background: #C9A227; color: #212529; }
.bbv-toast.primary { background: var(--bbv-primary); }

/* ---- Scanner modal ---- */
.scanner-modal {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: flex; flex-direction: column;
}
.scanner-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; color: #fff; background: rgba(0,0,0,.6);
}
#scannerViewport { flex: 1; }
.scanner-hint { text-align: center; color: #fff; padding: 12px; font-size: .85rem; background: rgba(0,0,0,.6); }

/* ---- Result cards (trace) ---- */
.trace-result-card { background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 6px 24px rgba(11,31,46,.08); animation: fadeIn .2s ease; }
.trace-result-card table { width: 100%; }
.trace-result-card td { padding: 4px 6px; border-bottom: 1px solid #f0f0f0; }
.badge-MATCHED { background: #198754; }
.badge-MISMATCH { background: #dc3545; }
.badge-NOT_FOUND { background: #C9A227; color: #212529; }
