

.ocr-page { max-width: 1120px; margin: 0 auto; padding: var(--space-4) var(--space-6) var(--space-8); }

.tool-page__content { display: grid; grid-template-columns: 1fr 340px; gap: var(--space-5); align-items: start; }
.tool-right-col { display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: var(--space-4); }

@media (max-width: 900px) {
    .tool-page__content { grid-template-columns: 1fr; gap: var(--space-4); }
    .tool-right-col { position: static; }
}


.ocr-ad { margin: var(--space-4) 0; text-align: center; overflow: hidden; }
.ocr-ad__wrap { display: inline-block; max-width: 100%; overflow: hidden; }
.ocr-ad__wrap:empty { display: none; }
.ocr-ad:has(.ocr-ad__wrap:empty:only-child) { display: none; }
.ocr-ad--728 { display: block; } .ocr-ad--300 { display: none; }
@media (max-width: 768px) { .ocr-ad--728 { display: none; } .ocr-ad--300 { display: block; } }
.ocr-ad iframe { max-width: 100% !important; }
.ocr-ad--sidebar { margin: 0; }


.tool-preview { background: var(--bg-secondary); border: 1px solid var(--gray-100); border-radius: var(--radius-xl); overflow: hidden; }
.tool-preview__image-area { position: relative; }

.drop-zone {
    position: relative; border: 2px dashed var(--gray-300); border-radius: var(--radius-xl);
    padding: var(--space-10) var(--space-6); text-align: center; cursor: pointer;
    background: var(--bg-secondary); transition: all 0.2s; min-height: 320px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary-400); background: var(--primary-50); }
.drop-zone__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-zone__icon { color: var(--text-tertiary); margin-bottom: var(--space-2); }
.drop-zone:hover .drop-zone__icon { color: var(--primary-500); }
.drop-zone__text { font-size: 17px; font-weight: 600; color: var(--text-primary); }
.drop-zone__hint { font-size: 13px; color: var(--text-tertiary); }

#options-panel { padding: var(--space-4); }
#processing-ui { padding: 40px 20px; text-align: center; }

.ocr-file-info { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-tertiary); border-radius: var(--radius-md); margin-bottom: 16px; border: 1px solid var(--gray-100); }
.ocr-file-info__icon { flex-shrink: 0; color: var(--text-secondary); }
.ocr-file-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocr-file-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.ocr-field { margin-bottom: 16px; }
.ocr-label {
    font-size: 12px; font-weight: 700; color: var(--text-secondary);
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px;
}
.ocr-label > span:first-child { display: flex; align-items: center; gap: 6px; }
.ocr-label svg { flex-shrink: 0; }
.ocr-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; }
.ocr-counter { font-size: 11px; color: var(--text-tertiary); font-weight: 600; }


