$tooltip-width: 300px;
$tooltip-color: #000;

// Generic tooltips with clickable triggers
.tooltip-trigger {
    display: inline-block;
    position: relative;
    cursor: default;
}

// Tooltips specifically for antibody statuses
.tooltip-status {
    padding: 2px 5px;
    text-align: center;
    white-space: nowrap;
    font-size: 0.9rem;
    border-radius: 4px;

    span:last-child {
        font-weight: normal;
    }
}

.tooltip-status-trigger {
    position: relative;
    margin-left: 5px;
    font-size: 1.2rem;
    cursor: default;
}

// Series and info tooltip sizing
.series-tooltip, .tooltip-home-info {
    button {
        font-size: 1rem;
    }

    @media screen and (min-width: $screen-md-min) {
        button {
            font-size: 1.2rem;
        }
    }
}

// Info icons with tooltips.
.tooltip-home-info {
    margin-left: 5px;
    width: 16px;
    height: 16px;
    line-height: 1;
    vertical-align: baseline;

    .tooltip-container__trigger {
        font-size: 0;

        .svg-icon-question-circle {
            width: 16px;
            fill: #b3b3b3;
        }
    }
}

// Series tooltip on experiment pages
.series-tooltip {
    margin-left: 2px;
}

.tooltip {
    position: absolute;
    z-index: 1030;
    display: block;
    line-height: 1.4;
    font-size: 0.8rem;

    @media screen and (min-width: $screen-md-min) {
        font-size: 1rem;
        line-height: 1.2;
    }

    &.right {
        transform: translateY(-50%);
        left: 100%;
        top: 50%;
        white-space: nowrap;

        .tooltip-inner {
            text-align: left;
            max-width: none;
        }
    }

    &.bottom {
        transform: translateX(-50%);
        left: 50%;
        top: 100%;
        white-space: normal;

        .tooltip-inner {
            text-align: center;
            min-width: 250px;
        }
    }
}

.tooltip-inner {
    max-width: 200px;
    padding: 10px;
    margin-top: 5px;
    text-align: center;
    text-decoration: none;
    border-radius: 3px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    -webkit-box-shadow: 7px 5px 7px -5px #ccc;
    -moz-box-shadow: 7px 5px 7px -5px #ccc;
    box-shadow: 7px 5px 7px -5px #ccc;
}

.tooltip-open {
    visibility: visible;
    opacity: 1;
}

.menu-tooltip {
    position: relative;
    width: auto;
    padding: 5px 60px 15px;
    top: unset;
    left: unset;
    color: black;
    background: #b3b3b3;
    border: 0;
    line-height: 1.4;
    font-size: 0.8rem;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    margin-top: 5px;
    margin-left: -25px;
    margin-right: -30px;
    z-index: 9999;
    white-space: pre-wrap;
    letter-spacing: 0;
    font-weight: 400;
    // For now, we do not keep the menu tooltip bubbles open when they are hovered over
    pointer-events: none;

    &.sub-menu {
        margin-left: -45px;
        padding-left: 60px;

        @media screen and (min-width: $screen-md-min) {
            margin: 0;
            padding: 10px;
        }
    }

    .tooltip-inner {
        max-width: inherit;
        padding: 0;
        color: inherit;
        text-align: inherit;
        background-color: inherit;
        border-radius: inherit;
        box-shadow: none;
        -webkit-box-shadow: none;
        -moz-box-shadow: none;
        border: none;
    }

    @media screen and (min-width: $screen-md-min) {
        position: absolute;
        width: 350px;
        padding: 10px;
        top: 3px;
        left: 30px;
        color: black;
        background: white;
        border: 1px solid #d2d2d2;
        line-height: 1.2;
        font-size: 1rem;
        -webkit-box-shadow: 7px 5px 7px -5px #ccc;
        -moz-box-shadow: 7px 5px 7px -5px #ccc;
        box-shadow: 7px 5px 7px -5px #ccc;
        margin: 0;

        .tooltip-inner {
            box-shadow: none;
            -webkit-box-shadow: none;
            -moz-box-shadow: none;
            border: none;
        }
    }
}

.dl-tooltip-trigger {
    @extend .tooltip-trigger;

    padding-left: 5px;
}

// When a tooltip appears next to a real button, use this to wrap that button so that even if thead
// button gets disabled, we can add an absolutely positioned div within this div that can respond
// to hover events, because disabled button can't.
.tooltip-button-wrapper {
    position: relative;
}

// Position a div within the above div that covers a disabled button. Disabled buttons can't
// respond to hover events, so we need this overlay button to do that.
.tooltip-button-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.tooltip-trigger, .tooltip-container {
    .icon-question-circle {
        color: #b3b3b3;
    }
}

.tooltip-container {
    position: relative;
    display: inline-block;

    .tooltip {
        position: absolute;
        visibility: visible;
        opacity: 1;
        font-weight: normal;
    }

    @at-root #{&}__trigger {
        padding: 0;
        border: none;
        background: none;
    }
}
