@import "colors.scss";
@import "breakpoints.scss";

.itsec-admin-bar {
    border-top: 1px solid $dark-gray-200;
    border-bottom: 1px solid $dark-gray-200;
    padding: 1em;
    margin: 1em 0 1em 0;
    display: flex;
    align-items: center;
    height: 3em;

    & .itsec-admin-bar__title {
        color: $dark-gray-300;

        & h1 {
            color: $dark-gray-300;
            padding: 0;
            font-size: 1em;
            line-height: 1;
            font-weight: normal;
        }

        & .itsec-admin-bar-manage-dashboards__trigger > .components-button {
            display: flex;
            align-items: center;
            color: $dark-gray-300;

            & .dashicon {
                margin-left: .5em;
            }
        }
    }

    & .itsec-admin-bar__dashboard-selector {
        display: flex;
        align-items: center;
    }

    & .itsec-admin-bar__share {
        display: flex;
        margin: 0 2em;
        height: 3em;
        flex-grow: 1;
        align-items: center;

        .itsec-admin-bar-share__owner::after {
            content: '';
            height: 1.5em;
            width: 1px;
            margin-left: 1em;
            background: $light-gray-900;
            display: inline-block;
            top: 50%;
            transform: translateY(-50%);
        }

        & .itsec-admin-bar-share__recipient {
            display: inline-block;
            width: 3em;
            height: 3em;

            & .itsec-admin-bar-share__user-avatar {
                height: 3em;
                border-radius: 50%;
            }
        }

        & .itsec-admin-bar-share__recipient-trigger {
            width: 3em;
            height: 3em;
            border-radius: 50%;
            align-items: center;
        }

        & .itsec-admin-bar-share__recipient--user .itsec-admin-bar-share__recipient-trigger {
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center center;
        }

        & .itsec-admin-bar-share__recipient--role .itsec-admin-bar-share__recipient-trigger {
            background-color: $dark-gray-700;
            color: white;

            & .itsec-admin-bar-share__role-abbr {
                font-size: 1.3em;
                width: 3em;

                &.itsec-admin-bar-share__role-abbr--theme-dark {
                    color: white;
                }

                &.itsec-admin-bar-share__role-abbr--theme-light {
                    color: $dark-gray-900;
                }
            }
        }

        & .itsec-admin-bar-share__recipients {
            display: flex;
            margin-left: 1em;
            align-items: center;

            // Style the overlapping icons for the recipients section.
            & .itsec-admin-bar-share__recipient {
                margin-left: -1.5em;
                transition: all 300ms ease;

                &:first-child {
                    margin-left: 0;
                }

                &:hover {
                    margin-right: .5em;
                }

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

                &:hover + * {
                    margin-left: 0;
                }
            }
        }
    }

    & .itsec-admin-bar-share__recipients:empty ~ .itsec-admin-bar-share__add-share-container {
        margin-left: 0;
    }

    & .itsec-admin-bar-share__recipient-content {
        & .components-popover__content {
            padding: 1em;
        }

        & header {
            display: flex;

            & img {
                border-radius: 50%;
                width: 4em;
                height: 4em;
                margin-right: 1em;
            }

            & h3 {
                margin: 0;
            }
        }

        & footer {
            text-align: right;
        }
    }

    & .itsec-admin-bar-share__add-share-container {
        margin-left: 1em;

        & .itsec-admin-bar-share__add-share > .components-icon-button {
            color: $light-gray-900;
            height: 3em;
            padding: 0;

            &:hover,
            &:focus {
                color: $dark-gray-300;
            }

            &:hover,
            &:focus,
            &:enabled {
                box-shadow: none !important;
                background-color: transparent !important;
            }
        }

        .itsec-admin-bar-share__add-share-content.components-popover::after {
            border-color: #E5EAEE !important;
        }
    }

    & .itsec-admin-bar__edit-cards {
        margin-left: auto;

        & .itsec-admin-bar-edit-cards__trigger > .components-button {
            color: $main-blue;

            &:hover {
                color: lighten($main-blue, 20%);
            }

            & svg {
                margin-right: .5em
            }
        }
    }

    @media screen and (max-width: $small) {
        flex-direction: column;
        height: auto;
        align-items: center;
        justify-items: center;

        & .itsec-admin-bar__edit-cards {
            margin-left: 0;
        }

        & > * {
            margin: 1em 0;

            &:first-child {
                margin-top: 0;
            }

            &:last-child {
                margin-bottom: 0;
            }
        }

        & .itsec-admin-bar__share {
            margin: 1em 0;
        }

        .itsec-app-page--create-dashboard & .itsec-admin-bar__title {
            margin-bottom: 0;
        }
    }
}
