/* style.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    display: flex;
    justify-content: center;
}

#app-container {
    width: 100%;
    max-width: 450px; /* Mobile-first constraint */
    min-height: 100vh;
    background-color: #ffffff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

#scanner-container {
    position: relative;
    width: 90%;
    margin: 20px auto 10px auto;
    aspect-ratio: 16/9; /* Common video aspect ratio */
    border: 2px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
}

#scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* This creates the rectangular target area */
    border-top: 50px solid rgba(0,0,0,0.5);
    border-bottom: 50px solid rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.laser-beam {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #32CD32; /* Green laser color */
    box-shadow: 0 0 5px #32CD32, 0 0 10px #32CD32;
    transform: translateY(-50%);
    animation: scan 2s infinite linear;
    display: none; /* Initially hidden */
}

@keyframes scan {
    0% { top: 10%; }
    50% { top: 90%; }
    100% { top: 10%; }
}

#controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
}

button {
    padding: 10px 25px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

#stopButton {
    background-color: #dc3545;
}

#stopButton:hover {
    background-color: #c82333;
}

#results-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 20px;
}

.book-result {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #fff;
    animation: fadeIn 0.5s ease-in-out;
}

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

.prioritized-info {
    background-color: #e9f5ff;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.prioritized-info p {
    margin: 5px 0;
    font-size: 14px;
}

.book-details h4 {
    margin: 0 0 5px 0;
}

.book-details .description {
    font-size: 14px;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit description to 3 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}