/* =========================================================
   IQR CHECK PORTAL — giao diện app mobile (mobile-first)
   Phong cách Cyber Security & Trust Verification (Bảo Mật - Tin Cậy)
   Đặc trưng: Xanh An Ninh Mạng & Khiên Bảo Chứng Quốc Tế,
   Nền sáng tinh tươm, uy tín, chính xác, không tím, không chói.
   Giữ nguyên toàn bộ ID/class mà assets/js/app.js đang dùng.
   ========================================================= */

:root {
    --ink: #0f172a;
    --seal: #0969da;
    --seal-light: #2563eb;
    --seal-deep: #0a2540;
    --seal-gradient: linear-gradient(135deg, #0a2540 0%, #0d3b66 50%, #0969da 100%);
    --seal-soft: #f0f7ff;
    --seal-tint: #e0edfe;
    --bg: #f4f7fb;
    --card: #ffffff;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --muted: #64748b;
    --shield-green: #059669;
    --shield-green-bg: #ecfdf5;
    --shield-gold: #b45309;
    --ok: #059669;
    --ok-bg: #ecfdf5;
    --warn: #d97706;
    --warn-bg: #fef3c7;
    --bad: #dc2626;
    --bad-bg: #fef2f2;
    --shell: 520px;
    --nav-h: 64px;
    --radius: 18px;
    --primary: var(--seal);        /* app.js / HTML cũ có dùng var(--primary) */
    --text-main: var(--ink);
    --text-muted: var(--muted);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 80px;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

:focus-visible {
    outline: 3px solid #38bdf8;
    outline-offset: 2px;
}

.app-shell {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: var(--shell);
    margin: 0 auto;
    background: var(--bg);
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}

/* ---------- App bar ---------- */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--seal-gradient);
    color: #fff;
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    min-height: 56px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.portal-logo-icon {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #38bdf8;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
}

.portal-title-wrap { min-width: 0; }
.portal-title-wrap h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .03em;
    line-height: 1.2;
}
.portal-title-wrap p {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.3;
    color: rgba(255,255,255,.88);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-badge-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(8px);
    transition: background .15s;
}
.admin-badge-btn i { font-size: 18px; }
.admin-badge-btn:active { background: rgba(255,255,255,.24); }

/* ---------- Hero ---------- */
.hero-intro {
    position: relative;
    background: #0a2540;
    background-image:
        radial-gradient(rgba(56, 189, 248, 0.12) 1.2px, transparent 1.2px),
        linear-gradient(135deg, #0a2540 0%, #0d3b66 50%, #0969da 100%);
    background-size: 16px 16px, 100% 100%;
    color: #fff;
    padding: 14px 20px 68px;
    border-radius: 0 0 28px 28px;
    box-shadow: 0 12px 28px -6px rgba(10, 37, 64, 0.35);
    overflow: hidden;
}
.hero-intro::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -30px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
    pointer-events: none;
}
.security-chip-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
}
.security-chip-pill i { font-size: 15px; color: #38bdf8; }
.hero-intro h2 {
    margin: 0 0 6px;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.3;
    text-wrap: balance;
    letter-spacing: -0.01em;
}
.hero-intro p {
    margin: 0;
    font-size: 13.5px;
    color: rgba(255,255,255,.9);
    max-width: 46ch;
}

/* ---------- Main ---------- */
.main-wrapper {
    position: relative;
    margin-top: -42px;
    padding: 0 16px;
}

.portal-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 2px 4px rgba(10, 37, 64, 0.04), 0 14px 30px -10px rgba(10, 37, 64, 0.1);
}

.security-trust-strip {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 8px;
    margin: 12px 0 16px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}
.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
}
.trust-item i { font-size: 15px; color: var(--seal); }

/* ---------- Inputs ---------- */
.search-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 54px;
    padding: 5px 6px 5px 12px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.search-input-group:focus-within {
    border-color: var(--seal);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}
