/**
 * QR Scanner Styles
 * Full-screen camera overlay for QR code scanning.
 * Uses BEM naming and design system variables.
 * @version 1.0.0
 */

/* ── Scanner Overlay ─────────────────────────────── */

.qr-scanner {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* ── Camera Feed ─────────────────────────────────── */

.qr-scanner__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hidden offscreen canvas for jsQR frame extraction */
.qr-scanner__canvas {
    display: none;
}

/* ── Viewfinder ──────────────────────────────────── */

.qr-scanner__viewfinder {
    position: relative;
    width: 250px;
    height: 250px;
    border: 3px solid rgb(255 255 255 / 80%);
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgb(0 0 0 / 50%);
    z-index: 1;
}

/* Corner accents */
.qr-scanner__viewfinder::before,
.qr-scanner__viewfinder::after {
    content: "";
    position: absolute;
    width: 32px;
    height: 32px;
    border-color: #fff;
    border-style: solid;
}

.qr-scanner__viewfinder::before {
    top: -3px;
    left: -3px;
    border-width: 4px 0 0 4px;
    border-radius: 12px 0 0;
}

.qr-scanner__viewfinder::after {
    bottom: -3px;
    right: -3px;
    border-width: 0 4px 4px 0;
    border-radius: 0 0 12px;
}

/* ── Close Button ────────────────────────────────── */

.qr-scanner__close {
    position: absolute;
    top: max(env(safe-area-inset-top, 0px), 16px);
    right: 16px;
    z-index: 2;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    background: rgb(0 0 0 / 50%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.qr-scanner__close:hover {
    background: rgb(0 0 0 / 70%);
}

.qr-scanner__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ── Status Text ─────────────────────────────────── */

.qr-scanner__status {
    position: absolute;
    bottom: max(env(safe-area-inset-bottom, 0px), 32px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 10px 20px;
    font-size: var(--font-size-sm, 0.875rem);
    font-family: var(--font-primary, -apple-system, blinkmacsystemfont, sans-serif);
    color: #fff;
    background: rgb(0 0 0 / 60%);
    border-radius: var(--border-radius-lg, 12px);
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

/* ── Responsive ──────────────────────────────────── */

@media (min-width: 768px) {
    .qr-scanner__viewfinder {
        width: 300px;
        height: 300px;
    }
}
