/**
 * Product import wizard modals — desktop and mobile layouts.
 */

/* --- Desktop (default) --- */

.import-wizard-modal-dialog {
    max-width: min(960px, 94vw);
    width: 94vw;
    max-height: calc(100vh - 1rem);
}

.import-wizard-modal-dialog--wide {
    max-width: min(1320px, 96vw);
    width: 96vw;
}

.import-wizard-modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 1rem);
}

.import-wizard-modal-content > form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.import-wizard-modal-form {
    margin: 10px;
}

.import-wizard-modal-body-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(65vh, 560px);
    overflow: auto;
}

.import-wizard-preview-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(62vh, 520px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.import-wizard-modal-content .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

.import-wizard-modal-content .modal-footer {
    flex-shrink: 0;
    padding: 0.75rem 1.5rem 1.25rem;
}

.import-header-preview-table .import-header-row {
    cursor: pointer;
}

.import-header-preview-table .import-header-row.table-primary {
    font-weight: 600;
}

.import-header-row-number {
    width: 3rem;
    white-space: nowrap;
}

.import-row-selection-check-col {
    width: 3rem;
}

.import-row-line-col {
    width: 3rem;
    min-width: 3rem;
    max-width: 3rem;
    white-space: nowrap;
    text-align: center;
}

.import-wizard-preview-scroll.table-responsive {
    overflow-x: auto;
    overflow-y: auto;
}

.import-wizard-preview-scroll .table td,
.import-wizard-preview-scroll .table th {
    vertical-align: middle;
}

.import-wizard-summary-bar {
    gap: 0.75rem;
}

#productsImportRowSelectionModal .import-row-selection-modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

#productsImportRowSelectionModal .import-row-selection-modal-body > .import-wizard-summary-bar,
#productsImportRowSelectionModal .import-row-selection-modal-body > .import-merge-action-bar,
#productsImportRowSelectionModal .import-row-selection-modal-body > .alert {
    flex-shrink: 0;
}

#productsImportRowSelectionModal .import-row-selection-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

#productsImportRowSelectionModal .import-row-selection-table-wrap .import-row-selection-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #fff;
}

.import-row-selection-table .import-row-merge-col {
    display: none;
    width: 16rem;
    min-width: 14rem;
    max-width: 18rem;
}

.import-row-selection-table.import-merge-col-active .import-row-merge-col {
    display: table-cell;
}

.import-row-selection-table .import-row-merge-target {
    padding: 0.35rem 0.5rem;
}

.import-row-merge-group-cell {
    vertical-align: top;
    background-color: #fffbf0;
}

.import-row-selection-table tr.import-row-has-merge > td,
.import-row-selection-table tr.import-row-merge-group-member > td {
    background-color: #fffbf0;
}

.import-row-selection-table tr.import-row-has-merge:hover > td,
.import-row-selection-table tr.import-row-merge-group-member:hover > td {
    background-color: #fff6e0;
}

.import-merge-group-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    background-color: #fff9eb;
    border: 1px solid #e8c872;
    border-left: 4px solid #d35400;
    border-radius: 0.375rem;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.import-merge-group-field {
    margin-bottom: 0;
}

.import-merge-group-field-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a5a12;
    margin-bottom: 0.25rem;
}

.import-merge-group-panel .select2-container {
    width: 100% !important;
}

.import-merge-group-panel .select2-selection--single {
    min-height: 2rem;
    border-color: #d4a843;
    background-color: #fff;
}

.import-merge-group-discount-input {
    max-width: 7rem;
    border-color: #d4a843;
}

.import-merge-group-actions {
    border-top: 1px solid #f0e0b0;
    padding-top: 0.35rem;
}

.import-merge-group-remove {
    color: #8a3b00;
    text-align: left;
}

.import-merge-group-remove:hover,
.import-merge-group-remove:focus {
    color: #c0392b;
    text-decoration: none;
}

.import-merge-group-sp-dropdown {
    z-index: 1060 !important;
}

.import-not-found-create-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}

.import-not-found-create-bar__label {
    flex: 1 1 auto;
    min-width: 0;
}

.import-not-found-create-bar__switch {
    flex: 0 0 auto;
}

