:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #667eea;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --text-light: #ffffff;
    --text-dark: #333333;
    --bg-dark: #0d1117;
    --bg-light: #f5f5f5;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --sidebar-width: 260px;
    --sidebar-bg: #ffffff;
    --sidebar-text: #333333;
    --sidebar-text-muted: rgba(0, 0, 0, 0.45);
    --sidebar-item-hover: rgba(102, 126, 234, 0.1);
    --sidebar-active: rgba(102, 126, 234, 0.15);
    --sidebar-border: rgba(0, 0, 0, 0.08);
    --scanner-bg: #3730a3;
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-text: #333333;
    --footer-bg: rgba(245, 245, 245, 0.95);
    --footer-text: rgba(0, 0, 0, 0.5);
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --sidebar-bg: #0d0d0d;
    --sidebar-text: rgba(255, 255, 255, 0.75);
    --sidebar-text-muted: rgba(255, 255, 255, 0.35);
    --sidebar-item-hover: rgba(102, 126, 234, 0.15);
    --sidebar-active: rgba(102, 126, 234, 0.25);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --header-bg: rgba(26, 35, 50, 0.95);
    --header-text: #ffffff;
    --footer-bg: rgba(26, 35, 50, 0.95);
    --footer-text: rgba(255, 255, 255, 0.7);
    --card-bg: #1e293b;
    --card-border: rgba(255, 255, 255, 0.08);
    --bg-light: #1e293b;
    --text-dark: #e5e7eb;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background-color: #fff;
    color: #000;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    border-right: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    animation: sidebar-shimmer 6s infinite linear;
    pointer-events: none;
}

@keyframes sidebar-shimmer {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sidebar-header-actions {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.sidebar-logo img {
    height: auto;
    width: 96px;
    max-width: 140px;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

.sidebar-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.sidebar-logo-img {
    width: 96px;
    object-fit: contain;
    drop-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-menu li.selected {
    background-color: rgba(59,130,246,0.26);
}

.sidebar-menu li.selected a {
    color: #123288;
}

.sidebar-menu li.selected a i {
    color: #123288;
}

.sidebar-menu li:hover {
    background-color: #f8fafc;
    transform: translateX(4px);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.9rem;
}

.sidebar-menu {
    list-style: none;
    margin: 0 0 1.2rem;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
}

.sidebar-menu li {
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s;
}

.sidebar-menu li:last-child {
    border-bottom: none;
}

.sidebar-group-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #6b7280;
    padding: 0.5rem 0.2rem 0.5rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 10px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.875rem;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: #6b7280;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: #f8fafc;
    color: #1d4ed8;
    transform: translateX(4px);
}

.sidebar-link:hover i {
    color: #1d4ed8;
    transform: scale(1.1);
}

.sidebar-link.active {
    background: rgba(59,130,246,0.26);
    color: #123288;
    border-right: none;
}

.sidebar-link.active i {
    color: #123288;
}

/* ===== Page Wrapper ===== */
.page-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* ===== Header ===== */
.header {
    background: transparent;
    padding: 0.75rem 1rem;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hamburger {
    background: #fff;
    border: none;
    color: #374151;
    font-size: 18px;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.hamburger:hover {
    background: #f3f4f6;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.language-toggle {
    color: var(--text-light);
    text-decoration: none;
}

.language-toggle:hover {
    color: var(--secondary-color);
}

.main-content {
    flex: 1;
    min-height: calc(100vh - 200px);
}

/* ===== Responsive ===== */
@media (max-width: 991px) {
    .sidebar-close {
        display: flex;
    }

    .hamburger {
        display: block;
    }

    .page-wrapper {
        margin-left: 0;
    }
}

/* ===== Home: scan-centric layout ===== */
.home-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
}

.home-scan-area {
    text-align: center;
    padding: 2rem 1.5rem;
}

.home-title {
    font-size: 2.4rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.home-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 2rem;
}

/* ===== How-to modal steps ===== */
.how-to-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.how-to-step:last-of-type {
    border-bottom: none;
}

.how-to-num {
    min-width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.how-to-title {
    font-weight: 600;
    margin: 0 0 0.2rem;
    color: #111827;
}

.how-to-desc {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
}

.hero-section {
    padding: 4rem 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

.scan-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: 50px;
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
}

.scan-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(118, 75, 162, 0.5);
}

.scan-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(255, 149, 0, 0.4);
}

.steps-section {
    padding: 4rem 0;
    background: rgba(255, 255, 255, 0.05);
}

.section-title {
    color: var(--text-light);
    margin-bottom: 3rem;
    font-size: 2rem;
}

.step-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
    height: 100%;
}

.step-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.15);
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.step-icon {
    font-size: 3rem;
    color: var(--secondary-color);
    margin: 1rem 0;
}

.step-title {
    color: var(--text-light);
    font-size: 1.3rem;
    margin: 1rem 0;
}

.step-desc {
    color: rgba(255, 255, 255, 0.7);
}

.features-section {
    padding: 4rem 0;
}

.feature-item {
    text-align: center;
    padding: 2rem;
}

.feature-item i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.feature-item h4 {
    color: var(--text-light);
}

/* Ensure Bootstrap modals appear above scanner overlay */
.modal {
    z-index: 100000 !important;
}

.modal-backdrop {
    z-index: 99999 !important;
}

/* ===== Scanner Modal ===== */
.scanner-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgb(57, 57, 173);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.scanner-modal.active {
    display: flex;
}

/* Permission / Init overlay */
.scanner-permission-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow-y: auto;
    padding: 1rem;
}

