$o-ma-border-color: gray($o-ma-border-color-gray-value);

// ------------------------------------------------------------------
// Campaign Kanban
// ------------------------------------------------------------------

.o_odex25_marketing_automation_campaign_kanban {
    .o_text_brand {
        color: $o-brand-odoo;
    }
    .o_badge_brand {
        background: $o-brand-odoo;
    }
    .o_ma_campaign_header {
        padding-bottom: 8px;
        border-bottom: 1px solid $o-ma-border-color;
    }
    .o_ma_campaign_item {
        border-right: 1px solid $o-ma-border-color;
    }
    .o_ma_campaign_item:last-child {
        border-right: none;
    }
}


// ------------------------------------------------------------------
// Abstract Hierarchy
// ------------------------------------------------------------------
.o_ma_hierarchy {
    margin-left: -$o-horizontal-padding;
    margin-right: -$o-horizontal-padding;
    @include media-breakpoint-between(lg, xl, $o-extra-grid-breakpoints) {
        margin-left: -$o-horizontal-padding*2;
        margin-right: -$o-horizontal-padding*2;
    }
    margin-bottom:-24px;
    padding: 10px 0px 24px 16px;
    background-color: $o-ma-hierarchy-background;
    box-shadow: 0px 1px 1px rgba(17, 17, 17, 0.23);
    overflow-x: auto;
    .o_ma_hierarchy_title {
        padding: 0px 0px 0px 72px;
        font-size: 18px;
    }
    .o_ma_hierarchy_readonly {
        padding: 40px 0px 0px 40px;
    }
    .o_ma_hierarchy_container {
        // Add new button
        .o-kanban-button-new {
            padding: 2px 12px;
            margin: 0px 0px 0px 44px;
            border-radius: 25px;
        }
        .o_kanban_view.o_kanban_ungrouped .o_kanban_record {
            display: flex;
            flex: 0 0 100%;
            border: 0px;
            padding: 0px 0px 0px 100px;
            margin: 0px 0px 0px 0px;
            background-color: transparent;
            // Timeline Border
            &:before {
                content: '';
                display: block;
                @include o-position-absolute;
                height: 100%;
                margin-left: 8px;
                border-left: 1px dashed darken($o-ma-border-color, 10%);
            }
            // Record with all children
            .o_ma_body {
                margin-left: 8px;
                padding-top: 20px;
                // Timeline Pill: Display time
                .o_ma_timeline {
                    @include o-position-absolute($top: 32px, $left: 6px);
                    width: 90px;
                    padding: 3px 0px;
                    border-radius: 3px;
                    background-color: $o-ma-color-white;
                    box-shadow: 0 1px 2px rgba(0,0,0,.1);
                }
                // Current Record (not children or timeline)
                .o_ma_card {
                    position: relative;
                    margin-left: 22px;
                    margin-bottom: 2px;
                    width: 500px;
                    border-radius: 3px;
                    background: $o-ma-color-white;
                    box-shadow: 0 1px 2px rgba(0,0,0,.1);
                    // Triangle arrow for the card
                    &:before {
                        content: '';
                        @include o-position-absolute($top: 12px, $left: -17px);
                        margin-left: 10px;
                        width: 14px;
                        height: 14px;
                        background: $o-ma-color-white;
                        border-bottom: 1px solid $o-ma-border-color;
                        transform: rotate(45deg);
                    }
                    // Timeline dot
                    &:after {
                        content: '';
                        @include o-position-absolute($top: 14px, $left: -28px);
                        width: 12px;
                        height: 12px;
                        border: 2px solid $o-brand-primary;
                        border-radius: 10px;
                        background: $o-ma-hierarchy-background;
                    }
                }
                // Contain children
                .o_hierarchy_children {
                    margin-left: 25px;
                    & > div:last-child:before {
                        height: 40px;
                    }
                }
            }
            &:last-child:before {
                height: 40px;
            }
        }
    }
}

.o_form_editable{
    .o_ma_hierarchy .o_ma_hierarchy_container .o_kanban_view.o_kanban_ungrouped > .o_kanban_record:last-child:before{
        height: 100%;
    }
}

