@use '@/styles/base';

.root {
    all: unset;
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease-in-out;

    &:focus-visible {
        outline: none;
    }

    &:disabled {
        cursor: not-allowed;
        opacity: 0.5;
    }

    &:active {
        transform: translateY(1px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading {
    cursor: not-allowed;

    svg {
        display: inline-block;
        animation: spin 1s linear infinite;
    }
}

.inner {
    position: relative;
    display: flex;
    gap: base.$gap-sm;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-weight: base.$font-weight-lg;
}

.spinner {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.uppercase {
    text-transform: uppercase;
}

.size-xs {
    padding: 0.125rem 0.5rem;
    font-size: base.$font-size-sm;
}

.size-xs.compact {
    padding: 0.125rem;
    font-size: base.$font-size-sm;
}

.size-sm {
    padding: 0.25rem 0.5rem;
    font-size: base.$font-size-sm;
}

.size-sm.compact {
    padding: 0.25rem;
    font-size: base.$font-size-sm;
}

.size-md {
    padding: 0.5rem 0.75rem;
    font-size: base.$font-size-md;
}

.size-md.compact {
    padding: 0.5rem;
    font-size: base.$font-size-md;
}

.size-lg {
    padding: 0.5rem 1rem;
    font-size: base.$font-size-lg;
}

.size-lg.compact {
    padding: 0.5rem;
    font-size: base.$font-size-lg;
}

.size-xl {
    padding: 0.75rem 1.25rem;
    font-size: base.$font-size-xl;
}

.size-xl.compact {
    padding: 0.75rem;
    font-size: base.$font-size-xl;
}

.radius-xs {
    border-radius: base.$border-radius-xs;
}

.radius-sm {
    border-radius: base.$border-radius-sm;
}

.radius-md {
    border-radius: base.$border-radius-md;
}

.radius-lg {
    border-radius: base.$border-radius-lg;
}

.radius-xl {
    border-radius: base.$border-radius-xl;
}

.justify-start {
    justify-content: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.filled-variant {
    @include base.button-filled-variant;
}

.default-variant {
    @include base.button-default-variant;
}

.danger-variant {
    @include base.button-danger-variant;
}

.primary-variant {
    @include base.button-primary-variant;
}

.subtle-variant {
    @include base.button-subtle-variant;
}

.transparent-variant {
    @include base.button-transparent-variant;
}

.outline-variant {
    @include base.button-outline-variant;
}

.input-variant {
    @include base.button-input-variant;
}

.label {
    position: relative;
}

.inner-label {
    font-weight: base.$font-weight-md;
    user-select: none;

    @include base.text-ellipsis;
}

.inner-label.loading {
    opacity: 0;
}

.section.loading {
    opacity: 0;
}

.right-section {
    padding-right: 2rem;
}

.section[data-position='right'] {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}