.scanner-permission-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #111827;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Step rows */
.init-step {
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.init-step:last-of-type {
    border-bottom: none;
}

.init-step-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    margin-top: 2px;
}

.init-step-body {
    flex: 1;
}

.init-step-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.init-step-desc {
    font-size: 0.9rem;
    color: #9ca3af;
    line-height: 1.5;
    margin-bottom: 0;
}

/* QR sample icon */
.init-qr-sample {
    margin-top: 0.75rem;
    width: 80px;
    height: 80px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #d1d5db;
}

/* Bottom action area */
.init-bottom {
    padding-top: 1.5rem;
    text-align: center;
}

/* Page-level load overlay (shown on entry) */
.scanner-load-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    transition: opacity 0.4s ease;
}

.scanner-load-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.scanner-load-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.25rem;
    margin: 0;
    text-align: center;
    animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.scanner-load-logo {
    height: 72px;
    max-width: 220px;
    object-fit: contain;
    display: block;
    margin-bottom: 1.5rem;
}

.scanner-load-bar {
    width: 90vw;
    max-width: 400px;
    height: 20px;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    align-self: center;
}

.scanner-load-fill {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.5s ease-in-out, background-color 0.5s ease-in-out;
    background: linear-gradient(to right, #374495, #5547d3);
}

/* Init loading progress */
.init-progress-wrap {
    margin-top: 1.2rem;
}

.init-loading-text {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.init-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.init-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* scanner-start-btn */
.scanner-start-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 0.9rem 0;
    width: 100%;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
    letter-spacing: 0.01em;
}

.scanner-start-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* Top bar */
.scanner-topbar {
    width: 100%;
    display: flex;
    align-items: center;
    position: relative;
    padding: 1rem 1.2rem 0.8rem;
}

.scanner-logo-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scanner-menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: #fff;
    border: none;
    color: #1e1b4b;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    transition: all 0.2s;
    z-index: 10000;
}

.scanner-menu-btn:hover {
    background: #f9fafb;
    transform: scale(1.05);
}

/* Logo container */
#logoContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    margin-top: 5vh;
    margin-bottom: 10px;
    border-radius: 8px;
    width: 100%;
    max-height: 20vh;
}

.scanner-logo,
#authNowLogo {
    max-width: 40%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Canvas Container — matches #canvasContainer in original */
#canvasContainer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 95vw;
    height: 72vw;
    max-width: 500px;
    max-height: 380px;
    margin: 10px 0;
    border-radius: 20px;
    overflow: hidden;
    background: #333;
}

