@use '../globals' as *;

/**
 * Translations Page Styles
 *
 * Styles for the translations management page including filters, table, and modals.
 *
 * @package MultilingualPressZone
 * @since 1.0.0
 */

/* ==========================================================================
   Variables
   ========================================================================== */

$primary-color: #0073aa !default;
$primary-hover: #005a87 !default;
$success-color: #00a32a !default;
$warning-color: #f0b849 !default;
$error-color: #d63638 !default;
$info-color: #2271b1 !default;

$text-primary: #1e1e1e !default;
$text-secondary: #757575 !default;
$text-light: #a7aaad !default;
$border-color: #c3c4c7 !default;
$background-light: #f0f0f1 !default;
$background-white: #ffffff !default;

$dark-bg: #1e1e1e !default;
$dark-surface: #2c2c2c !default;
$dark-text: #e4e4e4 !default;
$dark-border: #3c3c3c !default;

$spacing-xs: 4px !default;
$spacing-sm: 8px !default;
$spacing-md: 16px !default;
$spacing-lg: 24px !default;
$spacing-xl: 32px !default;

$border-radius-sm: 2px !default;
$border-radius-md: 4px !default;
$border-radius-lg: 8px !default;

$transition-fast: 0.15s ease !default;
$transition-normal: 0.3s ease !default;

/* ==========================================================================
   Page Header
   ========================================================================== */

.mpz-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: $spacing-lg;
    padding-bottom: $spacing-md;
    border-bottom: 1px solid $border-color;

    &__title {
        flex: 1;

        h1 {
            margin: 0 0 $spacing-xs 0;
            font-size: 23px;
            font-weight: 400;
            line-height: 1.3;
            color: $text-primary;
        }
    }

    &__description {
        margin: 0;
        font-size: 13px;
        color: $text-secondary;
    }

    &__actions {
        flex-shrink: 0;
        margin-inline-start: $spacing-md;
    }
}

/* ==========================================================================
   Filters
   ========================================================================== */

.mpz-filters {
    margin-bottom: $spacing-lg;
    padding: $spacing-md;
    background: $presszone-multilingual-surface;
    border: 1px solid $presszone-multilingual-border;
    border-radius: $presszone-multilingual-radius-lg;

    @include dark-mode-class {
        background: $presszone-multilingual-surface-dark;
        border-color: $presszone-multilingual-border-dark;
    }
}

.mpz-filters__row {
    display: flex;
    flex-wrap: wrap;
    gap: $spacing-md;
    align-items: flex-end;
}

.mpz-filter-group {
    display: flex;
    flex-direction: column;
    gap: $spacing-xs;
    min-width: 0;

    &--search {
        flex: 1;
        min-width: 200px;
    }

    &--actions {
        justify-content: flex-end;
        margin-inline-start: auto;
    }
}

.mpz-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: $presszone-multilingual-text-muted;
    margin: 0;

    @include dark-mode-class {
        color: $presszone-multilingual-text-muted-dark;
    }
}

.mpz-filter-input {
    width: 100%;
    min-width: 150px;
}

.mpz-filter-select {
    width: 100%;
    min-width: 150px;
    cursor: pointer;
}

/* ==========================================================================
   Table Container
   ========================================================================== */

.mpz-table-container {
    margin-bottom: $spacing-lg;
    // The Table component now renders a `presszone-multilingual-table-wrapper`
    // which owns the surface/border/radius. Keep this container as a layout hook.
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

/* ==========================================================================
   Translations Table
   ========================================================================== */

// Table layout is provided by `.presszone-multilingual-table--legacy`.
// Keep this class for page-specific hooks only.
.mpz-translations-table {
    font-size: 13px;
}

.mpz-translation-select-checkbox {
    margin: 0;
}

.mpz-translation-title {
    display: flex;
    align-items: center;
    gap: $spacing-xs;

    &__link {
        color: $primary-color;
        text-decoration: none;
        font-weight: 500;
        transition: color $transition-fast;

        &:hover {
            color: $primary-hover;
            text-decoration: underline;
        }

        &:focus {
            outline: 2px solid $primary-color;
            outline-offset: 2px;
            border-radius: $border-radius-sm;
        }
    }
}

.mpz-translation-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 14px;
    cursor: help;
}