.lang-picker {
    position: relative;
    background: var(--bg-primary);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 6px 36px 6px 8px;
    min-height: 42px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.lang-picker:focus-within, .lang-picker.open { border-color: var(--primary-400); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.lang-picker__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.lang-picker__chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--primary-50, #eef2ff); color: var(--primary-700, #4338ca);
    border: 1px solid var(--primary-100, #e0e7ff);
    padding: 4px 6px 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    white-space: nowrap;
}
.lang-picker__chip-remove {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: transparent; border: none; cursor: pointer;
    color: var(--primary-700, #4338ca);
    padding: 0; margin-left: 2px;
    transition: background 0.15s;
}
.lang-picker__chip-remove:hover { background: var(--primary-100, #e0e7ff); }
.lang-picker__chip-remove svg { width: 12px; height: 12px; }

.lang-picker__toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px;
    background: transparent; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-tertiary); border-radius: var(--radius-sm);
    transition: background 0.15s, transform 0.2s;
}
.lang-picker__toggle:hover { background: var(--bg-tertiary); }
.lang-picker.open .lang-picker__toggle { transform: translateY(-50%) rotate(180deg); }

.lang-picker__dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 50;
    max-height: 320px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.lang-picker__search {
    border: none; border-bottom: 1px solid var(--gray-100);
    padding: 10px 12px; font-size: 13px; outline: none;
    background: var(--bg-primary);
    border-radius: 0;
}
.lang-picker__list { overflow-y: auto; padding: 4px; flex: 1; }
.lang-picker__group-label {
    font-size: 10px; font-weight: 700; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 8px 10px 4px;
}
.lang-picker__option {
    display: block; width: 100%; text-align: left;
    padding: 8px 10px; border: none; background: transparent;
    font-size: 13px; color: var(--text-primary); cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
}
.lang-picker__option:hover { background: var(--primary-50, #eef2ff); }
.lang-picker__option.selected { background: var(--primary-100, #e0e7ff); color: var(--primary-700); font-weight: 600; }
.lang-picker__option.selected::after { content: '✓'; float: right; }
.lang-picker__option[hidden] { display: none; }
.lang-picker__group[data-empty="true"] { display: none; }


.ocr-progress-wrap { background: var(--bg-tertiary); height: 10px; border-radius: 5px; overflow: hidden; margin: 16px auto; max-width: 400px; }
.ocr-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary-500), var(--primary-700)); transition: width 0.3s ease; border-radius: 5px; }
.ocr-status-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.ocr-status-detail { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.ocr-spinner { width: 48px; height: 48px; border: 4px solid var(--gray-200); border-top-color: var(--primary-600); border-radius: 50%; animation: ocr-spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes ocr-spin { to { transform: rotate(360deg); } }


.tool-settings { background: var(--bg-secondary); border: 1px solid var(--gray-100); border-radius: var(--radius-xl); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.tool-settings__title { font-size: 13px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: 0.4px; padding-bottom: var(--space-2); border-bottom: 1px solid var(--gray-100); }
.tool-settings__title svg { flex-shrink: 0; color: var(--primary-500); }

.ocr-steps { display: flex; flex-direction: column; gap: 10px; }
.ocr-step { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.ocr-step span {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary-100); color: var(--primary-700);
    font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.tc-note {
    padding: 10px 12px; background: var(--bg-tertiary); border-radius: var(--radius-md);
    font-size: 11px; color: var(--text-tertiary); line-height: 1.5;
    display: flex; align-items: flex-start; gap: 6px;
    border: 1px solid var(--gray-100);
}
.tc-note svg { flex-shrink: 0; margin-top: 1px; }

#btn-start-ocr { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#btn-start-ocr svg { flex-shrink: 0; }

.tc-actions { padding: 12px; display: flex; gap: 8px; background: var(--bg-tertiary); border-top: 1px solid var(--gray-100); }
.tc-actions .btn { flex: 1; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tc-actions .btn svg { flex-shrink: 0; }


.tc-breadcrumb { font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: var(--space-4); }
.tc-breadcrumb a { color: var(--text-tertiary); text-decoration: none; } .tc-breadcrumb a:hover { color: var(--primary-600); }
.tc-breadcrumb span { margin: 0 var(--space-1); } .tc-breadcrumb span:last-child { color: var(--text-primary); font-weight: 500; }
.tc-header { display: flex; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-6); }
.tc-header__icon { flex-shrink: 0; margin-top: 2px; color: var(--primary-600); }
.tc-header__title { font-size: var(--text-2xl); font-weight: 700; margin: 0 0 var(--space-1); }
.tc-header__desc { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; line-height: 1.5; }
.tc-result { max-width: 520px; margin: 0 auto; padding: var(--space-6); }
.tc-result__header { text-align: center; margin-bottom: var(--space-6); }
.tc-result__icon { margin-bottom: var(--space-2); color: var(--success); }
.tc-result__title { font-size: var(--text-xl); font-weight: 700; color: var(--success); margin: 0 0 var(--space-2); }
.tc-result__meta { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; }
.tc-result__file { display: flex; align-items: center; gap: 12px; padding: var(--space-4); background: var(--bg-tertiary); border-radius: var(--radius-lg); margin-bottom: var(--space-4); border: 1px solid var(--gray-100); }
.tc-result__file-icon { flex-shrink: 0; color: var(--text-tertiary); }
.tc-result__filename { font-weight: 600; font-size: 14px; word-break: break-all; }
.tc-result__filesize { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.tc-result__rename { margin-bottom: var(--space-4); }
.tc-result__rename label { font-size: 12px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.tc-result__rename input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-md); font-size: 14px; background: var(--bg-primary); box-sizing: border-box; }
.tc-result__rename input:focus { outline: none; border-color: var(--primary-400); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.tc-result__actions { display: flex; gap: 10px; margin-bottom: var(--space-4); }
.tc-result__actions .btn { flex: 1; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tc-result__actions .btn svg { flex-shrink: 0; }
.tc-related { padding-top: var(--space-4); border-top: 1px solid var(--gray-100); }
.tc-related__title { font-size: 11px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: var(--space-3); }
.tc-related__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tc-related__grid a { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; background: var(--bg-tertiary); border-radius: var(--radius-md); font-size: 13px; font-weight: 500; color: var(--text-secondary); text-decoration: none; border: 1px solid transparent; }
.tc-related__grid a svg { flex-shrink: 0; }
.tc-related__grid a:hover { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-200); }

.hidden { display: none !important; }

@media (max-width: 600px) {
    .tc-header { gap: var(--space-3); } .tc-header__title { font-size: var(--text-xl); }
    .tc-result { padding: var(--space-4); }
    .tc-related__grid { grid-template-columns: 1fr; }
    .drop-zone { padding: var(--space-6) var(--space-3); min-height: 240px; }
    .drop-zone__text { font-size: 15px; }
}