/**
 * OCR Scanner Styles for Mobile Trailer Number Capture
 * Touch-optimized interface with camera controls and status messages
 */

/* ============================================================================
   INPUT WITH CAMERA BUTTON
   ============================================================================ */

.input-with-camera {
    display: flex;
    gap: var(--spacing-sm);
    align-items: stretch;
}

.input-with-camera .form-control {
    flex: 1;
    min-height: 48px;
    font-size: 18px;
}

.camera-btn {
    min-width: 56px;
    min-height: 56px;
    font-size: 28px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.camera-btn:hover {
    background: var(--primary-dark);
}

.camera-btn:active {
    background: var(--primary-dark);
    transform: scale(0.95);
}

.camera-btn:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Hide camera button on desktop */
@media (min-width: 768px) {
    .camera-btn {
        display: none !important;
    }
}

/* ============================================================================
   OCR STATUS MESSAGES
   ============================================================================ */

.ocr-status {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ocr-status.ocr-success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.ocr-status.ocr-warning {
    display: block;
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.ocr-status.ocr-error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--error-color);
}

/* ============================================================================
   CAMERA MODAL
   ============================================================================ */

.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--spacing-md);
}

.camera-modal.active {
    display: flex;
}

.camera-modal-content {
    background: var(--gray-900);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-close:active {
    transform: scale(0.9);
}

/* ============================================================================
   CAMERA PREVIEW
   ============================================================================ */

#camera-preview {
    width: 100%;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    background: var(--gray-800);
    min-height: 300px;
    object-fit: cover;
}

#photo-upload {
    width: 100%;
    padding: var(--spacing-lg);
    background: var(--gray-800);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    color: var(--white);
    font-size: 16px;
    cursor: pointer;
    margin-bottom: var(--spacing-lg);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#photo-upload::-webkit-file-upload-button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================================================
   CAMERA CONTROLS
   ============================================================================ */

.camera-controls {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

.btn-capture,
.btn-cancel {
    min-height: 56px;
    padding: var(--spacing-md) var(--spacing-2xl);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    max-width: 200px;
}

.btn-capture {
    background: var(--success-color);
    color: var(--white);
}

.btn-capture:hover {
    background: #059669;
}

.btn-capture:active {
    background: #047857;
    transform: scale(0.98);
}

.btn-capture:disabled {
    background: var(--gray-600);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-cancel {
    background: var(--gray-700);
    color: var(--white);
}

.btn-cancel:hover {
    background: var(--gray-600);
}

.btn-cancel:active {
    background: var(--gray-800);
    transform: scale(0.98);
}

/* ============================================================================
   CAPTURE GUIDE
   ============================================================================ */

.capture-guide {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-top: var(--spacing-lg);
    font-size: 14px;
    line-height: 1.6;
}

.capture-guide p {
    margin: var(--spacing-xs) 0;
}

.capture-guide strong {
    color: var(--white);
    font-weight: 600;
}

/* ============================================================================
   PROCESSING OVERLAY
   ============================================================================ */

.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    gap: var(--spacing-lg);
}

.processing-overlay.active {
    display: flex;
}

.processing-message {
    color: var(--white);
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    margin-top: var(--spacing-md);
}

/* ============================================================================
   SPINNER
   ============================================================================ */

.spinner {
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--white);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   MOBILE OPTIMIZATIONS
   ============================================================================ */

@media (max-width: 480px) {
    .camera-modal-content {
        padding: var(--spacing-md);
        max-height: 95vh;
    }

    .camera-controls {
        flex-direction: column;
    }

    .btn-capture,
    .btn-cancel {
        max-width: none;
        width: 100%;
    }

    .modal-close {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

.camera-btn:focus,
.btn-capture:focus,
.btn-cancel:focus,
.modal-close:focus {
    outline: 3px solid rgba(124, 58, 237, 0.5);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
