/* Estilos generales para scanners en todos los módulos */

/* Botón de cámara - común a todos */
.btn-camera-barcode {
    background: none;
    color: #143DD4;
    border: none;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 26px;
    cursor: pointer;
    box-shadow: none;
    box-sizing: border-box;
}

.btn-camera-barcode:hover {
    color: #0f2a9e;
}

.btn-camera-barcode:active {
    color: #0f2a9e;
}

/* Contenedor de código de barras */
.barcode-container-productos,
.barcode-container-inventario,
.barcode-container-kardex,
.barcode-container-pos,
.barcode-container-kardex2,
.barcode-container-ranking,
.barcode-container-detalleproducto,
.barcode-container-agregarproducto,
.barcode-container {
    flex-wrap: nowrap !important;
}

@media (max-width: 768px) {
    .barcode-container-productos,
    .barcode-container-inventario,
    .barcode-container-kardex,
    .barcode-container-pos,
    .barcode-container-kardex2,
    .barcode-container-ranking,
    .barcode-container-detalleproducto,
    .barcode-container-agregarproducto,
    .barcode-container {
        gap: 5px;
    }

    .barcode-container-productos .textos_ventasNegrita,
    .barcode-container-inventario .textos_ventasNegrita,
    .barcode-container-kardex .textos_ventasNegrita,
    .barcode-container-pos .textos_ventasNegrita,
    .barcode-container-kardex2 .textos_ventasNegrita,
    .barcode-container-ranking .textos_ventasNegrita,
    .barcode-container-detalleproducto .textos_ventasNegrita,
    .barcode-container-agregarproducto div,
    .barcode-container .input-group {
        flex: 1;
        min-width: 0;
    }

    #btnCameraProductos,
    #btnCameraInventario,
    #btnCameraKardex,
    #btnCameraKardex2,
    #btnCameraRanking,
    #btnCameraDetalleproducto,
    #btnCameraAgregarProducto,
    #btnCameraAgregarProductoDoc,
    #btnCameraBarcode {
        display: inline-flex !important;
    }
}

@media (min-width: 769px) {
    #btnCameraProductos,
    #btnCameraInventario,
    #btnCameraKardex,
    #btnCameraKardex2,
    #btnCameraRanking,
    #btnCameraDetalleproducto,
    #btnCameraAgregarProducto,
    #btnCameraAgregarProductoDoc,
    #btnCameraBarcode {
        display: none !important;
    }
}

#btnCameraPos {
    display: inline-flex;
}

/* ========== Estilos de Modales Fullscreen ========== */

/* Productos */
#modalScanBarcodeProductos.modal,
#modalScanBarcodeInventario.modal,
#modalScanBarcodeKardex.modal,
#modalScanBarcodePos.modal,
#modalScanBarcodeAgregarProducto.modal,
#modalScanBarcodeAgregarProductoDoc.modal {
    background-color: rgba(0,0,0,0.95) !important;
    z-index: 2000 !important;
}

/* Asegurar que el backdrop del modal anidado esté por encima del modal padre */
#modalScanBarcodeAgregarProducto.modal::before,
#modalScanBarcodeAgregarProductoDoc.modal::before {
    z-index: 1999 !important;
}

/* Scanner containers - común */
#html5-qrcode-productos,
#html5-qrcode-full,
#html5-qrcode-kardex,
#html5-qrcode-pos,
#html5-qrcode-kardex2,
#html5-qrcode-ranking,
#html5-qrcode-detalleproducto,
#html5-qrcode-agregarproducto,
#html5-qrcode-agregarproducto-doc {
    position: relative;
}

#html5-qrcode-productos .html5-qrcode-element-hr,
#html5-qrcode-productos .html5-qrcode-controls,
#html5-qrcode-productos button,
#html5-qrcode-productos select,
#html5-qrcode-productos .html5-qrcode-button-element,
#html5-qrcode-productos .html5-qrcode-scanner-status,
#html5-qrcode-full .html5-qrcode-element-hr,
#html5-qrcode-full .html5-qrcode-controls,
#html5-qrcode-full button,
#html5-qrcode-full select,
#html5-qrcode-full .html5-qrcode-button-element,
#html5-qrcode-full .html5-qrcode-scanner-status,
#html5-qrcode-kardex .html5-qrcode-element-hr,
#html5-qrcode-kardex .html5-qrcode-controls,
#html5-qrcode-kardex button,
#html5-qrcode-kardex select,
#html5-qrcode-kardex .html5-qrcode-button-element,
#html5-qrcode-kardex .html5-qrcode-scanner-status,
#html5-qrcode-pos .html5-qrcode-element-hr,
#html5-qrcode-pos .html5-qrcode-controls,
#html5-qrcode-pos button,
#html5-qrcode-pos select,
#html5-qrcode-pos .html5-qrcode-button-element,
#html5-qrcode-pos .html5-qrcode-scanner-status,
#html5-qrcode-kardex2 .html5-qrcode-element-hr,
#html5-qrcode-kardex2 .html5-qrcode-controls,
#html5-qrcode-kardex2 button,
#html5-qrcode-kardex2 select,
#html5-qrcode-kardex2 .html5-qrcode-button-element,
#html5-qrcode-kardex2 .html5-qrcode-scanner-status,
#html5-qrcode-ranking .html5-qrcode-element-hr,
#html5-qrcode-ranking .html5-qrcode-controls,
#html5-qrcode-ranking button,
#html5-qrcode-ranking select,
#html5-qrcode-ranking .html5-qrcode-button-element,
#html5-qrcode-ranking .html5-qrcode-scanner-status,
#html5-qrcode-detalleproducto .html5-qrcode-element-hr,
#html5-qrcode-detalleproducto .html5-qrcode-controls,
#html5-qrcode-detalleproducto button,
#html5-qrcode-detalleproducto select,
#html5-qrcode-detalleproducto .html5-qrcode-button-element,
#html5-qrcode-detalleproducto .html5-qrcode-scanner-status,
#html5-qrcode-agregarproducto .html5-qrcode-element-hr,
#html5-qrcode-agregarproducto .html5-qrcode-controls,
#html5-qrcode-agregarproducto button,
#html5-qrcode-agregarproducto select,
#html5-qrcode-agregarproducto .html5-qrcode-button-element,
#html5-qrcode-agregarproducto .html5-qrcode-scanner-status,
#html5-qrcode-agregarproducto-doc .html5-qrcode-element-hr,
#html5-qrcode-agregarproducto-doc .html5-qrcode-controls,
#html5-qrcode-agregarproducto-doc button,
#html5-qrcode-agregarproducto-doc select,
#html5-qrcode-agregarproducto-doc .html5-qrcode-button-element,
#html5-qrcode-agregarproducto-doc .html5-qrcode-scanner-status {
    display: none !important;
}

