/* 图片翻译（与站内 AI 工具页风格一致） */

.imgtrans-page {
    width: 100%;
    min-width: 0;
}

.ai-tool-main:has(.imgtrans-page) .ai-tool-header {
    display: none;
}

.ai-tool-page:has(.imgtrans-page) .ai-tool-sidebar {
    position: sticky;
    top: 76px;
    align-self: flex-start;
}

.imgtrans-workspace {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Hero */
.imgtrans-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 45%, #6366f1 100%);
    color: #fff;
    box-shadow: 0 8px 28px rgb(99 102 241 / 22%);
}

.imgtrans-hero-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.imgtrans-hero-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #1a1a2e;
}

.imgtrans-hero-badge--free {
    background: linear-gradient(135deg, #22c55e, #4ade80);
    color: #fff;
    text-transform: none;
    font-weight: 700;
    letter-spacing: 0;
}

.imgtrans-hero-badge--soft {
    background: rgb(255 255 255 / 14%);
    color: #fff;
    border: 1px solid rgb(255 255 255 / 22%);
    text-transform: none;
    font-weight: 600;
    letter-spacing: 0;
}

.imgtrans-hero-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.imgtrans-hero-desc {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.65;
    opacity: .92;
    max-width: 640px;
}

.imgtrans-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.imgtrans-hero-tags span {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgb(255 255 255 / 12%);
    border: 1px solid rgb(255 255 255 / 20%);
}

.imgtrans-tool-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: center;
}

.imgtrans-tool-link {
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: rgb(255 255 255 / 10%);
    border: 1px solid rgb(255 255 255 / 22%);
    transition: background .18s, border-color .18s;
    white-space: nowrap;
}

.imgtrans-tool-link:hover {
    background: rgb(255 255 255 / 20%);
    border-color: rgb(255 255 255 / 40%);
    color: #fff;
}

/* 语言栏 */
.imgtrans-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.imgtrans-lang-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8eef5;
    box-shadow: 0 2px 8px rgb(15 23 42 / 4%);
}

.imgtrans-lang-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 140px;
}

.imgtrans-lang-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.imgtrans-select-wrap {
    position: relative;
}

.imgtrans-select-wrap::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #94a3b8;
    pointer-events: none;
}

.imgtrans-select {
    width: 100%;
    height: 42px;
    padding: 0 32px 0 12px;
    border: 1px solid #dbe4ef;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    appearance: none;
    transition: border-color .18s, box-shadow .18s;
}

.imgtrans-select:hover {
    border-color: #93c5fd;
}

.imgtrans-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 15%);
    background: #fff;
}

.imgtrans-swap-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    margin-bottom: 0;
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe4ef;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: all .18s;
}

.imgtrans-swap-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}

.imgtrans-submit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 148px;
    height: 42px;
    padding: 0 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgb(99 102 241 / 35%);
    transition: transform .18s, box-shadow .18s, opacity .18s;
}

.imgtrans-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgb(99 102 241 / 42%);
}

.imgtrans-submit:disabled,
.imgtrans-submit.is-loading {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
}

.imgtrans-submit-icon {
    flex-shrink: 0;
}

/* 主卡片 */
.imgtrans-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e8eef5;
    box-shadow: 0 4px 20px rgb(15 23 42 / 5%);
    overflow: hidden;
}

.imgtrans-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
}

.imgtrans-card-head-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.imgtrans-card-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #818cf8);
}

.imgtrans-card-tip {
    font-size: 12px;
    color: #94a3b8;
}

.imgtrans-card-head-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.imgtrans-step {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    transition: color .2s;
}

.imgtrans-step.is-active {
    color: #4f46e5;
    font-weight: 700;
}

.imgtrans-step.is-done {
    color: #22c55e;
}

.imgtrans-step-divider {
    width: 16px;
    height: 1px;
    background: #e2e8f0;
}

/* 上传区 */
.imgtrans-upload {
    padding: 24px;
}

.imgtrans-upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 300px;
    padding: 36px 28px;
    margin: 0;
    border: 2px dashed #c7d2fe;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8faff 0%, #f1f5ff 100%);
    cursor: pointer;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.imgtrans-upload-inner:hover,
.imgtrans-upload.is-dragover .imgtrans-upload-inner {
    border-color: #6366f1;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    box-shadow: 0 0 0 4px rgb(99 102 241 / 8%);
}

.imgtrans-upload-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.imgtrans-upload-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border-radius: 20px;
    background: #fff;
    color: #6366f1;
    box-shadow: 0 8px 24px rgb(99 102 241 / 15%);
}

.imgtrans-upload-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.imgtrans-upload-desc {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
}

.imgtrans-upload-btn {
    display: inline-block;
    padding: 10px 28px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 4px 12px rgb(99 102 241 / 30%);
}

/* 结果区 */
.imgtrans-result {
    padding: 0 20px 20px;
}

.imgtrans-result-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.imgtrans-view-tabs {
    display: inline-flex;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 10px;
}

.imgtrans-view-tab {
    border: none;
    background: transparent;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all .18s;
}

