@import '../../sass/Variables.scss';
@import '../../sass/Text.scss';

$row-height: 6em;
$path-line-width: 0.05em;
$headers-gap: 2em;
$dot-width: calc($headers-gap / 3);
$font-size: 1em;
$font-size-titles: 1.2em;
$font-size-small: 0.8em;
$icon-size: 1em;
$search-ui-dropdown-header-color: #1d4f76;
$timestamp-grey: #67768b;
$background-color-white: #fff;
$background-color-grey: #f7f8f9;
$clickable-blue: #004990;

%bold-blue-text {
    color: $coveo-blue-6;
    font-size: $font-size;
    font-weight: bold;
}

%white-box {
    width: max-content;
    border: 1px solid $coveo-blue-6;
    background-color: white;
}

.coveo-user-actions-opened {
    .CoveoUserActions {
        display: block;
    }

    .coveo-main-section {
        display: none;
    }
}

.CoveoUserActions {
    display: none;
    margin-top: 10px;
    max-width: 1200px;
    padding: 0;
    background-color: $background-color-white;

    > h1 {
        color: $coveo-blue-6;
        font-size: 2em;
        font-weight: bold;
        margin: 0.5em 0;
    }

    .coveo-no-actions {
        padding: 1em;
        border: 1px solid $heather;
        border-radius: 2px;
        background-color: $background-color-grey;
        height: 15rem;
        text-align: left;

        .coveo-user-actions-title {
            font-size: 1.2em;
            font-weight: bold;
            text-align: left;
            width: auto;
            margin-bottom: 1em;
        }

        .coveo-no-actions-causes {
            margin: 0.5em 0;
        }
    }

    .coveo-enable-prompt {
        padding: 1.5em;
        text-align: center;
    }

    .coveo-close {
        display: inline-block;
        width: 1em;
        height: 1em;
        text-align: right;
    }

    &-opened {
        .coveo-user-actions {
            display: block;
        }

        .coveo-main-section {
            display: none;
        }
    }

    .coveo-loading-container {
        position: relative;
        height: 10rem;
        top: 10rem;
    }
}