/* Viewfinder mask — dark overlay with transparent center window */
#canvasContainer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2;
    pointer-events: none;
    /* Cut out a transparent rectangular window in the center */
    --mask-left: 8%;
    --mask-top: 6%;
    --mask-right: 8%;
    --mask-bottom: 6%;
    -webkit-mask-image: linear-gradient(#000 0 0),
        linear-gradient(#000 0 0);
    -webkit-mask-position:
        calc(var(--mask-left) - 100%) calc(var(--mask-top) - 100%),
        var(--mask-right) var(--mask-bottom);
    -webkit-mask-size:
        calc(100% - var(--mask-left) - var(--mask-right)) calc(100% - var(--mask-top) - var(--mask-bottom)),
        calc(100% - var(--mask-left) - 100%) calc(100% - var(--mask-top) - 100%);
    -webkit-mask-composite: source-out, destination-over;
    mask-image: linear-gradient(#000 0 0),
        linear-gradient(#000 0 0);
    mask-position:
        calc(var(--mask-left) - 100%) calc(var(--mask-top) - 100%),
        var(--mask-right) var(--mask-bottom);
    mask-size:
        calc(100% - var(--mask-left) - var(--mask-right)) calc(100% - var(--mask-top) - var(--mask-bottom)),
        calc(100% - var(--mask-left) - 100%) calc(100% - var(--mask-top) - 100%);
    mask-composite: exclude;
    border-radius: 20px;
}

/* Inner scan area (the visible camera region inside the viewfinder) */
#canvasContainer .scan-area {
    position: absolute;
    left: 8%;
    top: 6%;
    right: 8%;
    bottom: 6%;
    border-radius: 16px;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

/* Green corner brackets for the scan area */
#canvasContainer .scan-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    z-index: 5;
    pointer-events: none;
}
#canvasContainer .scan-corner::before,
#canvasContainer .scan-corner::after {
    content: '';
    position: absolute;
    background: #4ade80;
    border-radius: 2px;
}
#canvasContainer .scan-corner.tl { top: 6%; left: 8%; }
#canvasContainer .scan-corner.tl::before { top: 0; left: 0; width: 100%; height: 4px; }
#canvasContainer .scan-corner.tl::after { top: 0; left: 0; width: 4px; height: 100%; }

#canvasContainer .scan-corner.tr { top: 6%; right: 8%; }
#canvasContainer .scan-corner.tr::before { top: 0; right: 0; width: 100%; height: 4px; }
#canvasContainer .scan-corner.tr::after { top: 0; right: 0; width: 4px; height: 100%; }

#canvasContainer .scan-corner.bl { bottom: 6%; left: 8%; }
#canvasContainer .scan-corner.bl::before { bottom: 0; left: 0; width: 100%; height: 4px; }
#canvasContainer .scan-corner.bl::after { bottom: 0; left: 0; width: 4px; height: 100%; }

#canvasContainer .scan-corner.br { bottom: 6%; right: 8%; }
#canvasContainer .scan-corner.br::before { bottom: 0; right: 0; width: 100%; height: 4px; }
#canvasContainer .scan-corner.br::after { bottom: 0; right: 0; width: 4px; height: 100%; }

/* Animated horizontal scan line */
#canvasContainer .scan-line {
    position: absolute;
    left: 9%;
    right: 9%;
    height: 2px;
    z-index: 4;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.7), 0 0 20px rgba(74, 222, 128, 0.35);
    animation: scanLineMove 2.5s ease-in-out infinite;
}
@keyframes scanLineMove {
    0%, 100% { top: calc(6% + 12px); }
    50% { top: calc(94% - 14px); }
}

/* Dynamic guidance text overlay (green text on dark band) */
#dynamicText {
    position: absolute;
    left: 9%;
    right: 9%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: clamp(18px, 5vw, 30px);
    font-weight: 700;
    color: #4ade80;
    padding: 8px 16px;
    background-color: rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 6;
    white-space: nowrap;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

/* Torch button */
.btn-torch {
    width: 64px;
    height: 64px;
    position: absolute;
    bottom: 0;
    right: 0;
    border-radius: 50%;
    background: #374151;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    transition: all 0.2s;
    z-index: 10;
}