.import-not-found-rows-wrap.import-not-found-um-fields-disabled .import-not-found-um-cell {
    opacity: 0.55;
    pointer-events: none;
}

.import-not-found-create-col {
    display: none;
    width: 2.75rem;
    min-width: 2.75rem;
    vertical-align: middle;
}

.import-not-found-table.import-not-found-create-col-active .import-not-found-create-col {
    display: table-cell;
}

.import-not-found-table .import-not-found-mapping-col {
    display: none;
    width: 14rem;
    min-width: 12rem;
    max-width: 16rem;
    vertical-align: middle;
}

.import-not-found-table.import-not-found-mapping-col-active .import-not-found-mapping-col {
    display: table-cell;
}

.import-not-found-table .import-not-found-mapping-target {
    padding: 0.35rem 0.5rem;
}

.import-not-found-mapping-group-cell {
    vertical-align: middle;
    background-color: #fffbf0;
}

.import-not-found-table tr.import-not-found-has-provider-mapping > td,
.import-not-found-table tr.import-not-found-provider-group-member > td,
.import-not-found-table tr.import-not-found-has-category-mapping > td,
.import-not-found-table tr.import-not-found-category-group-member > td,
.import-not-found-table tr.import-not-found-has-admin-mapping > td,
.import-not-found-table tr.import-not-found-admin-group-member > td {
    background-color: #fffbf0;
}

.import-not-found-table tr.import-not-found-has-provider-mapping:hover > td,
.import-not-found-table tr.import-not-found-provider-group-member:hover > td,
.import-not-found-table tr.import-not-found-has-category-mapping:hover > td,
.import-not-found-table tr.import-not-found-category-group-member:hover > td,
.import-not-found-table tr.import-not-found-has-admin-mapping:hover > td,
.import-not-found-table tr.import-not-found-admin-group-member:hover > td {
    background-color: #fff6e0;
}

.import-not-found-mapping-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 100%;
    background-color: #fff9eb;
    border: 1px solid #e8c872;
    border-left: 4px solid #d35400;
    border-radius: 0.375rem;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.import-not-found-mapping-panel .select2-container {
    width: 100% !important;
}

.import-not-found-mapping-panel .select2-selection--single {
    min-height: 2rem;
    border-color: #d4a843;
    background-color: #fff;
}

.import-not-found-mapping-actions {
    border-top: 1px solid #f0e0b0;
    padding-top: 0.35rem;
}

.import-not-found-um-row.import-not-found-row-skip-create .import-not-found-create-col {
    opacity: 0.55;
}

#productsImportNotFoundModal .import-not-found-modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

#productsImportNotFoundModal .import-not-found-modal-body > .import-not-found-create-bar,
#productsImportNotFoundModal .import-not-found-modal-body > .d-flex,
#productsImportNotFoundModal .import-not-found-modal-body > .import-merge-action-bar {
    flex-shrink: 0;
}

#productsImportNotFoundModal .import-not-found-rows-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#productsImportNotFoundModal .import-not-found-rows-wrap .import-wizard-preview-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

#importMergePopupModal .select2-container {
    width: 100% !important;
}

#productsImportNotFoundModal .import-not-found-um-cell .select2-container {
    width: 100% !important;
}

#productsImportNotFoundModal .import-not-found-um-cell.has-error .select2-selection {
    border-color: #dc3545;
}

#productsImportNotFoundModal .import-not-found-um-cell .help-block.form-error {
    margin-bottom: 0;
    margin-top: 0.25rem;
}

#productsImportNotFoundModal .import-not-found-data-cell.import-not-found-cell-has-error
.import-not-found-cell-value {
    color: #212529;
}

#productsImportNotFoundModal .import-not-found-field-error {
    margin-top: 0.25rem;
    white-space: normal;
}

#productsImportNotFoundModal .import-not-found-um-row.import-not-found-row-import-error td {
    vertical-align: top;
}

#productsImportNotFoundModal .import-not-found-modal-body > #importNotFoundReviewSummary {
    flex-shrink: 0;
}

#productsImportNotFoundModal .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}