#html5-qrcode-productos video,
#html5-qrcode-full video,
#html5-qrcode-kardex video,
#html5-qrcode-pos video,
#html5-qrcode-kardex2 video,
#html5-qrcode-ranking video,
#html5-qrcode-detalleproducto video,
#html5-qrcode-agregarproducto video,
#html5-qrcode-agregarproducto-doc video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#html5-qrcode-productos > *,
#html5-qrcode-full > *,
#html5-qrcode-kardex > *,
#html5-qrcode-pos > *,
#html5-qrcode-kardex2 > *,
#html5-qrcode-ranking > *,
#html5-qrcode-detalleproducto > *,
#html5-qrcode-agregarproducto > *,
#html5-qrcode-agregarproducto-doc > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#html5-qrcode-productos > div:first-child,
#html5-qrcode-full > div:first-child,
#html5-qrcode-kardex > div:first-child,
#html5-qrcode-pos > div:first-child,
#html5-qrcode-kardex2 > div:first-child,
#html5-qrcode-ranking > div:first-child,
#html5-qrcode-detalleproducto > div:first-child,
#html5-qrcode-agregarproducto > div:first-child,
#html5-qrcode-agregarproducto-doc > div:first-child {
    display: none !important;
}

.modal-scan-barras .modal-dialog {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
}

.modal-scan-barras .modal-content {
    background-color: #0a0a0a;
    border: none;
    border-radius: 0;
    box-shadow: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.modal-scan-barras .modal-header {
    background: linear-gradient(to bottom, rgba(20,61,212,0.95), rgba(20,61,212,0.6), transparent);
    border: none;
    padding: 20px;
    z-index: 1055;
}

.modal-scan-barras .modal-title {
    color: #fff;
    font-weight: bold;
    margin: 0;
}

.modal-scan-barras .modal-title i {
    margin-right: 12px;
    font-size: 24px;
}

.modal-scan-barras .close {
    color: #fff;
    opacity: 1;
    font-size: 32px;
    text-shadow: none;
}

.modal-scan-barras .modal-body {
    flex: 1;
    padding: 0;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#html5-qrcode-pos,
#html5-qrcode-full,
#html5-qrcode-kardex,
#html5-qrcode-productos,
#html5-qrcode-kardex2,
#html5-qrcode-ranking,
#html5-qrcode-detalleproducto,
#html5-qrcode-agregarproducto,
#html5-qrcode-agregarproducto-doc,
#qr-reader {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

#qr-reader > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#qr-reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#html5-qrcode-pos #qr-shaded-region,
#html5-qrcode-full #qr-shaded-region,
#html5-qrcode-kardex #qr-shaded-region,
#html5-qrcode-productos #qr-shaded-region,
#html5-qrcode-kardex2 #qr-shaded-region,
#html5-qrcode-ranking #qr-shaded-region,
#html5-qrcode-detalleproducto #qr-shaded-region,
#html5-qrcode-agregarproducto #qr-shaded-region,
#html5-qrcode-agregarproducto-doc #qr-shaded-region,
#qr-reader #qr-shaded-region {
    box-sizing: border-box;
    width: auto !important;
    height: auto !important;
}

.detalle-error-camara {
    color: #8b93a7;
    word-break: break-word;
}

/* Modal anidado - asegurar visibilidad */
#modalScanBarcodeAgregarProducto .modal-body,
#modalScanBarcodeAgregarProductoDoc .modal-body {
    z-index: 2000 !important;
}

#modalScanBarcodeAgregarProducto .modal-header,
#modalScanBarcodeAgregarProductoDoc .modal-header {
    z-index: 2001 !important;
}

.btn-activar-camara-prod {
    width: 100%;
    max-width: 300px;
    margin-top: 10px;
    padding: 11px;
    border: 1px dashed #28a745;
    border-radius: 10px;
    background-color: #f4fbf6;
    color: #1e7e34;
    font-size: 13px;
    font-weight: 600;
}

.btn-activar-camara-prod:active {
    background-color: #e6f5ea;
}

#videoProd {
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid #28a745;
    margin-top: 10px;
}

.video-producto-oculto {
    display: none;
}

.barra-camara {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: 14px;
}

.camara-diag {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
}

.camara-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
}

.camara-luz-encendida {
    background-color: #f7b500;
    color: #4a3200;
}

.visor-escaneo-simple {
    position: relative;
    width: 100%;
    height: 260px;
    overflow: hidden;
    background-color: #000;
}

.visor-escaneo-simple > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.visor-escaneo-simple video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.visor-escaneo-simple > div:first-child {
    display: none !important;
}

.visor-escaneo-simple #qr-shaded-region {
    box-sizing: border-box;
    width: auto !important;
    height: auto !important;
}
