/**
 * Translation viewer — minimal split-screen, independent scroll, mode switcher.
 */

body.translation-viewer-page-open #chatAssistantWrap {
    display: none !important;
}

body.app-dashboard-home #translationViewerPage:not(.hidden) {
    background: #000000;
    min-height: calc(100vh - 56px);
}

#translationViewerPage {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 56px);
}

.translation-viewer-page-root {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.translation-viewer-back {
    position: absolute;
    top: clamp(0.5rem, 2vw, 0.75rem);
    left: clamp(0.5rem, 2vw, 0.75rem);
    z-index: 20;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: #e2e8f0;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.translation-viewer-back:hover {
    border-color: rgba(61, 214, 140, 0.35);
    background: rgba(61, 214, 140, 0.08);
}

.translation-viewer-mount {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(2.75rem, 4vw, 3.25rem) clamp(1rem, 3vw, 1.5rem) clamp(1rem, 2vw, 1.25rem);
    box-sizing: border-box;
}

/* Root layout */
.tv-root {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 2rem;
}

.tv-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-left: 2.75rem;
    max-width: 56rem;
}

@media (min-width: 900px) {
    .tv-header {
        padding-left: 0;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
}

.tv-title {
    margin: 0;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #f8fafc;
    line-height: 1.2;
}

.tv-mode-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tv-mode-pill {
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tv-mode-pill:hover {
    border-color: rgba(61, 214, 140, 0.35);
    color: #e2e8f0;
}

.tv-mode-pill--active,
.tv-mode-pill.tv-mode-pill--active {
    border-color: rgba(61, 214, 140, 0.55);
    background: linear-gradient(135deg, rgba(46, 181, 116, 0.35) 0%, rgba(61, 214, 140, 0.22) 100%);
    color: #ecfdf5;
}

.tv-inline-error {
    margin: 0;
    font-size: 0.88rem;
    color: #fca5a5;
}

.tv-generate-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.tv-gen-btn {
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.tv-gen-btn:hover {
    border-color: rgba(61, 214, 140, 0.4);
    background: rgba(61, 214, 140, 0.1);
}

/* Split */
.tv-split-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tv-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 16px;
}

.tv-split {
    flex: 1;
    min-height: 320px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    min-height: 0;
}

@media (max-width: 900px) {
    .tv-split {
        grid-template-columns: 1fr;
        min-height: 480px;
    }

    .tv-pane {
        min-height: 280px;
    }
}

.tv-pane {
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.tv-pane-inner {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tv-pane-sticky-head {
    margin: 0;
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.35);
}

.tv-pane-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.tv-pane-lines {
    padding: 1.25rem 1.25rem 2rem;
    box-sizing: border-box;
}

.tv-pane-line {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
    padding-bottom: 0.35rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tv-pane-line:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.tv-pane-line-num {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-align: right;
    padding-top: 0.2rem;
    font-variant-numeric: tabular-nums;
}

.tv-pane-line-text {
    font-size: 0.98rem;
    line-height: 1.65;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tv-pane-empty-line {
    opacity: 0.25;
}

.tv-diff-mark {
    background: rgba(61, 214, 140, 0.12);
    color: #a7f3d0;
    padding: 0.05em 0.15em;
    border-radius: 4px;
}

.tv-loading,
.tv-error {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

.tv-error {
    color: #fca5a5;
}

.tv-btn-back {
    margin-top: 1rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    font-weight: 600;
    cursor: pointer;
}
