/* Smart tooltip styling and positioning
 * This provides responsive tooltips that adapt to screen edges
 */

/* Base tooltip styling */
.tooltip-content {
    display: none;
    position: absolute;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    z-index: 1000;
    width: 250px;
    max-width: 90vw; /* Responsive width on small screens */
    font-size: 0.88rem;
    color: #333;
    line-height: 1.4;
}

/* Show tooltip on hover */
.info-button:hover .tooltip-content {
    display: block;
}

/* Default position (above the button) */
.tooltip-content.position-top {
    bottom: 30px;
    right: -10px;
}

/* Position below the button */
.tooltip-content.position-bottom {
    top: 30px;
    right: -10px;
}

/* Position to the left of the button */
.tooltip-content.position-left {
    top: 0;
    right: 30px;
}

/* Position to the right of the button */
.tooltip-content.position-right {
    top: 0;
    left: 30px;
}

/* Arrow styling for different positions */
.tooltip-content:after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
}

/* Arrow for position-top */
.tooltip-content.position-top:after {
    bottom: -6px;
    right: 15px;
    border-left: 0;
    border-top: 0;
    transform: rotate(45deg);
}

/* Arrow for position-bottom */
.tooltip-content.position-bottom:after {
    top: -6px;
    right: 15px;
    border-right: 0;
    border-bottom: 0;
    transform: rotate(45deg);
}

/* Arrow for position-left */
.tooltip-content.position-left:after {
    top: 50%;
    right: -6px;
    transform: translateY(-50%) rotate(-45deg);
    border-left: 0;
    border-bottom: 0;
}

/* Arrow for position-right */
.tooltip-content.position-right:after {
    top: 50%;
    left: -6px;
    transform: translateY(-50%) rotate(135deg);
    border-right: 0;
    border-top: 0;
}

/* Media query for mobile devices */
@media screen and (max-width: 480px) {
    .tooltip-content {
        font-size: 0.8rem;
        padding: 8px 10px;
        width: 200px;
    }
}

/* JavaScript-free responsive positioning hack */
@media screen and (max-height: 400px) {
    /* For short screens, default to right position */
    .tooltip-content {
        top: 0 !important;
        bottom: auto !important;
        left: 30px !important;
        right: auto !important;
    }
    .tooltip-content:after {
        top: 10px !important;
        left: -6px !important;
        bottom: auto !important;
        right: auto !important;
        transform: rotate(135deg) !important;
        border-right: 0 !important;
        border-top: 0 !important;
    }
}

@media screen and (max-width: 350px) {
    /* For narrow screens, make tooltip wider */
    .tooltip-content {
        min-width: auto;
        width: calc(100vw - 60px);
    }
}
