@use '../../styles/abstract/base' as base;
@use '../../styles/abstract/variables' as v;
@use '../../styles/abstract/functions' as f;
@use '../../styles/abstract/mixins' as m;
@use '../../styles/abstract/theme' as t;

/**
 * Badge component styles
 * 
 * Badge specifications:
 * - Small badge size: 6dp
 * - Large badge height: 16dp
 * - Small badge corner radius: 3dp
 * - Large badge corner radius: 8dp
 * - Small badge: 6dp from the icon's top trailing corner to the badge's
 *   bottom leading corner
 * - Large badge: 14dp (height) x 12dp (width) from the icon's top trailing
 *   corner to the badge's bottom leading corner
 */
$component: '#{base.$prefix}-badge';
$wrapper: '#{base.$prefix}-badge__wrapper';

.#{$wrapper} {
position: relative;
display: inline-flex;
flex-shrink: 0;
}

.#{$component} {
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
overflow: hidden;
transition: all 200ms ease;
text-overflow: ellipsis;

&--invisible {
display: none;
}

&--small {
width: 6px;
height: 6px;
min-width: 6px;
border-radius: v.shape('full');
font-size: 0;
padding: 0;
}

&--large {
height: 16px;
min-width: 16px;
border-radius: v.shape('full');
padding: 0 4px;
@include m.typography('label-small');
padding-top: 0.5px;

&.#{$component}--overflow {
min-width: auto;
max-width: 34px;
padding: 0 4px;
}
}

&--positioned {
position: absolute;

&.#{$component}--small {
&.#{$component}--top-right {
top: 0;
right: 0;
}

&.#{$component}--top-left {
top: 0;
left: 0;
}

&.#{$component}--bottom-right {
bottom: 0;
right: 0;
}

&.#{$component}--bottom-left {
bottom: 0;
left: 0;
}
}

&.#{$component}--large {
&.#{$component}--top-right {
top: -2px;
right: -4px;
}

&.#{$component}--top-left {
top: -2px;
left: -4px;
}

&.#{$component}--bottom-right {
bottom: -2px;
right: -4px;
}

&.#{$component}--bottom-left {
bottom: -2px;
left: -4px;
}
}
}

&--error {
background-color: t.color('error');
color: t.color('on-error');
}

&--primary {
background-color: t.color('primary');
color: t.color('on-primary');
}

&--secondary {
background-color: t.color('secondary');
color: t.color('on-secondary');
}

&--tertiary {
background-color: t.color('tertiary');
color: t.color('on-tertiary');
}

&--success {
background-color: t.color('success');
color: t.color('on-success');
}

&--warning {
background-color: t.color('warning');
color: t.color('on-warning');
}

&--info {
background-color: t.color('info');
color: t.color('on-info');
}

&--positioned {
@include m.rtl {
&.#{$component}--small {
&.#{$component}--top-right {
right: auto;
left: 0;
}

&.#{$component}--top-left {
left: auto;
right: 0;
}

&.#{$component}--bottom-right {
right: auto;
left: 0;
}

&.#{$component}--bottom-left {
left: auto;
right: 0;
}
}

&.#{$component}--large {
&.#{$component}--top-right {
right: auto;
left: -4px;
}

&.#{$component}--top-left {
left: auto;
right: -4px;
}

&.#{$component}--bottom-right {
right: auto;
left: -4px;
}

&.#{$component}--bottom-left {
left: auto;
right: -4px;
}
}
}
}
}
