/* QR Scanner Module Styles */

/* QR Scanner Section - Bottom Right */
.qr-scanner-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: all 0.3s ease;
}

.qr-scanner-floating.collapsed {
    width: 60px;
    height: 60px;
}

.qr-scanner-floating.expanded {
    width: 280px;
    height: auto;
}

.qr-scanner-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}

.qr-scanner-toggle:hover {
    transform: scale(1.05);
}

.qr-scanner-toggle.active {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.qr-scanner-toggle.active::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

.qr-scanner-toggle.scanning {
    animation: scan-flash 0.5s ease;
}

@keyframes scan-flash {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
}

@keyframes pulse-green {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.2);
    }
}

.qr-scanner-content {
    display: none;
    padding: 15px;
}

.qr-scanner-floating.expanded .qr-scanner-content {
    display: block;
}

.qr-scanner-floating.expanded .qr-scanner-toggle {
    border-radius: 0;
}

.qr-scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.qr-scanner-header h4 {
    margin: 0;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qr-close-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s;
}

.qr-close-btn:hover {
    color: #333;
}

#qr-reader {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    display: none;
}

/* Collapsed state - camera hidden but active in background.
   We can't shrink the element to 1×1 px because the html5-qrcode library
   wouldn't be able to decode QR codes from a 1-pixel video stream.
   Instead, position it off-screen at a usable size (300×300). */
.qr-scanner-floating.collapsed #qr-reader {
    position: fixed;
    left: -9999px;
    top: -9999px;
    width: 300px;
    height: 300px;
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    display: block;
}

.qr-scanner-floating.collapsed #qr-reader video {
    width: 300px !important;
    height: 300px !important;
}

/* Expanded state - camera visible */
.qr-scanner-floating.expanded #qr-reader {
    display: block;
    width: 100%;
    height: auto;
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

#qr-reader video {
    display: block !important;
    width: 100% !important;
}

.qr-status {
    margin-top: 10px;
    padding: 8px;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
}

.qr-status.scanning {
    background: #e3f2fd;
    color: #0d47a1;
}

.qr-status.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.qr-status.error {
    background: #ffebee;
    color: #c62828;
}

.qr-status.waiting {
    background: #fff3e0;
    color: #e65100;
}

.qr-instructions {
    margin-top: 10px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 11px;
    color: #666;
}

.qr-instructions h5 {
    margin: 0 0 5px 0;
    font-size: 12px;
    color: #333;
    font-weight: 600;
}

.qr-instructions ul {
    margin: 0;
    padding-left: 15px;
}

.qr-instructions li {
    margin-bottom: 3px;
}