.search-icon {
    flex: none;
    font-size: 22px;
    color: var(--muted);
}
.search-input {
    flex: 1;
    min-width: 0;
    height: 42px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 16px; /* >=16px để iOS không tự zoom */
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--ink);
}
.search-input::placeholder { font-weight: 400; color: #94a3b8; letter-spacing: 0; }

.qr-scan-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: var(--seal-tint);
    color: var(--seal);
    font-size: 13.5px;
    font-weight: 700;
    transition: all .15s;
}
.qr-scan-btn i { font-size: 20px; }
.qr-scan-btn:active { background: #bae6fd; transform: scale(.97); }

.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}
.req { color: var(--bad); }

.form-control {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    font-size: 16px;
    outline: 0;
    color: var(--ink);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.form-control:focus {
    border-color: var(--seal);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 16px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
}
select.form-control:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.75;
}

/* Captcha chống Bot */
.captcha-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-display-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    padding: 0 14px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border: 1.5px dashed #64748b;
    border-radius: 14px;
    user-select: none;
    flex-shrink: 0;
}

.captcha-display-badge #captchaCode {
    font-family: 'Courier New', Courier, monospace;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 4px;
    color: #0a2540;
    text-decoration: line-through;
    font-style: italic;
    transform: skew(-6deg);
    display: inline-block;
}

.captcha-reload-btn {
    background: none;
    border: none;
    color: #475569;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: transform 0.25s ease, color 0.15s ease;
}

.captcha-reload-btn:hover {
    color: #0969da;
    transform: rotate(180deg);
}

.captcha-input {
    flex: 1;
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.submit-search-btn {
    width: 100%;
    min-height: 52px;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #0a2540 0%, #0d3b66 40%, #0969da 100%);
    color: #fff;
    font-size: 15.5px;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(10, 37, 64, 0.28);
    transition: transform .1s, background .15s, box-shadow .15s;
}
.submit-search-btn i { font-size: 22px; color: #38bdf8; }
.submit-search-btn:active { transform: scale(.98); box-shadow: 0 2px 8px rgba(10, 37, 64, 0.25); }
.submit-search-btn:disabled { opacity: .6; }

/* ---------- Loading ---------- */
.loading-state {
    text-align: center;
    padding: 28px 16px;
    color: var(--muted);
    font-size: 13.5px;
}
.loading-state i { font-size: 38px; color: var(--seal); }
.loading-state p { margin: 8px 0 0; }

/* ---------- Kết quả: thẻ tem có đường xé ---------- */
.result-card {
    display: none;
    padding: 0;
    overflow: visible;
}
.result-card.show,
.result-card.active,
.result-card.visible { display: block; }

.result-card { animation: stamp-in .28s ease-out; }
@keyframes stamp-in {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.brand-header-banner {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f0fa 100%);
    border-bottom: 2px dashed #93c5fd;
    overflow: hidden;
}
.security-seal-stamp {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(-12deg);
    width: 78px;
    height: 78px;
    border-radius: 50%;
    border: 2px dashed rgba(9, 105, 218, 0.22);
    display: grid;
    place-items: center;
    pointer-events: none;
}
.security-seal-stamp .seal-inner {
    text-align: center;
    color: rgba(9, 105, 218, 0.35);
    font-weight: 900;
    font-size: 8px;
    letter-spacing: .08em;
    line-height: 1.1;
}
.security-seal-stamp i { font-size: 22px; display: block; margin-bottom: 2px; }
.brand-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.brand-avatar {
    flex: none;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 14px;
    background: #fff;
    color: var(--seal);
    font-size: 26px;
    font-weight: 800;
    border: 1.5px solid #dbeafe;
    box-shadow: 0 2px 8px rgba(10, 37, 64, 0.08);
}
.brand-avatar.has-logo {
    padding: 3px;
    background: #ffffff;
}
.brand-avatar img { width: 100%; height: 100%; object-fit: contain; }
.result-brand-banner {
    width: 100%;
    margin-top: 14px;
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.result-brand-banner img {
    width: 100%;
    max-height: 190px;
    object-fit: cover;
    display: block;
}

/* Mặc định trên Mobile: Ẩn banner cột trái (chỉ hiển thị trong thẻ kết quả bên phải) */
@media (max-width: 767.98px) {
    .left-brand-banner {
        display: none !important;
    }
}
.brand-name-title { font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.brand-sub { font-size: 12px; color: var(--muted); }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--warn-bg);
    color: var(--warn);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}
.status-pill i { font-size: 16px; }
.status-pill.active,
.status-pill.activated,
.status-pill.success,
.status-pill.valid,
.status-pill.ok { background: var(--ok-bg); color: var(--ok); }
.status-pill.expired,
.status-pill.invalid,
.status-pill.error,
.status-pill.danger,
.status-pill.not_found,
.status-pill.notfound,
.status-pill.inactive { background: var(--bad-bg); color: var(--bad); }
.status-pill.pending,
.status-pill.warning,
.status-pill.unactivated { background: var(--warn-bg); color: var(--warn); }

.product-details {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
}
.product-img {
    flex: none;
    width: 76px;
    height: 76px;
    object-fit: contain;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
}
.product-info-text { min-width: 0; }
.product-name { margin: 0 0 4px; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.product-info-text p { margin: 0; font-size: 12.5px; color: var(--muted); }

/* đường xé tem + hai lỗ khuyết hai bên */
.perforation {
    position: relative;
    height: 0;
    margin: 0 14px;
    border-top: 2px dashed #cbd5e1;
}
.perforation::before,
.perforation::after {
    content: "";
    position: absolute;
    top: -13px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg);
}
.perforation::before { left: -26px; box-shadow: inset -1px 0 0 var(--line); }
.perforation::after  { right: -26px; box-shadow: inset 1px 0 0 var(--line); }

.product-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
    padding: 18px 16px 8px;
}
.meta-item { min-width: 0; }
.meta-item:first-child { grid-column: 1 / -1; }
.meta-label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.meta-value {
    font-size: 14.5px;
    font-weight: 600;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.meta-item:first-child .meta-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: .03em;
    color: #0a2540;
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1.5px dashed #94a3b8;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.35;
    transition: all .2s;
}

.meta-item:first-child .meta-value.status-valid {
    color: #059669 !important;
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.12);
}

