﻿
/* Base */
/*.qr-fullscreen {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}*/

/* Alto del “visor” */
/*.qr-viewport {
    position: relative;
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    background: #000;
    height: 520px;*/ /* desktop/tablet */
/*}*/

/* Móvil: ocupar casi toda la pantalla */
/*@media (max-width: 576px) {
    .qr-viewport {
        height: 78vh;
        border-radius: 14px;
    }

    .qr-fullscreen {
        max-width: 100%;
    }
}*/

/* Host del html5-qrcode */
/*.qr-host {
    width: 100%;
    height: 100%;
}*/

    /* html5-qrcode wrappers */
    /*.qr-host [id$="__scan_region"] {
        width: 100% !important;
        height: 100% !important;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }*/

    /* video/canvas bien centrado (sin recortar) */
    /*.qr-host video,
    .qr-host canvas {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;*/ /* confiable para lectura */
        /*object-position: center;
        background: #000;
    }*/

/* Marco visual */
/*.qr-overlay {
    pointer-events: none;
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.qr-frame {
    width: 260px;
    height: 260px;
    border: 3px solid rgba(255,255,255,.85);
    border-radius: 18px;
    box-shadow: 0 0 0 2000px rgba(0,0,0,.28);
}

@media (max-width: 576px) {
    .qr-frame {
        width: 240px;
        height: 240px;
    }
}*/

/* Barra superior (selector) */
/*.qr-topbar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: center;
    z-index: 5;
}

.qr-topcard {
    pointer-events: auto;
    width: min(560px, 100%);
    background: rgba(15, 15, 15, 0.55);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    padding: 10px 12px;
    color: #fff;
}*/

/* Barra inferior (controles) */
/*.qr-bottombar {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: center;
    z-index: 5;
}

.qr-bottomcard {
    pointer-events: auto;
    width: min(560px, 100%);
    background: rgba(15, 15, 15, 0.55);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 10px 12px;
    color: #fff;
}*/

/* Botones */
/*.qr-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 12px;
}*/

/* Estado */
/*.qr-status {
    margin-top: 10px;
    text-align: center;
    font-size: .95rem;
    color: #6c757d;
}*/



.card-reader {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(50,117,84,.10), 0 2px 8px rgba(0,0,0,.06);
}

/* ── HEADER ── */
.reader-header {
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--light-darker);
    display: flex;
    align-items: center;
    gap: .75rem;
    background:white;
}

    .reader-header .brand-icon {
        width: 38px;
        height: 38px;
        border-radius: .75rem;
        background: var(--primary);
        display: grid;
        place-items: center;
        font-size: 1.1rem;
        color: #fff;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(50,117,84,.35);
    }

    .reader-header h1 {
        font-family: 'Space Mono', monospace;
        font-size: 1rem;
        font-weight: 700;
        margin: 0;
        letter-spacing: -.01em;
        color: var(--text);
    }

    .reader-header .subtitle {
        font-size: .72rem;
        color: var(--muted);
        margin: 0;
    }

.status-pill {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--light);
    border: 1px solid var(--light-darker);
    border-radius: 999px;
    padding: .25rem .7rem;
    transition: all .3s;
}

    .status-pill.active {
        color: var(--primary);
        border-color: var(--light-darker);
        background: var(--secondary);
    }

    .status-pill .dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: currentColor;
    }

    .status-pill.active .dot {
        box-shadow: 0 0 0 3px rgba(50,117,84,.2);
        animation: pulse 1.5s infinite;
    }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .35;
    }
}

/* ── CAMERAS LIST ── */
.cameras-section {
    padding: 1.1rem 1.5rem .9rem;
    border-bottom: 1px solid var(--light-darker);
}

.section-label {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--light);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.camera-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.camera-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .9rem;
    border-radius: .75rem;
    border: 1px solid var(--light-darker);
    background: var(--light);
    cursor: pointer;
    transition: all .2s;
    user-select: none;
}

    .camera-item:hover {
        border-color: var(--secondary);
        background: var(--secondary);
    }

    .camera-item.selected {
        border-color: var(--primary);
        background: var(--secondary);
        box-shadow: inset 3px 0 0 var(--primary);
    }

    .camera-item .cam-icon {
        width: 32px;
        height: 32px;
        border-radius: .5rem;
        background: var(--light);
        display: grid;
        place-items: center;
        font-size: 1rem;
        color: var(--light);
        border: 1px solid var(--border);
        flex-shrink: 0;
        transition: all .2s;
    }

    .camera-item.selected .cam-icon {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
        box-shadow: 0 2px 6px rgba(50,117,84,.3);
    }

