.upload-page {
    --upload-primary: #137eeb;
    --upload-primary-dark: #0f67c0;
    --upload-primary-soft: #e8f2ff;
    --upload-border: #d7e4f5;
    --upload-text: #17324d;
    --upload-muted: #5e7792;
    --upload-surface: #ffffff;
    --upload-shadow: 0 24px 60px rgba(19, 126, 235, 0.14);
    --upload-radius: 22px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 2rem 6%;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top left, rgba(19, 126, 235, 0.12), transparent 28%),
        linear-gradient(180deg, #f5faff 0%, #eef5fb 100%);
}

.upload-page {
    color: var(--upload-text);
}

.upload-page__row {
    flex: 1 1 auto;
    min-height: 0;
}

.upload-page__row > [class*="col-"] {
    display: flex;
    min-height: 0;
}

.upload-card {
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid rgba(19, 126, 235, 0.1);
    border-radius: var(--upload-radius);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--upload-shadow);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.upload-card__body {
    height: 100%;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.upload-form {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.upload-result {
    flex: 0 0 auto;
    padding-left: 15px;
    margin-top: 10px;
}

.upload-result__alert {
    margin-bottom: 0;
}

.upload-form__controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 0 0 auto;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--upload-border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(19, 126, 235, 0.05), rgba(255, 255, 255, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.upload-form__file-group {
    width: 100%;
    margin-bottom: 0;
}

.upload-form__file-row {
    width: 100%;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 1rem;
}

.upload-form__file-input {
    width: 100%;
}

.upload-form__toggle-group {
    width: 100%;
}

.upload-form__toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1.1rem;
    border: 1px solid var(--upload-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
}

.upload-form__toggle-copy {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--upload-text);
}

.upload-form__toggle-label {
    font-size: 0.95rem;
    font-weight: 700;
}

.upload-form__toggle-switch {
    flex: 0 0 auto;
}

.upload-form__toggle-switch .custom-control-label {
    min-height: 1.4rem;
}

.upload-form__info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--upload-primary);
    font-size: 0.95rem;
    cursor: help;
}

.upload-page .form-label,
.upload-page .control-label {
    margin-bottom: 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--upload-text);
}

.upload-page .form-control {
    border: 1px solid var(--upload-border);
    border-radius: 14px;
    min-height: 50px;
    padding: 0.8rem 1rem;
    color: var(--upload-text);
    background: #fff;
    box-shadow: none;
}

.upload-page .form-control:focus {
    border-color: rgba(19, 126, 235, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(19, 126, 235, 0.14);
}

.upload-page .btn-primary {
    border-color: var(--upload-primary);
    background: linear-gradient(135deg, var(--upload-primary), #36a2ff);
    color: #fff;
    border-radius: 14px;
    min-height: 50px;
    padding: 0.8rem 1.3rem;
    font-weight: 700;
    box-shadow: 0 14px 28px rgba(19, 126, 235, 0.24);
}

.upload-page .btn-primary:hover,
.upload-page .btn-primary:focus {
    border-color: var(--upload-primary-dark);
    background: linear-gradient(135deg, var(--upload-primary-dark), var(--upload-primary));
    color: #fff;
}

.upload-page .btn-success {
    border-radius: 14px;
    min-height: 46px;
    padding: 0.7rem 1.2rem;
    font-weight: 700;
}

.upload-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#loadingSpinner {
    display: none;
}

.preview-conatiner {
    flex: 1 1 auto;
    min-height: 0;
    height: 70vh;
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid var(--upload-border);
    border-radius: 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(19, 126, 235, 0.04), rgba(255, 255, 255, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#progress-container {
    width: 100%;
    background-color: #e6edf5;
    border-radius: 999px;
    margin-top: 20px;
    display: none;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 14px;
    background: linear-gradient(90deg, var(--upload-primary), #54b2ff);
    text-align: center;
    line-height: 14px;
    color: white;
    border-radius: 999px;
    font-size: 0;
}

#translation-live-status {
    margin-top: 0.9rem;
}

.upload-progress-panel {
    position: relative;
    overflow: hidden;
    padding: 1rem 1rem 1.05rem;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 22px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.52), rgba(226, 239, 255, 0.2)),
        radial-gradient(circle at top right, rgba(84, 178, 255, 0.22), transparent 42%);
    box-shadow:
        0 18px 38px rgba(17, 79, 138, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(14px);
}

.upload-progress-panel::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 18px;
    width: 92px;
    height: 92px;
    border-radius: 999px;
    /* background: radial-gradient(circle, rgba(84, 178, 255, 0.3), transparent 72%); */
    pointer-events: none;
}

