/* =============================================================================
   OCR Tool — Premium Styles
   ============================================================================= */
.iht-ocr-wrap {
    --ocr-bg:      #0d0d12;
    --ocr-card:    #16161f;
    --ocr-input:   #1e1e2a;
    --ocr-border:  #2a2a38;
    --ocr-text:    #f0f0f5;
    --ocr-muted:   #8888a0;
    --ocr-accent:  #a855f7;
    --ocr-accent2: #ec4899;
    --ocr-radius:  24px;
    font-family: 'Inter', sans-serif;
}

.iht-ocr-wrap {
    background: var(--ocr-bg);
    border-radius: var(--ocr-radius);
    max-width: 880px;
    margin: 32px auto;
    color: var(--ocr-text);
    box-shadow: 0 0 0 1px var(--ocr-border), 0 32px 80px rgba(0,0,0,0.6);
    position: relative;
    overflow: hidden;
}
.iht-ocr-wrap::before {
    content: ''; position: absolute; top: -100px; right: -100px; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 70%); pointer-events: none;
}

/* ШАПКА */
.iht-ocr-header {
    display: flex; align-items: center; gap: 14px;
    padding: 20px 24px; border-bottom: 1px solid var(--ocr-border);
    background: var(--ocr-card); position: relative; z-index: 2;
}
.iht-ocr-icon {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 14px;
    background: linear-gradient(135deg, var(--mod-c1, var(--ocr-accent)), var(--mod-c2, var(--ocr-accent2)));
    font-size: 20px; color: #fff; flex-shrink: 0;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--mod-c1, var(--ocr-accent)) 40%, transparent);
}
.iht-ocr-title    { font-size: 16px; font-weight: 700; margin: 0; }
.iht-ocr-subtitle { font-size: 12px; color: var(--ocr-muted); margin-top: 4px; }

/* ТЕЛО */
.iht-ocr-body { padding: 24px; position: relative; z-index: 2; }
.iht-ocr-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.iht-ocr-col { display: flex; flex-direction: column; gap: 16px; }

/* НАСТРОЙКИ (SELECT) */
.iht-ocr-settings label { font-size: 11px; font-weight: 600; color: var(--ocr-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 8px; }
.iht-ocr-select {
    width: 100%; background: var(--ocr-input); border: 1px solid var(--ocr-border);
    border-radius: 12px; padding: 14px 16px; color: var(--ocr-text); font-size: 14px;
    outline: none; cursor: pointer; font-family: inherit; transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 16px center; background-size: 16px;
}
.iht-ocr-select:focus { border-color: var(--ocr-accent); }
.iht-ocr-select option { background: var(--ocr-card); color: var(--ocr-text); }

/* ЗОНА ЗАГРУЗКИ (DROPZONE) */
.iht-ocr-dropzone {
    border: 2px dashed var(--ocr-border); border-radius: 16px; padding: 40px 20px;
    text-align: center; cursor: pointer; transition: all 0.3s ease;
    background: var(--ocr-input); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    min-height: 220px;
}
.iht-ocr-dropzone:hover, .iht-ocr-dropzone.dragover {
    border-color: var(--ocr-accent); background: rgba(168,85,247,0.05);
}
.iht-ocr-dropzone-icon {
    width: 56px; height: 56px; border-radius: 50%; background: var(--ocr-card);
    display: flex; align-items: center; justify-content: center; font-size: 24px;
    color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.2); margin-bottom: 8px;
    border: 1px solid var(--ocr-border);
}
.iht-ocr-dropzone p { margin: 0; font-size: 14px; font-weight: 500; color: var(--ocr-text); }
.iht-ocr-dropzone span { color: var(--ocr-accent2); text-decoration: none; font-weight: 600; }
.iht-ocr-hint { font-size: 12px; color: var(--ocr-muted); }

