// user avatars
.avatar {
    border-radius: 100%;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    overflow: hidden;
    width: 50px;
    height: 50px;

    img {
        position: absolute;
        z-index: 2;
        top: 0;
        left: 0;
        right: 0;
        border: 0;
    }

    &.small {
        vertical-align: middle;
        margin: 0 0.5em;
        width: 25px;
        height: 25px;
    }

    &.square {
        border-radius: 0;

        &:before {
            border-radius: 0;
        }
    }
}

.media-placeholder {
    width: 600px;
    height: 400px;
    background-color: #ccc;
    padding: 5px;

    h3,
    p {
        margin: 0;
    }

    img {
        max-width: 350px;
        max-height: 350px;
        margin: 20px;
    }
}

// Displays 'timesince' formatted date with full date on hover
.human-readable-date {
    overflow: hidden;
    display: block;
    position: relative;

    &:before {
        position: absolute;
        display: none;
        content: attr(title);
    }

    &:hover {
        visibility: hidden;

        &:before {
            visibility: visible;
            display: block;
        }
    }
}

// makes a link look like regular text
.nolink {
    color: $color-text-base;

    &:hover {
        color: $color-teal;
    }
}

// Status tags
.status-tag {
    border-radius: 2px;
    text-align: center;
    display: inline-block;
    text-transform: uppercase;
    padding: 0 0.5em;
    border: 1px solid lighten($color-grey-2, 30%);
    color: lighten($color-grey-2, 30%);
    -webkit-font-smoothing: auto;
    line-height: 19px;
    font-size: 0.8em;
    margin: 0 0.5em 0.5em;
    background: #fff url('#{$images-root}bg-dark-diag.svg');

    &.primary {
        color: $color-grey-2;
        border: 1px solid $color-grey-2;
        background: #fff;
    }

    &.disabled {
        pointer-events: none;
    }
}

button.status-tag:hover,
a.status-tag:hover,
a.status-tag.primary:hover {
    border-color: $color-teal;
    color: $color-teal;
}

button.status-tag:hover {
    border-color: $color-teal-dark;
    background-color: $color-teal-darker;
    color: $color-white;
}

.privacy-indicator {
    .label-private,
    .label-public {
        &:before {
            font-size: 1.5em;
        }
    }

    &.public {
        .label-private {
            display: none;
        }
    }

    &.private {
        .label-public {
            display: none;
        }
    }
}

// free tagging tags from taggit
.tag {
    border-radius: 2px;
    background-color: $color-teal;
    padding-right: 0.5em;
    padding: 0.2em 0.5em;
    color: $color-white;
    line-height: 2em;
    white-space: nowrap;

    &:before {
        font-family: wagtail;
        display: inline-block;
        color: $color-white;
        content: 'u';
        padding-right: 0.5em;
    }

    .taglist & {
        margin-right: 0.8em;
    }
}

a.tag:hover {
    background-color: $color-teal-darker;
    color: $color-white;
}

.taglist {
    font-size: 0.9em;
    line-height: 2.4em;

    h3 {
        display: inline;
        margin-right: 1em;
    }
}

// Loading mask: overlays a certain area with a loading spinner and a faded out cover to prevent interaction
.loading-mask {
    &.loading {
        position: relative;

        &:before,
        &:after {
            position: absolute;
            display: block;
        }

        &:before {
            content: '';
            top: -5px;
            left: -5px;
            bottom: -5px;
            right: -5px;
            z-index: 1;
            background-color: rgba(255, 255, 255, 0.5);
        }

        &:after {
            font-size: 30px;
            width: 30px;
            line-height: 30px;
            left: 50%;
            top: 50%;
            margin: -15px 0 0 -15px;
            font-family: wagtail;
            animation: spin 0.5s infinite linear;
            content: '1';
            z-index: 2;
            color: $color-teal;
        }
    }
}

hr {
    border: 1px solid $color-grey-4;
    border-width: 1px 0 0;
    margin: 1.5em 0;
}

// general image style
img {
    max-width: 100%;
    height: auto;
}

// Show a transparency grid in background
.show-transparency {
    background: url('#{$images-root}transparency.svg');
}

// make a block-level element inline
.inline {
    display: inline;
}

.inline-block {
    display: inline-block;
}

.block {
    display: block;
}

.unlist {
    @include unlist();
}

// utility class to allow things to be scrollable if their contents can't wrap more nicely
.overflow {
    overflow: auto;
}

.status-msg {
    &.success {
        color: $color-green;
    }

    &.failure {
        color: $color-red;
    }
}
