/* Fixed Asset System CSS */

body {
    font-family: 'Sarabun', sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    /* Enhanced mobile touch handling */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Force video elements to normal size globally */
video {
    transform: scale(1) !important;
    -webkit-transform: scale(1) !important;
    -moz-transform: scale(1) !important;
    -ms-transform: scale(1) !important;
    zoom: 1 !important;
    -webkit-zoom: 1 !important;
    object-fit: cover !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

.main-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 20px auto;
    max-width: 800px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.header-section {
    background: linear-gradient(135deg, #4a69bd, #3c5aa6);
    color: white;
    padding: 25px;
    text-align: center;
}

.header-section h1 {
    margin: 0;
    font-weight: 600;
    font-size: 1.8rem;
}

.content-section {
    padding: 30px;
}

.test-mode-banner {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: none;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.2);
    color: white;
}

.user-info-card,
.asset-card {
    background: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.employee-registration-card {
    background: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.scan-btn {
    background: linear-gradient(135deg, #229954, #27ae60);
    border: none;
    border-radius: 10px;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.25);
    cursor: pointer;
}

.scan-btn:hover {
    color: #fff;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.asset-details-card {
    background: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.detail-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-left: 4px solid #4a69bd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.detail-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.detail-value {
    color: #6c757d;
    font-size: 1rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    border: 2px solid #e0e6ed;
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #4a69bd;
    box-shadow: 0 0 0 0.2rem rgba(74, 105, 189, 0.25);
}

.btn-confirm {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    border-radius: 10px;
    padding: 14px 28px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
    color: white;
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.35);
    background: linear-gradient(135deg, #2980b9, #21618c);
    color: white;
}

.btn-warning-update {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: none;
    color: white;
}

.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #b6b6b6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.version-info {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    background: #f8f9fa;
    border-top: 1px solid #e0e6ed;
}

.icon-badge {
    font-size: 1.5rem;
    margin-right: 10px;
}

.status-badge {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-normal {
    background: #d1f2eb;
    color: #0e6251;
}

.status-damaged {
    background: #fadbd8;
    color: #922b21;
}

.toast-container {
    z-index: 9999;
}

/* Media Queries */
@media (max-width: 768px) {
    .main-container {
        margin: 10px;
        border-radius: 10px;
    }
    
    .content-section {
        padding: 20px;
    }
    
    .header-section {
        padding: 20px;
    }
    
    .header-section h1 {
        font-size: 1.5rem;
    }
    
    .scan-btn {
        padding: 15px;
        font-size: 1rem;
    }
    
    .detail-item {
        padding: 10px 12px;
    }
}

/* Hover Effects */
.user-info-card,
.asset-card,
.employee-registration-card,
.asset-details-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.user-info-card:hover,
.asset-card:hover,
.asset-details-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Button States */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Form Validation Styles */
.form-control:invalid {
    border-color: #e74c3c;
}

.form-control:valid {
    border-color: #27ae60;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f3f5;
}

::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

/* Mobile Touch Enhancements */
@media (max-width: 768px) {
    /* Enhanced touch targets for mobile */
    video, canvas {
        -webkit-tap-highlight-color: rgba(76, 175, 80, 0.2);
        touch-action: manipulation;
        cursor: pointer;
        /* Force video element to normal size */
        max-width: 100% !important;
        max-height: 100% !important;
        transform: scale(1) !important;
        zoom: 1 !important;
        /* Prevent browser auto-zoom */
        -webkit-transform: scale(1) !important;
        -moz-transform: scale(1) !important;
        -ms-transform: scale(1) !important;
    }

    /* Touch feedback animation */
    video:active, canvas:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Mobile status styling */
    #mobile-status {
        border-radius: 8px;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        animation-duration: 0.5s;
    }

    /* Improved button touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better modal touch handling */
    .qr-scanner-modal video {
        border: 2px dashed #007bff;
        border-radius: 8px;
        transition: all 0.2s ease;
        /* Force zoom reset via CSS */
        transform: scale(1) !important;
        transform-origin: center center !important;
        width: 100% !important;
        height: auto !important;
        object-fit: cover !important;
    }

    .qr-scanner-modal video:active {
        border-color: #28a745;
        box-shadow: 0 0 15px rgba(40, 167, 69, 0.3);
        /* Maintain scale during touch */
        transform: scale(0.98) !important;
    }

    /* QR Scanner Modal specific styles */
    .qr-scanner-modal {
        /* Prevent any zoom inheritance */
        zoom: 1 !important;
        -webkit-zoom: 1 !important;
        transform: scale(1) !important;
    }

    .qr-scanner-modal .modal-body {
        zoom: 1 !important;
        -webkit-zoom: 1 !important;
        transform: scale(1) !important;
        overflow: hidden !important;
    }

    /* Force QR reader container to normal size */
    [id^="qr-reader-"] {
        zoom: 1 !important;
        -webkit-zoom: 1 !important;
        transform: scale(1) !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        overflow: hidden !important;
    }

    /* HTML5-QRCode library specific */
    [id^="qr-reader-"] > div {
        zoom: 1 !important;
        -webkit-zoom: 1 !important;
        transform: scale(1) !important;
    }
}

/* Scanner Container - Prevent Browser Zoom */
#scanner-container {
    touch-action: pan-y pinch-zoom !important;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#scanner-container * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* QR Reader - Prevent Double Tap Zoom */
#qr-reader {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
}

#qr-reader video {
    touch-action: manipulation !important;
    pointer-events: auto;
}

/* Scanner Buttons - Allow Touch */
#scanner-container button,
#scanner-container input[type="range"] {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}