/**
 * For items common to all, or a large subset of, pages.
 */

// Accessory block at the top of most object pages with audits, JSON, etc.
.item-accessories {
    display: flex;

    @at-root #{&}--left {
        flex: 1 1 auto;
    }

    @at-root #{&}--right {
        display: flex;
        flex: 0 1 auto;
    }
}

.btn-copy-action {
    background-color: #fff;
    transition: background-color 0.2s linear;

    &.flash {
        background-color: #4e4;
        transition: background-color 0.01s linear;
    }
}

// doi: (Digital Object Identifier) references, including Copy button.
$doi-ref-border-color: #a0a0a0;

.doi-ref {
    display: flex;
    margin: -8px 0 10px;

    @at-root #{&}__id {
        display: flex;
        align-items: center;
        padding: 0 5px;
    }

    @at-root #{&}__copy-button {
        margin: 0;

        &.btn {
            .svg-icon-clipboard {
                height: 14px;
                fill: none;
                stroke: #000;
                stroke-width: 22px;
            }
        }
    }
}

// Generic, custom-styled checkbox.
$checkbox-dimensions: 18px;
$checkbox-padding: 3px;

.checkbox {
    position: relative;
    padding: $checkbox-padding;

    // Hide default input checkbox border.
    input {
        position: absolute;
        margin: 0;
        padding: 0;
        width: $checkbox-dimensions;
        height: $checkbox-dimensions;
        top: $checkbox-padding;
        left: $checkbox-padding;
        opacity: 0;
        z-index: 1;
        cursor: pointer;

        &:checked {
            border: none;

            + label {
                &::before {
                    background-color: #008000;
                }

                svg {
                    opacity: 1;
                }
            }
        }

        &:focus {
            + label {
                &::before {
                    border-color: black;
                }
            }
        }

        // Push label over from absolutely positioned checkbox
        + label {
            padding: 3px 3px 0 $checkbox-dimensions + 5px;
            z-index: 0;

            // Style custom checkbox border.
            &::before {
                position: absolute;
                content: "";
                left: $checkbox-padding;
                top: 0;
                width: $checkbox-dimensions;
                height: $checkbox-dimensions;
                background-color: white;
                border: 1px solid #c0c0c0;
                border-radius: 3px;
            }

            + label::after {
                opacity: 1;
            }

            svg {
                position: absolute;
                height: $checkbox-dimensions - 4px;
                width: $checkbox-dimensions - 4px;
                top: 2px;
                left: $checkbox-padding + 2px;
                fill: white;
                stroke: none;
                opacity: 0;
                z-index: 0;
            }

            &:hover {
                cursor: pointer;
            }
        }
    }

    &.checkbox--disabled {
        input {
            + label {
                color: #808080;
            }
        }
    }
}