// ------------------------------------------------------------------
// Campaign Card
// ------------------------------------------------------------------
.o_ma_hierarchy_container.o_ma_campaign_hierarchy {
    .o_kanban_view.o_kanban_ungrouped  .o_kanban_record {
        .o_ma_title_bar {
            position: relative;
            border-bottom: 1px solid $o-ma-border-color;
            @include border-top-radius(3px);
            background-color: $o-ma-color-white;
            .o_ma_icon {
                display: inline-block;
                padding: 3px 7px;
                margin: 5px;
                width: 28px;
                height: 28px;
                color: $o-ma-color-white;
                font-size: 14px;
                border-radius: 3px;
                background: linear-gradient(to right bottom, $o-brand-primary, darken($o-brand-primary, 5%));
            }
            .o_ma_title {
                @include o-position-absolute;
                display: inline-block;
                margin-top: 5px;
                h3 {
                    font-weight: 500;
                    a {
                        @include o-text-overflow;
                        width: 296px;
                        &.o_ma_full {
                            width: 378px;
                        }
                    }
                }
                .o_ma_desc {
                    margin-top: -2px;
                    font-size: 11px;
                    color: #999999;
                }
            }
            .o_ma_switch {
                @include o-position-absolute($top: 0px, $right: 0px);
                > span {
                    width: 39px;
                    height: 39px;
                    display: inline-block;
                    border-left: 1px solid $o-ma-border-color;
                    border-bottom: 1px solid transparent;
                    transition: all 0.2s ease 0s;
                    .fa {
                        font-size: 16px;
                        margin: 12px;
                    }
                    &:hover:not(.active) {
                        cursor: pointer;
                        background-color: $o-ma-border-color;
                        border-bottom-color: $o-ma-border-color;
                    }
                    &.active {
                        color: $o-brand-primary;
                        border-bottom-color: $o-ma-color-white;
                        background-color: $o-ma-color-white;
                    }
                }
            }
        }
        .o_pane_graph {
            overflow: hidden;
            > .row {
                margin-left: 0px;
                margin-right: 0px;
            }
            .o_ma_graph {
                padding: 0px;
                .o_ma_activity_graph {
                    height: 110px;
                    width: 100%;
                    .o_graph_canvas_container {
                        position: relative;
                        top: 0px;
                        left: 0px;
                    }
                }
                .o_ma_chart_time {
                    @include o-position-absolute($top: 5px, $left: 170px);
                    font-size: 10px;
                    color: #A7A7A7;
                }
            }
            .o_ma_email_details {
                border-top: 1px solid $o-ma-border-color;
                @include border-bottom-radius(3px);
                > div {
                    padding: 4px 0px;
                    border-right: 1px solid $o-ma-border-color;
                }
                div:last-child {
                    border-right: 0px;
                }
                div:first-child {
                    font-weight: 500;
                }
            }
        }
        .o_pane_filter {
            padding: 10px;
            min-height: 140px;
        }
        .o_ma_child_activity {
            background: $o-ma-hierarchy-background;
            @include size(100%, 18px);
            overflow: hidden;
            transition: all 0.3s ease 0s;
            .o_ma_child_activity_title {
                padding: 2px;
                font-size: 11px;
                font-weight: bold;
            }
            .o_ma_child_activity_buttons {
                display: flex;
                justify-content: space-around;
                i.fa {
                    flex: 1 0 auto;
                    padding: 10px;
                    border-top: 1px solid #E2E2E2;
                    border-left: 1px solid #E2E2E2;
                    cursor: pointer;
                    &:hover {
                        background-color: darken($o-ma-hierarchy-background, 5%);
                    }
                    &:first-child {
                        border-bottom: 1px solid #E2E2E2;
                        border-top-width: 0px;
                        border-left-width: 0px;
                    }
                }
            }
            &:hover {
                height: 53px;
            }
        }
    }
}

// ------------------------------------------------------------------
// Workitem Card
// ------------------------------------------------------------------
.o_ma_hierarchy_container.o_ma_workitem_hierarchy {
    .o_kanban_view.o_kanban_ungrouped  .o_kanban_record {
        .o_ma_body .o_ma_timeline {
            top: 20px;
        }
        .o_ma_icon {
            position: relative;
            display: inline-block;
            padding: 4px 7px;
            margin: 5px;
            width: 28px;
            height: 28px;
            color: $o-ma-color-white;
            font-size: 14px;
            border-radius: 3px;
        }
        .o_ma_type {
            margin-left: 3px;
            font-size: 10px;
            color: #A7A7A7;
        }
        .o_ma_status_text {
            font-size: 10px;
        }
        .o_ma_actions {
            display: flex;
            justify-content: space-around;
            span {
                flex: 1 0 auto;
                padding: 3px;
                border-top: 1px solid #F1F1F1;
                border-left: 1px solid #F1F1F1;
                font-size: 11px;
                color: #C3C3C3;
                &:first-child {
                    border-left-width: 0px;
                }
                &.active {
                    color: $o-brand-primary;
                }
            }
        }
        .o_ma_test_buttons {
            @include o-position-absolute($top: 5px, $right: -70px);
            .btn {
                border-radius: 3px;
            }
        }
    }
}

// ------------------------------------------------------------------
// Colors
// ------------------------------------------------------------------
.o_ma_text_processed {
    color: $o-brand-primary;
}
.o_ma_text_rejected {
    color: theme-color('danger');
}
.o_ma_text_canceled {
    color: theme-color('warning');
}
.o_ma_text_error {
    color: #8F8F8F;
}
.o_ma_text_scheduled {
    color: $o-brand-odoo;
}
.o_ma_processed {
    background-color: $o-brand-primary;
}
.o_ma_rejected {
    background-color: theme-color('danger');
}
.o_ma_canceled {
    background-color: theme-color('warning');
}
.o_ma_error {
    background-color: #8F8F8F;
}
.o_ma_scheduled {
    background-color: $o-brand-odoo;
}