/* ПРЕВЬЮ КАРТИНКИ */
.iht-ocr-preview-container {
    border-radius: 16px; overflow: hidden; border: 1px solid var(--ocr-border);
    background: var(--ocr-input); display: flex; flex-direction: column;
    position: relative; min-height: 220px; justify-content: center;
}
.iht-ocr-preview-container img {
    width: 100%; max-height: 260px; object-fit: contain; display: block;
}
.iht-ocr-btn-small {
    position: absolute; top: 12px; right: 12px;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    color: #ff8a80; border: 1px solid rgba(255,138,128,0.2); padding: 8px 12px; border-radius: 8px;
    cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.iht-ocr-btn-small:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

/* ПОЛОСА ПРОГРЕССА */
.iht-ocr-progress-box {
    background: var(--ocr-input); padding: 16px; border-radius: 12px; border: 1px solid var(--ocr-border);
}
.iht-ocr-status { font-size: 13px; color: var(--ocr-text); margin-bottom: 10px; font-weight: 600; text-align: center; }
.iht-ocr-progress-bar { width: 100%; height: 8px; background: var(--ocr-card); border-radius: 4px; overflow: hidden; }
.iht-ocr-progress-fill {
    height: 100%; width: 0%; border-radius: 4px; transition: width 0.3s ease;
    background: linear-gradient(90deg, var(--ocr-accent), var(--ocr-accent2));
    box-shadow: 0 0 10px rgba(168,85,247,0.5);
}

/* ТЕКСТОВОЕ ПОЛЕ РЕЗУЛЬТАТА */
.iht-ocr-result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: -4px; }
.iht-ocr-result-title { font-size: 11px; font-weight: 600; color: var(--ocr-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.iht-ocr-confidence { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: var(--ocr-input); border: 1px solid var(--ocr-border); }

.iht-ocr-textarea {
    flex-grow: 1; min-height: 280px; background: var(--ocr-input); border: 1px solid var(--ocr-border);
    border-radius: 16px; padding: 18px; color: var(--ocr-text); font-size: 14px; line-height: 1.6;
    outline: none; resize: none; font-family: inherit; transition: border-color 0.2s;
}
.iht-ocr-textarea:focus { border-color: var(--ocr-accent); box-shadow: 0 0 0 3px rgba(168,85,247,0.1); }
.iht-ocr-textarea::placeholder { color: var(--ocr-muted); }

/* КНОПКИ ОСНОВНЫЕ */
.iht-ocr-btn {
    background: linear-gradient(135deg, var(--ocr-accent), var(--ocr-accent2));
    color: #fff !important; border: none; padding: 14px 24px; border-radius: 12px;
    font-weight: 600; font-size: 14px; cursor: pointer; transition: opacity 0.2s, transform 0.1s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 16px rgba(168,85,247,0.3); width: 100%;
}
.iht-ocr-btn:hover:not(:disabled)  { opacity: 0.88; }
.iht-ocr-btn:active:not(:disabled) { transform: scale(0.98); }
.iht-ocr-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; background: var(--ocr-input); color: var(--ocr-muted) !important; border: 1px solid var(--ocr-border); }
.iht-ocr-btn.is-processing:disabled {
    opacity: 1 !important; cursor: wait !important;
    background: linear-gradient(135deg, #8b5cf6, #c084fc) !important;
    box-shadow: 0 4px 16px rgba(168,85,247,0.4) !important; color: #fff !important; border: none;
}

/* КНОПКИ ВТОРОСТЕПЕННЫЕ */
.iht-ocr-result-btns { display: flex; gap: 12px; }
.iht-ocr-btn-outline {
    background: var(--ocr-input) !important; border: 1px solid var(--ocr-border) !important;
    color: var(--ocr-text) !important; box-shadow: none !important;
}
.iht-ocr-btn-outline:hover:not(:disabled) { border-color: var(--ocr-accent) !important; color: #fff !important; background: rgba(168,85,247,0.1) !important; }
.iht-ocr-btn-outline:disabled { background: transparent !important; color: var(--ocr-muted) !important; border-color: var(--ocr-border) !important; }

/* АДАПТИВНОСТЬ */
@media (max-width: 768px) {
    .iht-ocr-layout { grid-template-columns: 1fr; }
    .iht-ocr-wrap   { border-radius: 16px; margin: 16px auto; }
    .iht-ocr-body   { padding: 16px; }
    .iht-ocr-textarea { min-height: 200px; }
}