/* =========================
   Tooltip Container
   ========================= */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

/* Optional underline styling for tooltip triggers */
.tooltip[data-underline="true"] {
    border-bottom: 1px dotted currentColor;
}

/* =========================
   Tooltip Text
   ========================= */
.tooltip .tooltiptext {
    position: absolute;
    bottom: 125%; /* Position above the element */
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 200px;
    padding: 8px 10px;
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.4;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none; /* Prevent interaction with tooltip text */
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1000;
}

/* Tooltip arrow */
.tooltip .tooltiptext::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
}

/* =========================
   Hover & Focus States
   ========================= */
.tooltip:hover .tooltiptext,
.tooltip:focus-within .tooltiptext {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* =========================
   Responsive Tweaks
   ========================= */
@media (max-width: 480px) {
    .tooltip .tooltiptext {
        max-width: 150px;
        font-size: 0.8rem;
        padding: 6px 8px;
    }
}
