body {
    font-family: Arial, sans-serif;
    background: #f2f2f2;
    margin: 0;
}

.controls {
    background: #fff;
    padding: 10px;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    gap: 8px;
    align-items: center;
}

input, select, button {
    padding: 6px 8px;
    font-size: 14px;
}

#counter {
    font-weight: bold;
}

#pdfViewer {
    width: 85%;
    margin: auto;
}

.page {
    position: relative;
    margin: 20px auto;
    background: white;
    box-shadow: 0 0 6px rgba(0,0,0,0.2);
}

canvas {
    display: block;
}

/* Text layer ABOVE canvas */
.textLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

/* Hide extracted text */
.textLayer span {
    position: absolute;
    white-space: pre;
    transform-origin: 0% 0%;
    color: transparent !important;
}

/* Solid highlight */
.highlight {
    background: rgba(255, 255, 0, 0.95);
    outline: 2px solid orange;
    border-radius: 2px;
    opacity: 0.2;
}

/* ===== LOADER ===== */
#loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 5px solid #ddd;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

#loaderText {
    margin-top: 10px;
    font-weight: bold;
}