/* Tag Component - Cacao UI Framework */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #e8e8e8;
    transition: all 0.2s ease;
    max-width: 100%;
    box-sizing: border-box;
}

.tag:hover {
    background-color: #e9ecef;
    border-color: #8B4513;
}

/* Tag Text */
.tag-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Tag Close Button */
.tag-close {
    margin-left: 4px;
    cursor: pointer;
    font-size: 10px;
    color: #999;
    transition: color 0.2s ease;
    padding: 2px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.tag-close:hover {
    color: #ff4d4f;
    background-color: rgba(255, 77, 79, 0.1);
}

.tag-close::before {
    content: "×";
    font-size: 12px;
    line-height: 1;
}

/* Tag Icon */
.tag-icon {
    margin-right: 4px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tag Colors */
.tag.primary {
    background-color: #8B4513;
    color: #fff;
    border-color: #8B4513;
}

.tag.primary:hover {
    background-color: #6b3410;
    border-color: #6b3410;
}

.tag.primary .tag-close {
    color: rgba(255, 255, 255, 0.7);
}

.tag.primary .tag-close:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

.tag.success {
    background-color: #52c41a;
    color: #fff;
    border-color: #52c41a;
}

.tag.success:hover {
    background-color: #389e0d;
    border-color: #389e0d;
}

.tag.success .tag-close {
    color: rgba(255, 255, 255, 0.7);
}

.tag.success .tag-close:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

.tag.warning {
    background-color: #faad14;
    color: #fff;
    border-color: #faad14;
}

.tag.warning:hover {
    background-color: #d48806;
    border-color: #d48806;
}

.tag.warning .tag-close {
    color: rgba(255, 255, 255, 0.7);
}

.tag.warning .tag-close:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

.tag.error {
    background-color: #ff4d4f;
    color: #fff;
    border-color: #ff4d4f;
}

.tag.error:hover {
    background-color: #f5222d;
    border-color: #f5222d;
}

.tag.error .tag-close {
    color: rgba(255, 255, 255, 0.7);
}

.tag.error .tag-close:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

.tag.info {
    background-color: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.tag.info:hover {
    background-color: #096dd9;
    border-color: #096dd9;
}

.tag.info .tag-close {
    color: rgba(255, 255, 255, 0.7);
}

.tag.info .tag-close:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Tag Sizes */
.tag.small {
    padding: 2px 6px;
    font-size: 11px;
}

.tag.small .tag-close {
    width: 12px;
    height: 12px;
    margin-left: 2px;
}

.tag.small .tag-close::before {
    font-size: 10px;
}

.tag.small .tag-icon {
    font-size: 8px;
    margin-right: 2px;
}

.tag.large {
    padding: 6px 12px;
    font-size: 14px;
}

.tag.large .tag-close {
    width: 20px;
    height: 20px;
    margin-left: 6px;
}

.tag.large .tag-close::before {
    font-size: 14px;
}

.tag.large .tag-icon {
    font-size: 12px;
    margin-right: 6px;
}

/* Tag Variants */
.tag.outlined {
    background-color: transparent;
    border-width: 1px;
}

.tag.outlined.primary {
    color: #8B4513;
    border-color: #8B4513;
}

.tag.outlined.primary:hover {
    background-color: rgba(139, 69, 19, 0.1);
}

.tag.outlined.success {
    color: #52c41a;
    border-color: #52c41a;
}

.tag.outlined.success:hover {
    background-color: rgba(82, 196, 26, 0.1);
}

.tag.outlined.warning {
    color: #faad14;
    border-color: #faad14;
}

.tag.outlined.warning:hover {
    background-color: rgba(250, 173, 20, 0.1);
}

.tag.outlined.error {
    color: #ff4d4f;
    border-color: #ff4d4f;
}

.tag.outlined.error:hover {
    background-color: rgba(255, 77, 79, 0.1);
}

.tag.outlined.info {
    color: #1890ff;
    border-color: #1890ff;
}

.tag.outlined.info:hover {
    background-color: rgba(24, 144, 255, 0.1);
}

/* Tag Rounded */
.tag.rounded {
    border-radius: 12px;
}

/* Tag Borderless */
.tag.borderless {
    border: none;
}

/* Tag Clickable */
.tag.clickable {
    cursor: pointer;
}

.tag.clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tag.clickable:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Tag Disabled */
.tag.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tag Group */
.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.tag-group .tag {
    margin: 0;
}

/* Tag Input */
.tag-input {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 12px;
    background-color: transparent;
    border: 1px dashed #8B4513;
    border-radius: 4px;
    color: #8B4513;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-input:hover {
    background-color: rgba(139, 69, 19, 0.1);
    border-style: solid;
}

.tag-input-icon {
    margin-right: 4px;
    font-size: 10px;
}

.tag-input-icon::before {
    content: "+";
}

/* Tag Animation */
.tag-enter {
    opacity: 0;
    transform: scale(0.8);
}

.tag-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: all 0.2s ease;
}

.tag-exit {
    opacity: 1;
    transform: scale(1);
}

.tag-exit-active {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

/* Tag Status */
.tag.new {
    position: relative;
}

.tag.new::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background-color: #ff4d4f;
    border-radius: 50%;
    animation: tagPulse 2s infinite;
}

@keyframes tagPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tag {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .tag.large {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .tag-group {
        gap: 2px;
    }
}

/* Accessibility */
.tag:focus {
    outline: 2px solid #8B4513;
    outline-offset: 2px;
}

.tag-close:focus {
    outline: 2px solid #8B4513;
    outline-offset: 1px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tag {
        border: 2px solid #000;
    }
    
    .tag.primary,
    .tag.success,
    .tag.warning,
    .tag.error,
    .tag.info {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tag {
        transition: none;
    }
    
    .tag.clickable:hover {
        transform: none;
    }
    
    .tag.clickable:active {
        transform: none;
    }
    
    .tag-enter-active,
    .tag-exit-active {
        transition: none;
    }
    
    .tag.new::after {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .tag {
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .tag-close {
        display: none;
    }
    
    .tag.clickable:hover {
        transform: none;
        box-shadow: none;
    }
}