.camera-info {
    flex: 1;
    min-width: 0;
}

.camera-name {
    font-size: .85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.camera-meta {
    font-size: .7rem;
    color: var(--muted);
}

.camera-item .check {
    font-size: 1rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity .2s;
}

.camera-item.selected .check {
    opacity: 1;
}

/* ── VIEWFINDER ── */
.viewfinder-wrap {
    position: relative;
    aspect-ratio: 4/3;
    background: #1a2e24;
    overflow: hidden;
}

    .viewfinder-wrap .video,
    .viewfinder-wrap canvas {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

/* Scanner overlay lines */
.scan-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-frame {
    width: 200px;
    height: 200px;
    position: relative;
}

    .scan-frame::before,
    .scan-frame::after,
    .scan-frame span::before,
    .scan-frame span::after {
        content: '';
        position: absolute;
        width: 28px;
        height: 28px;
        border-color: #fff;
        border-style: solid;
    }

    .scan-frame::before {
        top: 0;
        left: 0;
        border-width: 3px 0 0 3px;
        border-radius: 4px 0 0 0;
    }

    .scan-frame::after {
        top: 0;
        right: 0;
        border-width: 3px 3px 0 0;
        border-radius: 0 4px 0 0;
    }

    .scan-frame span::before {
        bottom: 0;
        left: 0;
        border-width: 0 0 3px 3px;
        border-radius: 0 0 0 4px;
    }

    .scan-frame span::after {
        bottom: 0;
        right: 0;
        border-width: 0 3px 3px 0;
        border-radius: 0 0 4px 0;
    }

    /* laser line */
    .scan-frame .laser {
        position: absolute;
        left: 6px;
        right: 6px;
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--primary), transparent);
        border-radius: 2px;
        box-shadow: 0 0 10px rgba(50,117,84,.8), 0 0 4px #fff;
        animation: scan 2s ease-in-out infinite;
    }

@keyframes scan {
    0% {
        top: 10px;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 182px;
        opacity: 0;
    }
}

.idle-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26,46,36,.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    color: rgba(255,255,255,.6);
    font-size: .85rem;
    transition: opacity .3s;
}

    .idle-overlay i {
        font-size: 3rem;
        opacity: .25;
        color: #fff;
    }

/* ── RESULT BANNER ── */
.result-banner {
    margin: .9rem 1.5rem 0;
    padding: .75rem 1rem;
    border-radius: .75rem;
    background: var(--secondary);
    border: 1px solid var(--light-darker);
    display: none;
    align-items: center;
    gap: .75rem;
}

    .result-banner.show {
        display: flex;
    }

    .result-banner i {
        color: var(--primary);
        font-size: 1.2rem;
        flex-shrink: 0;
    }

.result-text {
    font-family: 'Space Mono', monospace;
    font-size: .78rem;
    color: var(--primary-dk);
    word-break: break-all;
    flex: 1;
}

.result-copy {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    transition: color .2s;
}

    .result-copy:hover {
        color: var(--primary);
    }

/* ── CONTROLS ── */
.controls-section {
    padding: 1.1rem 1.5rem 1.4rem;
    background: var(--white);
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: .65rem;
    align-items: center;
}

.btn-ctrl {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    padding: .85rem .5rem;
    border-radius: 1rem;
    border: 1px solid var(--light-darker);
    background: var(--light);
    color: var(--text);
    font-size: .7rem;
    font-weight: 500;
    letter-spacing: .02em;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}

    .btn-ctrl i {
        font-size: 1.3rem;
        color: var(--muted);
    }

    .btn-ctrl:hover {
        border-color: var(--primary);
        background: var(--light);
        color: var(--primary-darker);
    }

        .btn-ctrl:hover i {
            color: var(--primary);
        }

    .btn-ctrl:active {
        transform: scale(.97);
    }

    .btn-ctrl:disabled {
        opacity: .4;
        pointer-events: none;
    }

