/* Ensure the body and html elements take up the full viewport */
body, html {
    font-family: Arial, sans-serif;
    min-height: 100%;
    margin: 0;
    padding: 0;
    background-color: #f4f7fa;
    color: #333;
    text-align: center;
    box-sizing: border-box;
}

/* Title Style */
h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

/* Container that holds all the elements */
.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    box-sizing: border-box;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Hide the barcode wrapper when there's no barcode */
.barcode-wrapper {
    display: flex; /* Initially hide the barcode wrapper */
    justify-content: center;
    align-items: center;
    min-height: 200px; /* Ensure the space is reserved */
    margin-top: 20px;
}

/* Show the barcode wrapper only when the barcode is generated */
.barcode-wrapper.show {
    display: flex;
}

svg {
    max-width: 100%;
    height: auto;
    display: block; /* Ensure it doesn't stretch vertically */
}

/* Make the input and button elements look consistent */
input, button {
    font-size: 20px;
    margin: 10px 0;
    padding: 15px;
    width: 100%;
    border: 2px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    box-sizing: border-box;
}

/* Prevent input from going to the edge */
input {
    text-align: center;
    width: calc(100% - 20px);
}

/* Button styling */
button {
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

/* Popup and Message Modal Styles */
.popup, .message-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content, .message-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-sizing: border-box;
}

.popup input {
    font-size: 20px;
    padding: 15px;
    width: calc(100% - 20px);
    margin-bottom: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
}

.popup button {
    margin-top: 10px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.popup button:hover {
    background-color: #45a049;
}

.popup button:last-child {
    background-color: #f44336;
}

.popup button:last-child:hover {
    background-color: #e53935;
}

/* Version Number Styling */
.version {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 1rem;
    font-weight: 400;
    color: #888;
    z-index: 1000;
}

/* Button Enhancements */
a.view-history-button, a.back-button {
    padding: 15px;
    background-color: #4CAF50;
    color: white;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
    font-size: 20px;
    transition: background-color 0.3s;
    text-align: center;
    box-sizing: border-box;
}

a.view-history-button:hover, a.back-button:hover {
    background-color: #45a049;
}

a.view-history-button {
    margin-bottom: 10px;
}

/* Mobile-Friendly Layout for Buttons */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    h2 {
        font-size: 2rem;
    }

    input, button, a {
        font-size: 18px;
    }

    a.view-history-button, a.back-button {
        width: 100%;
        font-size: 18px;
    }
}

/* Style for history items */
.history-item {
    margin: 10px 0;
}

.history-button {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
}

.history-button:hover {
    text-decoration: none;
    color: #0056b3;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

#scanArea {
    position: relative;
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: black;
    overflow: hidden; /* Prevents video from overflowing */
}

/* Ensure the video is sized and positioned correctly */
#scannerVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the video completely covers the container */
}

/* The scan box overlay */
#scanBox {
    position: absolute;
    width: 80%;
    height: 30%;
    border: 2px solid red;
    box-shadow: 0 0 10px red;
    opacity: 0.8;
    pointer-events: none; /* Ensures the box doesn’t block interactions */
}

.image-upload {
    display: flex; /* Use flexbox to align items in a row */
    justify-content: center; /* Center the elements horizontally */
    align-items: center; /* Vertically center the items */
    gap: 10px; /* Add space between the file input and button */
    width: 100%; /* Ensure it takes full width if needed */
}

.image-upload input[type="file"] {
    font-size: 16px; /* Adjust the size of the file input box */
    padding: 10px; /* Add padding for better visibility */
    border: 2px solid #ccc; /* Border around the input */
    border-radius: 5px; /* Slightly rounded corners */
}

.image-upload button {
    font-size: 16px; /* Make the button font size consistent */
    padding: 10px 20px; /* Add padding for a larger button */
    border: 2px solid #ccc; /* Border around the button */
    border-radius: 5px; /* Slightly rounded corners */
    background-color: #4CAF50; /* Green background */
    color: white; /* White text */
    cursor: pointer; /* Pointer cursor on hover */
    transition: background-color 0.3s; /* Smooth transition on hover */
}

.image-upload button:hover {
    background-color: #45a049; /* Darker green when hovered */
}