.mpz-translation-meta {
    margin-top: $spacing-xs;
    font-size: 12px;
    color: $text-secondary;
}

/* ==========================================================================
   Language Flag Display
   ========================================================================== */

.mpz-language-flag {
    display: flex;
    align-items: center;
    gap: $spacing-sm;

    &__emoji {
        font-size: 18px;
        line-height: 1;
    }

    &__name {
        font-size: 13px;
        color: $text-primary;
    }
}

/* ==========================================================================
   Table Actions
   ========================================================================== */

.mpz-table-actions {
    display: flex;
    gap: $spacing-xs;
    justify-content: flex-end;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.mpz-pagination-container {
    display: flex;
    justify-content: center;
    margin-bottom: $spacing-lg;
}

.mpz-pagination {
    display: flex;
    align-items: center;
    gap: $spacing-md;
    padding: $spacing-md;
    background: $presszone-multilingual-surface;
    border: 1px solid $presszone-multilingual-border;
    border-radius: $presszone-multilingual-radius-lg;

    @include dark-mode-class {
        background: $presszone-multilingual-surface-dark;
        border-color: $presszone-multilingual-border-dark;
    }

    &__info {
        font-size: 13px;
        color: $presszone-multilingual-text-muted;
        font-weight: 600;
        min-width: 100px;
        text-align: center;

        @include dark-mode-class {
            color: $presszone-multilingual-text-muted-dark;
        }
    }
}

/* ==========================================================================
   Translation Details Modal
   ========================================================================== */

.mpz-translation-details {
    display: flex;
    flex-direction: column;
    gap: $spacing-lg;
    max-height: 60vh;
    overflow-y: auto;
}

.mpz-detail-section {
    h3 {
        margin: 0 0 $spacing-md 0;
        font-size: 15px;
        font-weight: 600;
        color: $text-primary;
        padding-bottom: $spacing-sm;
        border-bottom: 1px solid $border-color;
    }
}

.mpz-detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: $spacing-sm $spacing-md;
    margin: 0;

    dt {
        font-weight: 600;
        color: $text-secondary;
        font-size: 13px;
    }

    dd {
        margin: 0;
        color: $text-primary;
        font-size: 13px;
    }
}

.mpz-detail-actions {
    display: flex;
    gap: $spacing-sm;

    .button {
        display: inline-flex;
        align-items: center;
        gap: $spacing-xs;
        padding: 8px 16px;
        font-size: 13px;
        text-decoration: none;
        transition: all $transition-fast;

        &:hover {
            text-decoration: none;
        }
    }
}

/* ==========================================================================
   Hash Status Notice
   ========================================================================== */

.mpz-hash-status {
    margin-top: $spacing-sm;
}

// Notices are shared in admin/src/styles/_components.scss

/* ==========================================================================
   Bulk Translate Modal
   ========================================================================== */

.mpz-bulk-translate {
    display: flex;
    flex-direction: column;
    gap: $spacing-md;

    p {
        margin: 0;
        font-size: 14px;
        color: $text-primary;
    }
}

.mpz-form-group {
    display: flex;
    flex-direction: column;
    gap: $spacing-xs;

    label {
        font-size: 13px;
        font-weight: 500;
        color: $text-primary;
        margin: 0;
    }
}