/* Center start/stop button */
.btn-main {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.7rem;
    cursor: pointer;
    transition: all .25s;
    box-shadow: 0 4px 16px rgba(50,117,84,.35);
}

    .btn-main:hover {
        background: var(--primary-darker);
        border-color: var(--primary-darker);
        box-shadow: 0 6px 24px rgba(50,117,84,.45);
        transform: translateY(-1px);
    }

    .btn-main:active {
        transform: scale(.94);
    }

    .btn-main.running {
        border-color: var(--danger);
        background: var(--danger);
        box-shadow: 0 4px 16px rgba(217,79,107,.35);
    }

        .btn-main.running:hover {
            background: #c0374f;
            border-color: #c0374f;
            box-shadow: 0 6px 24px rgba(217,79,107,.45);
        }

/* ── FOOTER ── */
.reader-footer {
    padding: .6rem 1.5rem .9rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--light);
}

    .reader-footer span {
        font-size: .68rem;
        color: var(--light);
        font-family: 'Space Mono', monospace;
    }

.torch-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    transition: color .2s;
    padding: 0;
}

    .torch-btn.on {
        color: #d4860a;
    }

    .torch-btn:hover {
        color: var(--text);
    }





/* QR Skeleton (solo componente + CSS) */
.qr-skeleton {
    --qr-size: 260px;
    --qr-radius: 18px;
    --qr-bg: #f3f4f6; /* base skeleton */
    --qr-bg-2: #e9ecef; /* highlight */
    --qr-border: rgba(0,0,0,.06);
    --qr-stroke: rgba(0,0,0,.18);
    --qr-cell: rgba(0,0,0,.10);
    width: var(--qr-size);
    max-width: 100%;
}

.qr-skeleton__frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--qr-radius);
    background: linear-gradient(135deg, var(--qr-bg), var(--qr-bg-2));
    border: 1px solid var(--qr-border);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
}

/* “Esquinas” tipo visor de escáner */
.qr-skeleton__corner {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 3px solid var(--qr-stroke);
    border-radius: 12px;
    opacity: .65;
}

    .qr-skeleton__corner.c1 {
        top: 14px;
        left: 14px;
        border-right: 0;
        border-bottom: 0;
    }

    .qr-skeleton__corner.c2 {
        top: 14px;
        right: 14px;
        border-left: 0;
        border-bottom: 0;
    }

    .qr-skeleton__corner.c3 {
        bottom: 14px;
        left: 14px;
        border-right: 0;
        border-top: 0;
    }

    .qr-skeleton__corner.c4 {
        bottom: 14px;
        right: 14px;
        border-left: 0;
        border-top: 0;
    }

/* Simulación de celdas del QR */
.qr-skeleton__grid {
    position: absolute;
    inset: 22px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
    gap: 8px;
    opacity: .95;
    filter: blur(.0px);
}

/* Celdas con apariencia aleatoria (sin JS) */
.qr-skeleton__cell {
    display: block;
    border-radius: 6px;
    background: rgba(255,255,255,.35);
    border: 1px solid rgba(0,0,0,.04);
    position: relative;
    overflow: hidden;
}

    /* Variación visual por posición */
    .qr-skeleton__cell:nth-child(3n) {
        background: color-mix(in srgb, var(--qr-cell) 55%, transparent);
    }

    .qr-skeleton__cell:nth-child(4n) {
        background: color-mix(in srgb, var(--qr-cell) 35%, transparent);
    }

    .qr-skeleton__cell:nth-child(5n) {
        background: color-mix(in srgb, var(--qr-cell) 65%, transparent);
    }

/* Brillo animado tipo skeleton */
.qr-skeleton__shine {
    position: absolute;
    inset: 0;
    background: linear-gradient( 110deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 35%, rgba(255,255,255,0) 70% );
    transform: translateX(-120%);
    animation: qr-skeleton-shine 1.35s ease-in-out infinite;
    mix-blend-mode: soft-light;
    pointer-events: none;
}

@keyframes qr-skeleton-shine {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(120%);
    }
}

/* Línea “hint” inferior (opcional) */
.qr-skeleton__hint {
    margin-top: 10px;
    width: 68%;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--qr-bg), var(--qr-bg-2), var(--qr-bg));
    border: 1px solid var(--qr-border);
    animation: qr-skeleton-pulse 1.2s ease-in-out infinite;
}

@keyframes qr-skeleton-pulse {
    0%,100% {
        opacity: .65;
    }

    50% {
        opacity: 1;
    }
}

/* Accesibilidad: respeta usuarios con reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    .qr-skeleton__shine,
    .qr-skeleton__hint {
        animation: none;
    }
}