.order-table {
    margin-bottom: $spacer-lg;
    border: 1px solid $border-color;
    position: relative;

    .order-item-detail {
        border-top: 0 none;
    }

    .order-detail-content {
        border-top: 1px solid $border-color;
        padding: 0;
        box-shadow: none;
    }
}

.order-table-header {
    display: none;

    :first-child {
        position: relative;
    }
}

.order-hide-btn {
    .order-hide-btn-text {
        display: block;
    }

    .order-view-btn-text {
        display: none;
    }

    &.collapsed {
        .order-hide-btn-text {
            display: none;
        }

        .order-view-btn-text {
            display: block;
        }
    }
}

.order-table-header,
.order-wrapper {
    &:last-of-type {
        border-bottom: 0;
    }
}

.order-table-header,
.order-item-header {
    padding-top: $spacer-sm;
    padding-bottom: $spacer-sm;
}

.order-table-header,
.order-item-header {
    padding-left: $order-grid-gutter-width;
    padding-right: $order-grid-gutter-width;
}

.order-table-header-heading,
.order-table-header-order-status,
.order-table-header-context-menu {
    display: inline-block;
}

.order-table-header-heading {
    max-width: 290px;
}

.order-table-header-order-status {
    font-weight: $font-weight-bold;
}

.order-table-header-context-menu-wrapper {
    position: absolute;
    top: $spacer-sm;
    right: $spacer-sm;
}

.order-table-header-context-menu-wrapper,
.order-table-header-heading {
    margin-top: $spacer-sm;
}

.order-table-header-context-menu {
    $width: 35px;
    $height: $width;

    float: right;
    border: 1px solid $sw-border-color;
    border-radius: $border-radius;
    width: $width;
    height: $height;
    padding: 0;

    &::after {
        display: none;
    }

    .icon {
        position: relative;
        margin: 5px;

        > svg {
            color: $sw-text-color;
            position: absolute;
            top: 0;
            left: 0;
        }
    }

    &-content {
        padding-left: 10px;
        padding-right: 10px;
    }
}

.order-table-header-context-menu-content-link {
    display: block;
    border: 0 none;
    padding: 0;
    width: 100%;
    color: $sw-text-color;
    background: none;
    cursor: pointer;
    text-align: left;

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

    &:active {
        outline: none;
    }
}

.order-table-header-order-number {
    display: block;
    font-weight: $font-weight-normal;
    margin-bottom: $spacer-lg;
    width: 100%;
    padding-left: 0;
    padding-right: 0;

    .order-table-header-label {
        display: inline;
    }
}

.order-table-header-order-table-body,
.order-table-header-order-table-header {
    padding-left: 0;
    padding-right: 0;
}

.order-table-header-order-table-body {
    border-top: 1px solid $sw-border-color;
    font-weight: $font-weight-normal;

    .order-table-header-order-table-body-cell[class*='col-'] {
        margin-top: 10px;

        &:first-of-type {
            padding-left: 0;
        }

        &:last-of-type {
            padding-right: 0;
        }
    }
}

.order-table-header-order-table-header {
    font-weight: $font-weight-bold;

    .order-table-header-order-table-header-cell[class*='col-'] {
        margin-bottom: 10px;

        &:first-of-type {
            padding-left: 0;
        }

        &:last-of-type {
            padding-right: 0;
        }
    }
}

.order-table-header-order-table {
    width: 100%;
}

.order-table-header-label {
    display: none;
}

.payment-control input,
.payment-control label {
    cursor: pointer;
}

.order-item {
    padding-top: $spacer-sm;
    padding-bottom: $spacer-sm;
}

.order-item-actions {
    text-align: center;
}

.order-item-label {
    float: left;
    width: 50%;
}

.order-item-value {
    width: 50%;
}

.order-table-header-context-menu-indicator {
    position: absolute;
    top: -3px;
    right: 7px;
}

.order-item-status-badge {

    /*
     * Set colors of the order status badge according to the order state.
     * The stylelint rule `selector-class-pattern` is disabled.
     * The technicalName of the order state includes underscores.
     */
    /* stylelint-disable selector-class-pattern */
    &.order-item-status-badge-open,
    &.order-item-status-badge-in_progress {
        background-color: $info;
        color: $white;
    }

    &.order-item-status-badge-completed {
        background-color: $success;
        color: $white;
    }

    &.order-item-status-badge-failed,
    &.order-item-status-badge-cancelled {
        background-color: $danger;
        color: $white;
    }
    /* stylelint-enable selector-class-pattern */

    .icon {
        color: currentColor;

        svg {
            top: 5px;
        }
    }
}

@include media-breakpoint-up(md) {
    .order-table-header {
        display: block;
    }

    .order-table-header,
    .order-item-header {
        padding-top: $spacer-sm;
        padding-bottom: $spacer-sm;
    }

    .order-item {
        padding-top: 0;
        padding-bottom: 0;
    }

    .order-item-actions {
        text-align: right;
    }
}

@include media-breakpoint-down(sm) {
    .order-table-header-order-table-header {
        display: none;
    }

    .order-table-header-order-table-body {
        border-top: 0;
    }

    .order-table-header-label {
        display: inline;
    }

    .order-table-header-order-number {
        margin-bottom: 0;
    }

    .order-table-header-label {
        display: block;
        float: left;
        width: 50%;
    }

    .order-table-body-value {
        width: 50%;
    }

    .order-table-header-order-status {
        margin-top: 0;
        margin-bottom: $spacer;
    }

    .order-table-header-context-menu-wrapper {
        top: $spacer / 2;
        right: $spacer;
    }

    .order-table-header-context-menu-indicator {
        top: -3px;
        right: -3px;
    }
}