.mpz-select {
    width: 100%;
    padding: 8px 12px;
    padding-inline-end: 36px;
    font-size: 13px;
    line-height: 1.4;
    color: $text-primary;
    background-color: $background-white;
    border: 1px solid $border-color;
    border-radius: $border-radius-sm;
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"%3e%3cpath fill="%23a7aaad" d="M5 6l5 5 5-5 2 1-7 7-7-7z"/%3e%3c/svg%3e');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    transition: border-color $transition-fast;

    @include rtl {
        background-position: left 10px center;
    }

    &:focus {
        border-color: $primary-color;
        outline: none;
        box-shadow: 0 0 0 1px $primary-color;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .mpz-page-header {
        border-bottom-color: $dark-border;

        &__title h1 {
            color: $dark-text;
        }

        &__description {
            color: lighten($text-secondary, 10%);
        }
    }

    .mpz-filters {
        background: $dark-surface;
        border-color: $dark-border;
    }

    .mpz-filter-label {
        color: $dark-text;
    }

    .mpz-filter-input,
    .mpz-filter-select,
    .mpz-select {
        color: $dark-text;
        background-color: $dark-bg;
        border-color: $dark-border;

        &:focus {
            border-color: lighten($primary-color, 15%);
            box-shadow: 0 0 0 1px lighten($primary-color, 15%);
        }
    }

    .mpz-table-container {
        background: $dark-surface;
        border-color: $dark-border;
    }

    .mpz-translations-table {
        thead {
            background-color: $dark-bg;
            border-bottom-color: $dark-border;

            th {
                color: $dark-text;
            }
        }

        tbody {
            tr {
                border-bottom-color: $dark-border;

                &:hover {
                    background-color: lighten($dark-surface, 3%);
                }
            }

            td {
                color: $dark-text;
            }
        }
    }

    .mpz-translation-title__link {
        color: lighten($primary-color, 15%);

        &:hover {
            color: lighten($primary-hover, 15%);
        }
    }

    .mpz-translation-meta {
        color: lighten($text-secondary, 10%);
    }

    .mpz-language-flag__name {
        color: $dark-text;
    }

    .mpz-pagination {
        background: $dark-surface;
        border-color: $dark-border;

        &__info {
            color: lighten($text-secondary, 10%);
        }
    }

    .mpz-detail-section h3 {
        color: $dark-text;
        border-bottom-color: $dark-border;
    }

    .mpz-detail-list {
        dt {
            color: lighten($text-secondary, 10%);
        }

        dd {
            color: $dark-text;
        }
    }

    .mpz-notice {
        &--success {
            color: lighten($success-color, 20%);
            background-color: rgba($success-color, 0.15);
            border-color: rgba($success-color, 0.3);
        }

        &--warning {
            color: lighten($warning-color, 10%);
            background-color: rgba($warning-color, 0.15);
            border-color: rgba($warning-color, 0.3);
        }

        &--error {
            color: lighten($error-color, 20%);
            background-color: rgba($error-color, 0.15);
            border-color: rgba($error-color, 0.3);
        }

        &--info {
            color: lighten($info-color, 20%);
            background-color: rgba($info-color, 0.15);
            border-color: rgba($info-color, 0.3);
        }
    }

    .mpz-form-group label {
        color: $dark-text;
    }

    .mpz-bulk-translate p {
        color: $dark-text;
    }
}

// Explicit dark mode class (WordPress admin color scheme)
body.admin-color-midnight,
body.admin-color-ectoplasm {
    .mpz-page-header {
        border-bottom-color: $dark-border;

        &__title h1 {
            color: $dark-text;
        }

        &__description {
            color: lighten($text-secondary, 10%);
        }
    }

    .mpz-filters {
        background: $dark-surface;
        border-color: $dark-border;
    }

    .mpz-filter-label {
        color: $dark-text;
    }

    .mpz-filter-input,
    .mpz-filter-select,
    .mpz-select {
        color: $dark-text;
        background-color: $dark-bg;
        border-color: $dark-border;

        &:focus {
            border-color: lighten($primary-color, 15%);
            box-shadow: 0 0 0 1px lighten($primary-color, 15%);
        }
    }

    .mpz-table-container {
        background: $dark-surface;
        border-color: $dark-border;
    }

    .mpz-translations-table {
        thead {
            background-color: $dark-bg;
            border-bottom-color: $dark-border;

            th {
                color: $dark-text;
            }
        }

        tbody {
            tr {
                border-bottom-color: $dark-border;

                &:hover {
                    background-color: lighten($dark-surface, 3%);
                }
            }

            td {
                color: $dark-text;
            }
        }
    }

    .mpz-translation-title__link {
        color: lighten($primary-color, 15%);

        &:hover {
            color: lighten($primary-hover, 15%);
        }
    }

    .mpz-pagination {
        background: $dark-surface;
        border-color: $dark-border;

        &__info {
            color: lighten($text-secondary, 10%);
        }
    }

    .mpz-detail-section h3 {
        color: $dark-text;
        border-bottom-color: $dark-border;
    }

    .mpz-detail-list {
        dt {
            color: lighten($text-secondary, 10%);
        }

        dd {
            color: $dark-text;
        }
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (max-width: 1200px) {
    .mpz-filters__row {
        flex-wrap: wrap;
    }

    .mpz-filter-group {
        min-width: 150px;

        &--search {
            flex: 1 1 100%;
            max-width: 100%;
        }
    }
}

@media screen and (max-width: 782px) {
    .mpz-page-header {
        flex-direction: column;
        align-items: stretch;

        &__actions {
            margin-inline-start: 0;
            margin-top: $spacing-md;
        }
    }

    .mpz-filters__row {
        flex-direction: column;
    }

    .mpz-filter-group {
        width: 100%;
        min-width: 0;

        &--actions {
            margin-inline-start: 0;
        }
    }

    .mpz-translations-table {
        font-size: 12px;

        thead {
            th {
                padding: $spacing-xs $spacing-sm;
            }
        }

        tbody {
            td {
                padding: $spacing-sm;
            }
        }
    }

    .mpz-table-actions {
        flex-direction: column;
        gap: $spacing-xs;
    }

    .mpz-detail-list {
        grid-template-columns: 1fr;
        gap: $spacing-xs;

        dt {
            font-weight: 600;
            margin-top: $spacing-sm;

            &:first-child {
                margin-top: 0;
            }
        }
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

// High contrast mode support
@media (prefers-contrast: high) {
    .mpz-translations-table {
        border: 2px solid currentColor;

        thead th,
        tbody td {
            border: 1px solid currentColor;
        }
    }

    .mpz-filter-input,
    .mpz-filter-select,
    .mpz-select {
        border-width: 2px;

        &:focus {
            outline: 2px solid currentColor;
            outline-offset: 2px;
        }
    }
}

// Reduced motion support
@media (prefers-reduced-motion: reduce) {
    .mpz-translations-table tbody tr,
    .mpz-translation-title__link,
    .mpz-filter-input,
    .mpz-filter-select,
    .mpz-select,
    .mpz-notice {
        transition: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .mpz-page-header__actions,
    .mpz-filters,
    .mpz-table-actions,
    .mpz-pagination-container {
        display: none;
    }

    .mpz-translations-table {
        border: 1px solid #000;

        thead,
        tbody tr {
            border: 1px solid #000;
        }

        td, th {
            padding: 4px 8px;
        }
    }
}

/* ==========================================================================
   String Translate Sub-page Styles
   ========================================================================== */

#mpz-translations-tab-content {
    margin-top: $spacing-md;
}

.mpz-st-string {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.mpz-st-domain {
    font-family: monospace;
    color: $presszone-multilingual-text-muted;
    font-size: 13px;

    @include dark-mode-class {
        color: $presszone-multilingual-text-muted-dark;
    }
}

.mpz-st-table-row {
    cursor: pointer;

    &:hover {
        background: var(--presszone-multilingual-surface-hover, #{$presszone-multilingual-surface-2});
    }

    @include dark-mode-class {
        &:hover {
            background: $presszone-multilingual-surface-2-dark;
        }
    }
}

.mpz-st-scan-progress {
    font-size: 13px;
    color: $presszone-multilingual-text-muted;
}

// Edit Modal -- Side-by-side translation layout
.mpz-st-edit-layout {
    display: flex;
    flex-direction: column;
    gap: $spacing-md;
}

.mpz-st-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: $spacing-md;
    min-height: 200px;

    @media screen and (max-width: 782px) {
        grid-template-columns: 1fr;
    }
}

.mpz-st-edit-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: $presszone-multilingual-text-muted;
    margin-bottom: $spacing-xs;

    @include dark-mode-class {
        color: $presszone-multilingual-text-muted-dark;
    }
}

.mpz-st-edit-grid__original-text {
    background: $presszone-multilingual-surface-alt;
    border: 1px solid $presszone-multilingual-border;
    border-radius: $border-radius-md;
    padding: $spacing-md;
    user-select: all;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    max-height: 300px;
    color: $text-primary;

    @include dark-mode-class {
        background: $presszone-multilingual-surface-alt-dark;
        border-color: $presszone-multilingual-border-dark;
        color: $presszone-multilingual-text-dark;
    }
}

.mpz-st-edit-grid__translation textarea {
    width: 100%;
    min-height: 200px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.6;
    padding: $spacing-md;
    border-radius: $border-radius-md;
    border: 1px solid $presszone-multilingual-border;
    color: $text-primary;
    background: $background-white;

    &:focus {
        border-color: $primary-color;
        outline: none;
        box-shadow: 0 0 0 1px $primary-color;
    }

    @include dark-mode-class {
        color: $presszone-multilingual-text-dark;
        background: $presszone-multilingual-surface-dark;
        border-color: $presszone-multilingual-border-dark;

        &:focus {
            border-color: lighten($primary-color, 15%);
            box-shadow: 0 0 0 1px lighten($primary-color, 15%);
        }
    }
}

.mpz-st-edit-meta {
    display: flex;
    align-items: center;
    gap: $spacing-md;
    margin-top: $spacing-sm;
    padding-top: $spacing-sm;
    border-top: 1px solid $presszone-multilingual-border;
    font-size: 13px;
    color: $presszone-multilingual-text-muted;

    @include dark-mode-class {
        border-top-color: $presszone-multilingual-border-dark;
        color: $presszone-multilingual-text-muted-dark;
    }
}

.mpz-st-tab-check {
    color: $success-color;
    font-weight: 700;
}

.mpz-st-tab-inactive-badge {
    display: inline-block;
    margin-inline-start: $spacing-xs;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.4;
    color: $text-secondary;
    background: $background-light;
    border: 1px solid $border-color;
    border-radius: 10px;
    vertical-align: middle;
    text-transform: lowercase;

    @include dark-mode-class {
        color: $presszone-multilingual-text-muted-dark;
        background: $presszone-multilingual-surface-dark;
        border-color: $presszone-multilingual-border-dark;
    }
}

.presszone-multilingual-tabs__item--inactive {
    opacity: 0.65;
}

.mpz-ct-lang-inactive {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: $spacing-md;
    background: $background-light;
    border: 1px dashed $border-color;
    border-radius: $border-radius-md;
    padding: $spacing-lg;
    text-align: center;

    @include dark-mode-class {
        background: $presszone-multilingual-surface-dark;
        border-color: $presszone-multilingual-border-dark;
    }
}

.mpz-ct-lang-inactive__text {
    color: $text-secondary;
    font-size: 14px;
    margin: 0;

    @include dark-mode-class {
        color: $presszone-multilingual-text-muted-dark;
    }
}

.mpz-st-skeleton-container {
    padding: $spacing-md 0;
}

/* ==========================================================================
   Content Translate Sub-page Styles (Posts/Pages tabs)
   ========================================================================== */

.mpz-ct-title-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mpz-ct-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.mpz-ct-meta {
    font-size: 12px;
    color: var(--presszone-multilingual-text-muted);
}

.mpz-ct-date {
    font-size: 13px;
    color: var(--presszone-multilingual-text-muted);
}

.mpz-tooltip-wrap {
    position: relative;
    display: inline-block;
    cursor: default;

    &:hover .mpz-tooltip-box {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }
}

.mpz-tooltip-box {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--presszone-multilingual-bg-tooltip, #1a1a2e);
    color: var(--presszone-multilingual-text-tooltip, #fff);
    font-size: 12px;
    line-height: 1.5;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);

    .dark-mode & {
        background: var(--presszone-multilingual-bg-tooltip-dark, #0d0d1a);
    }
}

.mpz-st-meta-auto {
    font-size: 11px;
    color: var(--presszone-multilingual-primary, #0073aa);
    font-style: italic;
}

.mpz-ct-excerpt-preview {
    margin-top: $spacing-xs;
    font-size: 13px;
    line-height: 1.5;
    color: var(--presszone-multilingual-text-muted);
    max-height: 200px;
    overflow-y: auto;
}

.mpz-ct-not-translated {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: $spacing-md;
    background: var(--presszone-multilingual-surface-alt);
    border: 1px dashed var(--presszone-multilingual-border);
    border-radius: $border-radius-md;
    padding: $spacing-lg;
    text-align: center;
}

.mpz-ct-not-translated__text {
    color: var(--presszone-multilingual-text-muted);
    font-size: 14px;
}

.mpz-ct-translated-content {
    background: var(--presszone-multilingual-surface-alt);
    border: 1px solid var(--presszone-multilingual-border);
    border-radius: $border-radius-md;
    padding: $spacing-md;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    user-select: all;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.6;
}

.mpz-ct-edit-link {
    margin-top: $spacing-sm;
}

.mpz-ct-edit-link__anchor {
    color: var(--presszone-multilingual-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;

    &:hover {
        text-decoration: underline;
    }
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

.mpz-table-actions {
    @include rtl {
        justify-content: flex-start;
    }
}

/* ==========================================================================
   Generate Translation Styles
   ========================================================================== */

.mpz-ct-generating {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: $spacing-md;
    background: var(--presszone-multilingual-surface-alt);
    border: 1px solid var(--presszone-multilingual-border);
    border-radius: $border-radius-md;
    padding: $spacing-lg;
}

.mpz-ct-generating__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--presszone-multilingual-border);
    border-top-color: $primary-color;
    border-radius: 50%;
    animation: mpz-spin 0.8s linear infinite;
}

.mpz-ct-generating__text {
    color: var(--presszone-multilingual-text-muted);
    font-size: 14px;
    margin: 0;
}

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

@media (prefers-reduced-motion: reduce) {
    .mpz-ct-generating__spinner {
        animation: none;
    }
}

/* ==========================================================================
   Promotional Modal Styles
   ========================================================================== */

.mpz-promo-modal {
    text-align: center;
    padding: $spacing-md 0;
}

.mpz-promo-modal__icon {
    font-size: 48px;
    margin-bottom: $spacing-md;
}

.mpz-promo-modal__heading {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 $spacing-sm;
}

.mpz-promo-modal__description {
    font-size: 14px;
    line-height: 1.6;
    color: $text-secondary;
    margin: 0 0 $spacing-lg;
}

/* ==========================================================================
   Generate All Modal
   ========================================================================== */

.mpz-generate-all-modal {
    &__summary {
        font-size: 14px;
        font-weight: 600;
        margin: 0 0 $spacing-md;
        color: $text-primary;

        @include dark-mode-class {
            color: $dark-text;
        }
    }

    &__langs {
        display: flex;
        flex-direction: column;
        gap: $spacing-sm;
    }

    &__lang-row {
        display: flex;
        align-items: center;
        gap: $spacing-sm;
        padding: $spacing-sm;
        border-radius: $border-radius-md;
        cursor: pointer;
        transition: background $transition-fast;

        &:hover {
            background: $background-light;
        }

        @include dark-mode-class {
            &:hover {
                background: $dark-surface;
            }
        }
    }

    &__lang-row--done {
        opacity: 0.5;
    }

    &__flag {
        font-size: 18px;
        line-height: 1;
    }

    &__lang-count {
        margin-left: auto;
        font-size: 12px;
        color: $text-secondary;
        white-space: nowrap;

        @include dark-mode-class {
            color: lighten($text-secondary, 10%);
        }
    }

    &__estimate {
        font-size: 13px;
        color: $text-secondary;
        margin: $spacing-md 0 0;
        padding-top: $spacing-md;
        border-top: 1px solid $border-color;

        @include dark-mode-class {
            color: lighten($text-secondary, 10%);
            border-top-color: $dark-border;
        }
    }

    &__progress,
    &__done {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: $spacing-xl $spacing-md;
        gap: $spacing-md;
        text-align: center;
    }

    &__icon {
        font-size: 36px;

        &--success {
            color: $success-color;
        }

        &--error {
            color: $error-color;
        }
    }

    &__title {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        color: $text-primary;

        @include dark-mode-class {
            color: $dark-text;
        }
    }

    &__note {
        font-size: 13px;
        color: $text-secondary;
        margin: 0;

        @include dark-mode-class {
            color: lighten($text-secondary, 10%);
        }
    }

    &__failed-list {
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
        margin-top: $spacing-sm;
        text-align: left;
        border-top: 1px solid $border-color;
        padding-top: $spacing-sm;

        @include dark-mode-class {
            border-top-color: $dark-border;
        }
    }

    &__failed-header {
        font-size: 12px;
        font-weight: 600;
        color: $text-secondary;
        margin: 0 0 $spacing-xs;
        text-transform: uppercase;
        letter-spacing: 0.5px;

        @include dark-mode-class {
            color: lighten($text-secondary, 10%);
        }
    }

    &__failed-item {
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: $spacing-sm;
        padding: $spacing-xs 0;
        font-size: 12px;
        border-bottom: 1px solid rgba($border-color, 0.5);
        align-items: baseline;

        &:last-child {
            border-bottom: none;
        }

        @include dark-mode-class {
            border-bottom-color: rgba($dark-border, 0.5);
        }
    }

    &__failed-text {
        color: $text-primary;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        @include dark-mode-class {
            color: $dark-text;
        }
    }

    &__failed-lang {
        color: $text-secondary;
        font-size: 11px;
        text-transform: uppercase;

        @include dark-mode-class {
            color: lighten($text-secondary, 10%);
        }
    }

    &__failed-reason {
        color: $error-color;
        font-size: 11px;
        white-space: nowrap;
    }
}

.mpz-promo-modal__features {
    list-style: none;
    padding: 0;
    margin: 0 0 $spacing-md;
    text-align: start;

    li {
        position: relative;
        padding-inline-start: 24px;
        margin-bottom: $spacing-sm;
        font-size: 14px;

        &::before {
            content: '\2713';
            position: absolute;
            inset-inline-start: 0;
            color: $success-color;
            font-weight: 700;
        }
    }
}

/* ==========================================================================
   Translate All — in-modal progress and completion
   ========================================================================== */

.mpz-bulk-progress-container {
    display: flex;
    flex-direction: column;
    gap: $spacing-md;
    padding: $spacing-lg $spacing-md;

    &__label {
        font-size: 14px;
        font-weight: 500;
        color: $text-primary;
        text-align: center;

        @include dark-mode-class {
            color: $dark-text;
        }
    }

    &__bar {
        // ProgressBar component renders into this div
    }
}

.tpz-modal-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    min-height: 180px;

    &__icon {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        font-weight: 700;
        margin-bottom: 12px;
        color: #fff;
        background: $success-color;

        &--error {
            background: $error-color;
        }
    }

    &__title {
        font-size: 16px;
        font-weight: 600;
        margin: 0 0 8px;
        color: $text-primary;

        @include dark-mode-class {
            color: $dark-text;
        }
    }
}

.mpz-translate-all-results {
    display: flex;
    flex-direction: column;
    gap: $spacing-xs;
    width: 100%;
    max-width: 360px;
    margin-top: $spacing-sm;
}

.mpz-translate-all-result {
    display: flex;
    align-items: center;
    gap: $spacing-sm;
    padding: $spacing-xs $spacing-sm;
    font-size: 13px;
    border-radius: $border-radius-sm;
    background: $background-light;

    @include dark-mode-class {
        background: $dark-surface;
    }

    &__lang {
        flex: 1;
        font-weight: 500;
        color: $text-primary;

        @include dark-mode-class {
            color: $dark-text;
        }
    }

    &__status {
        font-weight: 700;
        font-size: 14px;

        &--ok {
            color: $success-color;
        }

        &--fail {
            color: $error-color;
        }
    }

    &__link {
        font-size: 12px;
        color: $primary-color;
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }

    &__error {
        font-size: 11px;
        color: $error-color;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.mpz-st-tab-check--failed {
    color: $error-color;
}
