/**
 * Estilos del Scanner OCR/QR - Sistema Notarial atinet v3.0
 * Estilos específicos para módulos de escaneo
 */

/* ============================================
   MODAL DEL SCANNER
   ============================================ */
.scanner-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.scanner-modal.active {
    display: flex;
}

.scanner-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ============================================
   VIDEO Y CANVAS
   ============================================ */
#scanner-video {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    background-color: #000;
}

#scanner-canvas {
    display: none;
}

.scanner-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 0.5rem;
    overflow: hidden;
}

/* ============================================
   OVERLAY DE DETECCIÓN
   ============================================ */
.detection-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.detection-box {
    position: absolute;
    border: 3px solid #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-color: #22c55e;
        box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
    }
    50% {
        border-color: #16a34a;
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.5);
    }
}

/* ============================================
   CONTROLES DEL SCANNER
   ============================================ */
.scanner-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.scanner-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.scanner-btn-primary {
    background-color: #0284c7;
    color: white;
}

.scanner-btn-primary:hover {
    background-color: #0369a1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.3);
}

.scanner-btn-danger {
    background-color: #ef4444;
    color: white;
}

.scanner-btn-danger:hover {
    background-color: #dc2626;
}

.scanner-btn-secondary {
    background-color: #16a34a;
    color: white;
}

.scanner-btn-secondary:hover {
    background-color: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.3);
}

.scanner-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   INDICADORES DE ESTADO
   ============================================ */
.scanner-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.scanner-status-loading {
    background-color: #dbeafe;
    color: #1e40af;
}

.scanner-status-success {
    background-color: #dcfce7;
    color: #166534;
}

.scanner-status-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.scanner-status-warning {
    background-color: #fef9c3;
    color: #854d0e;
}

.scanner-status-icon {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
}

/* ============================================
   PROGRESO DEL ESCANEO
   ============================================ */
.scanner-progress {
    width: 100%;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 1rem;
}

.scanner-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0284c7, #22c55e);
    transition: width 0.3s ease-out;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

/* ============================================
   LISTA DE DOCUMENTOS ESCANEADOS
   ============================================ */
.scanned-documents {
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.scanned-document-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.scanned-document-item:last-child {
    margin-bottom: 0;
}

.scanned-document-thumbnail {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 0.25rem;
}

.scanned-document-info {
    flex: 1;
}

.scanned-document-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #111827;
}

.scanned-document-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

.scanned-document-remove {
    padding: 0.5rem;
    color: #ef4444;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.scanned-document-remove:hover {
    background-color: #fee2e2;
}

/* ============================================
   QR READER ESPECÍFICO
   ============================================ */
#qr-reader {
    width: 100%;
    border-radius: 0.5rem;
    overflow: hidden;
}

#qr-reader__dashboard_section_swaplink {
    display: none !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .scanner-container {
        width: 95%;
        padding: 1rem;
    }
    
    .scanner-controls {
        flex-direction: column;
    }
    
    .scanner-btn {
        width: 100%;
        min-width: unset;
    }
}

/* ============================================
   ANIMACIONES DE ESCANEO
   ============================================ */
@keyframes scan-line {
    0% {
        top: 0;
    }
    100% {
        top: 100%;
    }
}

.scanning-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        #22c55e 50%, 
        transparent
    );
    animation: scan-line 2s ease-in-out infinite;
    box-shadow: 0 0 10px #22c55e;
}

/* ============================================
   FLASH DE CAPTURA
   ============================================ */
@keyframes flash {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.capture-flash {
    position: fixed;
    inset: 0;
    background: white;
    pointer-events: none;
    animation: flash 0.3s ease-out;
    z-index: 10000;
}