.coveo-expandable-list {
    padding-bottom: 1.5em;

    .coveo-title {
        font-size: $font-size-small;
        font-weight: normal;
        margin: 0 0 0.75em;
        text-transform: uppercase;
    }

    .coveo-list {
        margin: 0;
        padding: 0;
        list-style-type: none;

        li {
            .coveo-list-row {
                display: flex;
                position: relative;

                a {
                    width: calc(100% - #{$icon-container-size});
                    margin-bottom: 7px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }

                .coveo-row-icon {
                    position: relative;
                    width: $icon-container-size;

                    & > {
                        svg {
                            position: absolute;
                            top: 2px;
                            height: $icon-size;
                            width: $icon-size;
                        }
                    }
                }

                .coveo-tooltip-origin1 {
                    display: none;
                    position: absolute;
                    top: -2.75em;
                    padding: 8px 12px;
                    background-color: $clickable-blue;
                    border-radius: 4px;
                    color: white;
                    margin-left: 1.5em;

                    &:after {
                        position: absolute;
                        top: 100%;
                        content: '';
                        left: 1em;
                        border: 10px solid;
                        border-color: $clickable-blue transparent transparent transparent;
                    }
                }

                &:hover .coveo-tooltip-origin1 {
                    display: flex;
                }
            }
        }
    }

    .coveo-more-less {
        font-size: $font-size-small;
        border: 0;
        padding: 0;
        color: $coveo-blue-6;
        text-decoration: underline;
        font-weight: normal;
        background-color: transparent;
        cursor: pointer;
        margin-top: 0.5em;
        margin-left: $icon-container-size;
    }
}

.coveo-user-activity {
    margin-top: 1em;
    background-color: $grey-1;

    .coveo-header {
        font-size: $font-size;
        padding-bottom: $headers-gap;
        display: flex;
        flex-flow: row nowrap;
        align-content: flex-start;

        .coveo-cell {
            margin-right: 2em;

            &:last-child {
                margin-right: 0em;
            }
        }

        .coveo-data {
            margin-top: 1em;
            font-weight: bold;
        }
    }

    .coveo-activity {
        margin: 0;
        padding: 0 0 1.5em 0;
        list-style-type: none;

        .coveo-data {
            font-weight: bold;
        }

        $folded-grey: $grey-4;
        $primary-grey: #626971;

        .coveo-folded {
            cursor: pointer;
            border: 0;
            padding: 0.5em 0;
            text-align: center;

            hr {
                height: 0;
                border: 0;
                border-bottom: thin solid $folded-grey;
                overflow: visible;

                .coveo-text {
                    position: relative;
                    top: -0.5em;
                    display: inline-block;
                    vertical-align: top;
                    line-height: 1em;
                    height: 1em;
                    padding: 0 0.5em;
                    background-color: $grey-1;
                    color: $clickable-blue;
                }
            }
        }

        .coveo-folded-actions {
            cursor: pointer;
            padding-top: 0.5em;
            padding-bottom: 0.8em;
            display: flex;

            .coveo-text {
                margin-left: 0.5em;
                color: $clickable-blue;
                font-size: $font-size-small;
            }

            & > .coveo-icon > svg {
                font-size: 0.5em;
                fill: $clickable-blue;
            }
        }

        .coveo-activity-title-section {
            display: table;
            table-layout: fixed;
            margin: 0.25em 0;
            width: 100%;

            .coveo-activity-title {
                box-sizing: border-box;
                vertical-align: top;
                text-align: left;
                display: table-cell;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .coveo-activity-timestamp {
                box-sizing: border-box;
                font-size: $font-size-small;
                color: $timestamp-grey;
                vertical-align: top;
                text-align: right;
                display: table-cell;
            }
        }

        .coveo-case-creation-action {
            .coveo-activity-title {
                font-weight: bold;
            }

            .coveo-icon {
                background-color: $background-color-grey;
            }
        }

        .coveo-session-container {
            .coveo-session-header {
                font-style: italic;
                font-weight: 700;
                color: $primary-grey;
                padding: 0.5em 0;
            }
        }

        .coveo-bubble {
            height: 1.5em;
            border-left: thin solid $coveo-blue-6;
            margin-left: 0.5em;
        }

        .coveo-click,
        .coveo-view {
            a {
                cursor: pointer;
                color: $coveo-blue-6;
                word-wrap: break-word;

                text-decoration: none;

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

        .coveo-click,
        .coveo-search,
        .coveo-custom,
        .coveo-view {
            position: relative;
            margin-left: 0.5em;
            border-left: thin solid $coveo-blue-6;
            padding-left: 1.5em;

            .coveo-icon {
                position: absolute;
                left: -0.75em;
                top: -0.1em;
                padding: 0;
                height: 1.5em;
                width: 1.5em;

                & > svg {
                    height: 1.5em;
                    width: 1.5em;
                }
            }

            & > div {
                padding-bottom: 0.5em;
            }

            &:last-child {
                padding-bottom: 0;
                border-left: 0;
            }

            .coveo-footer {
                font-size: $font-size-small;
                color: $primary-grey;
                padding-bottom: 1.7em;
            }

            .coveo-caption-for-icon {
                font-size: $font-size-small;
                display: none;
                background: #263e55;
                color: white;
                border-radius: 2px;
                padding: 6px 16px;
                position: absolute;
                white-space: nowrap;
                z-index: 1;
            }

            .coveo-caption-for-icon {
                display: inline;
            }
        }
    }
}

.coveo-accordion {
    padding: 0 1em;
    border: 1px solid $heather;
    border-radius: 2px;
    background-color: $background-color-grey;

    &:first-child {
        margin-bottom: 1em;
    }

    &-header {
        cursor: pointer;
        display: flex;

        flex-flow: row nowrap;
        align-content: center;
        align-items: baseline;
        justify-content: space-between;

        padding: 1em 0;

        &-title {
            font-size: $font-size-titles;
            font-weight: bold;
            text-align: left;
            width: auto;
        }

        .coveo-arrow-down svg {
            height: 1em;
            fill: black;
            transform: rotate(180deg);
            width: 0.5em;
            padding: 0.25em 0 0;
        }
    }

    &.coveo-folded {
        .coveo-accordion-foldable {
            display: none;
        }

        .coveo-arrow-down svg {
            transform: initial;
            padding: 0 0 0.25em;
        }
    }
}

/**
 * Ensure base css for button is present.
 */
.coveo-dropdown-header-wrapper {
    width: 100%;
    display: inline-flex;
    flex-wrap: nowrap;
    -webkit-box-pack: end;
    justify-content: flex-end;
    margin: 0px;
    padding: 0px;

    .coveo-user-actions-dropdown-header {
        border: thin solid #bcc3ca;
        border-radius: 2px;
        background-color: white;
    }

    a {
        margin-right: 10px;
    }

    .coveo-dropdown-header {
        font-size: $font-size-small;
        display: inline-block;
        padding: 0 7px;
        height: 22px;
        font-weight: 700;
        line-height: 20px;
        letter-spacing: 0.09px;
        vertical-align: middle;
        white-space: normal;
        color: $search-ui-dropdown-header-color;
        cursor: pointer;
        text-transform: uppercase;

        p {
            line-height: 16px;
        }

        * {
            display: inline-block;
            margin: 0;
        }
    }
}