.btn-torch img {
    width: 100%;
    height: 100%;
    display: block;
    filter: invert(1);
}

.btn-torch:active {
    transform: scale(0.9);
}

.btn-torch.active {
    background: #4ade80;
}

/* Progress bar */
#progressBarContainer {
    width: 90vw;
    max-width: 400px;
    height: 20px;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px auto 10px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

#scanProgressBar {
    width: 0%;
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

/* Info area */
.scanner-info-area {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Info (How-to) floating button */
.scanner-info-btn {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    z-index: 9999;
}

#infoIcoContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    width: 100%;
    max-height: 5vh;
}

#infoIcoLogo {
    max-width: 40%;
    max-height: 100%;
    object-fit: contain;
}

#infoTextTitle {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #0000ff;
    font-size: 24px;
    font-weight: bold;
    padding: 5px;
    margin-bottom: 5px;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

#infoTextDescription {
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    padding: 5px;
    margin-bottom: 10px;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* Authenticate button */
#scannerContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90vw;
    max-width: 400px;
    border-radius: 8px;
}

/* Bottom area / Authenticate button */
.scanner-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90vw;
    max-width: 400px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.scanner-authenticate-label,
#scanButton {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90vw;
    max-width: 400px;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    background-image: linear-gradient(to right, #22c55e, #16a34a);
    color: #fff;
    font-weight: 500;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 200ms;
    text-align: center;
    gap: 12px;
}

#scanButton:active {
    transform: scale(0.9);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

#scanButton:disabled {
    background: linear-gradient(to right, #9ca3af, #9ca3af);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#scanButton:active {
    transform: scale(0.9);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

#scanButton:disabled {
    background: linear-gradient(to right, #9ca3af, #9ca3af);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 3rem;
    margin: 3rem auto;
    max-width: 800px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.result-icon.genuine {
    color: var(--success-color);
}

.result-icon.fake {
    color: var(--danger-color);
}

.result-icon.unknown {
    color: #ff9800;
}

.result-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.product-info {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 15px;
}

.product-image img {
    max-width: 300px;
    border-radius: 10px;
}

.product-details {
    text-align: left;
    margin-top: 1rem;
}

.points-reward {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: var(--text-light);
    padding: 2rem;
    border-radius: 15px;
    margin: 2rem 0;
}

.reward-icon {
    font-size: 3rem;
}

.points-value {
    font-size: 3rem;
    font-weight: bold;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.social-share {
    margin-top: 2rem;
}

.share-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.points-dashboard {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
}

.points-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.points-balance {
    text-align: center;
}

.balance-value {
    font-size: 3rem;
    color: var(--secondary-color);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.points-rules {
    margin: 3rem 0;
}

.rule-card {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    height: 100%;
}

.rule-card i {
    font-size: 3rem;
    color: var(--secondary-color);
}

.transactions-section {
    margin-top: 3rem;
}

.report-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 3rem;
    margin: 2rem auto;
    max-width: 800px;
}

.report-header {
    text-align: center;
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--secondary-color);
    background: rgba(255, 149, 0, 0.05);
}

.upload-placeholder i {
    font-size: 3rem;
    color: #ccc;
}

.image-preview {
    position: relative;
}

.image-preview img {
    max-width: 100%;
    border-radius: 10px;
}

.btn-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: var(--text-light);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
}

.info-card {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    height: 100%;
}

.info-card i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

/* Post-geo loading overlay: full-screen mask shown after location authorization */
.post-geo-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.post-geo-loading-overlay.active {
    display: flex;
}

.post-geo-loading-content {
    text-align: center;
    color: #fff;
}

.post-geo-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.post-geo-loading-text {
    font-size: 1.15rem;
    letter-spacing: 0.05em;
    margin: 0;
}

.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 2rem 0;
    margin-top: 4rem;
}

