/* Scanner Button */
.cfe-scanner-wrapper {
    margin-bottom: 20px;
}

#cfe-open-scanner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #E01A4F;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#cfe-open-scanner:hover {
    background: #c91644;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 26, 79, 0.3);
}

#cfe-open-scanner svg {
    flex-shrink: 0;
}

/* Modal Overlay */
.cfe-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body.cfe-modal-open {
    overflow: hidden;
}

/* Modal Content */
.cfe-modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Modal Header */
.cfe-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
}

.cfe-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.cfe-close-modal {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cfe-close-modal:hover {
    background: #f5f5f5;
    color: #333;
}

/* Modal Body */
.cfe-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Scanner Options */
.cfe-scanner-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cfe-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 20px;
    background: #f8f9fa;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cfe-option-btn:hover {
    background: #fff;
    border-color: #E01A4F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cfe-option-btn svg {
    color: #E01A4F;
}

.cfe-option-btn span {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Camera View */
#cfe-camera-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#cfe-video {
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: #000;
}

.cfe-camera-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Preview Area */
#cfe-preview-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#cfe-preview-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8f9fa;
}

.cfe-preview-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Buttons */
.cfe-btn-primary,
.cfe-btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cfe-btn-primary {
    background: #E01A4F;
    color: white;
}

.cfe-btn-primary:hover {
    background: #c91644;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 26, 79, 0.3);
}

.cfe-btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e5e5e5;
}

.cfe-btn-secondary:hover {
    background: #e9ecef;
    border-color: #ddd;
}

/* Processing State */
#cfe-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
}

.cfe-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #E01A4F;
    border-radius: 50%;
    animation: cfe-spin 1s linear infinite;
}

@keyframes cfe-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#cfe-status-text {
    font-size: 16px;
    color: #666;
    text-align: center;
    margin: 0;
}

/* Results/Success State */
#cfe-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px 20px;
}

.cfe-success-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.cfe-success-message svg {
    color: #28a745;
}

.cfe-success-message p {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.cfe-success-message .cfe-small {
    font-size: 14px;
    font-weight: 400;
    color: #666;
}

/* Debug Info */
.cfe-debug-info {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 12px;
}

.cfe-debug-info summary {
    cursor: pointer;
    font-weight: 600;
    color: #666;
    padding: 4px;
}

.cfe-debug-info summary:hover {
    color: #333;
}

.cfe-debug-info pre {
    margin: 8px 0 0 0;
    padding: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 11px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Responsive Design */
@media (max-width: 640px) {
    .cfe-modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .cfe-scanner-options {
        grid-template-columns: 1fr;
    }
    
    .cfe-option-btn {
        padding: 24px 20px;
    }
    
    #cfe-open-scanner {
        width: 100%;
        justify-content: center;
    }
}

/* Animation for modal */
@keyframes cfe-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cfe-modal-content {
    animation: cfe-fadeIn 0.2s ease;
}
