/* QR Scanner Container */
.trs-qr-scanner-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    background-color: #f5f5f5;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.trs-qr-scanner-header {
    text-align: center;
    margin-bottom: 20px;
}

.trs-qr-scanner-header h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

/* Scanner area */
.trs-qr-scanner-inner {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #3498db;
}

#trs-qr-reader {
    width: 100% !important;
    height: 100% !important;
    background-color: #000;
}

#trs-qr-reader video {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Scanner overlay with scanning animation */
.trs-scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.trs-scan-area {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    border: 2px solid #3498db;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);
    animation: trs-pulse 1.5s infinite;
}

/* Status message */
.trs-qr-status {
    text-align: center;
    margin: 10px 0;
    min-height: 24px;
    color: #555;
    font-weight: bold;
}

/* Result input */
.trs-scan-result {
    margin-bottom: 20px;
    text-align: center;
}

.trs-scan-result-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    background-color: #fff;
}

/* Buttons */
.trs-qr-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.trs-scan-button {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.trs-scan-button:hover {
    background-color: #2980b9;
}

/* Success animation - เปลี่ยนจากเครื่องหมายถูกเป็นรถวิ่ง */
.trs-success-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.trs-success-animation.active {
    visibility: visible;
    opacity: 1;
}

/* เปลี่ยนจาก checkmark circle เป็น car circle */
.trs-car-circle {
    width: 150px;
    height: 150px;
    position: relative;
    background-color: #4caf50;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    transform: scale(0);
    animation: trs-scale-up 0.4s ease-out forwards;
    overflow: hidden;
}

/* สร้างรถด้วย CSS */
.trs-car {
    position: absolute;
    top: 50%;
    left: -60px; /* เริ่มต้นจากนอกวงกลม */
    transform: translateY(-50%);
    width: 60px;
    height: 30px;
    background-color: white;
    border-radius: 10px;
    animation: trs-car-drive 1.5s ease-in-out forwards;
}

/* ส่วนหลังคารถ */
.trs-car:before {
    content: '';
    position: absolute;
    top: -15px;
    left: 10px;
    width: 35px;
    height: 20px;
    background-color: white;
    border-radius: 10px 10px 0 0;
}

/* ล้อรถ */
.trs-car:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 10px;
    width: 10px;
    height: 10px;
    background-color: #333;
    border-radius: 50%;
    box-shadow: 30px 0 0 #333;
    animation: trs-wheel-rotate 0.5s linear infinite;
}

/* ไฟหน้ารถ */
.trs-car-light {
    position: absolute;
    right: 0;
    top: 5px;
    width: 8px;
    height: 8px;
    background-color: #ffcc00;
    border-radius: 50%;
    box-shadow: 0 0 10px 5px rgba(255, 204, 0, 0.5);
}

/* Animation สำหรับรถวิ่ง */
@keyframes trs-car-drive {
    0% {
        left: -60px;
    }
    100% {
        left: 150px; /* วิ่งออกนอกวงกลม */
    }
}

/* Animation สำหรับล้อหมุน */
@keyframes trs-wheel-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Animations */
@keyframes trs-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4), 0 0 0 4000px rgba(0, 0, 0, 0.3);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(52, 152, 219, 0), 0 0 0 4000px rgba(0, 0, 0, 0.3);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0), 0 0 0 4000px rgba(0, 0, 0, 0.3);
    }
}

@keyframes trs-scale-up {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* Hide QR code reader library elements we don't need */
#trs-qr-reader__dashboard {
    display: none !important;
}

#trs-qr-reader__scan_region {
    display: none !important;
}

#trs-qr-reader__status_span {
    display: none !important;
}

/* Icon Button Style */
.trs-scan-icon-button {
    background-color: #FF8C00; /* สีส้ม */
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    outline: none;
}

.trs-scan-icon-button:hover {
    background-color: #FF7000;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.trs-scan-icon-button i {
    font-size: 28px;
}

/* Fullscreen Modal for Scanner */
.trs-qr-scanner-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background-color: #000;
}

.trs-qr-scanner-fullscreen {
    width: 100%;
    height: 100%;
    position: relative;
}

.trs-qr-scanner-fullscreen #trs-qr-reader {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

.trs-qr-scanner-fullscreen .trs-qr-status {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    margin: 0;
}

.trs-close-scan {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10001;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 20px;
}

.trs-close-scan:hover {
    background-color: rgba(255, 0, 0, 0.7);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .trs-qr-scanner-container {
        padding: 15px;
    }
    
    .trs-qr-scanner-inner {
        height: 250px;
    }
    
    .trs-scan-area {
        width: 180px;
        height: 180px;
    }
    
    .trs-scan-icon-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}