// stylelint-disable selector-class-pattern

.btn {
    display: inline-block;
    margin-bottom: 0;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    touch-action: manipulation;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 14px;
    line-height: $tall-line-height;
    border-radius: 2px;
    user-select: none;
    color: $color-text-white;

    &:active {
        // TODO: color variable
        box-shadow: inset 0 1px 2px rgba(38, 57, 71, 0.2);
    }

    &:disabled {
        cursor: not-allowed;
        filter: alpha(opacity=65);
        opacity: 0.65;
    }
}

.btn-small {
    padding: 2px 10px;
}

.btn-medium {
    padding: 6px 12px;
}

.btn-large {
    padding: 15px 20px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: $color-text-white;
    font-weight: bold;

    &:hover:not([disabled]) {
        background-color: var(--secondary-color);
    }
}

// This should only be used in preprint branding as we move away from using custom CSS
// Please don't rely on this class for new brands
.DarkText {
    color: $color-text-black;
}

.btn-secondary {
    background-color: $color-bg-white;
    border: 1px solid $color-border-gray-light;
    color: $color-text-black;

    &:hover:not([disabled]) {
        border: 1px solid $color-bg-gray-blue;
        background-color: $color-bg-gray-blue-light;
    }
}

.btn-create {
    background-color: darken($brand-success, 10%);
    color: $color-text-white;

    &:hover:not([disabled]) {
        background-color: darken($brand-success, 25%);
    }
}

.btn-default {
    color: $color-text-black;
}

.btn-destroy {
    background-color: $color-text-white;
    color: $brand-danger;
    border: 1px solid $color-border-gray-darker;

    &:hover:not([disabled]) {
        background-color: $brand-danger;
        color: $color-text-white;
    }
}

.btn-success {
    color: $btn-success-high-contrast-color;
    background-color: $brand-success;
    border-color: darken($brand-success, 5%);

    &:hover {
        background-color: darken($brand-success, 10%) !important;
        border-color: darken($brand-success, 15%);
    }


    &[disabled],
    &[disabled]:hover,
    :global(&.disabled),
    :global(&.disabled):hover {
        color: darken($brand-success, 85%);
        background-color: lighten($brand-success, 50%);
        border-color: lighten($brand-success, 45%);
        opacity: 1;
    }
}

.btn-success.disabled,
.btn-success.disabled:hover {
    color: darken($brand-success, 85%);
    background-color: lighten($brand-success, 50%);
    border-color: lighten($brand-success, 45%);
    opacity: 1;
}

.btn-info {
    color: $btn-info-high-contrast-color;
    background-color: $brand-info;
    border-color: darken($brand-info, 5%);

    &:hover:not([disabled]) {
        background-color: darken($brand-info, 10%);
        border-color: darken($brand-info, 15%);
    }
}

.btn-danger {
    color: $btn-danger-high-contrast-color;
    background-color: $brand-danger;
    border-color: darken($brand-danger, 5%);

    &:hover:not([disabled]) {
        background-color: darken($brand-danger, 10%);
        border-color: darken($brand-danger, 15%);
    }
}

.btn-danger.disabled,
.btn-danger.disabled:hover {
    color: $btn-danger-high-contrast-color;
    background-color: $brand-danger;
    border-color: lighten($brand-danger, 5%);
    opacity: 1;
}

/* stylelint-enable */
