﻿/* ==========================================================================================================
   Element toolbars of the press release builder (QFormBuilder): every element's settings are edited on the page
   in a toolbar centred above the selected element. Global (not scoped) so every element and the shared toolbar
   pieces (TbAlign, InlineMarginEditor in a drop-down) use the same styles.
   ========================================================================================================== */

/* ---- On-page settings toolbar: centred above the selected element, styled like the text editor's
   toolbar (white, 40px, grey shadow - site.css .tox-toolbar). Details open in small drop-downs under the buttons. ---- */
.ElementToolbar {
    position: absolute;
    bottom: calc(100% + 8px);
    /* centred above the element */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    display: flex;
    /* always one line - never wraps, however narrow the element */
    flex-wrap: nowrap;
    white-space: nowrap;
    align-items: center;
    gap: 4px;
    width: max-content;
    min-height: 40px;
    padding: 5px 6px;
    background-color: white;
    border-radius: 7px;
    box-shadow: 0 0 3px 1px #7b8083;
    text-align: left;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: normal;
    color: #434a4f;
    cursor: default;
}

    /* buttons, separators and the contact picker keep their size instead of squeezing */
    .ElementToolbar > * {
        flex-shrink: 0;
    }

.TbBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    background-color: white;
    color: #434a4f;
    border: solid 1px transparent;
    border-radius: 7px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

    .TbBtn .mdi {
        font-size: 17px;
        line-height: 1;
    }

    .TbBtn .TbCaret {
        font-size: 14px;
        margin-left: -2px;
    }

    .TbBtn:hover {
        background-color: #f1f1f1;
    }

    .TbBtn.Active {
        color: #C8252C;
        border-color: #C8252C;
    }

    .TbBtn.Invalid {
        color: #C8252C;
    }

.TbWide {
    padding: 0 8px;
}

.TbSep {
    width: 1px;
    height: 22px;
    margin: 0 3px;
    background-color: rgba(0,0,0,0.15);
}

.TbLabel {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    font-weight: 700;
}

    .TbLabel .mdi {
        font-size: 17px;
    }

.TbText {
    height: 28px;
    padding: 0 6px;
    border: solid 1px rgba(0,0,0,0.25);
    border-radius: 5px;
    font-size: 12px;
}

    .TbText:focus {
        outline: none;
        border-color: #C8252C;
    }

    .TbText.Invalid {
        border-color: #C8252C;
        box-shadow: 0 0 0 1px #C8252C;
    }

.TbButtonText {
    width: 130px;
}

.TbColour {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0;
    border-radius: 7px;
    cursor: pointer;
}

    .TbColour:hover {
        background-color: #f1f1f1;
    }

    .TbColour .mdi {
        font-size: 16px;
        line-height: 16px;
    }

    /* the colour input is the coloured bar under the icon */
    .TbColour input[type=color] {
        width: 20px;
        height: 6px;
        padding: 0;
        border: none;
        cursor: pointer;
    }

        .TbColour input[type=color]::-webkit-color-swatch-wrapper {
            padding: 0;
        }

        .TbColour input[type=color]::-webkit-color-swatch {
            border: solid 1px rgba(0,0,0,0.25);
            border-radius: 2px;
        }

.TbPicker {
    width: 220px;
}

.TbGroup {
    position: relative;
    display: inline-flex;
}

.TbMenu {
    position: absolute;
    top: calc(100% + 9px);
    left: 0;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: max-content;
    padding: 10px 12px;
    background-color: white;
    border-radius: 7px;
    box-shadow: 0 0 3px 1px #7b8083;
}

.TbMenuWide {
    width: 300px;
}

.TbMenuRight {
    left: auto;
    right: 0;
}

.TbField {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
}

    .TbField select, .TbField input[type=number] {
        height: 26px;
        padding: 0 4px;
        border: solid 1px rgba(0,0,0,0.25);
        border-radius: 5px;
        font-size: 12px;
        background-color: white;
    }

    .TbField input[type=number] {
        width: 64px;
    }

    .TbField input[type=color] {
        width: 32px;
        height: 26px;
        padding: 1px;
        border: solid 1px rgba(0,0,0,0.25);
        border-radius: 5px;
        background-color: white;
        cursor: pointer;
    }

    .TbField select:focus, .TbField input:focus {
        outline: none;
        border-color: #C8252C;
    }

.TbError {
    color: #C8252C;
}

.TbHint {
    color: #7b8083;
}

/* small number / text box straight in the toolbar row, with an icon in front (e.g. width, height) */
.TbInline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    margin: 0;
    padding: 0 4px;
    border-radius: 7px;
    color: #434a4f;
    cursor: default;
}

    .TbInline .mdi {
        font-size: 17px;
        line-height: 1;
    }

    .TbInline input[type=number], .TbInline input[type=text] {
        height: 26px;
        padding: 0 4px;
        border: solid 1px rgba(0,0,0,0.25);
        border-radius: 5px;
        font-size: 12px;
        background-color: white;
    }

    .TbInline input[type=number] {
        width: 58px;
    }

    .TbInline input[type=text] {
        width: 120px;
    }

    .TbInline input:focus {
        outline: none;
        border-color: #C8252C;
    }

    .TbInline .TbUnit {
        color: #7b8083;
    }

/* tick boxes in a drop-down */
.TbCheck {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}

/* a row of toggle buttons in a drop-down (e.g. which borders) */
.TbButtonRow {
    display: flex;
    align-items: center;
    gap: 4px;
}

    .TbButtonRow .TbBtn {
        border-color: rgba(0,0,0,0.15);
    }

        .TbButtonRow .TbBtn.Active {
            border-color: #C8252C;
        }

/* list in a drop-down (e.g. social links): one row per item */
.TbList {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.TbListRow {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .ElementToolbar .TbListRow img {
        width: 22px;
        height: 22px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .TbListRow .TbText {
        flex: 1 1 auto;
        min-width: 180px;
    }

/* picture picker in a modal (Video / Carousel) */
.TbGallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: fit-content;
    max-width: 900px;
    margin: 0 10px;
}

.TbGalleryItem {
    position: relative;
    width: 120px;
    height: 120px;
    background-color: #80808080;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    border: solid 1px rgba(0,0,0,0.3);
    border-radius: 7px;
    cursor: pointer;
}

    .TbGalleryItem:hover {
        border-color: #C8252C;
        box-shadow: 0 0 10px #C8252C;
    }

    .TbGalleryItem.Selected {
        outline: 2px solid #C8252C;
    }

.TbGalleryIndex {
    position: absolute;
    top: 4px;
    left: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: #C8252C;
    border-radius: 7px;
}

.TbGalleryEmpty {
    padding: 10px;
    color: #7b8083;
}

/* items in a drop-down that act like a menu (e.g. add a social link) */
.TbMenuItem {
    justify-content: flex-start;
    width: 100%;
}

    .ElementToolbar .TbMenuItem img {
        width: 18px;
        height: 18px;
        object-fit: contain;
    }

/* wider drop-down holding a list (e.g. social links) */
.TbMenuList {
    width: 420px;
}

.TbBtn.TbDelete {
    color: #C8252C;
}

.TbBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

    .TbBtn:disabled:hover {
        background-color: white;
    }
