/* Badge Component - Cacao UI Framework */

.badge-wrapper {
    position: relative;
    display: inline-block;
}

.badge {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-block;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    border-radius: 10px;
    background-color: #ff4d4f;
    color: #fff;
    transform: translate(50%, -50%);
    z-index: 10;
    box-shadow: 0 0 0 1px #fff;
    transition: all 0.3s ease;
}

.badge:empty {
    display: none;
}

/* Dot Badge Style */
.badge.dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    border-radius: 50%;
    background-color: #ff4d4f;
    transform: translate(50%, -50%);
}

/* Badge Colors */
.badge.primary {
    background-color: #8B4513;
}

.badge.success {
    background-color: #52c41a;
}

.badge.warning {
    background-color: #faad14;
}

.badge.error {
    background-color: #ff4d4f;
}

.badge.info {
    background-color: #1890ff;
}

/* Badge Positioning */
.badge-wrapper.top-left .badge {
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
}

.badge-wrapper.top-right .badge {
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
}

.badge-wrapper.bottom-left .badge {
    bottom: 0;
    left: 0;
    transform: translate(-50%, 50%);
}

.badge-wrapper.bottom-right .badge {
    bottom: 0;
    right: 0;
    transform: translate(50%, 50%);
}

/* Badge Sizes */
.badge.small {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    line-height: 16px;
    border-radius: 8px;
}

.badge.small.dot {
    width: 6px;
    height: 6px;
    min-width: 6px;
}

.badge.large {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    font-size: 14px;
    line-height: 24px;
    border-radius: 12px;
}

.badge.large.dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
}

/* Badge Animation */
.badge {
    animation: badgeZoom 0.3s ease;
}

@keyframes badgeZoom {
    0% {
        transform: translate(50%, -50%) scale(0);
    }
    50% {
        transform: translate(50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(50%, -50%) scale(1);
    }
}

/* Badge on different elements */
.badge-wrapper button .badge,
.badge-wrapper .btn .badge {
    top: -2px;
    right: -2px;
}

.badge-wrapper .avatar .badge {
    top: 0;
    right: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .badge {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .badge {
        animation: none;
        transition: none;
    }
}