//
// Figures
//

.redactor-editor {

    figure {
        position: relative;
    }

    figcaption {
        text-align: center;
        line-height: @line-height-computed;
        font-size: @font-size-base;
    }

    figure[data-type=table] {
        clear: both;
    }

    figure[data-type=video] {
        position: relative;
        margin-bottom: @line-height-computed;
        text-align: center;
        clear: both;
        p {
            margin: 0;
        }

        &.oc-figure-full {
            &:before {
                position: relative;
                padding-bottom: 51%;
                width: 100%;
                height: 0;
                content: "";
                display: block;
            }
            iframe {
                width: 100%;
                height: 100%;
                position: absolute;
                left: 0;
                top: 0;
            }
        }
    }

    figure[data-type=image] {
        position: relative;
        margin-bottom: @line-height-computed;
        .oc-figure-controls {
            top: 0px;
        }
        img {
            width: 100%;
        }
        &.oc-figure-large {
            width: 100%;
            clear: both;
        }
        &.oc-figure-medium {
            width: 50%;
        }
        &.oc-figure-small {
            width: 33%;
        }
    }

    figure[data-type=quote] {
        font-family: Georgia, serif;
        margin-bottom: @line-height-computed;
        margin-left: @line-height-computed;
        font-style: italic;
        position: relative;
        border-left: solid 4px @color-border;
        padding-left: @line-height-computed;
        figcaption {
            font-weight: bold;
            text-align: left;
        }
        .oc-figure-controls {
            margin-left: -5px;
        }
        &.oc-figure-medium {
            &, blockquote { font-size: 20px; }
        }
        &.oc-figure-large {
            &, blockquote { font-size: 24px; }
        }
        &.oc-figure-right {
            width: 33%;
        }
        &.oc-figure-left {
            width: 33%;
            border-left: none;
            border-right: solid 4px @color-border;
            padding-left: 0;
            padding-right: @line-height-computed;
            margin-left: 0;
            margin-right: @line-height-computed;
            .oc-figure-controls {
                margin-left: 0;
                margin-right: -5px;
            }
        }
        cite {
            display: block;
            text-align: left;
            font-weight: normal;
            &:before {
                content: "\2014\00a0";
            }
            &:empty:before {
                opacity: 0.4;
                // @todo Convert to language value
                content: "\2014 Type to add citation (optional)";
            }
        }
    }

}

.redactor-box {

    figcaption {
        &:empty:before {
            opacity: .4;
            // @todo Convert to language value
            content: "Type to add caption (optional)";
        }
    }

    .oc-figure-controls {
        background: #2b3e50 !important;
        padding: 0;
        .border-radius(4px);
        position: absolute;
        display: none;
        // min-width: 100%;
        white-space: nowrap;
        left: 10px;
        top: -50px;
        margin: 0 auto;
        font-family: @font-family-base;
        line-height: @line-height-computed;
        font-style: normal;
        z-index: @richeditor-zindex + 500;
        text-align: center;

        &:after {
            content: ' ';
            left: 0;
            position: absolute;
            display: block;
            height: 10px;
            background: rgba(0,0,0,0.1);
            width: 100%;
            bottom: -10px;
            .opacity(0.1);
        }

        &:before {
            .triangle(down, 17px, 9px, #2b3e50);
            position: absolute;
            left: 14px;
            bottom: -8px;
        }
    }

    figure:hover .oc-figure-controls {
        display: block;
    }

    .oc-figure-controls.bottom {
        bottom: -50px;
        top: auto;

        &:after {
            bottom: auto;
            top: -10px;
        }

        &:before {
            .triangle(up, 17px, 9px, #2b3e50)!important;
            border-top: none;
            top: -8px;
        }
    }

    .oc-figure-controls span {
        display: inline-block;
        border: none;
        background: none;
        color: #ffffff;
        vertical-align: top;
        font-size: 14px;
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        cursor: pointer;
        &:before {
            line-height: 24px;
        }
        &:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.1);
        }
        &.on {
            background: #fff;
            color: @gray;
            background-color: #1f9e84;
            color: white;
        }
        &:last-child {
            .border-right-radius(4px);
        }
        &:first-child {
            .border-right-radius(4px);
        }
    }

    .oc-figure-controls span {
        &.oc-figure-controls-divider {
            width: 1px;
            background: @color-border;
            padding: 0;
            margin: 0 4px;
            cursor: normal;
        }
        &.oc-figure-controls-small {
            font-size: 7px;
        }
        &.oc-figure-controls-medium {
            font-size: 10px;
        }
        &.oc-figure-controls-arrow-left:before {
            .icon(@arrow-left);
        }
        &.oc-figure-controls-arrow-right:before {
            .icon(@arrow-right);
        }
        &.oc-figure-controls-arrow-up:before {
            .icon(@arrow-up);
        }
        &.oc-figure-controls-arrow-down:before {
            .icon(@arrow-down);
        }
        &.oc-figure-controls-resize-full:before {
            .icon(@expand);
        }
        &.oc-figure-controls-resize-small:before {
            .icon(@compress);
        }
        &.oc-figure-controls-delete {
            margin-left: @line-height-computed;
            &:before { .icon(@trash-o); }
            &:hover { background: @color-btn-danger; }
        }
        &.oc-figure-controls-table {
            width: auto;
            padding-left: @line-height-computed / 2;
            padding-right: @line-height-computed / 2;
            text-align: left;
            &:before { .icon(@table); }
        }
    }

    .oc-figure-right {
        float: right;
        margin-left: @line-height-computed;
        .oc-figure-controls {
            right: 0;
        }
    }

    .oc-figure-left {
        float: left;
        margin-right: @line-height-computed;
    }

    .oc-dropdown-menu {
        &, ul { padding: 0 !important; }

        ul {
            background-color: @dropdown-bg !important;
        }

        a {
            text-decoration: none;
            padding: 0 15px !important;
            color: @dropdown-link-color !important;
            text-decoration: none !important;
            &:hover,
            &:focus {
                color: @color-dropdown-hover-text !important;
            }
        }
    }

    @media (max-width: @menu-breakpoint-max) {
        figure[data-type=image] {
            width: 100% !important;
            float: none !important;
            margin-left: 0;
            margin-right: 0;
        }
        figure[data-type=video] iframe {
            width: 100% !important;
            height: auto !important;
        }
    }

}