.upload-progress-panel__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
}

.upload-progress-step {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--upload-text);
    letter-spacing: 0.01em;
}

.upload-progress-chip {
    flex: 0 0 auto;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid rgba(19, 126, 235, 0.14);
    color: rgba(19, 50, 77, 0.78);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.upload-progress-preview-shell {
    position: relative;
    min-height: 152px;
    padding: 1rem;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.32);
    overflow: hidden;
}

.upload-progress-preview-shell::after {
    content: "";
    position: absolute;
    inset: auto -28px -34px auto;
    width: 112px;
    height: 112px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(19, 126, 235, 0.12), rgba(255, 255, 255, 0));
    transform: rotate(20deg);
    pointer-events: none;
}

.upload-progress-preview-stage {
    position: relative;
    min-height: 120px;
}

.upload-progress-preview-pane {
    position: absolute;
    inset: 0;
    color: #5d6d80;
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(8px);
    transition:
        opacity 360ms ease,
        transform 520ms cubic-bezier(0.2, 0.78, 0.16, 1),
        filter 420ms ease;
}

.upload-progress-preview-pane.is-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.upload-progress-preview-pane.is-leaving {
    opacity: 0;
    transform: translateY(-16px) scale(0.98);
    filter: blur(8px);
}

.upload-progress-preview-pane.is-placeholder {
    color: rgba(94, 119, 146, 0.9);
    font-style: italic;
}

.upload-progress-preview {
    margin-top: 0.4rem;
    color: #7a8796;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.preview-frame-container {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

#translated-preview-container {
    display: none;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: block;
    border: none;
}

#preview-main-container {
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: stretch;
    gap: 1.5rem;
    margin: 1.5rem 0 0;
    padding: 0;
    min-height: 0;
}

.preview-column {
    flex: 1 1 0;
    width: 50%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 0.85rem;
}

.preview-column__controls {
    width: 100%;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 1rem 1.15rem;
    border: 1px solid var(--upload-border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
}

#translation-privew-text {
    text-align: center;
    margin: 4rem 0 0;
    color: var(--upload-muted);
    font-weight: 600;
}

.upload-result {
    padding-left: 0;
    margin-top: 1rem;
}

.upload-result__alert {
    padding: 1rem 1.1rem;
    border: 1px solid rgba(19, 126, 235, 0.12);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(19, 126, 235, 0.08), rgba(255, 255, 255, 0.96));
    color: var(--upload-text);
}

.upload-result__alert > div {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

#loadingSpinner .spinner-border {
    color: var(--upload-primary) !important;
}

@media (max-width: 767.98px) {
    .upload-page {
        padding: 1rem;
    }

    .upload-card__body {
        padding: 1rem;
    }

    .upload-form__controls {
        padding: 1rem;
    }

    .upload-form__file-row {
        align-items: stretch !important;
    }

    #preview-main-container {
        flex-direction: column;
        min-height: auto;
        flex: 0 0 auto;
    }

    .preview-column {
        width: 100%;
        min-height: auto;
        flex: 0 0 auto;
    }

    .upload-progress-panel__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .upload-progress-preview-shell {
        min-height: 172px;
    }

    .preview-column__controls {
        padding: 0.9rem 1rem;
    }

    .preview-conatiner {
        height: 50vh;
        min-height: 50vh;
    }

    .upload-result__alert {
        align-items: flex-start !important;
        gap: 0.9rem;
    }
}
