/* 术语字典组件样式 */

/* 术语链接基础样式 */
.term-link {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px dotted #667eea;
    cursor: help;
    position: relative;
    transition: all 0.2s ease;
}

.term-link:hover {
    color: #5a6fd8;
    border-bottom-style: solid;
}

.term-link.highlight {
    background: #fff3cd;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

.term-link.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 悬浮提示样式 */
.term-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    min-width: 280px;
    max-width: 400px;
    word-wrap: break-word;
}

.term-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.tooltip-header {
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.tooltip-category {
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.tooltip-content {
    padding: 12px 16px;
}

.tooltip-brief {
    color: #4a5568;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.tooltip-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: #718096;
}

.tooltip-difficulty {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tooltip-actions {
    padding: 8px 16px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
}

.tooltip-btn:hover {
    background: #5a6fd8;
}

.tooltip-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 16px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color 0.2s ease;
}

.tooltip-close:hover {
    color: #4a5568;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .term-tooltip {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 320px;
        max-width: 90vw;
        max-height: 70vh;
        overflow-y: auto;
    }

    .term-tooltip.show {
        opacity: 1;
        visibility: visible;
    }
}

/* 加载动画 */
.term-loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .term-tooltip {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .tooltip-header {
        border-bottom-color: #4a5568;
    }

    .tooltip-title {
        color: #f7fafc;
    }

    .tooltip-brief {
        color: #cbd5e0;
    }

    .tooltip-meta {
        color: #a0aec0;
    }
}

/* 无障碍支持 */
.term-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .term-link {
        border-bottom: 2px solid #667eea;
    }

    .term-tooltip {
        border-width: 2px;
        border-color: #000;
    }
}