/* ========== 文档翻译页 ========== */

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

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

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

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

/* ---- Hero ---- */
.doc-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 28px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0f172a 0%, #273548 48%, #1a56db 100%);
    color: #fff;
    box-shadow: 0 8px 28px rgb(26 86 219 / 22%);
}

.doc-hero-main {
    flex: 1;
    min-width: 240px;
}

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

.doc-hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}

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

.doc-hero-badge--engine {
    background: rgb(255 255 255 / 14%);
    color: #fff;
    border: 1px solid rgb(255 255 255 / 22%);
    font-weight: 600;
}

.doc-hero-title {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.3;
}

.doc-hero-desc {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.7;
    opacity: .92;
    max-width: 700px;
}

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

.doc-hero-tags span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgb(255 255 255 / 12%);
    border: 1px solid rgb(255 255 255 / 20%);
}

.doc-tool-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.doc-tool-link {
    display: block;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    color: rgb(255 255 255 / .82);
    text-decoration: none;
    background: rgb(255 255 255 / .08);
    border: 1px solid rgb(255 255 255 / .12);
    transition: background .2s, color .2s;
}

.doc-tool-link:hover {
    background: rgb(255 255 255 / .16);
    color: #fff;
}

/* ---- Lang Bar (matches texttranslate design) ---- */
.doc-lang-bar {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e8eef5;
    background: #fff;
    border-radius: 14px 14px 0 0;
    border: 1px solid #eef2f7;
    box-shadow: 0 2px 12px rgb(0 0 0 / .04);
}
.doc-lang-bar-inner {
    display: flex;
    align-items: center;
    flex: 1;
    height: 48px;
    white-space: nowrap;
}
.doc-lang-group {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: visible;
    padding-left: 12px;
    position: relative;
}
.doc-lang-tabs {
    position: relative;
    display: flex;
}
.doc-lang-tab {
    padding: 0 8px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: #5f6368;
    min-width: 75px;
    border-bottom: 2px solid #fff;
}
.doc-lang-tab:hover {
    color: #202124;
    background: #f8f9fa;
}
.doc-lang-tab.is-active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
}

/* ---- Dropdown Button ---- */
.doc-lang-dropdown-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    outline: none;
    border-radius: 50%;
    background: #fff;
    color: #5f6368;
    cursor: pointer;
    flex-shrink: 0;
}
.doc-lang-dropdown-btn:hover {
    background: #f1f3f4;
}

/* ---- Swap ---- */
.doc-lang-swap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 4px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s, color .2s;
}
.doc-lang-swap:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* ---- Dropdown Panel ---- */
.doc-lang-dropdown {
    display: none;
    position: absolute;
    left: 0;
    top: 48px;
    width: 100%;
    z-index: 1010;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 2px 2px rgb(0 0 0 / .22);
    padding: 10px 5px;
    box-sizing: border-box;
    min-width: 320px;
}
.doc-lang-dropdown.show {
    display: block;
}
.doc-lang-search {
    padding: 8px 12px;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    gap: 8px;
}
.doc-lang-search-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: 0;
    outline: none;
    font-size: 16px;
    color: #3c4043;
    background: transparent;
}
.doc-lang-search-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.doc-lang-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    flex-shrink: 0;
}
.doc-lang-search-btn:hover {
    background: #f1f3f4;
    color: #202124;
}
.doc-lang-search-btn svg {
    fill: #5f6368;
    display: block;
}
.doc-lang-search-btn:hover svg {
    fill: #202124;
}

/* ---- Language List ---- */
.doc-lang-list {
    margin-top: 10px;
}
.doc-lang-list::after {
    content: "";
    display: table;
    clear: both;
}
.doc-lang-item {
    display: block;
    float: left;
    height: 30px;
    line-height: 30px;
    padding: 0 8px;
    color: #333;
    text-decoration: none;
    width: 20%;
    box-sizing: border-box;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}
.doc-lang-item:hover {
    background: #f8f8f8;
    color: #555;
}
.doc-lang-item.is-selected {
    background: #e8f0fe;
    color: #185abc;
}

/* Lang list scrollbar */
.doc-lang-list::-webkit-scrollbar {
    width: 5px;
}
.doc-lang-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}
.doc-lang-list::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 10px;
}
.doc-lang-list::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* ---- Submit (in lang bar) ---- */
.doc-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    margin-right: 12px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(135deg, #0d6efd, #4dabf7);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.doc-submit:hover {
    background: linear-gradient(135deg, #0b5ed7, #3d9af5);
    box-shadow: 0 4px 14px rgb(13 110 253 / .35);
}
.doc-submit:disabled {
    background: #b8d4fe;
    cursor: not-allowed;
    box-shadow: none;
}
.doc-submit-icon {
    flex-shrink: 0;
}

/* Spinner for buttons during loading */
.doc-btn-spin {
    flex-shrink: 0;
    animation: doc-btn-spin-anim 0.8s linear infinite;
}
@keyframes doc-btn-spin-anim {
    to { transform: rotate(360deg); }
}
.doc-submit.is-loading,
.doc-btn-primary.is-loading {
    background: #b8d4fe;
    cursor: wait;
    pointer-events: none;
}

/* Spacer for lang bar bottom border when followed by card */
.doc-lang-bar + .doc-card {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}

/* ---- Card ---- */
.doc-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgb(13 110 253 / .1);
    box-shadow: 0 4px 20px rgb(13 110 253 / .06);
    overflow: hidden;
}

