/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */
 
/* eslint-disable Magento2.Less.ClassNaming.NotAllowedSymbol */

.wtai-categories-index,
.wtai-grid-index {
    &._has-modal {
        .main-col {
            .data-grid-cap-right {
                display: none;
            }
        }
    }
    
    .modals-wrapper {
        .modal-popup {
            .thumbnail-preview {
                .thumbnail-preview-link {
                    display: none;
                }
            }
        }
    }
    
    .admin__data-grid-wrap {
        overflow-x: auto;
        min-height: 600px;

        table td {
            .action-menu-item {
                cursor: pointer;
            }
            
            .action-select-wrap {
                position: relative;

                .action-menu {
                    position: absolute;
                    left: 0;
                    min-width: max-content;
                    
                    .action-menu-item:not(.wtai-disabled) {
                        width: 100%;
                    }
                }
            }
        }
    }

    .notices-wrapper {
        z-index: 503;
        position: relative;
    }
    
    .page-header.row {
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 502;
        display: flex;
    }

    .admin__data-grid-filters {
        .admin__control-select,
        .wtai-select_ai-fields {
            &._error {
                border-color: #ee7d7d;
            }
        }

        .wtai-no_activity_days {
            line-height: 19px;
        }
    }
    
    .action-select-wrap {
        &.wtai-disabled {
            cursor: not-allowed;
            opacity: .5;
            pointer-events: none;
        }

        &.wtai-loading {
            &::before {
                background-image: url("../WriteTextAI_WriteTextAI/images/generate-ongoing.gif");
                background-color: transparent;
                background-position: center center;
                background-repeat: no-repeat;
                background-size: contain;
                content: "";
                display: inline-block;
                height: 19px;
                margin-right: 10px;
                vertical-align: middle;
                width: 19px;
                mix-blend-mode: multiply;
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
            }
        }
    }

    .data-grid {
        th.wtai-ai-header {
            border-right: none;
        }

        th.wtai-mg-header {
            border-left: none;
        }

        .data-row {
            &.wtai-row-disabled {
                .wtai-col-index,
                .wtai-col-actions {
                    opacity: .5;
                    pointer-events: none;
                }

                .wtai-col-product_name span:first-child {
                    opacity: .5;
                    pointer-events: none;
                }
            }
            
            &.wtai-row-generating {
                .wtai-col-index,
                .wtai-col-actions {
                    opacity: .5;
                    pointer-events: none;
                }

                .wtai-col-product_name span:first-child {
                    opacity: .5;
                    pointer-events: none;
                }
            }
            
            &.wtai-row-optimizing {
                .wtai-col-index,
                .wtai-col-actions {
                    opacity: .5;
                    pointer-events: none;
                }

                .wtai-col-product_name span:first-child {
                    opacity: .5;
                    pointer-events: none;
                }
            }

            td {
                max-height: unset;
                max-width: 258px;
                border-top: none;
                border-bottom: none;

                &.data-grid-thumbnail-cell {
                    cursor: pointer;
                }

                &.wtai-col-ai {
                    border-right: none;
                    max-width: 318px;
                }

                &.wtai-col-mg {
                    border-left: none;
                }

                &.wtai-col-ai,
                &.wtai-col-mg {
                    .data-grid-cell-content {
                        .wtai-text-content {
                            -webkit-box-orient: vertical;
                            display: -webkit-box;
                            -webkit-line-clamp: 3;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            min-width: 238px;
                        }
                    }
                }

                &.wtai-col-date {
                    .data-grid-cell-content {
                        width: 138px;
                    }
                }

                &.wtai-col-target_keywords,
                &.wtai-col-traffic_potential {
                    .data-grid-cell-content {
                        width: 150px;
                        word-break: break-word;
                    }
                }

                &.wtai-col-sku,
                &.wtai-col-product_name {
                    .data-grid-cell-content {
                        -webkit-box-orient: vertical;
                        display: -webkit-box;
                        width: 238px;
                        
                        .wtai-grid-item-name {
                            max-height: 74px;
                            -webkit-box-orient: vertical;
                            display: -webkit-box;
                            -webkit-line-clamp: 3;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            width: 238px;

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

                    span {
                        color: #007BDB;
                        cursor: pointer;
                    }

                    .wtai-analysis-ongoing {
                        color: #2C3338;
                        font-weight: 400;
                        display: flex;
                        font-size: 11px;
                        align-items: center;

                        &::before {
                            background-image: url("../WriteTextAI_WriteTextAI/images/generate-ongoing.gif");
                            background-color: transparent;
                            background-position: center center;
                            background-repeat: no-repeat;
                            background-size: contain;
                            content: "";
                            display: inline-block;
                            height: 19px;
                            margin-right: 10px;
                            vertical-align: middle;
                            width: 19px;
                            mix-blend-mode: multiply;
                        }
                    }

                    .wtai-analysis-failed {
                        color: #DC3232;
                        font-size: 13px;
                        font-weight: 400;
                        display: flex;
                        font-size: 11px;
                        align-items: center;

                        &::before {
                            background-image: url("../WriteTextAI_WriteTextAI/images/generate-error.png");
                            background-color: transparent;
                            background-position: center center;
                            background-repeat: no-repeat;
                            background-size: contain;
                            content: "";
                            display: inline-block;
                            height: 15px;
                            margin-right: 10px;
                            vertical-align: middle;
                            width: 19px;
                            mix-blend-mode: multiply;
                        }
                    }
                }
                
                &:hover {
                    .data-grid-cell-content {
                        .wtai-comparison {
                            display: block;
                        }
                    }
                }

                .data-grid-cell-content {
                    display: flex;
                    height: 100%;
                    justify-content: space-between;
                    overflow: visible;
                    position: relative;
    
                    ul, ol, dl {
                        padding-left: 20px;
                    }
    
                    .wtai-comparison {
                        background: #FFFFFF;
                        border-radius: 1px;
                        box-shadow: 0px -4px 12px rgba(0, 0, 0, 0.12);
                        display: none;
                        filter: drop-shadow(0px -4px 12px rgba(0, 0, 0, 0.12));
                        height: min-content;
                        left: 50%;
                        padding: 20px;
                        position: absolute;
                        top: ~"calc(100% + 12px)";
                        transform: translate(-50%);
                        z-index: 999;

                        &:hover {
                            display: block;
                        }

                        &.wtai-show-top {
                            bottom: ~"calc(100% + 12px)";
                            top: auto;

                            &::after {
                                border-color: #fff transparent transparent transparent;
                                top: 100%;
                            }
                        }
    
                        &::after {
                            border-color: transparent transparent #fff transparent;
                            border-style: solid;
                            border-width: 12px;
                            bottom: 100%;
                            content: "";
                            left: 50%;
                            margin-left: -12px;
                            position: absolute;
                        }
    
                        .wtai-comparison-content {
                            display: flex;
                            max-height: 350px;
                            overflow-y: auto;
                            
                            .wtai-col {
                                max-width: max-content;
                                width: 260px;
                                overflow-wrap: break-word;
    
                                .wtai-header {
                                    color: #303030;
                                    font-family: 'Open Sans';
                                    font-size: 14px;
                                    font-style: normal;
                                    font-weight: 400;
                                }
    
                                .wtai-content {
                                    color: #303030;
                                    font-family: 'Open Sans';
                                    font-size: 13px;
                                    font-style: normal;
                                    font-weight: 400;
                                    margin-top: 10px;

                                    img {
                                        height: auto;
                                    }
                                }
                            }
    
                            .wtai-separator {
                                background: #E3E3E3;
                                margin: 0 20px;
                                width: 1px;
                            }
                        }
                    }
                }
            }
        }
    }

    .page-header-hgroup {
        width: 50%;
    }

    .page-header-actions {
        width: 50%;
        
        .action {
            background: none;
            border: 0;
            color: #41362f;
            float: right;
            font-size: 16px;
            padding-right: 0;

            &:before {
                content: '';
                display: inline-block;
                line-height: 22px;
                margin-right: 9px;
                vertical-align: middle;
            }

            &.wtai-history-log {
                &:before {
                    background: url(../WriteTextAI_WriteTextAI/images/ic_history.png) no-repeat center;
                    background-size: contain;
                    width: 20px;
                    height: 20px;
                }
            }
        }
    }

    .page-columns .main-col {
        > .wtai-history-log-modal,
        > .wtai-edit-modal-wrapper {
            display: none;
        }
    }

    .wtai-grid-settings {
        .admin__action-dropdown:before {
            background: url("../WriteTextAI_WriteTextAI/images/ic_grid_settings.svg") no-repeat center;
            width: 20px;
            height: 20px;
            content: '';
            display: inline-block;
            vertical-align: middle;
        }
    }

    .admin__data-grid-action-user-settings-menu {
        font-size: 1.3rem;
        padding: 2.2rem 3.5rem 1rem;
        width: 30rem;
    
        .admin__data-grid-action-user-settings-menu-content {
            margin-bottom: 1.5rem;

            .loader {
                background-color: transparent;
                background-size: 27px;
                height: 30px;
                width: 50px;
            }

            .wtai-note {
                color: #8C8F94;
                font-size: 11px;
                margin-top: 2rem;
                padding-left: 2.6rem;
            }
        }

        .admin__action-dropdown-footer-main-actions {
            padding: 1rem 0 2rem;
            
            .lib-clearer();

            .action-tertiary {
                float: left;
                margin-left: -1em;
            }

            .action-secondary {
                float: right;
            }
        }
    }

    .sticky-header {
        .admin__data-grid-wrap {
            min-height: unset;
        }

        .admin__data-grid-actions-wrap .admin__action-dropdown .admin__action-dropdown-text {
            font-size: 0;
        }
        .admin__data-grid-action-bookmarks .admin__action-dropdown:before {
            top: 2px;
        }
    }

    .selectmenu-items {
        /**hide last child item*/
        ul {
            li:last-child {
                display: none;
            }
        }
    }

    .wtai-padding-left {
        padding-left: 40px;
    }

    .admin__control-checkbox._disabled {
        opacity: 0;
    }
}

.wtai-book-notice {
    line-height: 23px;
}