.meta-item:first-child .meta-value.status-expired {
    color: #dc2626 !important;
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.12);
}

.meta-item:first-child .meta-value.status-pending {
    color: #d97706 !important;
    background: #fffbeb !important;
    border-color: #f59e0b !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.12);
}

.serial-tag {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: normal;
    font-family: 'Be Vietnam Pro', system-ui, sans-serif;
    white-space: nowrap;
}
.serial-tag.tag-valid { color: #059669; }
.serial-tag.tag-expired { color: #dc2626; }
.serial-tag.tag-pending { color: #d97706; }

.result-actions { padding: 8px 16px 16px; }
.result-actions .submit-search-btn {
    margin-top: 6px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

/* ---------- Form kích hoạt ---------- */
.card-title { margin: 0 0 4px; font-size: 18px; font-weight: 800; color: var(--ink); }
.card-sub { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }

/* ---------- Hướng dẫn 3 bước & Quyền lợi kích hoạt (chuẩn ảnh 1) ---------- */
.desktop-nav { display: none; }
.hero-inner { width: 100%; }
.lookup-grid-layout,
.activate-grid-layout { display: block; }

.brand-letter-badge {
    font-size: 24px;
    font-weight: 800;
    color: var(--seal);
    line-height: 1;
}

.guide-card-box {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 18px 18px 20px;
    margin-top: 16px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 2px 4px rgba(10, 37, 64, 0.04), 0 10px 24px -8px rgba(10, 37, 64, 0.06);
}

.guide-title {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
    color: #0a2540;
    line-height: 1.3;
}

.guide-steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guide-steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    line-height: 1.55;
    color: #334155;
}

.guide-steps-list .step-num {
    flex: none;
    font-weight: 800;
    color: var(--ok);
    font-size: 14.5px;
}

.guide-steps-list strong {
    color: #0f172a;
    font-weight: 700;
}

/* Hộp quyền lợi kích hoạt */
.activate-benefits-box {
    margin-top: 16px;
}

.benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.benefit-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.benefit-icon {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #e0f2fe;
    color: #0284c7;
    display: grid;
    place-items: center;
    font-size: 20px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.12);
}

.benefit-text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.benefit-text p {
    margin: 0;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.45;
}

/* ---------- Thanh điều hướng dưới (tab) ---------- */
.tab-controls {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--shell);
    display: grid;
    grid-template-columns: 1fr 84px 1fr;
    align-items: end;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
}

.tab-btn,
.nav-scan {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.2;
    position: relative;
    transition: color .15s;
}
.tab-btn i { font-size: 25px; }
.tab-btn.active { color: var(--seal); }
.tab-btn.active::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 30%;
    right: 30%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--seal);
}

