/**
 * Receipt Scanner Styles
 * Styles for mobile camera interface and receipt preprocessing UI
 */

/* Camera Mode Toggle */
.camera-mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
}

.camera-mode-toggle .btn {
    flex: 1;
    min-width: 120px;
}

.camera-mode-toggle .btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* Camera Preview Container */
.camera-preview-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: #000;
    border-radius: 0.5rem;
    overflow: hidden !important;
    min-height: 60vh;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate; /* Create a stacking context to contain children */
}

.camera-video-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    display: block !important;
}

.camera-video-wrapper video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.camera-video-wrapper .edge-overlay {
    position: absolute !important;
    pointer-events: none !important;
    z-index: 2 !important;
    overflow: hidden !important;
    /* Size and position will be set via JavaScript to match actual video display area */
    /* DO NOT use object-fit on canvas - it doesn't work as expected */
}

.camera-preview-container video,
.camera-video-wrapper video {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    /* Ensure the live camera preview fits inside the frame similarly on upload link and modal */
    object-fit: contain !important;
    position: relative !important;
    z-index: 1 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.camera-preview-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

.camera-preview-container .edge-overlay {
    position: absolute !important;
    pointer-events: none !important;
    z-index: 2 !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    /* Size and position will be set dynamically via JavaScript */
    /* to match the actual video display area */
}

/* Camera Controls Overlay (New Mobile-Friendly Design) */
.camera-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.camera-controls-overlay button {
    pointer-events: auto;
}

.edge-detection-status {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    padding: 0.4rem 1.1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
    pointer-events: none;
    transition: background 0.2s ease;
}

.edge-detection-status i {
    color: #22c55e;
}

.edge-detection-status.detected {
    background: rgba(34, 197, 94, 0.85);
}

/* Capture Button - Bottom Center Overlay */
.btn-capture-overlay {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 4px solid white;
    background: #dc3545;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(220, 53, 69, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.btn-capture-overlay:hover {
    background: #bb2d3b;
    transform: translateX(-50%) scale(1.05);
}

.btn-capture-overlay:active {
    transform: translateX(-50%) scale(0.95);
}

/* Close Button - Top Right Corner */
.btn-camera-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.btn-camera-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.btn-camera-close:active {
    transform: scale(0.95);
}

/* Switch Camera Button - Top Left Corner */
.btn-camera-switch {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.btn-camera-switch:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1) rotate(180deg);
}

.btn-camera-switch:active {
    transform: scale(0.95);
}

/* Legacy Camera Controls (kept for backward compatibility) */
.camera-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.camera-controls .btn-capture {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px solid white;
    background: #dc3545;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.3);
    transition: all 0.2s ease;
}

.camera-controls .btn-capture:active {
    transform: scale(0.95);
}

.camera-controls .btn-secondary {
    align-self: center;
}

/* Processing Status Overlay */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.processing-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
}

