/* QR Scanner Specific Responsive Styles */

/* Ensure QR button is visible on all screen sizes */
.qr-scanner-btn {
    min-width: 40px !important;
    white-space: nowrap;
}

/* QR button responsive behavior */
@media (max-width: 767.98px) {
    .qr-scanner-btn .command-text {
        display: none !important;
    }
    
    .qr-scanner-btn {
        padding: 0.5rem !important;
    }
}

@media (min-width: 768px) {
    .qr-scanner-btn .command-text {
        display: inline !important;
    }
}

/* QR Scanner modal optimizations */
.qr-scanner-modal {
    z-index: 10001 !important;
}

.qr-scanner-modal .k-window-content {
    padding: 1rem !important;
}

@media (max-width: 768px) {
    .qr-scanner-modal {
        width: 95% !important;
        max-width: none !important;
        margin: 0.5rem !important;
    }
    
    .qr-scanner-modal .k-window-content {
        padding: 0.5rem !important;
    }
}

/* QR Scanner Component Styles */
.qr-scanner-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.camera-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.camera-preview {
    position: relative;
    width: 100%;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-preview video {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
}

/* QR Scanner Overlay */
.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    pointer-events: none;
    z-index: 10;
}

.scan-frame {
    position: relative;
    width: 200px;
    height: 200px;
    border: 2px solid transparent;
}

.scan-corners {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #007bff;
}

.corner.top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
}

.corner.top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
}

.corner.bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
}

.corner.bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #007bff, transparent);
    animation: scan-line 2s linear infinite;
}

@keyframes scan-line {
    0% { transform: translateY(0); }
    100% { transform: translateY(200px); }
}

.scan-instruction {
    margin-top: 1rem;
    color: white;
    text-align: center;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 16px;
}

/* Camera Controls */
.camera-controls {
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.control-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.scan-button {
    min-width: 140px;
}

.switch-camera-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Manual Input Section */
.manual-input-section {
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
}

.mobile-manual-input {
    border-top: 1px solid #dee2e6;
    padding-top: 0.5rem;
}

.manual-input-collapsible {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.manual-input-toggle {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    list-style: none;
    user-select: none;
}

.manual-input-toggle::-webkit-details-marker {
    display: none;
}

.manual-input-content {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid #dee2e6;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .qr-scanner-container {
        max-width: 100%;
    }
    
    .camera-preview {
        min-height: 250px;
    }
    
    .camera-preview video {
        max-height: 300px;
    }
    
    .scan-frame {
        width: 150px;
        height: 150px;
    }
    
    .scan-line {
        animation: scan-line-mobile 2s linear infinite;
    }
    
    @keyframes scan-line-mobile {
        0% { transform: translateY(0); }
        100% { transform: translateY(150px); }
    }
    
    .control-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .scan-button {
        width: 100%;
        min-width: unset;
    }
}

/* WebView specific adjustments */
.webview-detected .camera-preview {
    background: #343a40;
    color: white;
}

.webview-detected .scan-instruction {
    background: rgba(255, 255, 255, 0.9);
    color: #343a40;
}

/* Status alerts */
.qr-scanner-container .alert {
    margin-bottom: 0;
    border-radius: 6px;
}

.qr-scanner-container .alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.qr-scanner-container .alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.qr-scanner-container .alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}