.redeem-code-display {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 0.3rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 10px;
    margin: 1rem 0;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .points-header {
        flex-direction: column;
    }
    
    .result-container,
    .report-container,
    .points-dashboard {
        padding: 1.5rem;
    }
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

.overlay.active {
    display: block;
}

/* ===== Gesture Unlock ===== */
.gesture-overlay {
    position: fixed;
    inset: 0;
    background: #3730a3;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gesture-overlay.hidden {
    display: none;
}

.gesture-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 380px;
    padding: 4rem 1.5rem 1.5rem;
}

.gesture-logo {
    height: 60px;
    object-fit: contain;
    margin-bottom: 2.5rem;
}

.gesture-hint {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
}

.gesture-board-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #1e1b4b;
    border-radius: 24px;
    overflow: hidden;
}

#patternLockContainer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#patternLockContainer svg.pattern-lock {
    width: 100%;
    height: 100%;
}

#guideCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    pointer-events: none;
}

/* Override vanilla-pattern-lock colors for blue background */
svg.pattern-lock g.lock-dots circle {
    fill: #fff;
    stroke: transparent;
    stroke-width: 13.5;
}

svg.pattern-lock g.lock-actives circle {
    fill: #fff;
    opacity: .3;
}

svg.pattern-lock g.lock-lines line {
    stroke: #fff;
    stroke-width: 2;
    opacity: 0.4;
}

svg.pattern-lock.success g.lock-actives circle {
    fill: #4ade80;
    opacity: 0.7;
}

svg.pattern-lock.success g.lock-lines line {
    stroke: #4ade80;
    opacity: 0.8;
}

svg.pattern-lock.error g.lock-actives circle {
    fill: #f87171;
    opacity: 0.7;
}

svg.pattern-lock.error g.lock-lines line {
    stroke: #f87171;
    opacity: 0.8;
}

.gesture-version {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    margin-top: 2rem;
}

/* ===== Geo Permission Modal ===== */
.geo-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 1);
}

.geo-modal-overlay.hidden {
    display: none;
}

.geo-modal-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem 2rem;
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.geo-modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #3730a3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.8rem;
    margin-top: -52px;
    margin-bottom: 1.2rem;
    box-shadow: 0 4px 16px rgba(55, 48, 163, 0.4);
}

.geo-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e1b4b;
    margin-bottom: 0.8rem;
}

.geo-modal-desc {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 1.6rem;
}

.geo-modal-deny {
    background: none;
    border: none;
    color: #3730a3;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 0.8rem;
    padding: 0.3rem 1rem;
}

.geo-modal-agree {
    background: #3730a3;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.85rem 3rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.geo-modal-agree:hover {
    background: #4338ca;
}

/* ===== Authentic Product Splash Screen ===== */
.authentic-splash {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #2d3aaf 0%, #3730a3 40%, #4c1d95 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 999999;
    padding: 2rem 1.5rem;
    text-align: center;
}

.authentic-splash-logo {
    width: 130px;
    margin-bottom: 0.5rem;
}

.authentic-splash-card {
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.18);
    border-radius: 18px;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 380px;
}

.authentic-splash-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.authentic-splash-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: #4ade80;
    margin: 0;
}

.authentic-splash-desc {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.6;
}

.authentic-splash-info {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}

.authentic-splash-redirecting {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    letter-spacing: 0.04em;
    margin: 0;
}