.processing-overlay .processing-status {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.processing-overlay .processing-step {
    font-size: 0.9rem;
    color: #adb5bd;
}

/* Before/After Preview */
.preview-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

@media (max-width: 768px) {
    .preview-comparison {
        grid-template-columns: 1fr;
    }
}

.preview-item {
    position: relative;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f8f9fa;
}

.preview-item.active {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.preview-item img {
    width: 100%;
    height: auto;
    display: block;
}

.preview-item .preview-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.preview-item .preview-checkmark {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 30px;
    height: 30px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

/* Processing Steps List */
.processing-steps {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
}

.processing-steps-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.processing-steps ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.processing-steps li {
    padding: 0.25rem 0;
    color: #6c757d;
    font-size: 0.875rem;
}

.processing-steps li::before {
    content: "✓ ";
    color: #28a745;
    font-weight: bold;
    margin-right: 0.25rem;
}

/* Enhancement Badge */
.enhancement-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.enhancement-badge i {
    font-size: 0.875rem;
}

/* File Preview with Scanner */
.file-preview-scanner {
    position: relative;
    padding: 1rem;
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    background: white;
    margin-bottom: 1rem;
}

.file-preview-scanner.processing {
    border-color: #0d6efd;
    background: #f8f9ff;
}

.file-preview-scanner.enhanced {
    border-color: #28a745;
    background: #f8fff8;
}

.file-preview-image {
    max-width: 200px;
    border-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-preview-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-preview-details {
    flex: 1;
}

.file-preview-name {
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.25rem;
}

.file-preview-meta {
    font-size: 0.875rem;
    color: #6c757d;
}

.file-preview-actions {
    display: flex;
    gap: 0.5rem;
}

/* Mobile Optimizations */
@media (max-width: 576px) {
    .camera-mode-toggle {
        flex-direction: column;
    }
    
    .camera-mode-toggle .btn {
        width: 100%;
    }
    
    /* Optimized camera preview for mobile */
    .camera-preview-container {
        max-height: 60vh;
        border-radius: 0.375rem;
    }
    
    /* Smaller capture button on very small screens */
    .btn-capture-overlay {
        width: 58px;
        height: 58px;
        bottom: 15px;
        font-size: 1.3rem;
    }
    
    /* Smaller control buttons */
    .btn-camera-close,
    .btn-camera-switch {
        width: 32px;
        height: 32px;
        top: 10px;
        font-size: 0.95rem;
    }
    
    .btn-camera-close {
        right: 10px;
    }
    
    .btn-camera-switch {
        left: 10px;
    }
    
    /* Legacy controls */
    .camera-controls {
        flex-wrap: wrap;
    }
    
    .camera-controls .btn-capture {
        width: 60px;
        height: 60px;
    }
    
    .file-preview-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .file-preview-actions {
        width: 100%;
    }
    
    .file-preview-actions .btn {
        flex: 1;
    }
    
    /* Compact toggle even smaller on mobile */
    .scanner-toggle-compact-label {
        padding: 0.3rem 0.55rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }
    
    .scanner-toggle-compact-label input[type="checkbox"] {
        width: 12px;
        height: 12px;
    }
    
    .scanner-toggle-compact-label i {
        font-size: 0.7rem;
    }
    
    .scanner-toggle-compact-label span {
        font-size: 0.75rem;
    }
}

/* Camera Permission Prompt */
.camera-permission-prompt {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.camera-permission-prompt i {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.camera-permission-prompt h5 {
    color: #495057;
    margin-bottom: 0.5rem;
}

.camera-permission-prompt p {
    color: #6c757d;
    margin-bottom: 1rem;
}

/* Camera Not Available */
.camera-not-available {
    text-align: center;
    padding: 1.5rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 0.5rem;
    color: #856404;
}

.camera-not-available i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Scanner Toggle Switch - Compact Version */
.scanner-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.scanner-toggle-compact {
    flex: 1 1 160px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    padding: 0.55rem 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.scanner-toggle-compact:hover {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.12);
}

.scanner-toggle-compact-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1f2933;
    margin: 0;
}

.scanner-toggle-compact-label .toggle-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.scanner-toggle-compact-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    accent-color: #667eea;
}

.scanner-toggle-compact-label i {
    font-size: 1rem;
    color: #667eea;
}

.scanner-toggle-compact-label span,
.scanner-toggle-compact-label .toggle-meta {
    font-size: 0.85rem;
}

.btn-success-custom {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
    color: #fff;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-success-custom:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.25);
    color: #fff;
}

/* Multi-page capture card */
.multi-page-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 5px 15px rgba(15, 23, 42, 0.05);
    margin-bottom: 1rem;
}

.multi-page-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.multi-page-card-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.multi-page-card-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.multi-page-card-title p {
    margin: 0.15rem 0 0;
    color: #6b7280;
    font-size: 0.85rem;
}

.icon-pill {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-size: 1.25rem;
}

.multi-page-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.multi-page-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.multi-page-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    transition: 0.3s;
    border-radius: 999px;
}

.multi-page-switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.multi-page-switch input:checked + .multi-page-switch-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.multi-page-switch input:checked + .multi-page-switch-slider:before {
    transform: translateX(24px);
}

.multi-page-card-body {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

.multi-page-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(102, 126, 234, 0.08);
}

.multi-page-indicator-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #4c51bf;
    box-shadow: inset 0 0 0 1px rgba(76, 81, 191, 0.15);
}

.multi-page-indicator-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
}

.multi-page-indicator-text span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.multi-page-indicator-text strong {
    font-size: 1rem;
    color: #111827;
}

