/* ==================== SPIDER CHART STYLES ==================== */

.spider-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: linear-gradient(135deg, rgba(20, 10, 40, 0.9), rgba(30, 20, 50, 0.9));
    border: 3px solid rgba(var(--codex-ember-rgb, 201, 116, 47), 0.5);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(var(--codex-ember-rgb, 201, 116, 47), 0.3);
    position: relative;
}

.spider-chart-header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.spider-chart-title {
    font-size: 28px;
    color: #FFD700;
    margin-bottom: 10px;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    font-family: 'Cinzel', serif;
}

.spider-chart-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.spider-chart-canvas-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spider-chart-canvas {
    cursor: crosshair;
    transition: transform 0.3s ease;
}

.spider-chart-canvas:hover {
    transform: scale(1.02);
}

/* Leyenda de niveles */
.spider-chart-legend {
    display: flex;
    gap: 25px;
    justify-content: center;
    margin-top: 25px;
    padding: 15px;
    background: rgba(10, 10, 15, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(var(--codex-ember-rgb, 201, 116, 47), 0.3);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.legend-color.alto {
    background: linear-gradient(135deg, #00ff88, #00cc66);
}

.legend-color.medio {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

.legend-color.bajo {
    background: linear-gradient(135deg, #ff6666, #ff4444);
}

/* Controles del gráfico */
.spider-chart-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.chart-control-btn {
    padding: 10px 20px;
    background: rgba(var(--codex-ember-rgb, 201, 116, 47), 0.3);
    border: 2px solid rgba(var(--codex-ember-rgb, 201, 116, 47), 0.5);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
}

.chart-control-btn:hover {
    background: rgba(var(--codex-ember-rgb, 201, 116, 47), 0.5);
    border-color: rgba(255, 215, 0, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--codex-ember-rgb, 201, 116, 47), 0.4);
}

.chart-control-btn:active {
    transform: translateY(0);
}

/* Estadísticas debajo del gráfico */
.spider-chart-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 25px;
    width: 100%;
}

.stat-card {
    background: rgba(20, 10, 40, 0.7);
    border: 2px solid rgba(var(--codex-ember-rgb, 201, 116, 47), 0.4);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(255, 215, 0, 0.6);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(var(--codex-ember-rgb, 201, 116, 47), 0.3);
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    color: #FFD700;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-icon {
    font-size: 20px;
    margin-right: 5px;
}

.stat-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    margin-top: 5px;
}

/* Loading state */
.spider-chart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(var(--codex-ember-rgb, 201, 116, 47), 0.3);
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* Animaciones de entrada */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.spider-chart-container.animated {
    animation: fadeInScale 0.6s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .spider-chart-container {
        padding: 20px;
    }

    .spider-chart-title {
        font-size: 22px;
    }

    .spider-chart-subtitle {
        font-size: 12px;
    }

    .spider-chart-legend {
        flex-direction: column;
        gap: 10px;
    }

    .spider-chart-stats {
        grid-template-columns: 1fr;
    }

    .chart-control-btn {
        font-size: 12px;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    .spider-chart-container {
        padding: 14px;
    }

    .spider-chart-title {
        font-size: 20px;
    }

    .spider-chart-canvas-wrapper {
        overflow-x: auto;
    }

    .stat-value {
        font-size: 20px;
    }
}

/* Tooltip personalizado (si se usa fuera del canvas) */
.spider-chart-tooltip {
    position: absolute;
    background: rgba(20, 10, 40, 0.95);
    border: 2px solid #FFD700;
    border-radius: 8px;
    padding: 10px 15px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: 'Cinzel', serif;
}

.spider-chart-tooltip.visible {
    opacity: 1;
}

.tooltip-title {
    font-size: 14px;
    color: #FFD700;
    font-weight: bold;
    margin-bottom: 5px;
}

.tooltip-value {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.tooltip-level {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    margin-top: 3px;
}