/* ---- Card Body: Left-Right Layout ---- */
.doc-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 380px;
}

.doc-card-left {
    border-right: 1px solid #eef2f7;
    background: #fafbfd;
    display: flex;
    align-items: center;
}

.doc-card-right {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---- Empty State ---- */
.doc-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.doc-empty-icon {
    margin-bottom: 16px;
    opacity: .7;
}

.doc-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: #444;
    margin: 0 0 6px;
}

.doc-empty-desc {
    font-size: 13px;
    color: #999;
    margin: 0;
    line-height: 1.7;
}

/* ---- Error State ---- */
#docErrorSection {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
}

.doc-error-icon {
    margin-bottom: 12px;
}

.doc-error-title {
    font-size: 16px;
    font-weight: 700;
    color: #e64242;
    margin: 0 0 6px;
}

.doc-error-desc {
    font-size: 13px;
    color: #999;
    margin: 0;
    line-height: 1.7;
    max-width: 260px;
}

.doc-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid #eef2f7;
    background: #fafbfd;
}

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

.doc-card-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(135deg, #0d6efd, #6366f1);
    color: #fff;
}

.doc-card-tip {
    font-size: 12px;
    color: #999;
}

.doc-steps {
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-step {
    font-size: 12px;
    color: #999;
    transition: color .2s;
}

.doc-step.is-active {
    color: #0d6efd;
    font-weight: 600;
}

.doc-step-divider {
    width: 16px;
    height: 1px;
    background: #dde3ea;
}

/* ---- Upload ---- */
.doc-upload {
    width: 100%;
    padding: 20px;
    transition: opacity .3s;
}

.doc-upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    border: 2px dashed #b8d4fe;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color .25s, background .25s, box-shadow .25s;
    padding: 32px 20px;
    margin: 0;
}

.doc-upload-inner:hover,
.doc-upload-inner.is-dragover {
    border-color: #0d6efd;
    background: #eef4ff;
    box-shadow: 0 0 0 4px rgb(13 110 253 / .06);
}

.doc-upload-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 24px;
}

.doc-upload-icon {
    color: #0d6efd;
    margin-bottom: 8px;
}

.doc-upload-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.5;
}

.doc-upload-desc {
    font-size: 13px;
    color: #888;
    margin: 0;
    text-align: center;
    line-height: 1.6;
    max-width: 480px;
}

.doc-upload-btn {
    display: inline-block;
    background: #0d6efd;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 32px;
    border-radius: 24px;
    transition: background .2s, box-shadow .2s;
}

.doc-upload-btn:hover {
    background: #0b5ed7;
    box-shadow: 0 4px 12px rgb(13 110 253 / .3);
}

/* ---- Workspace / Result ---- */
.doc-workspace-section {
    padding: 16px 20px;
}

.doc-workspace-section + .doc-workspace-section {
    border-top: 1px solid #eef2f7;
}

.doc-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
}

.doc-file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-file-icon--pdf {
    background: #fef2f2;
    color: #ef4444;
}

.doc-file-icon--word {
    background: #eff6ff;
    color: #3b82f6;
}

.doc-file-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    word-break: break-all;
}

.doc-file-meta {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* ---- Language Hint ---- */
.doc-lang-hint {
    font-size: 14px;
    color: #555;
    margin: 0;
    text-align: center;
    line-height: 1.6;
}

.doc-lang-hint strong {
    color: #0d6efd;
    font-weight: 700;
}

/* ---- Progress ---- */
.doc-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.doc-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
}

.doc-progress-bar-wrap {
    flex: 1;
    height: 8px;
    background: #eef2f7;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.doc-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: linear-gradient(90deg, #0d6efd, #4dabf7, #6366f1);
    background-size: 200% 100%;
    transition: width .4s;
    animation: doc-progress-wave 2s linear infinite;
}

/* Shimmer overlay for indeterminate loading state */
.doc-progress-bar-shimmer {
    position: absolute;
    inset: 0;
    border-radius: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgb(255 255 255 / .4) 50%,
        transparent 100%
    );
    animation: doc-progress-shimmer 1.5s ease-in-out infinite;
    display: none;
}

/* When indeterminate, hide the fill bar and show shimmer */
.doc-progress-bar-wrap.is-loading .doc-progress-bar {
    width: 100% !important;
    background: #e0e7f6;
    animation: none;
}

.doc-progress-bar-wrap.is-loading .doc-progress-bar-shimmer {
    display: block;
}

@keyframes doc-progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes doc-progress-wave {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.doc-progress-percent {
    font-size: 13px;
    font-weight: 700;
    color: #0d6efd;
    min-width: 36px;
    text-align: right;
}

.doc-progress-tip {
    margin: 10px 0 0;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}

/* ---- Loading (removed - now uses progress bar instead) ---- */

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

/* ---- Actions ---- */
.doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #eef2f7;
    margin-top: auto;
}