.multi-page-pill {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: #4c51bf;
}

.multi-page-helper-text {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: #4b5563;
}

.multi-page-thumbnails {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.75rem;
}

.multi-page-thumbnail {
    position: relative;
    width: 82px;
    height: 102px;
    border: 2px solid #667eea;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.multi-page-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.multi-page-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.multi-page-thumbnail .page-number {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    background: #667eea;
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.multi-page-thumbnail .remove-page {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.multi-page-thumbnail:hover .remove-page {
    opacity: 1;
}

/* Photo preview modal */
.photo-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 2000;
}

.photo-preview-modal.active {
    display: flex;
}

.photo-preview-container {
    background: #fff;
    border-radius: 1rem;
    width: min(640px, 100%);
    max-height: calc(90vh - env(safe-area-inset-bottom, 0px));
    overflow: visible;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 70px rgba(15, 23, 42, 0.35);
}

.photo-preview-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.photo-preview-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.photo-preview-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.photo-preview-content {
    padding: 1rem;
    overflow: auto !important;
    background: #f8fafc;
    flex: 1 1 auto;
    min-height: 200px;
    max-height: calc(90vh - 200px);
    -webkit-overflow-scrolling: touch;
    display: block;
}

.photo-preview-image {
    display: block !important;
    visibility: visible !important;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    min-width: 100%;
    object-fit: contain;
}

.multi-page-status {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 1.5rem 0;
    padding: 0.55rem 0.85rem;
    border-radius: 0.6rem;
    background: #eef2ff;
    color: #1e1b4b;
    font-size: 0.85rem;
    font-weight: 600;
}

.multi-page-status i {
    color: #4f46e5;
}

.multi-page-status small {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4338ca;
}

.photo-preview-footer {
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.photo-preview-footer .btn {
    min-width: 120px;
}

@media (max-width: 576px) {
    .multi-page-card-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .multi-page-indicator {
        flex-direction: column;
        align-items: flex-start;
    }

    .photo-preview-container {
        border-radius: 0.75rem;
    }

    .photo-preview-footer {
        flex-direction: column;
    }
}

/* Legacy Scanner Toggle Switch (kept for backward compatibility) */
.scanner-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.scanner-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.scanner-toggle-label i {
    color: #667eea;
}

/* Custom Toggle Switch */
.custom-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.custom-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.custom-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.custom-toggle input:checked + .custom-toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.custom-toggle input:checked + .custom-toggle-slider:before {
    transform: translateX(24px);
}

.custom-toggle input:focus + .custom-toggle-slider {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

/* Loading Animation */
@keyframes scannerPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.scanner-loading {
    animation: scannerPulse 1.5s ease-in-out infinite;
}

/* Success Animation */
@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-animation {
    animation: successPop 0.4s ease-out;
}

/* Progress Bar for Preprocessing */
.preprocessing-progress {
    margin: 1rem 0;
}

.preprocessing-progress .progress {
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    overflow: hidden;
}

.preprocessing-progress .progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.preprocessing-progress .progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* FINAL FIX: Force proper camera preview scaling to match upload page */
#cameraPreview,
.camera-preview-container video,
.camera-preview-container canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

/* BOOTSTRAP MODAL INTERFERENCE FIX: Override modal flex/display rules for video */
.modal #cameraPreview,
.modal .camera-preview-container video,
.modal-content #cameraPreview,
.modal-content .camera-preview-container video,
.modal-dialog #cameraPreview,
.modal-dialog .camera-preview-container video {
    width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
    object-fit: contain !important;
    transform: none !important;
    flex: none !important;
    align-self: auto !important;
    justify-self: auto !important;
}

/* Ensure modal camera container doesn't inherit flex properties that could distort video */
.modal .camera-preview-container,
.modal-content .camera-preview-container,
.modal-dialog .camera-preview-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
}

/* CRITICAL EMERGENCY FIX: Override EVERYTHING to force proper video scaling */
#cameraPreview {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    position: relative !important;
    transform: scale(1) !important;
}

.modal #cameraPreview,
.modal-content #cameraPreview,
.modal-dialog #cameraPreview {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    position: relative !important;
    transform: scale(1) !important;
}

