/* Image to Text (OCR) — tool-specific styling */

:root {
    --ocr-accent:       #e8554f;
    --ocr-accent-light: #fff0ef;
    --ocr-border:       #e8e8ec;
    --ocr-text-muted:   #888;
}

.img-ocr__panel-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.img-ocr__hint {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    padding: 0.75rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #0c5460;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
}

.img-ocr__hint .bi {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.img-ocr__privacy-warn {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    padding: 0.75rem 0.85rem;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
}

.img-ocr__privacy-warn .bi {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.img-ocr__usage {
    margin: 0.35rem 0 0;
    padding: 0.55rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.55;
    color: #555;
    background: #f0f4f8;
    border: 1px solid #dde4ea;
    border-radius: 8px;
    direction: rtl;
    text-align: right;
}

.img-ocr__option-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.img-ocr__option-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #333;
}

.img-ocr__select {
    width: 100%;
    padding: 0.65rem 2.5rem 0.65rem 1rem;
    font-size: 0.88rem;
    color: #333;
    background: #f5f5f7;
    border: 1px solid var(--ocr-border);
    border-radius: 8px;
    appearance: none;
    cursor: pointer;
    direction: rtl;
    text-align: right;
}

.img-ocr__select-wrap {
    position: relative;
}

.img-ocr__select-wrap::before {
    content: "";
    position: absolute;
    inset-inline-start: 1rem;
    top: 50%;
    transform: translateY(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #333;
    pointer-events: none;
}

.img-ocr__check {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.img-ocr__check-input {
    margin-top: 0.2rem;
    accent-color: var(--ocr-accent);
}

.img-ocr__result-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.img-ocr__result-label {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 0;
}

.img-ocr__result {
    width: 100%;
    min-height: 120px;
    max-height: 220px;
    resize: vertical;
    font-size: 0.82rem;
    line-height: 1.65;
    direction: rtl;
    text-align: right;
    border: 1px solid var(--ocr-border);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    background: #fafafa;
}

.img-ocr__result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.img-ocr__copy-btn {
    font-size: 0.82rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--ocr-border);
    background: #fff;
    color: #333;
    cursor: pointer;
}

.img-ocr__copy-btn:hover:not(:disabled) {
    border-color: var(--ocr-accent);
    color: var(--ocr-accent);
}

.img-ocr__copy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.img-ocr__grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    direction: rtl;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    align-content: start;
    gap: 14px;
    padding: 1rem 1.25rem 1.25rem;
}

.img-ocr__grid.is-drag-over {
    background: var(--ocr-accent-light);
    outline: 2px dashed var(--ocr-accent);
    outline-offset: -6px;
}

.img-ocr__card {
    position: relative;
    border: 2px solid var(--ocr-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    cursor: grab;
    transition: border-color 0.2s, box-shadow 0.2s, opacity 0.15s;
}

.img-ocr__card:hover {
    border-color: var(--ocr-accent);
    box-shadow: 0 2px 10px rgba(232, 85, 79, 0.12);
}

.img-ocr__card.is-dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.img-ocr__card.is-drag-over {
    border: 2px dashed var(--ocr-accent);
    background-color: var(--ocr-accent-light);
}

.img-ocr__preview-area {
    padding: 10px;
    background: #f5f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 130px;
}

.img-ocr__thumb {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.img-ocr__card-actions {
    position: absolute;
    top: 6px;
    inset-inline-start: 6px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}

.img-ocr__card:hover .img-ocr__card-actions {
    opacity: 1;
}

.img-ocr__btn-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(120, 120, 120, 0.85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.img-ocr__btn-remove:hover {
    background: rgba(80, 80, 80, 0.95);
}

.img-ocr__card-footer {
    padding: 5px 6px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.img-ocr__card-name {
    font-size: 0.72rem;
    color: var(--ocr-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.img-ocr__clear-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    color: var(--ocr-text-muted);
    text-decoration: underline;
    cursor: pointer;
}

.img-ocr__hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    width: 100%;
}

.img-ocr__camera-btn {
    background: #fff;
    color: var(--ocr-accent);
    border: 2px solid var(--ocr-accent);
    border-radius: 10px;
    padding: 0.85rem 1.5rem;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}

.img-ocr__camera-btn:hover {
    background: var(--ocr-accent-light);
}

@media (max-width: 767px) {
    .img-ocr__result {
        max-height: 160px;
    }

    .img-ocr__card-actions {
        opacity: 1;
    }
}