.authentic-splash-stop {
    background: rgba(255,255,255,0.12);
    border: 1.5px solid rgba(255,255,255,0.3);
    color: #fff;
    border-radius: 50px;
    padding: 0.85rem 3rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    max-width: 380px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.authentic-splash-stop:hover {
    background: rgba(255,255,255,0.22);
}

/* ===== Result page bottom action FAB buttons ===== */
.result-bottom-actions {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin: 1.5rem 0 0.5rem;
}

.result-fab-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #c8980a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    color: #fff;
    box-shadow: 0 4px 16px rgba(180, 130, 0, 0.45);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.result-fab-btn:hover {
    background: #b07a00;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(180, 130, 0, 0.55);
}

.result-fab-btn:active {
    transform: scale(0.97);
}

/* ===== Authenticity Verification Modal ===== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 99999;
    padding: 0 0 0 0;
}

.auth-modal-card {
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 1.8rem 1.5rem 2rem;
    width: 100%;
    max-width: 520px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.18);
    animation: slideUp 0.28s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: background 0.15s;
}

.auth-modal-close:hover { background: #e5e7eb; }

.auth-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.6rem;
    padding-right: 2rem;
}

.auth-modal-desc {
    font-size: 0.92rem;
    color: #374151;
    margin-bottom: 0.5rem;
    line-height: 1.55;
}

.auth-modal-code {
    font-size: 1.3rem;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin: 0.7rem 0 1rem;
    letter-spacing: 0.05em;
}

.auth-modal-text {
    font-size: 0.88rem;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 0.7rem;
}

.auth-modal-disclaimer {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin-top: 1rem;
    line-height: 1.5;
}

.auth-modal-link {
    color: #2563eb;
    text-decoration: none;
}

.auth-modal-link:hover {
    text-decoration: underline;
}

/* ===================================================================
   PVT Product Detail Page  (result page — matches screenshot layout)
   =================================================================== */
.pvt-page {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    background: #fff;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    overflow-x: hidden;
    padding-bottom: 120px;
}

/* Loading screen */
.pvt-loading-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Top bar ---- */
.pvt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.pvt-menu-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #374151;
    cursor: pointer;
}

.pvt-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pvt-brand img {
    max-height: 72px;
    max-width: 160px;
    object-fit: contain;
    image-rendering: auto;
}

.pvt-brand span {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #5a3e1b;
    text-transform: uppercase;
}

/* Language selector */
.pvt-lang-wrap {
    position: relative;
}

.pvt-lang-btn {
    background: none;
    border: 1.5px solid #d1d5db;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pvt-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    min-width: 120px;
    overflow: hidden;
    z-index: 500;
}

.pvt-lang-item {
    padding: 12px 20px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #111827;
}

.pvt-lang-item:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.pvt-lang-item:hover { background: #f9fafb; }

.pvt-lang-active { font-weight: 600; }

.pvt-lang-check {
    color: #374151;
    font-size: 1rem;
}

/* ---- Product subtitle ---- */
.pvt-product-subtitle {
    padding: 10px 16px 4px;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

/* ---- Authentic badge strip ---- */
.pvt-auth-strip {
    margin: 6px 14px 10px;
    background: #f0f4ff;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.pvt-auth-strip:hover { background: #e0e9ff; }

.pvt-auth-icon { flex-shrink: 0; }

.pvt-auth-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pvt-auth-label {
    font-size: 1rem;
    font-weight: 800;
    color: #16a34a;
    letter-spacing: 0.02em;
}

.pvt-auth-code {
    font-size: 0.88rem;
    font-weight: 700;
    color: #111827;
}

.pvt-auth-arrow { flex-shrink: 0; }

/* ---- Product image ---- */
.pvt-img-wrap {
    background: #eef4ff;
    padding: 24px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.pvt-product-img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
}

/* ---- Notes section ---- */
.pvt-notes {
    padding: 16px 16px 8px;
    width: 100%;
    box-sizing: border-box;
}

.pvt-note-text {
    font-size: clamp(0.6rem, 2.8vw, 0.82rem);
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 6px;
    white-space: pre-line;
    word-break: normal;
    overflow-wrap: normal;
    max-width: 100%;
}

.pvt-note-dose {
    font-size: clamp(0.6rem, 2.8vw, 0.85rem);
    color: #374151;
    font-weight: 500;
    white-space: pre-line;
    word-break: normal;
    overflow-wrap: normal;
    max-width: 100%;
}

/* ---- Bottom action buttons ---- */
.pvt-bottom-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    position: static;
    padding: 1.5rem 0 2rem;
    margin: 0;
}

.pvt-fab {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #c8980a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(180, 130, 0, 0.4);
    transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
}

.pvt-fab:hover {
    background: #a97a00;
    transform: scale(1.07);
    box-shadow: 0 6px 20px rgba(180, 130, 0, 0.5);
}

.pvt-fab:active { transform: scale(0.96); }

