.tooltip-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 4px;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 14px;
    cursor: help;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tooltip-icon:hover,
.tooltip-icon:focus {
    opacity: 1;
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
    border-radius: 50%;
}

.tooltip {
    position: absolute;
    z-index: 9999;
    background: #1a1a1a;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    white-space: normal;
    text-align: right;
}

.tooltip-visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-top {
    bottom: calc(100% + 8px);
    right: 50%;
    transform: translateX(50%) translateY(4px);
}

.tooltip-visible.tooltip-top {
    transform: translateX(50%) translateY(0);
}

.tooltip-bottom {
    top: calc(100% + 8px);
    right: 50%;
    transform: translateX(50%) translateY(-4px);
}

.tooltip-visible.tooltip-bottom {
    transform: translateX(50%) translateY(0);
}

.tooltip-top::after,
.tooltip-bottom::after {
    content: '';
    position: absolute;
    right: 50%;
    transform: translateX(50%);
    border: 6px solid transparent;
}

.tooltip-top::after {
    top: 100%;
    border-top-color: #1a1a1a;
}

.tooltip-bottom::after {
    bottom: 100%;
    border-bottom-color: #1a1a1a;
}

@media (max-width: 640px) {
    .tooltip {
        max-width: 200px;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .tooltip-icon {
        width: 20px;
        height: 20px;
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tooltip {
        transition: none;
    }
}
