/* ============================================================
   stonetu 石材雷达图插件 - CSS 模板
   Stone Material Radar Chart WordPress Plugin
   ============================================================
   版本: 1.0.0
   说明: 此 CSS 为雷达图提供了完整的样式系统，
   包括容器、SVG 图表、图例、响应式、暗色模式等。
   ============================================================ */

/* ---------- 容器 ---------- */
.stonetu-radar-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.stonetu-radar-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.stonetu-radar-container svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---------- 标题 ---------- */
.stonetu-radar-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 16px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.stonetu-radar-subtitle {
    text-align: center;
    font-size: 13px;
    color: #95a5a6;
    margin: -10px 0 16px 0;
}

/* ---------- 图表网格 ---------- */
.stonetu-radar-grid-polygon {
    fill: none;
    stroke: #e8ecf1;
    stroke-width: 1;
}

.stonetu-radar-grid-line {
    stroke: #e8ecf1;
    stroke-width: 1;
}

.stonetu-radar-axis-line {
    stroke: #d0d7de;
    stroke-width: 1.5;
}

/* ---------- 数据区域 ---------- */
.stonetu-radar-area {
    fill-opacity: 0.25;
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.stonetu-radar-area-1 { fill: #3b82f6; stroke: #3b82f6; }
.stonetu-radar-area-2 { fill: #ef4444; stroke: #ef4444; }
.stonetu-radar-area-3 { fill: #10b981; stroke: #10b981; }
.stonetu-radar-area-4 { fill: #f59e0b; stroke: #f59e0b; }
.stonetu-radar-area-5 { fill: #8b5cf6; stroke: #8b5cf6; }

.stonetu-radar-dot {
    r: 4;
    stroke: #fff;
    stroke-width: 2;
    cursor: pointer;
    transition: r 0.2s ease;
}

.stonetu-radar-dot:hover {
    r: 7;
    stroke-width: 3;
}

/* ---------- 轴标签 ---------- */
.stonetu-radar-label {
    font-size: 12px;
    fill: #4a5568;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    text-anchor: middle;
    dominant-baseline: middle;
    user-select: none;
}

/* ---------- 数值标签 ---------- */
.stonetu-radar-value-label {
    font-size: 11px;
    fill: #718096;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* ---------- 图例 ---------- */
.stonetu-radar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.stonetu-radar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.stonetu-radar-legend-item:hover {
    opacity: 0.7;
}

.stonetu-radar-legend-item.hidden {
    opacity: 0.3;
    text-decoration: line-through;
}

.stonetu-radar-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ---------- 评分星级 ---------- */
.stonetu-radar-score {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.stonetu-radar-star {
    width: 14px;
    height: 14px;
    fill: #f59e0b;
}

.stonetu-radar-star-empty {
    fill: #e2e8f0;
}

/* ---------- Tooltip ---------- */
.stonetu-radar-tooltip {
    position: fixed;
    z-index: 9999;
    padding: 8px 14px;
    background: #1e293b;
    color: #fff;
    font-size: 13px;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.stonetu-radar-tooltip.visible {
    opacity: 1;
}

.stonetu-radar-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1e293b;
}

/* ---------- 加载状态 ---------- */
.stonetu-radar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
}

.stonetu-radar-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8ecf1;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: stonetu-spin 0.8s linear infinite;
}

@keyframes stonetu-spin {
    to { transform: rotate(360deg); }
}

/* ---------- 空状态 ---------- */
.stonetu-radar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #94a3b8;
    font-size: 14px;
}

.stonetu-radar-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* ---------- 错误状态 ---------- */
.stonetu-radar-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #ef4444;
    font-size: 14px;
}

/* ---------- 短代码容器（区分多个实例） ---------- */
.stonetu-radar-instance {
    /* 用于 JS 区分不同的雷达图实例 */
}

/* ---------- WordPress 后台编辑器预览 ---------- */
.stonetu-radar-preview-notice {
    padding: 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    font-size: 13px;
    text-align: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .stonetu-radar-wrapper {
        max-width: 100%;
        padding: 12px;
        margin: 12px auto;
    }

    .stonetu-radar-label {
        font-size: 10px;
    }

    .stonetu-radar-value-label {
        font-size: 9px;
    }

    .stonetu-radar-legend {
        gap: 10px;
        padding: 10px 12px;
    }

    .stonetu-radar-legend-item {
        font-size: 12px;
    }

    .stonetu-radar-tooltip {
        font-size: 12px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .stonetu-radar-wrapper {
        padding: 8px;
    }

    .stonetu-radar-title {
        font-size: 15px;
    }

    .stonetu-radar-legend-item {
        font-size: 11px;
    }
}

/* ---------- 暗色模式 ---------- */
@media (prefers-color-scheme: dark) {
    .stonetu-radar-wrapper {
        background: #1e293b;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .stonetu-radar-title {
        color: #e2e8f0;
    }

    .stonetu-radar-grid-polygon,
    .stonetu-radar-grid-line {
        stroke: #334155;
    }

    .stonetu-radar-axis-line {
        stroke: #475569;
    }

    .stonetu-radar-label {
        fill: #94a3b8;
    }

    .stonetu-radar-value-label {
        fill: #cbd5e1;
    }

    .stonetu-radar-legend {
        background: #0f172a;
    }

    .stonetu-radar-legend-item {
        color: #cbd5e1;
    }

    .stonetu-radar-subtitle {
        color: #64748b;
    }

    .stonetu-radar-star-empty {
        fill: #334155;
    }
}

/* ---------- 手动暗色模式（通过 body class 触发） ---------- */
.dark .stonetu-radar-wrapper {
    background: #1e293b;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.dark .stonetu-radar-title { color: #e2e8f0; }

.dark .stonetu-radar-grid-polygon,
.dark .stonetu-radar-grid-line { stroke: #334155; }

.dark .stonetu-radar-axis-line { stroke: #475569; }

.dark .stonetu-radar-label { fill: #94a3b8; }

.dark .stonetu-radar-value-label { fill: #cbd5e1; }

.dark .stonetu-radar-legend { background: #0f172a; }

.dark .stonetu-radar-legend-item { color: #cbd5e1; }

.dark .stonetu-radar-subtitle { color: #64748b; }

.dark .stonetu-radar-star-empty { fill: #334155; }

/* ---------- 打印样式 ---------- */
@media print {
    .stonetu-radar-wrapper {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
