/* ============================================================
 * tooltip.css - 재사용 가능한 툴팁 컴포넌트 (전 페이지 공용)
 * ============================================================
 * [일반 로직] 모든 지표 페이지에서 사용 가능
 * - 데스크톱: 마우스 오버 시 툴팁 표시, 클릭 시 고정/해제
 * - 모바일: 터치로 열기/닫기
 * 
 * 사용법:
 *   <span class="info-tip" data-tip="설명 텍스트">
 *     <svg class="info-icon">...</svg>
 *   </span>
 * 
 * JS 초기화: initTooltips() 호출 (tooltip.js 참조)
 * ============================================================ */

/* 툴팁 아이콘 컨테이너 */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
    -webkit-tap-highlight-color: transparent;
}

/* 느낌표 아이콘 SVG */
.info-icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: #8b949e;
    stroke-width: 2;
    transition: stroke 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.info-tip:hover .info-icon,
.info-tip.active .info-icon {
    stroke: #58a6ff;
    transform: scale(1.15);
}

/* 툴팁 말풍선 */
.info-tip .tip-box {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 180px;
    max-width: 280px;
    padding: 8px 10px;
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #c9d1d9;
    font-size: 11px;
    line-height: 1.5;
    font-weight: normal;
    text-align: left;
    white-space: normal;
    word-break: keep-all;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    pointer-events: auto;
}

/* 말풍선 화살표 */
.info-tip .tip-box::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1c2128;
}

/* 활성 상태 */
.info-tip.active .tip-box,
.info-tip:hover .tip-box {
    display: block;
}

/* 모바일: 화면 밖으로 나가지 않도록 */
@media (max-width: 480px) {
    .info-tip .tip-box {
        min-width: 150px;
        max-width: 220px;
        font-size: 10px;
        left: auto;
        right: -10px;
        transform: none;
    }
    .info-tip .tip-box::after {
        left: auto;
        right: 14px;
        transform: none;
    }
}

/* 왼쪽 끝에 있는 경우 보정 */
.info-tip.tip-left .tip-box {
    left: -10px;
    right: auto;
    transform: none;
}
.info-tip.tip-left .tip-box::after {
    left: 14px;
    right: auto;
    transform: none;
}