#importMergePopupModal .select2-container--default .select2-selection--single,
#productsImportRowSelectionModal .select2-container--default .select2-selection--single,
#productsImportNotFoundModal .select2-container--default .select2-selection--single {
    position: relative;
}

#importMergePopupModal .select2-container--default .select2-selection--single .select2-selection__rendered,
#productsImportRowSelectionModal .select2-container--default .select2-selection--single .select2-selection__rendered,
#productsImportNotFoundModal .select2-container--default .select2-selection--single .select2-selection__rendered {
    display: block;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#productsImportNotFoundModal .import-not-found-um-cell .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-right: 2.25rem;
}

#importMergePopupModal .select2-container--default .select2-selection--single .select2-selection__clear,
#productsImportRowSelectionModal .select2-container--default .select2-selection--single .select2-selection__clear,
#productsImportNotFoundModal .select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    top: 50%;
    right: 1.375rem;
    float: none;
    width: 1rem;
    height: 1rem;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: bold;
    font-size: 1rem;
    line-height: 1rem;
    text-align: center;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 1;
}

#importMergePopupModal .select2-container--default .select2-selection--single .select2-selection__arrow,
#productsImportRowSelectionModal .select2-container--default .select2-selection--single .select2-selection__arrow,
#productsImportNotFoundModal .select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 20px;
    height: 26px;
}

.import-wizard-mapping-table td .select2-container {
    width: 100% !important;
}

.import-merge-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    position: sticky;
    bottom: 0;
    z-index: 1;
}

.import-merge-action-bar__buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* --- Mobile --- */

@media (max-width: 767.98px) {
    .import-wizard-modal-dialog,
    .import-wizard-modal-dialog--wide {
        max-width: calc(100% - 0.75rem);
        width: calc(100% - 0.75rem);
        max-height: calc(100vh - 0.75rem);
        margin: 0.375rem auto;
    }

    .import-wizard-modal-content {
        max-height: calc(100vh - 0.75rem);
    }

    .import-wizard-modal-dialog.modal-dialog-centered {
        min-height: calc(100% - 0.75rem);
    }

    .import-wizard-modal-content .modal-header {
        padding: 0.75rem 1rem;
    }

    .import-wizard-modal-content .modal-header .modal-title {
        font-size: 1rem;
        line-height: 1.35;
        padding-right: 1.5rem;
    }

    .import-wizard-modal-content .modal-body {
        padding: 0.75rem 1rem;
    }

    .import-wizard-modal-content .modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        padding: 0.75rem 1rem 1rem;
    }

    .import-wizard-modal-content .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }

    .import-wizard-modal-form {
        margin: 0;
    }

    .import-wizard-modal-body-scroll,
    .import-wizard-preview-scroll {
        max-height: 50vh;
    }

    .import-wizard-summary-bar {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .import-wizard-summary-bar .btn {
        width: 100%;
    }

    .import-header-preview-table,
    .import-row-selection-table {
        font-size: 0.8125rem;
    }

    .import-header-preview-table td,
    .import-row-selection-table td,
    .import-row-selection-table th {
        white-space: normal;
        word-break: break-word;
    }

    .import-header-row-number {
        width: 2.25rem;
    }

    .import-wizard-mapping-table thead {
        display: none;
    }

    .import-wizard-mapping-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #dee2e6;
    }

    .import-wizard-mapping-table tbody tr:last-child {
        border-bottom: 0;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .import-wizard-mapping-table tbody td {
        display: block;
        width: 100%;
        border: 0;
        padding: 0.25rem 0;
    }

    .import-wizard-mapping-table tbody td:first-child {
        font-weight: 600;
        padding-top: 0;
    }

    .import-wizard-mapping-table tbody td .d-flex {
        justify-content: flex-start !important;
    }
}

@media (max-width: 575.98px) {
    .import-wizard-modal-body-scroll,
    .import-wizard-preview-scroll {
        max-height: 45vh;
    }

    .import-row-selection-table th:nth-child(5),
    .import-row-selection-table td:nth-child(5),
    .import-row-selection-table th:nth-child(6),
    .import-row-selection-table td:nth-child(6) {
        max-width: 7rem;
    }
}