.tab-btn.tab-locked {
    opacity: 0.45;
    cursor: not-allowed;
    position: relative;
}
.tab-btn.tab-locked::after {
    content: "\ea90";
    font-family: 'boxicons' !important;
    font-weight: normal;
    font-style: normal;
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    font-size: 11px;
    line-height: 1;
    color: var(--muted);
    background: #f1f5f9;
    padding: 2px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-scan { color: var(--ink); }
.nav-scan-ring {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin-top: -30px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: linear-gradient(135deg, #0a2540 0%, #0d3b66 45%, #0969da 100%);
    color: #fff;
    font-size: 26px;
    box-shadow: 0 8px 24px rgba(10, 37, 64, 0.35);
    transition: transform .1s, box-shadow .15s;
}
.nav-scan-ring i { color: #38bdf8; }
.nav-scan:active .nav-scan-ring { transform: scale(.93); }

/* ---------- Modal quét QR (bottom sheet - sáng hiện đại) ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
}
.modal-overlay.active,
.modal-overlay.show,
.modal-overlay.open { display: flex; }

.modal-content {
    width: 100%;
    max-width: var(--shell);
    max-height: 100vh;
    max-height: 100dvh;
    overflow: auto;
    background: #ffffff;
    color: var(--ink);
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.18);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.modal-close-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 22px;
    transition: background .15s, color .15s;
}
.modal-close-btn:active { background: #e2e8f0; color: var(--ink); }
.scanner-viewport-wrap {
    position: relative;
    background: #000;
    min-height: 260px;
}
.scanner-viewport-wrap::before {
    content: "";
    position: absolute;
    inset: 24px;
    border: 2px dashed rgba(56, 189, 248, 0.45);
    border-radius: 16px;
    pointer-events: none;
    z-index: 2;
}
#qr-reader { border: 0 !important; width: 100%; }
#qr-reader video { width: 100% !important; display: block; }
#qr-reader button {
    min-height: 40px;
    margin: 8px 4px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: var(--seal);
    color: #fff;
    font-weight: 600;
}
#qr-reader a { color: var(--seal-light); }
#qr-reader select { max-width: 100%; min-height: 36px; font-size: 16px; }
.scanner-hint {
    padding: 12px 16px;
    background: #f0f9ff;
    color: #0369a1;
    font-size: 12.5px;
    text-align: center;
    font-weight: 500;
}

/* ---------- Footer ---------- */
.portal-footer {
    padding: 12px 20px 24px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
}
.portal-footer a { color: var(--seal); font-weight: 700; text-decoration: none; }
.footer-note { margin-top: 6px; font-size: 11.5px; color: #94a3b8; }

.footer-brand-support {
    margin: 0 auto 8px;
    max-width: 600px;
}
.brand-footer-card {
    background: #ffffff;
    border: 1.5px solid #dbeafe;
    border-radius: 14px;
    padding: 12px 18px;
    box-shadow: 0 3px 12px rgba(10, 37, 64, 0.05);
    text-align: center;
}
.brand-footer-company {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.2px;
    margin-bottom: 3px;
}
.brand-footer-desc {
    font-size: 11.5px;
    color: var(--muted);
    margin-bottom: 8px;
    line-height: 1.4;
}
.brand-footer-contact-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}
.brand-footer-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #475569;
}
.brand-footer-item i {
    color: var(--seal);
    font-size: 15px;
}
.brand-footer-item a {
    color: var(--seal);
    font-weight: 700;
    text-decoration: none;
}
.brand-footer-item a:hover {
    text-decoration: underline;
}

/* ---------- SweetAlert2 ---------- */
.swal2-popup { font-family: inherit !important; border-radius: 20px !important; }
.swal2-styled.swal2-confirm { background: var(--seal) !important; border-radius: 12px !important; }
.swal2-styled.swal2-cancel  { border-radius: 12px !important; }

/* ---------- Màn hình rất nhỏ ---------- */
@media (max-width: 359px) {
    .admin-badge-btn span { display: none; }
    .hero-intro h2 { font-size: 19px; }
    .product-meta-grid { grid-template-columns: 1fr; }
    .qr-scan-btn { padding: 0 10px; }
}

/* =========================================================
   TABLET, LAPTOP & PC RESPONSIVE LAYOUT (Theo chuẩn ảnh 1)
   Màu sắc: Cyber Security & Trust Blue (Giữ nguyên bản mobile)
   Bố cục: 2 cột cân đối, thanh điều hướng nổi bật ở Header, ẩn tab bar dưới
   ========================================================= */

@media (min-width: 768px) {
    body {
        background: #f4f7fb;
    }

    .app-shell {
        max-width: 100%;
        margin: 0;
        padding-bottom: 40px;
        background: transparent;
        box-shadow: none;
    }

    /* Ẩn hoàn toàn thanh điều hướng dưới của mobile */
    .tab-controls {
        display: none !important;
    }

    /* Header & Navigation trên máy tính */
    .portal-header {
        position: sticky;
        top: 0;
        width: 100%;
        z-index: 50;
    }

    .header-container {
        max-width: 1160px;
        margin: 0 auto;
        padding: 12px 28px;
    }

    .portal-brand {
        gap: 12px;
    }

    .portal-logo-icon {
        width: 44px;
        height: 44px;
        font-size: 26px;
        border-radius: 14px;
    }

    .portal-title-wrap h1 {
        font-size: 17px;
        letter-spacing: .04em;
    }

    .portal-title-wrap p {
        font-size: 12.5px;
    }

    /* Thanh điều hướng dạng Pill ở Header bên phải */
    .desktop-nav {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .top-nav-btn {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 40px;
        padding: 0 18px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.14);
        border: 1px solid rgba(255, 255, 255, 0.22);
        color: #ffffff;
        font-size: 13.5px;
        font-weight: 600;
        cursor: pointer;
        backdrop-filter: blur(8px);
        transition: all .18s ease;
    }

    .top-nav-btn i {
        font-size: 17px;
    }

    .top-nav-btn:hover {
        background: rgba(255, 255, 255, 0.24);
        transform: translateY(-1px);
    }

    .top-nav-btn.active {
        background: #ffffff;
        color: #0a2540;
        border-color: #ffffff;
        font-weight: 700;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    }

    .top-nav-btn.active i {
        color: var(--seal);
    }

    .top-nav-btn.top-nav-scan {
        background: #f59e0b;
        color: #0f172a;
        border-color: #fbbf24;
        font-weight: 700;
        box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
    }

    .top-nav-btn.top-nav-scan i {
        color: #0f172a;
        font-size: 18px;
    }

    .top-nav-btn.top-nav-scan:hover {
        background: #d97706;
        color: #ffffff;
        border-color: #d97706;
        transform: translateY(-1px);
    }

    .top-nav-btn.top-nav-scan:hover i {
        color: #ffffff;
    }

    .top-nav-btn.tab-locked {
        opacity: 0.45;
        cursor: not-allowed;
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.15);
        position: relative;
    }

    .top-nav-btn.tab-locked:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.08);
    }

    .top-nav-btn.tab-locked::after {
        content: "\ea90";
        font-family: 'boxicons' !important;
        font-weight: normal;
        margin-left: 2px;
        font-size: 13px;
        color: #fca5a5;
    }

    /* Banner Hero uốn cong rộng tràn màn hình */
    .hero-intro {
        width: 100%;
        padding: 32px 0 92px;
        border-radius: 0 0 38px 38px;
    }

    .hero-inner {
        max-width: 1160px;
        margin: 0 auto;
        padding: 0 28px;
    }

    .hero-intro h2 {
        font-size: 28px;
        line-height: 1.25;
        margin-bottom: 8px;
        max-width: 750px;
        text-transform: uppercase;
        letter-spacing: -0.01em;
    }

    .hero-intro p {
        font-size: 15px;
        max-width: 650px;
    }

    /* Bố cục chính 2 CỘT */
    .main-wrapper {
        max-width: 1160px;
        margin: -58px auto 0;
        padding: 0 28px;
    }

    .lookup-grid-layout,
    .activate-grid-layout {
        display: grid;
        grid-template-columns: 360px 1fr;
        gap: 22px;
        align-items: start;
    }

    .activate-benefits-box {
        margin-top: 0;
    }

    /* Card styling */
    .portal-card {
        border-radius: 20px;
        padding: 22px 22px;
        box-shadow: 0 4px 6px -1px rgba(10, 37, 64, 0.04), 0 16px 36px -10px rgba(10, 37, 64, 0.08);
    }

    /* Result Card theo chuẩn ảnh 1 */
    /* Trên PC / Laptop: Ẩn banner bên cột phải của thẻ kết quả tra cứu */
    .result-card .result-brand-banner {
        display: none !important;
    }

    /* Trên PC / Laptop: Hiển thị Banner thương hiệu ở cột trái, nằm dưới nút tra cứu tem */
    .left-brand-banner {
        width: 100%;
        margin-top: 16px;
        border-radius: 14px;
        overflow: hidden;
        border: 1px solid #e2e8f0;
        background: #ffffff;
        box-shadow: 0 4px 14px rgba(10, 37, 64, 0.06);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .left-brand-banner:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 22px rgba(10, 37, 64, 0.1);
    }

    .left-brand-banner a {
        display: block;
        width: 100%;
        text-decoration: none;
        cursor: pointer;
    }

    .left-brand-banner img {
        width: 100%;
        height: auto;
        max-height: 220px;
        object-fit: cover;
        display: block;
        border-radius: 13px;
    }

    .brand-header-banner {
        padding: 18px 24px;
        border-radius: 20px 20px 0 0;
    }

    .brand-name-title {
        font-size: 16.5px;
    }

    .brand-sub {
        font-size: 12.5px;
    }

    .product-details {
        padding: 22px 24px;
    }

    .product-name {
        font-size: 21px;
    }

    .product-info-text p {
        font-size: 13.5px;
    }

    /* Đường xé tem có 2 lỗ khuyết chuẩn vé */
    .perforation {
        margin: 4px 24px;
    }

    .perforation::before {
        left: -36px;
    }

    .perforation::after {
        right: -36px;
    }

    /* Bảng thông tin tem 3 cột (ảnh 1) */
    .product-meta-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px 20px;
        padding: 22px 24px 16px;
    }

    .meta-item:first-child {
        grid-column: 1 / -1;
        margin-bottom: 4px;
    }

    .meta-item:first-child .meta-value {
        font-size: 18px;
        padding: 8px 16px;
    }

    .meta-label {
        font-size: 12.5px;
        margin-bottom: 4px;
    }

    .meta-value {
        font-size: 15px;
    }

    /* Hướng dẫn 3 bước */
    .guide-card-box {
        padding: 22px 24px;
        margin-top: 20px;
    }

    /* Modal quét QR căn giữa màn hình */
    .modal-overlay {
        align-items: center;
        justify-content: center;
    }

    .modal-content {
        max-width: 480px;
        border-radius: 24px;
        max-height: 90vh;
        box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    }

    .portal-footer {
        max-width: 1160px;
        margin: 36px auto 0;
        padding: 16px 28px 32px;
    }
}

/* ---------- Laptop & PC màn hình rộng (>= 1024px) ---------- */
@media (min-width: 1024px) {
    .lookup-grid-layout,
    .activate-grid-layout {
        grid-template-columns: 420px 1fr;
        gap: 28px;
    }

    .hero-intro h2 {
        font-size: 30px;
    }

    .search-card {
        padding: 24px 24px;
    }
}

@media (hover: hover) {
    .submit-search-btn:hover { background: linear-gradient(135deg, #0a2540 0%, #0d3b66 100%); }
    .qr-scan-btn:hover { background: #dbeafe; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