.doc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
}

.doc-btn-primary {
    background: #0d6efd;
    color: #fff;
}

.doc-btn-primary:hover:not(:disabled) {
    background: #0b5ed7;
    box-shadow: 0 4px 12px rgb(13 110 253 / .3);
}

.doc-btn-primary:disabled {
    background: #b8d4fe;
    cursor: not-allowed;
    box-shadow: none;
}

.doc-btn-outline {
    background: #fff;
    color: #444;
    border: 1px solid #dde3ea;
}

.doc-btn-outline:hover:not(:disabled) {
    border-color: #0d6efd;
    color: #0d6efd;
}

.doc-btn-outline:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ---- Features ---- */
.doc-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid #eef2f7;
    background: #fafbfd;
    list-style: none;
    margin: 0;
}

.doc-feature-item {
    padding: 14px 16px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #eef2f7;
    transition: box-shadow .2s, border-color .2s;
}

.doc-feature-item:hover {
    box-shadow: 0 2px 12px rgb(0 0 0 / .05);
    border-color: rgb(13 110 253 / .18);
}

.doc-feature-item strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.doc-feature-item span {
    display: block;
    font-size: 12px;
    color: #888;
    line-height: 1.6;
}

/* ---- Scenarios ---- */
.doc-scenarios {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.doc-scenario-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #eef2f7;
    text-align: center;
    transition: box-shadow .2s, border-color .2s;
}

.doc-scenario-item:hover {
    box-shadow: 0 2px 16px rgb(0 0 0 / .06);
    border-color: rgb(13 110 253 / .18);
}

.doc-scenario-icon {
    font-size: 28px;
    line-height: 1;
}

.doc-scenario-item h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.doc-scenario-item p {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.5;
}

/* ---- Dual View (Compare) ---- */
.doc-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.doc-compare-panel {
    border: 1px solid #eef2f7;
    border-radius: 12px;
    overflow: hidden;
}

.doc-compare-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
}

.doc-compare-panel-head h4 {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin: 0;
}

.doc-compare-panel-body {
    padding: 16px;
    max-height: 380px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- Toast ---- */
.doc-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: #1a1a2e;
    color: #fff;
    box-shadow: 0 4px 16px rgb(0 0 0 / .2);
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s;
}

.doc-toast.is-visible {
    opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .doc-hero {
        padding: 18px 20px;
    }

    .doc-hero-title {
        font-size: 22px;
    }

    .doc-lang-bar-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 4px 0;
    }

    .doc-lang-group {
        min-width: 200px;
    }

    .doc-lang-dropdown {
        width: 280px;
        min-width: 220px;
    }

    .doc-lang-item {
        width: 33.33%;
    }

    .doc-compare {
        grid-template-columns: 1fr;
    }

    .doc-upload-inner {
        min-height: 220px;
        padding: 32px 20px;
    }

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

@media (max-width: 768px) {
    .doc-card-body {
        grid-template-columns: 1fr;
    }

    .doc-card-left {
        border-right: none;
        border-bottom: 1px solid #eef2f7;
    }
}

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

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

    .doc-hero-desc {
        font-size: 13px;
    }

    .doc-lang-bar-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 4px 0;
    }

    .doc-lang-group {
        min-width: 150px;
        padding-left: 6px;
    }

    .doc-lang-tab {
        font-size: 12px;
        min-width: 55px;
        padding: 0 6px;
    }

    .doc-lang-dropdown-btn {
        width: 32px;
        height: 32px;
    }

    .doc-lang-swap {
        width: 32px;
        height: 32px;
        margin: 0 2px;
    }

    .doc-lang-dropdown {
        min-width: 220px;
    }

    .doc-lang-item {
        width: 50%;
    }

    .doc-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .doc-card-body {
        grid-template-columns: 1fr;
    }

    .doc-card-left {
        border-right: none;
        border-bottom: 1px solid #eef2f7;
    }

    .doc-actions {
        flex-direction: column;
    }

    .doc-btn {
        width: 100%;
        justify-content: center;
    }

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

    .doc-scenarios {
        grid-template-columns: 1fr 1fr;
    }

    .doc-upload {
        padding: 16px;
    }

    .doc-upload-inner {
        min-height: 200px;
        padding: 24px 16px;
    }

    .doc-compare {
        grid-template-columns: 1fr;
    }

    .doc-lang-dropdown {
        width: 260px;
        left: auto;
        right: 0;
    }
}

@media (max-width: 480px) {
    .index-container {
        width: 100%;
        padding: 0 8px;
    }
    .doc-hero {
        padding: 14px;
    }
    .doc-hero-title {
        font-size: 18px;
    }
    .doc-upload {
        padding: 12px;
    }
    .doc-upload-inner {
        min-height: 180px;
        padding: 20px 14px;
    }
    .doc-btn {
        width: 100%;
    }
    .doc-lang-bar-inner {
        flex-direction: column;
    }
    .doc-lang-group {
        width: 100%;
    }
    .doc-features,
    .doc-scenarios {
        grid-template-columns: 1fr;
    }
}
