/* ==========================================
   IMAGE TO TEXT (OCR)
========================================== */

.ocr-page .tool-page-title {
    font-size: 2.25rem;
    font-weight: 700;
}

.ocr-page .tool-page-description {
    font-size: 1.075rem;
    color: var(--gray-color, #6b7280);
    max-width: 780px;
    margin: 0 auto;
}

.ocr-page kbd {
    background: #1f2937;
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ---------- Selection stage ---------- */
.ocr-stage {
    position: relative;
    display: block;
    margin: 0 auto;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
    line-height: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    touch-action: none;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f3f5;
    background-image:
        linear-gradient(45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(-45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9ecef 75%),
        linear-gradient(-45deg, transparent 75%, #e9ecef 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

#ocrCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

/* Selection rectangle: everything outside is dimmed. */
.ocr-sel {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 2;
}

.ocr-sel::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px dashed rgba(37, 99, 235, 0.95);
}

/* ---------- Processed preview ---------- */
.ocr-proc-preview {
    background: #e9ecef;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    overflow: hidden;
}

#ocrProcCanvas {
    max-width: 100%;
    height: auto;
    display: block;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ---------- Output ---------- */
.ocr-output {
    font-size: 0.95rem;
    line-height: 1.7;
    resize: vertical;
    min-height: 220px;
    font-family: inherit;
}

/* Urdu, Arabic and Persian read better at a slightly larger size. */
.ocr-output[dir="rtl"] {
    font-size: 1.15rem;
    line-height: 2;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .ocr-page .tool-page-title {
        font-size: 1.75rem;
    }

    .ocr-output {
        min-height: 180px;
    }
}