.imgtrans-view-tab.is-active {
    background: #fff;
    color: #4f46e5;
    box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
}

.imgtrans-result-meta {
    flex: 1;
    min-width: 120px;
}

.imgtrans-ocr-count {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.imgtrans-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.imgtrans-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #dbe4ef;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all .18s;
}

.imgtrans-action-btn:hover {
    border-color: #6366f1;
    color: #4f46e5;
}

.imgtrans-action-btn--primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 10px rgb(99 102 241 / 28%);
}

.imgtrans-action-btn--primary:hover {
    color: #fff;
    box-shadow: 0 4px 14px rgb(99 102 241 / 38%);
}

.imgtrans-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: linear-gradient(90deg, #eef2ff, #f0f9ff);
    border: 1px solid #c7d2fe;
    font-size: 14px;
    font-weight: 500;
    color: #4338ca;
}

.imgtrans-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #c7d2fe;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: imgtrans-spin .8s linear infinite;
    flex-shrink: 0;
}

@keyframes imgtrans-spin {
    to { transform: rotate(360deg); }
}

.imgtrans-preview {
    position: relative;
    width: 100%;
    min-height: 380px;
    max-height: 68vh;
    overflow: hidden;
    background: #0f172a;
    border-radius: 12px;
    border: 1px solid #1e293b;
    cursor: grab;
}

.imgtrans-preview-hint {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    color: rgb(255 255 255 / 75%);
    background: rgb(0 0 0 / 35%);
    pointer-events: none;
}

.imgtrans-preview.is-loading {
    cursor: wait;
}

.imgtrans-preview.is-loading .imgtrans-preview-hint {
    opacity: 0;
}

.imgtrans-preview-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(15 23 42 / 72%);
    backdrop-filter: blur(4px);
}

.imgtrans-preview-loading-inner {
    text-align: center;
    padding: 24px;
}

.imgtrans-preview-loading-inner p {
    margin: 16px 0 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .02em;
}

.imgtrans-spinner--lg {
    width: 44px;
    height: 44px;
    border-width: 3px;
    border-color: rgb(255 255 255 / 25%);
    border-top-color: #818cf8;
    margin: 0 auto;
}

.imgtrans-preview-inner {
    position: relative;
    display: inline-block;
    transform-origin: 0 0;
    max-width: 100%;
    max-height: 100%;
}

#imgResultCanvas {
    display: block;
    max-width: 100%;
    max-height: calc(68vh - 24px);
    width: auto;
    height: auto;
}

.imgtrans-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 功能说明 */
.imgtrans-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid #eef2f7;
}

.imgtrans-features li {
    padding: 16px 18px;
    border-right: 1px solid #eef2f7;
}

.imgtrans-features li:last-child {
    border-right: none;
}

.imgtrans-features strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

.imgtrans-features span {
    font-size: 12px;
    color: #64748b;
    line-height: 1.55;
}

/* 场景推广 */
.imgtrans-promo {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.imgtrans-promo-item {
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8eef5;
    transition: box-shadow .18s, transform .18s;
}

.imgtrans-promo-item:hover {
    box-shadow: 0 6px 20px rgb(15 23 42 / 6%);
    transform: translateY(-2px);
}

.imgtrans-promo-icon {
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

.imgtrans-promo-item h3 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.imgtrans-promo-item p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

/* 响应式 */
@media (max-width: 992px) {
    .imgtrans-promo {
        grid-template-columns: repeat(2, 1fr);
    }

    .imgtrans-features {
        grid-template-columns: 1fr;
    }

    .imgtrans-features li {
        border-right: none;
        border-bottom: 1px solid #eef2f7;
    }

    .imgtrans-features li:last-child {
        border-bottom: none;
    }
}

@media (max-width: 768px) {
    .imgtrans-hero {
        flex-direction: column;
    }

    .imgtrans-tool-links {
        align-self: flex-start;
    }

    .imgtrans-lang-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .imgtrans-swap-btn {
        align-self: center;
    }

    .imgtrans-submit {
        width: 100%;
    }

    .imgtrans-card-head-right {
        width: 100%;
        justify-content: center;
    }

    .imgtrans-result-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .imgtrans-result-actions {
        margin-left: 0;
    }

    .imgtrans-action-btn {
        flex: 1;
        justify-content: center;
    }

    .imgtrans-promo {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .imgtrans-upload {
        padding: 16px;
    }

    .imgtrans-upload-inner {
        min-height: 240px;
        padding: 24px 16px;
    }

    .imgtrans-hero-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .index-container {
        width: 100%;
        padding: 0 8px;
    }
    .imgtrans-upload {
        padding: 14px;
    }
    .imgtrans-upload-inner {
        min-height: 200px;
        padding: 20px 14px;
    }
    .imgtrans-hero-title {
        font-size: 18px;
    }
    .imgtrans-submit,
    .imgtrans-action-btn {
        width: 100%;
    }
    .imgtrans-promo {
        grid-template-columns: 1fr;
    }
}
